XMLreaderProxy XMLreader::operator[] (std::string name) const { Data const& data = data_map.begin()->second; for (pluint iNode=0; iNode<data.children.size(); ++iNode) { if (data.children[iNode]->name == name) { return XMLreaderProxy(data.children[iNode]); } } plbIOError( std::string("Element ")+name+std::string(" not found in XML file.") ); return XMLreaderProxy(0); }
XMLreaderProxy XMLreader::operator[] (std::string name) const { Data const& data = data_map.begin()->second; for (unsigned iNode=0; iNode<data.children.size(); ++iNode) { if (data.children[iNode]->name == name) { return XMLreaderProxy(data.children[iNode]); } } EPC_MSG_ASSERT(std::string("Element ")+name+std::string(" not found in XML file."), false); return XMLreaderProxy(0); }
XMLreaderProxy XMLreaderProxy::iterId() const { if (!reader) { plbIOError(std::string("Use of invalid XML element")); } plint newId = id; if (reader->getNextId(newId)) { return XMLreaderProxy(reader, newId); } else { return XMLreaderProxy(0); } }
XMLreaderProxy XMLreaderProxy::iterId() const { if (!reader) { EPC_ASSERT(false && "Cannot read value from XML element" ); } int newId = id; if (reader->getNextId(newId)) { return XMLreaderProxy(reader, newId); } else { return XMLreaderProxy(0); } }
XMLreaderProxy XMLreader::getElement(std::string name, int id) const { std::map<int,Data>::const_iterator it = data_map.find(id); if (it==data_map.end()) { std::stringstream idStr; idStr << id; EPC_MSG_ASSERT(std::string("Element with id ") + idStr.str() + std::string(" does not exist"), false); } std::vector<XMLreader*> const& children = it->second.children; for (unsigned iNode=0; iNode<children.size(); ++iNode) { if (children[iNode]->name == name) { return XMLreaderProxy(children[iNode]); } } EPC_MSG_ASSERT(std::string("Element ")+name+std::string(" not found in XML file."), false); return XMLreaderProxy(0); }
XMLreaderProxy XMLreaderProxy::operator[] (int newId) const { if (!reader) { EPC_ASSERT(false && "Cannot read value from XML element" ); } if (!reader->idExists(newId)) { std::stringstream newIdStr; newIdStr << newId; EPC_MSG_ASSERT(std::string("Id ") + newIdStr.str() + std::string(" does not exist in XML element"), false); } return XMLreaderProxy(reader, newId); }
XMLreaderProxy XMLreaderProxy::operator[] (plint newId) const { if (!reader) { plbIOError(std::string("Cannot read value from XML element")); } if (!reader->idExists(newId)) { std::stringstream newIdStr; newIdStr << newId; plbIOError ( std::string("Id ") + newIdStr.str() + std::string(" does not exist in XML element") ); } return XMLreaderProxy(reader, newId); }