Crazy Eddie's GUI System  0.8.5
XMLSerializer.h
1 /***********************************************************************
2  created: Thue May 16 2006
3  author: Olivier Delannoy
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining
9  * a copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  ***************************************************************************/
27 #ifndef _CEGUIXMLSerializer_h_
28 #define _CEGUIXMLSerializer_h_
29 #include "CEGUI/Base.h"
30 #include "CEGUI/String.h"
31 #include <vector>
32 
33 #if defined(_MSC_VER)
34 # pragma warning(push)
35 # pragma warning(disable : 4251)
36 #endif
37 
38 // Start of CEGUI namespace section
39 namespace CEGUI
40 {
85  class CEGUIEXPORT XMLSerializer :
86  public AllocatedObject<XMLSerializer>
87  {
88  public:
97  XMLSerializer(OutStream& out, size_t indentSpace = 4);
98 
102  virtual ~XMLSerializer(void);
103 
112  XMLSerializer& openTag(const String& name);
119  XMLSerializer& closeTag(void);
130  XMLSerializer& attribute(const String& name, const String& value);
139  XMLSerializer& text(const String& text);
140 
148  unsigned int getTagCount() const;
155  operator bool () const
156  {
157  return false == d_error;
158  }
165  bool operator!() const
166  {
167  return false != d_error;
168  }
169 
170  protected:
171  private:
172  bool d_error;
173  unsigned int d_tagCount;
174  size_t d_depth;
175  size_t d_indentSpace;
176  bool d_needClose;
177  bool d_lastIsText;
178  OutStream& d_stream;
179  std::vector<String
180  CEGUI_VECTOR_ALLOC(String)> d_tagStack;
181 
185  void indentLine();
189  static String convertEntityInText(const String& text);
193  static String convertEntityInAttribute(const String& attributeValue);
194 
195 
196  // Disabled operation
197  XMLSerializer(const XMLSerializer& obj);
198  // Disabled operation
199  XMLSerializer& operator=(const XMLSerializer& obj);
200  };
201 }
202 
203 #if defined(_MSC_VER)
204 # pragma warning(pop)
205 #endif
206 
207 #endif
Definition: MemoryAllocatedObject.h:109
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
bool operator!() const
Check wether the XML Serializer status is invalid.
Definition: XMLSerializer.h:165
std::ostream OutStream
Output stream class.
Definition: Base.h:185
Class used to create XML Document.
Definition: XMLSerializer.h:85
String class used within the GUI system.
Definition: String.h:62