21 #ifndef SUMOSAXAttributes_h 22 #define SUMOSAXAttributes_h 89 T
get(
int attr,
const char* objectid,
bool& ok,
bool report =
true)
const;
107 template <
typename T>
108 T
getOpt(
int attr,
const char* objectid,
bool& ok, T defaultValue,
bool report =
true)
const;
128 bool report =
true)
const;
151 SUMOTime defaultValue,
bool report =
true)
const;
171 virtual bool hasAttribute(
const std::string&
id)
const = 0;
189 virtual bool getBool(
int id)
const = 0;
206 virtual int getInt(
int id)
const = 0;
224 virtual long long int getLong(
int id)
const = 0;
239 virtual std::string
getString(
int id)
const = 0;
255 const std::string& def)
const = 0;
273 virtual double getFloat(
int id)
const = 0;
291 virtual double getFloat(
const std::string&
id)
const = 0;
304 const std::string& def)
const = 0;
362 virtual std::string
getName(
int attr)
const = 0;
369 virtual void serialize(std::ostream& os)
const = 0;
395 static void parseStringVector(
const std::string& def, std::vector<std::string>& into);
406 static void parseStringSet(
const std::string& def, std::set<std::string>& into);
410 template <
typename T> T
getInternal(
const int attr)
const;
411 void emitUngivenError(
const std::string& attrname,
const char* objectid)
const;
412 void emitEmptyError(
const std::string& attrname,
const char* objectid)
const;
413 void emitFormatError(
const std::string& attrname,
const std::string& type,
const char* objectid)
const;
444 template <
typename T>
446 bool& ok,
bool report)
const {
455 return getInternal<T>(attr);
470 template <
typename T>
472 bool& ok, T defaultValue,
bool report)
const {
477 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 SUMOSAXAttributes * clone() const =0
return a new deep-copy attributes object
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
const std::string & getObjectType() const
return the objecttype to which these attributes belong
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...
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
virtual SumoXMLEdgeFunc getEdgeFunc(bool &ok) const =0
Returns the value of the named attribute.
A class that stores a 2D geometrical boundary.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
static void parseStringVector(const std::string &def, std::vector< std::string > &into)
Splits the given string.
virtual long long int getLong(int id) const =0
Returns the long-value of the named (by its enum-value) attribute.
void emitFormatError(const std::string &attrname, const std::string &type, const char *objectid) const
Encapsulated SAX-Attributes.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
static const std::string ENCODING
The encoding of parsed strings.
void emitUngivenError(const std::string &attrname, const char *objectid) const
virtual Boundary getBoundary(int attr) const =0
Tries to read given attribute assuming it is a Boundary.
virtual SumoXMLNodeType getNodeType(bool &ok) const =0
Returns the value of the named attribute.
void emitEmptyError(const std::string &attrname, const char *objectid) const
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.
virtual double getFloat(int id) const =0
Returns the double-value of the named (by its enum-value) attribute.
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.
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 ...
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.
virtual std::string getStringSecure(int id, const std::string &def) const =0
Returns the string-value of the named (by its enum-value) attribute.
T getInternal(const int attr) const
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.
SUMOSAXAttributes & operator=(const SUMOSAXAttributes &src)
Invalidated assignment operator.