Definition at line 43 of file XML.h.
 
◆ XNode()
Definition at line 124 of file XML.cpp.
  124             {
  125    this->parent = NULL;
  126    this->name = "";
  127    this->value = "";
  128    this->attributes = std::vector<XAttrib>();
  129    this->children = std::vector<XNode>();
  130}
 
 
 
◆ getAttribute()
      
        
          | const XAttrib & XNode::getAttribute  | 
          ( | 
          const char * |           name | ) | 
           const | 
        
      
 
Definition at line 149 of file XML.cpp.
  149                                                         {
  150    for (unsigned int i = 0; i < this->attributes.size(); i++) {
  151        if (strcmp(this->attributes.at(i).name.c_str(), name) == 0) return this->attributes.at(i);
  152    }
  153 
  154    printf("Warning: Attribute [%s] not found.", name);
  155    throw -1;
  156}
 
 
 
◆ getChild()
      
        
          | const XNode & XNode::getChild  | 
          ( | 
          const char * |           name | ) | 
           const | 
        
      
 
Definition at line 184 of file XML.cpp.
  184                                                   {
  185    for (unsigned int i = 0; i < this->children.size(); i++) {
  186        if (strcmp(this->children[i].name.c_str(), name) == 0) return this->children[i];
  187    }
  188 
  189    printf("Error: Node [%s] not found.\n", name);
  190    throw -1;
  191}
 
 
 
◆ getNode()
      
        
          | const XNode & XNode::getNode  | 
          ( | 
          const char * |           name | ) | 
           const | 
        
      
 
Definition at line 140 of file XML.cpp.
  140                                                  {
  141    const XNode* res = this->_getNode(name);
 
  142    if (!res) {
  143        printf("Error: Node [%s] not found.", name);
  144        throw -1;
  145    }
  146    return *res;
  147}
 
 
 
◆ getNodeByAttribute()
      
        
          | const XNode & XNode::getNodeByAttribute  | 
          ( | 
          const char * |           node_name,  | 
        
        
           | 
           | 
          const char * |           attrib_name,  | 
        
        
           | 
           | 
          const char * |           attrib_value ) const | 
        
      
 
Definition at line 165 of file XML.cpp.
  165                                                                                                                     {
  166    const XNode* res = this->_getNodeByAttribute(node_name, attrib_name, attrib_value);
 
  167    if (!res) {
  168        printf("Warning: Node with ");
  169        if (node_name != NULL) printf("name \"%s\" and ", node_name);
  170        printf("attribute [");
  171        printf("%s=", attrib_name == NULL ? "\"\"" : attrib_name);
  172        printf("%s", attrib_value == NULL ? "\"\"" : attrib_value);
  173        printf("] not found.\n");
  174        throw -1;
  175    }
  176    return *res;
  177}
 
 
 
◆ hasAttribute()
      
        
          | bool XNode::hasAttribute  | 
          ( | 
          const char * |           name | ) | 
           const | 
        
      
 
Definition at line 158 of file XML.cpp.
  158                                               {
  159    for (const auto & attribute : this->attributes) {
  160        if (strcmp(attribute.name.c_str(), name) == 0) return true;
  161    }
  162    return false;
  163}
 
 
 
◆ hasChild()
      
        
          | bool XNode::hasChild  | 
          ( | 
          const char * |           name | ) | 
           const | 
        
      
 
Definition at line 193 of file XML.cpp.
  193                                           {
  194    for (const auto & child : this->children) {
  195        if (strcmp(child.name.c_str(), name) == 0) return true;
  196    }
  197    return false;
  198}
 
 
 
◆ hasNodeByAttribute()
      
        
          | bool XNode::hasNodeByAttribute  | 
          ( | 
          const char * |           node_name,  | 
        
        
           | 
           | 
          const char * |           attrib_name,  | 
        
        
           | 
           | 
          const char * |           attrib_value ) const | 
        
      
 
Definition at line 179 of file XML.cpp.
  179                                                                                                             {
  180    const XNode* res = this->_getNodeByAttribute(node_name, attrib_name, attrib_value);
 
  181    return res != nullptr;
  182}
 
 
 
◆ print()
      
        
          | void XNode::print  | 
          ( | 
           | ) | 
           const | 
        
      
 
Definition at line 132 of file XML.cpp.
  133{
  134    printf("%s: [%s] ", name.c_str(), value.c_str());
  135    for (unsigned int i = 0; i < this->attributes.size(); i++)
  136        printf("%s ", this->attributes.at(i).toString().c_str());
  137    printf("\n");
  138}
 
 
 
◆ attributes
      
        
          | std::vector<XAttrib> XNode::attributes | 
        
      
 
Definition at line 55 of file XML.h.
 
 
◆ children
      
        
          | std::vector<XNode> XNode::children | 
        
      
 
Definition at line 56 of file XML.h.
 
 
◆ name
Definition at line 52 of file XML.h.
 
 
◆ parent
Definition at line 50 of file XML.h.
 
 
◆ raw
Definition at line 54 of file XML.h.
 
 
◆ sub_index
      
        
          | int XNode::sub_index = -1 | 
        
      
 
Definition at line 58 of file XML.h.
 
 
◆ value
Definition at line 53 of file XML.h.
 
 
The documentation for this class was generated from the following files: