20#pragma warning (disable : 4275)
25#include "smartpointer.h"
47class EXP xmlattribute :
public smartable {
54 virtual ~xmlattribute() {}
58 void setName (
const std::string& name);
59 void setValue (
const std::string& value);
60 void setValue (
long value);
61 void setValue (
int value);
62 void setValue (
float value);
64 const std::string& getName ()
const {
return fName; }
66 const std::string&
getValue ()
const {
return fValue; }
68 operator int ()
const;
70 operator long ()
const;
72 operator float ()
const;
85class EXP xmlelement :
public ctree<xmlelement>,
public visitable
93 std::vector<Sxmlattribute> fAttributes;
101 xmlelement (
int inputLineNumber) : fType(0), fInputLineNumber(inputLineNumber) {}
102 virtual ~xmlelement() {}
112 int getInputLineNumber () {
return fInputLineNumber; }
114 void setValue (
unsigned long value);
115 void setValue (
long value);
116 void setValue (
int value);
117 void setValue (
float value);
118 void setValue (
const std::string& value);
119 void setName (
const std::string& name);
121 int getType ()
const {
return fType; }
122 const std::string& getName ()
const {
return fName; }
125 const std::string&
getValue ()
const {
return fValue; }
128 operator long ()
const;
130 operator int ()
const;
132 operator float ()
const;
134 bool operator ==(
const xmlelement& elt)
const;
135 bool operator !=(
const xmlelement& elt)
const {
return !(*
this == elt); }
138 long add (
const Sxmlattribute& attr);
141 const std::vector<Sxmlattribute>& attributes()
const {
return fAttributes; }
142 const Sxmlattribute getAttribute (
const std::string& attrname)
const;
143 const std::string getAttributeValue (
const std::string& attrname)
const;
144 long getAttributeLongValue (
const std::string& attrname,
long defaultvalue)
const;
145 int getAttributeIntValue (
const std::string& attrname,
int defaultvalue)
const;
146 float getAttributeFloatValue (
const std::string& attrname,
float defaultvalue)
const;
153 const std::string getValue (
int subElementType);
154 int getIntValue (
int subElementType,
int defaultvalue);
155 long getLongValue (
int subElementType,
long defaultvalue);
156 float getFloatValue (
int subElementType,
float defaultvalue);
163 bool empty ()
const {
return fValue.empty() && elements().empty(); }
the smart pointer implementation
Definition smartpointer.h:58
Definition basevisitor.h:25
treeIterator< treePtr > iterator
the top -> bottom iterator type
Definition ctree.h:129
base class for visitable objects
Definition visitable.h:25
A generic xml attribute representation.
Definition xml.h:47
const std::string & getValue() const
returns the attribute value as a string
Definition xml.h:66
A generic xml element representation.
Definition xml.h:86
bool hasSubElement(int subElementType, std::string value)
returns true if subelement with given value exists
const std::string & getValue() const
returns the element value as a string
Definition xml.h:125
bool hasSubElement(int subElementType)
returns true if subelement exists
long add(const Sxmlattribute &attr)
adds an attribute to the element