27 #include <xercesc/sax2/Attributes.hpp> 28 #include <xercesc/sax2/DefaultHandler.hpp> 44 const std::map<int, XMLCh*>& predefinedTags,
45 const std::map<int, std::string>& predefinedTagsMML,
46 const std::string& objectType) :
49 myPredefinedTags(predefinedTags),
50 myPredefinedTagsMML(predefinedTagsMML) { }
63 return myAttrs.getIndex((*i).second) >= 0;
94 if (XERCES_CPP_NAMESPACE::XMLString::stringLen(utf16) == 0) {
113 return myAttrs.getValue((*i).second);
119 XMLCh* t = XERCES_CPP_NAMESPACE::XMLString::transcode(
id.c_str());
121 XERCES_CPP_NAMESPACE::XMLString::release(&t);
128 XMLCh* t = XERCES_CPP_NAMESPACE::XMLString::transcode(
id.c_str());
129 bool result =
myAttrs.getIndex(t) >= 0;
130 XERCES_CPP_NAMESPACE::XMLString::release(&t);
137 const std::string& str)
const {
138 XMLCh* t = XERCES_CPP_NAMESPACE::XMLString::transcode(
id.c_str());
139 const XMLCh* v =
myAttrs.getValue(t);
140 XERCES_CPP_NAMESPACE::XMLString::release(&t);
199 if (pos.size() != 2 && pos.size() != 3) {
204 if (pos.size() == 2) {
219 if (st.
size() != 4) {
226 return Boundary(xmin, ymin, xmax, ymax);
230 std::vector<std::string>
233 std::vector<std::string> ret;
250 for (
int i = 0; i < (int)
myAttrs.getLength(); ++i) {
259 std::map<std::string, std::string> attrs;
260 for (
int i = 0; i < (int)
myAttrs.getLength(); ++i) {
static StringBijection< RightOfWay > RightOfWayValues
lane spread functions
static StringBijection< SumoXMLNodeType > NodeTypes
node types
static RGBColor parseColor(std::string coldef)
Parses a color information.
int getInt(int id) const
Returns the int-value of the named (by its enum-value) attribute.
const std::string & getObjectType() const
return the objecttype to which these attributes belong
Encapsulated Xerces-SAX-attributes.
RightOfWay getRightOfWay(bool &ok) const
returns rightOfWay method
RightOfWay
algorithms for computing right of way
A class that stores a 2D geometrical boundary.
double getFloat(int id) const
Returns the double-value of the named (by its enum-value) attribute.
const std::map< int, std::string > & myPredefinedTagsMML
Map of attribute ids to their (readable) string-representation.
static bool toBool(const std::string &sData)
converts a string into the bool 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...
SUMOSAXAttributes * clone() const
return a new deep-copy attributes object
virtual ~SUMOSAXAttributesImpl_Xerces()
Destructor.
PositionVector getShape(int attr) const
Tries to read given attribute assuming it is a PositionVector.
const AttrMap & myPredefinedTags
Map of attribute ids to their xerces-representation.
static void parseStringVector(const std::string &def, std::vector< std::string > &into)
Splits the given string.
How to compute right of way.
Encapsulated SAX-Attributes.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter ...
const XERCES_CPP_NAMESPACE::Attributes & myAttrs
The encapsulated attributes.
A point in 2D or 3D with translation and scaling methods.
T get(const std::string &str) const
SumoXMLNodeType getNodeType(bool &ok) const
Returns the value of the named attribute.
bool getBool(int id) const
Returns the bool-value of the named (by its enum-value) attribute.
bool hasAttribute(int id) const
Returns the information whether the named (by its enum-value) attribute is within the current list...
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter...
std::string getString(int id) const
Returns the string-value of the named (by its enum-value) attribute.
SumoXMLEdgeFunc getEdgeFunc(bool &ok) const
Returns the value of the named attribute.
std::string getStringSecure(int id, const std::string &def) const
Returns the string-value of the named (by its enum-value) attribute.
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
static long long int toLong(const std::string &sData)
converts a string into the long value described by it by calling the char-type converter, which
SUMOSAXAttributesImpl_Xerces(const XERCES_CPP_NAMESPACE::Attributes &attrs, const std::map< int, XMLCh *> &predefinedTags, const std::map< int, std::string > &predefinedTagsMML, const std::string &objectType)
Constructor.
long long int getLong(int id) const
Returns the long-value of the named (by its enum-value) attribute.
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
std::string getName(int attr) const
Converts the given attribute id into a man readable string.
std::vector< std::string > getStringVector(int attr) const
Tries to read given attribute assuming it is a string vector.
const XMLCh * 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.
static StringBijection< SumoXMLEdgeFunc > EdgeFunctions
edge functions
RGBColor getColor() const
Returns the value of the named attribute.
Boundary getBoundary(int attr) const
Tries to read given attribute assuming it is a Boundary.