25 #include <xercesc/sax2/Attributes.hpp>
26 #include <xercesc/sax2/DefaultHandler.hpp>
42 const std::vector<XMLCh*>& predefinedTags,
43 const std::vector<std::string>& predefinedTagsMML,
44 const std::string& objectType) :
47 myPredefinedTags(predefinedTags),
48 myPredefinedTagsMML(predefinedTagsMML) { }
66 if (xString !=
nullptr) {
77 if (XERCES_CPP_NAMESPACE::XMLString::stringLen(utf16) == 0) {
96 XMLCh* t = XERCES_CPP_NAMESPACE::XMLString::transcode(
id.c_str());
98 XERCES_CPP_NAMESPACE::XMLString::release(&t);
105 XMLCh* t = XERCES_CPP_NAMESPACE::XMLString::transcode(
id.c_str());
106 bool result =
myAttrs.getIndex(t) >= 0;
107 XERCES_CPP_NAMESPACE::XMLString::release(&t);
114 const std::string& str)
const {
115 XMLCh* t = XERCES_CPP_NAMESPACE::XMLString::transcode(
id.c_str());
116 const XMLCh* v =
myAttrs.getValue(t);
117 XERCES_CPP_NAMESPACE::XMLString::release(&t);
136 for (
int i = 0; i < (int)
myAttrs.getLength(); ++i) {
143 std::vector<std::string>
145 std::vector<std::string> result;
146 for (
int i = 0; i < (int)
myAttrs.getLength(); ++i) {
155 std::map<std::string, std::string> attrs;
156 for (
int i = 0; i < (int)
myAttrs.getLength(); ++i) {
Encapsulated SAX-Attributes.
const std::string & getObjectType() const
return the objecttype to which these attributes belong
Encapsulated Xerces-SAX-attributes.
const XMLCh * getAttributeValueSecure(int id) const
Returns Xerces-value of the named attribute.
std::string getString(int id, bool *isPresent=nullptr) const
Returns the string-value of the named (by its enum-value) attribute.
const std::vector< std::string > & myPredefinedTagsMML
Map of attribute ids to their (readable) string-representation.
std::string getName(int attr) const
Converts the given attribute id into a man readable string.
std::vector< std::string > getAttributeNames() const
Retrieves all attribute names.
const XERCES_CPP_NAMESPACE::Attributes & myAttrs
The encapsulated attributes.
SUMOSAXAttributesImpl_Xerces(const XERCES_CPP_NAMESPACE::Attributes &attrs, const std::vector< XMLCh * > &predefinedTags, const std::vector< std::string > &predefinedTagsMML, const std::string &objectType)
Constructor.
double getFloat(const std::string &id) const
Returns the double-value of the named attribute.
const AttrMap & myPredefinedTags
Map of attribute ids to their xerces-representation.
virtual ~SUMOSAXAttributesImpl_Xerces()
Destructor.
void serialize(std::ostream &os) const
Prints all attribute names and values into the given stream.
std::string getStringSecure(int id, const std::string &def) const
Returns the string-value of the named (by its enum-value) attribute.
SUMOSAXAttributes * clone() const
return a new deep-copy attributes object
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
static std::string transcode(const XMLCh *const data)
converts a 0-terminated XMLCh* array (usually UTF-16, stemming from Xerces) into std::string in UTF-8