39 #define G_VALUE "GModelAssociation::value(std::string&)"
40 #define G_ERROR "GModelAssociation::error(std::string&)"
41 #define G_PROPERTY "GModelAssociation::property(std::string&, std::string&,"\
43 #define G_GET_PROPERTY_XML "GModelAssociation::get_property_xml("\
44 "GXmlElement&, std::string&)"
158 if (
this != &association) {
228 std::string msg =
"Property \""+name+
"\" not found in association.";
255 std::string msg =
"Association property \""+name+
"\" not found.";
278 const std::string& value,
279 const std::string& error)
283 std::string msg =
"Association property \""+name+
"\" exists already.";
329 for (
int i = 0; i < n; ++i) {
336 std::string
name =
property->attribute(
"name");
337 std::string
value =
property->attribute(
"value");
338 std::string
error =
property->attribute(
"error");
372 for (
int i = 0; i <
size(); ++i) {
374 property->attribute(
"name",
m_names[i]);
375 property->attribute(
"value",
m_values[i]);
377 property->attribute(
"error",
m_errors[i]);
401 result.append(
"=== GModelAssociation ===");
409 for (
int i = 0; i <
size(); ++i) {
488 for (
int i = 0; i <
size(); ++i) {
517 const std::string& name)
const
529 for (
int i = 0; i < n; ++i) {
545 std::string msg =
"Property \""+name+
"\" not found in XML element."
546 " Please verify the XML format.";
549 else if (number > 1) {
550 std::string msg =
"Property \""+name+
"\" found "+
552 " Please verify the XML format.";
std::string m_name
Association name.
int size(void) const
Return number of association properties.
std::string number(const std::string &noun, const int &number)
Convert singular noun into number noun.
void clear(void)
Clear model association.
XML element node class interface definition.
const std::string & value(const std::string &name) const
Return property value.
virtual int elements(void) const
Return number of GXMLElement children of node.
GXmlElement * get_property_xml(GXmlElement &xml, const std::string &name) const
Return pointer to property with given name in XML element.
std::string print(const GChatter &chatter=NORMAL) const
Print model association.
virtual ~GModelAssociation(void)
Destructor.
std::vector< std::string > m_names
Property names.
std::vector< std::string > m_values
Property values.
const GXmlAttribute * attribute(const int &index) const
Return attribute.
GModelAssociation(void)
Void constructor.
void read(const GXmlElement &xml)
Read model association from XML document.
const std::string & error(const std::string &name) const
Return property error.
std::vector< std::string > m_errors
Property errors.
GModelAssociation * clone(void) const
Clone model association.
int get_index(const std::string &name) const
Return property index by name.
GModelAssociation & operator=(const GModelAssociation &association)
Assignment operator.
void copy_members(const GModelAssociation &association)
Copy class members.
#define G_GET_PROPERTY_XML
virtual GXmlElement * element(const int &index)
Return pointer to GXMLElement child.
Model association class definition.
Exception handler interface definition.
const std::string & name(void) const
Return association name.
virtual GXmlNode * append(const GXmlNode &node)
Append XML child node.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
void init_members(void)
Initialise class members.
void free_members(void)
Delete class members.
void write(GXmlElement &xml) const
Write model association into XML element.
void property(const std::string &name, const std::string &value, const std::string &error="")
Set property value and (optionally) error.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.