22 #ifndef SUMOSAXAttributes_h
23 #define SUMOSAXAttributes_h
90 T
get(
int attr,
const char* objectid,
bool& ok,
bool report =
true)
const;
108 template <
typename T>
109 T
getOpt(
int attr,
const char* objectid,
bool& ok, T defaultValue,
bool report =
true)
const;
129 bool report =
true)
const;
152 SUMOTime defaultValue,
bool report =
true)
const;
172 virtual bool hasAttribute(
const std::string&
id)
const = 0;
190 virtual bool getBool(
int id)
const = 0;
207 virtual int getInt(
int id)
const = 0;
240 virtual std::string
getString(
int id)
const = 0;
256 const std::string& def)
const = 0;
305 const std::string& def)
const = 0;
363 virtual std::string
getName(
int attr)
const = 0;
370 virtual void serialize(std::ostream& os)
const = 0;
393 static void parseStringVector(
const std::string& def, std::vector<std::string>& into);
404 static void parseStringSet(
const std::string& def, std::set<std::string>& into);
408 template <
typename T> T
getInternal(
const int attr)
const;
409 void emitUngivenError(
const std::string& attrname,
const char* objectid)
const;
410 void emitEmptyError(
const std::string& attrname,
const char* objectid)
const;
411 void emitFormatError(
const std::string& attrname,
const std::string& type,
const char* objectid)
const;
442 template <
typename T>
444 bool& ok,
bool report)
const {
453 return getInternal<T>(attr);
468 template <
typename T>
470 bool& ok, T defaultValue,
bool report)
const {
475 return getInternal<T>(attr);
SUMOSAXAttributes(const std::string &objectType)
virtual RGBColor getColor() const =0
Returns the value of the named attribute.
static void parseStringSet(const std::string &def, std::set< std::string > &into)
Splits the given string, stores it in a set.
virtual PositionVector getShape(int attr) const =0
Tries to read given attribute assuming it is a PositionVector.
virtual std::string getName(int attr) const =0
Converts the given attribute id into a man readable string.
std::string myObjectType
the object type to use in error reporting
void emitUngivenError(const std::string &attrname, const char *objectid) const
static const std::string type
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
virtual SumoXMLEdgeFunc getEdgeFunc(bool &ok) const =0
Returns the value of the named attribute.
A class that stores a 2D geometrical boundary.
const std::string & getObjectType() const
return the objecttype to which these attributes belong
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
SUMOTime getOptSUMOTimeReporting(int attr, const char *objectid, bool &ok, SUMOTime defaultValue, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
T getInternal(const int attr) const
static void parseStringVector(const std::string &def, std::vector< std::string > &into)
Splits the given string.
virtual SUMOLong getLong(int id) const =0
Returns the long-value of the named (by its enum-value) attribute.
Encapsulated SAX-Attributes.
virtual SUMOReal getFloat(int id) const =0
Returns the SUMOReal-value of the named (by its enum-value) attribute.
static const std::string ENCODING
The encoding of parsed strings.
virtual Boundary getBoundary(int attr) const =0
Tries to read given attribute assuming it is a Boundary.
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
virtual SumoXMLNodeType getNodeType(bool &ok) const =0
Returns the value of the named attribute.
virtual void serialize(std::ostream &os) const =0
Prints all attribute names and values into the given stream.
virtual std::vector< std::string > getStringVector(int attr) const =0
Tries to read given attribute assuming it is a string vector.
static bool myHaveInformedAboutDeprecatedDivider
Information whether the usage of a deprecated divider was reported.
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
virtual std::string getStringSecure(int id, const std::string &def) const =0
Returns the string-value of the named (by its enum-value) attribute.
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
virtual ~SUMOSAXAttributes()
Destructor.
friend std::ostream & operator<<(std::ostream &os, const SUMOSAXAttributes &src)
virtual int getInt(int id) const =0
Returns the int-value of the named (by its enum-value) attribute.
virtual bool getBool(int id) const =0
Returns the bool-value of the named (by its enum-value) attribute.
void emitEmptyError(const std::string &attrname, const char *objectid) const
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
std::ostream & operator<<(std::ostream &os, const MTRand &mtrand)
SUMOSAXAttributes & operator=(const SUMOSAXAttributes &src)
Invalidated assignment operator.
void emitFormatError(const std::string &attrname, const std::string &type, const char *objectid) const