CEGUI::XMLSerializer Class Reference

Class used to create XML Document. More...

List of all members.

Public Member Functions

 XMLSerializer (OutStream &out, size_t indentSpace=4)
 XMLSerializer constructor.
virtual ~XMLSerializer (void)
 XMLSerializer destructor.
XMLSerializeropenTag (const String &name)
 Start a new tag in the xml document.
XMLSerializercloseTag (void)
 Close the current tag.
XMLSerializerattribute (const String &name, const String &value)
 After an opening tag you can populate attribute list with this function.
XMLSerializertext (const String &text)
 Create a text node.
unsigned int getTagCount () const
 report the nimber of tags created in the document
 operator bool () const
 Check wether the XML Serializer status is valid.
bool operator! () const
 Check wether the XML Serializer status is invalid.


Detailed Description

Class used to create XML Document.

This class hides the complexity of formatting valid XML files. The class provides automatic substitution of entities, XML indenting in respect of the spaces. It does not contains any codes specific to CEGUI taking appart the CEGUI::String class. The following example show the code needed to exports parts of an XML document similar to what can be found in a layout.

    #include <iostream>
    #include <CEGUI/XMLSerializer.h> 
    
    int main() 
    {
 Create an encoder that outputs its result on standard output 
       XMLSerializer xml(std::cout, 4);
       xml.openTag("Window")
          .attribute("Type", "TaharezLook/StaticText")
          .attribute("Name", "Test")
          .openTag("Property")
          .attribute("Name", "Text")
          .text("This is the static text to be displayed")
          .closeTag()
          .openTag("Window")
          .attribute("Name", "Button")
          .attribute("Type", "Vanilla/Button")
          .openTag("Property")
          .attribute("Name", "Text")
          .attribute("Value", "Push me")
          .closeTag()
          .closeTag()
          .closeTag();
          
       if (xml)
       {
           std::cout << "XML Exported successfully" << std::endl;
       }
       return 0;
    }

Constructor & Destructor Documentation

CEGUI::XMLSerializer::XMLSerializer ( OutStream out,
size_t  indentSpace = 4 
)

XMLSerializer constructor.

Parameters:
out The stream to use to export the result
indentSpace The indentation level (0 to disable indentation)


Member Function Documentation

XMLSerializer & CEGUI::XMLSerializer::attribute ( const String name,
const String value 
)

After an opening tag you can populate attribute list with this function.

Parameters:
name The name of the attribute
value The value of the attribute
Returns:
A reference to the current object for chaining operation

Referenced by CEGUI::FalagardComponentBase::writeColoursXML(), CEGUI::FalagardComponentBase::writeHorzFormatXML(), CEGUI::FalagardComponentBase::writeVertFormatXML(), CEGUI::WindowManager::writeWindowLayoutToStream(), CEGUI::PropertyLinkDefinition::writeXMLAttributes(), CEGUI::PropertyDefinitionBase::writeXMLAttributes(), CEGUI::UnifiedDim::writeXMLElementAttributes_impl(), CEGUI::PropertyDim::writeXMLElementAttributes_impl(), CEGUI::FontDim::writeXMLElementAttributes_impl(), CEGUI::WidgetDim::writeXMLElementAttributes_impl(), CEGUI::ImageDim::writeXMLElementAttributes_impl(), CEGUI::AbsoluteDim::writeXMLElementAttributes_impl(), CEGUI::Window::writeXMLToStream(), CEGUI::Property::writeXMLToStream(), CEGUI::Imageset::writeXMLToStream(), CEGUI::Image::writeXMLToStream(), CEGUI::Font::writeXMLToStream(), CEGUI::WidgetLookFeel::writeXMLToStream(), CEGUI::WidgetComponent::writeXMLToStream(), CEGUI::TextComponent::writeXMLToStream(), CEGUI::StateImagery::writeXMLToStream(), CEGUI::SectionSpecification::writeXMLToStream(), CEGUI::PropertyInitialiser::writeXMLToStream(), CEGUI::NamedArea::writeXMLToStream(), CEGUI::LayerSpecification::writeXMLToStream(), CEGUI::ImagerySection::writeXMLToStream(), CEGUI::ImageryComponent::writeXMLToStream(), CEGUI::FrameComponent::writeXMLToStream(), CEGUI::ComponentArea::writeXMLToStream(), CEGUI::Dimension::writeXMLToStream(), CEGUI::BaseDim::writeXMLToStream(), CEGUI::PixmapFont::writeXMLToStream_impl(), and CEGUI::FreeTypeFont::writeXMLToStream_impl().

XMLSerializer & CEGUI::XMLSerializer::closeTag ( void   ) 

unsigned int CEGUI::XMLSerializer::getTagCount (  )  const

report the nimber of tags created in the document

Returns:
return the number of tag created in the document

XMLSerializer & CEGUI::XMLSerializer::openTag ( const String name  ) 

Start a new tag in the xml document.

Parameters:
name The name of the tag
Returns:
A reference to the current object for chaining operation

Referenced by CEGUI::FalagardComponentBase::writeColoursXML(), CEGUI::FalagardComponentBase::writeHorzFormatXML(), CEGUI::FalagardComponentBase::writeVertFormatXML(), CEGUI::WidgetLookManager::writeWidgetLookSeriesToStream(), CEGUI::WidgetLookManager::writeWidgetLookToStream(), CEGUI::WindowManager::writeWindowLayoutToStream(), CEGUI::UnifiedDim::writeXMLElementName_impl(), CEGUI::PropertyDim::writeXMLElementName_impl(), CEGUI::FontDim::writeXMLElementName_impl(), CEGUI::WidgetDim::writeXMLElementName_impl(), CEGUI::ImageDim::writeXMLElementName_impl(), CEGUI::AbsoluteDim::writeXMLElementName_impl(), CEGUI::PropertyLinkDefinition::writeXMLElementType(), CEGUI::PropertyDefinition::writeXMLElementType(), CEGUI::Window::writeXMLToStream(), CEGUI::Property::writeXMLToStream(), CEGUI::Imageset::writeXMLToStream(), CEGUI::Image::writeXMLToStream(), CEGUI::Font::writeXMLToStream(), CEGUI::WidgetLookFeel::writeXMLToStream(), CEGUI::WidgetComponent::writeXMLToStream(), CEGUI::TextComponent::writeXMLToStream(), CEGUI::StateImagery::writeXMLToStream(), CEGUI::SectionSpecification::writeXMLToStream(), CEGUI::PropertyInitialiser::writeXMLToStream(), CEGUI::NamedArea::writeXMLToStream(), CEGUI::LayerSpecification::writeXMLToStream(), CEGUI::ImagerySection::writeXMLToStream(), CEGUI::ImageryComponent::writeXMLToStream(), CEGUI::FrameComponent::writeXMLToStream(), CEGUI::ComponentArea::writeXMLToStream(), CEGUI::Dimension::writeXMLToStream(), CEGUI::BaseDim::writeXMLToStream(), and CEGUI::PixmapFont::writeXMLToStream_impl().

CEGUI::XMLSerializer::operator bool (  )  const [inline]

Check wether the XML Serializer status is valid.

Returns:
True if all previous operations where successfull

bool CEGUI::XMLSerializer::operator! (  )  const [inline]

Check wether the XML Serializer status is invalid.

Returns:
True if one operations failed

XMLSerializer & CEGUI::XMLSerializer::text ( const String text  ) 

Create a text node.

Parameters:
text the content of the node
Returns:
A reference to the current object for chaining operation

Referenced by CEGUI::Property::writeXMLToStream().


Generated on Thu Nov 27 20:34:33 2008 for Crazy Eddies GUI System by  doxygen 1.5.7.1