root/ossiedev/branches/mcarrick/DPD/DevicePkg.cpp @ 8697

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
7DevicePkg::DevicePkg(TiXmlElement *elem):HWDeviceRegistration(elem->FirstChildElement("hwdeviceregistration"))
8{
9        parseElement(elem); // parse elements within devicepkg
10}
11
12DevicePkg::~DevicePkg()
13{
14        std::cout << "dev pkg deconstruct ... " << std::endl;
15}
16
17void 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
38std::string DevicePkg::getIDDevPkg()
39{
40        return id;
41}
42
43std::string DevicePkg::getNameDevPkg()
44{
45        return name;
46}
47
48std::string DevicePkg::getVersionDevPkg()
49{
50        return version;
51}
52
53std::string DevicePkg::getTitle()
54{
55        return title;
56}
57
58std::string DevicePkg::getAuthor()
59{
60        return author;
61}
62
63std::string DevicePkg::getDescription()
64{
65        return description;
66}
67
Note: See TracBrowser for help on using the browser.