Changeset 75:8aac19a77eb3 in finroc_plugins_parameters


Ignore:
Timestamp:
10.06.2018 19:07:52 (3 years ago)
Author:
Max Reichardt <max.reichardt@…>
Branch:
14.08
Parents:
74:4afa288fad73 (diff), 60:baa86ed122ec (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Phase:
public
Message:

Merged with changes from finroc.org

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tConfigFile.cpp

    r60 r75  
    221221  } 
    222222} 
     223 
     224std::vector<std::string> tConfigFile::GetChildrenNames(const std::string &entry) 
     225{ 
     226  std::vector<rrlib::xml::tNode *> nodes; 
     227  this->GetEntryImplementation(nodes, entry, wrapped.RootNode(), 0); 
     228  if (nodes.size() > 1) 
     229  { 
     230    FINROC_LOG_PRINT(WARNING, "There are ", nodes.size(), " entries in config file with the qualified name '", entry, "'. Using the first one."); 
     231  } 
     232 
     233  if (nodes.size() == 0) 
     234  { 
     235    throw std::runtime_error("Config node not found: " + entry); 
     236  } 
     237  if (nodes[0]->Name() == cXML_LEAF_NAME) 
     238  { 
     239    throw std::runtime_error("Config node is a leaf: " + entry); 
     240  } 
     241 
     242  std::vector<std::string> result; 
     243  for (auto it = nodes.front()->ChildrenBegin(); it != nodes.front()->ChildrenEnd(); ++it) 
     244  { 
     245    result.push_back(it->GetStringAttribute("name")); 
     246  } 
     247  return result; 
     248} 
     249 
    223250 
    224251void tConfigFile::GetEntryImplementation(std::vector<rrlib::xml::tNode*>& result, const std::string& entry, rrlib::xml::tNode& node, size_t entry_string_index) 
  • tConfigFile.cpp

    r74 r75  
    211211    std::string name = result[0]->GetStringAttribute("name"); 
    212212    tXMLNode& parent = result[0]->Parent(); 
     213    tXMLNode& new_node = result[0]->AddNextSibling(cXML_LEAF_NAME); 
     214    new_node.SetAttribute("name", name); 
    213215    parent.RemoveChildNode(*result[0]); 
    214     tXMLNode& new_node = parent.AddChildNode(cXML_LEAF_NAME); 
    215     new_node.SetAttribute("name", name); 
    216216    return new_node; 
    217217  } 
Note: See TracChangeset for help on using the changeset viewer.