00001 #ifndef SDXXMLSTREAMWRITER_H
00002 #define SDXXMLSTREAMWRITER_H
00003
00004
00005 #include <stack>
00006 #include <string>
00007 #include <ostream>
00008
00009 #include "SDXStreamWriter.h"
00010
00011 namespace SDX {
00012 class Document;
00013 namespace Formats {
00017 class XmlStreamWriter : public SDX::Helpers::StreamWriter {
00018 public:
00022 XmlStreamWriter();
00023
00027 void setDocumentName(std::string name);
00028
00029 void startDocument();
00030 void startNode(std::string nodeName);
00031 void writeAttribute(std::string name, std::string value);
00032 void endNode();
00033 void endDocument();
00034 private:
00035 struct NodeInfo {
00036 NodeInfo(std::string nodeName) :
00037 name(nodeName),
00038 hasAttributes(false),
00039 hasContent(false),
00040 hasChildren(false)
00041 {
00042 }
00043
00044 std::string name;
00045 bool hasAttributes;
00046 bool hasContent;
00047 bool hasChildren;
00048 };
00049 private:
00050 void printIndentation(bool minusOne = false);
00051
00052 std::stack<NodeInfo> m_nodeInfos;
00053 std::string m_docName;
00054 };
00055 }
00056 }
00057
00058 #endif
00059
00060
00061