31 #include <xercesc/sax2/Attributes.hpp> 32 #include <xercesc/sax2/DefaultHandler.hpp> 33 #include <xercesc/util/XercesVersion.hpp> 34 #include <xercesc/util/TransService.hpp> 35 #include <xercesc/util/TranscodingException.hpp> 50 const std::map<std::string, std::string>& attrs,
51 const std::map<int, std::string>& predefinedTagsMML,
52 const std::string& objectType) :
55 myPredefinedTagsMML(predefinedTagsMML) { }
98 const std::string& str)
const {
100 return result.size() == 0 ? str : result;
114 return myAttrs.find((*i).second)->second.c_str();
132 const std::string& str)
const {
133 std::map<std::string, std::string>::const_iterator it =
myAttrs.find(
id);
134 if (it !=
myAttrs.end() && it->second !=
"") {
180 if (pos.size() != 2 && pos.size() != 3) {
185 if (pos.size() == 2) {
200 if (st.
size() != 4) {
207 return Boundary(xmin, ymin, xmax, ymax);
211 std::vector<std::string>
214 std::vector<std::string> ret;
231 for (std::map<std::string, std::string>::const_iterator it =
myAttrs.begin(); it !=
myAttrs.end(); ++it) {
232 os <<
" " << it->first;
233 os <<
"=\"" << it->second <<
"\"";
SumoXMLNodeType getNodeType(bool &ok) const
Returns the value of the named attribute.
static StringBijection< SumoXMLNodeType > NodeTypes
node types
static RGBColor parseColor(std::string coldef)
Parses a color information.
std::vector< std::string > getStringVector(int attr) const
Tries to read given attribute assuming it is a string vector.
static bool _2bool(const E *const data)
converts a 0-terminated char-type array into the boolean value described by it
static long long int _2long(const E *const data)
converts a char-type array into the long value described by it
const std::string & getObjectType() const
return the objecttype to which these attributes belong
void serialize(std::ostream &os) const
Prints all attribute names and values into the given stream.
long long int getLong(int id) const
Returns the long-value of the named (by its enum-value) attribute.
Boundary getBoundary(int attr) const
Tries to read given attribute assuming it is a Boundary.
A class that stores a 2D geometrical boundary.
RGBColor getColor() const
Returns the value of the named attribute.
PositionVector getShape(int attr) const
Tries to read given attribute assuming it is a PositionVector.
std::string getName(int attr) const
Converts the given attribute id into a man readable string.
const std::map< int, std::string > & myPredefinedTagsMML
Map of attribute ids to their (readable) string-representation.
static void parseStringVector(const std::string &def, std::vector< std::string > &into)
Splits the given string.
Encapsulated SAX-Attributes.
A point in 2D or 3D with translation and scaling methods.
int getInt(int id) const
Returns the int-value of the named (by its enum-value) attribute.
T get(const std::string &str) const
double getFloat(int id) const
Returns the double-value of the named (by its enum-value) attribute.
virtual ~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::string getString(int id) const
Returns the string-value of the named (by its enum-value) attribute.
bool getBool(int id) const
Returns the bool-value of the named (by its enum-value) attribute.
static int _2int(const E *const data)
converts a char-type array into the integer value described by it
SUMOSAXAttributes * clone() const
return a new deep-copy attributes object
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
static double _2double(const E *const data)
converts a char-type array into the double value described by it
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
const char * getAttributeValueSecure(int id) const
Returns Xerces-value of the named attribute.
SumoXMLEdgeFunc getEdgeFunc(bool &ok) const
Returns the value of the named attribute.
SUMOSAXAttributesImpl_Cached(const std::map< std::string, std::string > &attrs, const std::map< int, std::string > &predefinedTagsMML, const std::string &objectType)
Constructor.
static StringBijection< SumoXMLEdgeFunc > EdgeFunctions
edge functions
std::map< std::string, std::string > myAttrs
The encapsulated attributes.
bool hasAttribute(int id) const
Returns the information whether the named (by its enum-value) attribute is within the current list...