23 #include <xercesc/sax2/Attributes.hpp>
24 #include <xercesc/sax2/DefaultHandler.hpp>
25 #include <xercesc/util/XercesVersion.hpp>
26 #include <xercesc/util/TransService.hpp>
27 #include <xercesc/util/TranscodingException.hpp>
42 const std::map<std::string, std::string>& attrs,
43 const std::vector<std::string>& predefinedTagsMML,
44 const std::string& objectType) :
47 myPredefinedTagsMML(predefinedTagsMML) { }
75 return result.size() == 0 ? str : result;
101 const std::string& str)
const {
102 std::map<std::string, std::string>::const_iterator it =
myAttrs.find(
id);
103 if (it !=
myAttrs.end() && it->second !=
"") {
121 for (std::map<std::string, std::string>::const_iterator it =
myAttrs.begin(); it !=
myAttrs.end(); ++it) {
122 os <<
" " << it->first;
123 os <<
"=\"" << it->second <<
"\"";
127 std::vector<std::string>
129 std::vector<std::string> result;
130 for (std::map<std::string, std::string>::const_iterator it =
myAttrs.begin(); it !=
myAttrs.end(); ++it) {
131 result.push_back(it->first);
Encapsulated SAX-Attributes.
const std::string & getObjectType() const
return the objecttype to which these attributes belong
std::string getName(int attr) const
Converts the given attribute id into a man readable string.
~SUMOSAXAttributesImpl_Cached()
Destructor.
std::string getStringSecure(int id, const std::string &def) const
Returns the string-value of the named (by its enum-value) attribute.
std::map< std::string, std::string > myAttrs
The encapsulated attributes.
double getFloat(const std::string &id) const
Returns the double-value of the named attribute.
SUMOSAXAttributesImpl_Cached(const std::map< std::string, std::string > &attrs, const std::vector< std::string > &predefinedTagsMML, const std::string &objectType)
Constructor.
const std::string & getAttributeValueSecure(int id) const
Returns Xerces-value of the named attribute.
void serialize(std::ostream &os) const
Prints all attribute names and values into the given stream.
std::vector< std::string > getAttributeNames() const
Retrieves all attribute names.
std::string getString(int id, bool *isPresent=nullptr) const
Returns the string-value of the named (by its enum-value) attribute.
SUMOSAXAttributes * clone() const
return a new deep-copy attributes object
const std::vector< std::string > & myPredefinedTagsMML
Map of attribute ids to their (readable) string-representation.
bool hasAttribute(int id) const
Returns the information whether the named (by its enum-value) attribute is within the current list.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter