|
Revision 8697, 1.2 KB
(checked in by mcarrick, 4 years ago)
|
|
added devicepkg parsing
|
| Line | |
|---|
| 1 | #include "DevicePkg.h" |
|---|
| 2 | |
|---|
| 3 | #include <iostream> |
|---|
| 4 | |
|---|
| 5 | #include "include/tinyxml.h" |
|---|
| 6 | |
|---|
| 7 | DevicePkg::DevicePkg(TiXmlElement *elem):HWDeviceRegistration(elem->FirstChildElement("hwdeviceregistration")) |
|---|
| 8 | { |
|---|
| 9 | parseElement(elem); // parse elements within devicepkg |
|---|
| 10 | } |
|---|
| 11 | |
|---|
| 12 | DevicePkg::~DevicePkg() |
|---|
| 13 | { |
|---|
| 14 | std::cout << "dev pkg deconstruct ... " << std::endl; |
|---|
| 15 | } |
|---|
| 16 | |
|---|
| 17 | void DevicePkg::parseElement(TiXmlElement *elem) |
|---|
| 18 | { |
|---|
| 19 | std::cout << "DEBUG: parsing device pkg ..." << std::endl; |
|---|
| 20 | |
|---|
| 21 | // get attributes from devicepkg |
|---|
| 22 | id = elem->Attribute("id"); |
|---|
| 23 | name = elem->Attribute("name"); |
|---|
| 24 | version = elem->Attribute("version"); |
|---|
| 25 | |
|---|
| 26 | // parse info from author, title and description tags |
|---|
| 27 | TiXmlElement *auth = elem->FirstChildElement("author"); |
|---|
| 28 | author = auth->GetText(); |
|---|
| 29 | |
|---|
| 30 | TiXmlElement *titleElem = elem->FirstChildElement("title"); |
|---|
| 31 | title = titleElem->GetText(); |
|---|
| 32 | |
|---|
| 33 | TiXmlElement *descrip = elem->FirstChildElement("description"); |
|---|
| 34 | description = descrip->GetText(); |
|---|
| 35 | |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | std::string DevicePkg::getIDDevPkg() |
|---|
| 39 | { |
|---|
| 40 | return id; |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | std::string DevicePkg::getNameDevPkg() |
|---|
| 44 | { |
|---|
| 45 | return name; |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | std::string DevicePkg::getVersionDevPkg() |
|---|
| 49 | { |
|---|
| 50 | return version; |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | std::string DevicePkg::getTitle() |
|---|
| 54 | { |
|---|
| 55 | return title; |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | std::string DevicePkg::getAuthor() |
|---|
| 59 | { |
|---|
| 60 | return author; |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | std::string DevicePkg::getDescription() |
|---|
| 64 | { |
|---|
| 65 | return description; |
|---|
| 66 | } |
|---|
| 67 | |
|---|