7#ifndef MYGUI_XML_DOCUMENT_H_
8#define MYGUI_XML_DOCUMENT_H_
40 return a.mValue ==
b.mValue;
44 return a.mValue !=
b.mValue;
77 return getValueName(mValue);
81 const char* getValueName(
int _index)
const
85 "Failed to open XML file",
86 "Failed to create XML file",
87 "XML file contain incorrect content",
88 "XML file contain not closed elements",
89 "XML file without declaration",
90 "XML file contain closed but not opened element",
91 "XML file contain inconsistent elements",
92 "XML file contain more than one declaration",
93 "XML file contain more than one root element",
94 "XML file contain incorrect attribute",
123 bool next(
const std::string&
_name);
129#ifndef MYGUI_DONT_USE_OBSOLETE
136 MYGUI_OBSOLETE(
"use : bool ElementEnumerator::next(const std::string& _name)")
151 VectorElement::iterator m_current, m_end;
173 template <
typename T>
176 addAttribute(
_key, utility::toString(
_value));
179 void addAttribute(
const std::string&
_key,
const std::string&
_value);
181 void removeAttribute(
const std::string&
_key);
183 void setAttribute(
const std::string&
_key,
const std::string&
_value);
185 template <
typename T>
188 addContent(utility::toString(
_content));
191 void addContent(
const std::string&
_content);
193 template <
typename T>
196 setContent(utility::toString(
_content));
199 void setContent(
const std::string&
_content);
203 bool findAttribute(
const std::string&
_name, std::string&
_value);
204 std::string findAttribute(
const std::string&
_name);
206 const std::string& getName()
const;
208 const std::string& getContent()
const;
221#ifndef MYGUI_DONT_USE_OBSOLETE
223 template <
typename T>
224 MYGUI_OBSOLETE(
"use : template <typename T> void Element::addAttribute(const std::string &_key, const T& _value)")
229 MYGUI_OBSOLETE(
"use : void Element::addAttribute(const std::string& _key, const std::string& _value)")
235 template <
typename T>
236 MYGUI_OBSOLETE(
"use : template <typename T> void Element::addContent(const T& _content)")
241 MYGUI_OBSOLETE(
"use : void Element::addContent(const std::string& _content)")
246 template <
typename T>
247 MYGUI_OBSOLETE(
"use : template <typename T> void Element::setContent(const T& _content)")
252 MYGUI_OBSOLETE(
"use : void Element::setContent(const std::string& _content)")
263 MYGUI_OBSOLETE(
"use : ElementEnumerator Element::getElementEnumerator()")
266 return getElementEnumerator();
273 std::string mContent;
293 bool open(
const std::wstring&
_filename);
296 bool open(std::istream&
_stream);
306 bool save(
const std::wstring&
_filename);
308 bool save(std::ostream&
_stream);
314 std::string getLastError()
const;
316 void clearLastError();
324#ifndef MYGUI_DONT_USE_OBSOLETE
326 MYGUI_OBSOLETE(
"use : ElementPtr Document::createDeclaration(const std::string& _version, const std::string& _encoding)")
335 void setLastFileError(
const std::string&
_filename);
336 void setLastFileError(
const std::wstring&
_filename);
340 bool checkPair(std::string&
_key, std::string&
_value);
347 void clearDeclaration();
354 std::string mLastErrorFile;
#define MYGUI_OBSOLETE(text)
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
void addContent(const T &_content)
void addAttribute(const std::string &_key, const T &_value)
void setContent(const T &_content)
std::pair< std::string, std::string > PairAttribute
std::vector< PairAttribute > VectorAttributes
std::vector< ElementPtr > VectorElement
friend bool operator==(ElementType const &a, ElementType const &b)
friend bool operator!=(ElementType const &a, ElementType const &b)
ElementType(Enum _value=MAX)
@ MoreThanOneXMLDeclaration
@ InconsistentOpenCloseElements
ErrorType(Enum _value=MAX)
std::string print() const