Changeset 8713
- Timestamp:
- 02/17/09 13:18:38 (4 years ago)
- Location:
- ossiedev/branches/mcarrick/DPD
- Files:
-
- 6 modified
-
DeviceClass.cpp (modified) (1 diff)
-
DevicePkg.cpp (modified) (1 diff)
-
DevicePkg.h (modified) (2 diffs)
-
DevicePkgRef.cpp (modified) (2 diffs)
-
HWDeviceRegistration.cpp (modified) (1 diff)
-
PropertyFile.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ossiedev/branches/mcarrick/DPD/DeviceClass.cpp
r8699 r8713 20 20 TiXmlElement *classType = elem->FirstChildElement("class"); // set link to class tags 21 21 22 // there may be one or more class tags, loop through and append them all 23 for (; classType; classType = classType->NextSiblingElement("class")) 22 if (classType) 24 23 { 25 deviceClass.push_back(classType->GetText()); 24 // there may be one or more class tags, loop through and append them all 25 for (; classType; classType = classType->NextSiblingElement("class")) 26 { 27 deviceClass.push_back(classType->GetText()); 28 } 26 29 } 27 30 else 31 { 32 std::cout << "ERROR: Could not find a 'class' element in deviceclass tag, must have at least one class designation" << std::endl; 33 exit(-1); 34 } 28 35 29 36 } -
ossiedev/branches/mcarrick/DPD/DevicePkg.cpp
r8699 r8713 27 27 void DevicePkg::parseAttributes(TiXmlElement *elem) 28 28 { 29 id = elem->Attribute("id"); 30 name = elem->Attribute("name"); 31 version = elem->Attribute("version"); 29 parseAttributeID(elem); 30 parseAttributeName(elem); 31 parseAttributeVersion(elem); 32 } 33 34 void DevicePkg::parseAttributeID(TiXmlElement *elem) 35 { 36 if (elem->Attribute("id")) 37 { 38 id = elem->Attribute("id"); 39 } 40 else 41 { 42 std::cout << "ERROR: Could not find attrbute 'id' within devicepkg tag" << std::endl; 43 exit(-1); 44 } 45 } 46 47 void DevicePkg::parseAttributeName(TiXmlElement *elem) 48 { 49 if (elem->Attribute("name")) 50 { 51 name = elem->Attribute("name"); 52 } 53 else 54 { 55 std::cout << "ERROR: Could not find attribute 'name' within devicepkg tag" << std::endl; 56 exit(-1); 57 } 58 } 59 60 void DevicePkg::parseAttributeVersion(TiXmlElement *elem) 61 { 62 if (elem->Attribute("version")) 63 { 64 version = elem->Attribute("version"); 65 } 66 else 67 { 68 std::cout << "ERROR: Could not find attribute 'version' within devicepkg tag" << std::endl; 69 exit(-1); 70 } 32 71 } 33 72 34 73 void DevicePkg::parseChildElements(TiXmlElement *elem) 35 74 { 75 parseAuthor(elem); 76 parseTitle(elem); 77 parseDescription(elem); 78 } 79 80 void DevicePkg::parseAuthor(TiXmlElement *elem) 81 { 36 82 TiXmlElement *auth = elem->FirstChildElement("author"); 37 author = auth->GetText(); 83 if (auth) 84 { 85 author = auth->GetText(); 86 } 87 else 88 { 89 std::cout << "ERROR: Could not find 'author' element within devicepkg tag" << std::endl; 90 exit(-1); 91 } 92 } 38 93 94 void DevicePkg::parseTitle(TiXmlElement *elem) 95 { 39 96 TiXmlElement *titleElem = elem->FirstChildElement("title"); 40 title = titleElem->GetText(); 97 if (titleElem) 98 { 99 title = titleElem->GetText(); 100 } 101 else 102 { 103 std::cout << "ERROR: Could not find 'title' element within devicepkg tag" << std::endl; 104 exit(-1); 105 } 106 } 41 107 108 void DevicePkg::parseDescription(TiXmlElement *elem) 109 { 42 110 TiXmlElement *descrip = elem->FirstChildElement("description"); 43 description = descrip->GetText(); 111 if (descrip) 112 { 113 description = descrip->GetText(); 114 } 115 else 116 { 117 std::cout << "ERROR: Could not find 'description' element within devicepkg tag" << std::endl; 118 } 44 119 } 45 120 -
ossiedev/branches/mcarrick/DPD/DevicePkg.h
r8699 r8713 21 21 std::string getDevPkgName(); 22 22 std::string getDevPkgVersion(); 23 24 23 std::string getDevPkgTitle(); 25 24 std::string getDevPkgAuthor(); … … 29 28 void parseElement(TiXmlElement *elem); 30 29 void parseAttributes(TiXmlElement *elem); 30 void parseAttributeID(TiXmlElement *elem); 31 void parseAttributeName(TiXmlElement *elem); 32 void parseAttributeVersion(TiXmlElement *elem); 31 33 void parseChildElements(TiXmlElement *elem); 34 void parseTitle(TiXmlElement *elem); 35 void parseAuthor(TiXmlElement *elem); 36 void parseDescription(TiXmlElement *elem); 32 37 33 38 private: -
ossiedev/branches/mcarrick/DPD/DevicePkgRef.cpp
r8703 r8713 25 25 void DevicePkgRef::parseAttributes(TiXmlElement *elem) 26 26 { 27 type = elem->Attribute("type"); 27 if (elem->Attribute("type")) 28 { 29 type = elem->Attribute("type"); 30 } 31 else 32 { 33 std::cout << "ERROR: Could not find 'type' attribute in devicepkgref tag" << std::endl; 34 exit(-1); 35 } 28 36 } 29 37 … … 31 39 { 32 40 TiXmlElement *local = elem->FirstChildElement("localfile"); 33 localfile = local->Attribute("name"); 41 if (local) 42 { 43 localfile = local->Attribute("name"); 44 } 45 else 46 { 47 std::cout << "ERROR: Could not find 'name' attribute in localfile tag" << std::endl; 48 exit(-1); 49 } 34 50 } 35 51 -
ossiedev/branches/mcarrick/DPD/HWDeviceRegistration.cpp
r8711 r8713 131 131 if (modNum) 132 132 { 133 modelnumber = modNum->GetText(); 133 134 } 134 135 else -
ossiedev/branches/mcarrick/DPD/PropertyFile.cpp
r8699 r8713 24 24 void PropertyFile::parseAttributes(TiXmlElement *elem) 25 25 { 26 type = elem->Attribute("type"); 26 // verify attribute exists before parsing to prevent seg fault 27 if (elem->Attribute("type")) 28 { 29 type = elem->Attribute("type"); 30 } 31 else 32 { 33 std::cout << "ERROR: Could not find 'type' attribute within propertyfile tag" << std::endl; 34 exit(-1); 35 } 27 36 } 28 37 … … 30 39 { 31 40 TiXmlElement *local = elem->FirstChildElement("localfile"); 32 localfile = local->Attribute("name"); 41 if (local) 42 { 43 localfile = local->Attribute("name"); 44 } 45 else 46 { 47 std::cout << "ERROR: Could not find 'name' attribute within localfile tag" << std::endl; 48 exit(-1); 49 } 33 50 } 34 51