24#include <tqvaluestack.h>
26#include <koffice_export.h>
43 KoXmlWriter( TQIODevice* dev, int indentLevel = 0 );
48 TQIODevice *device() const { return m_dev; }
57 void startDocument( const char* rootElemName, const char* publicId = 0, const char* systemId = 0 );
70 void startElement( const char* tagName, bool indentInside = true );
76 inline void addAttribute( const char* attrName, const TQString& value ) {
77 addAttribute( attrName, value.utf8() );
85 addAttribute( attrName, str.data() );
93 addAttribute( attrName, str.data() );
100 void addAttribute( const char* attrName, double value );
107 void addAttributePt( const char* attrName, double value );
110 inline void addAttribute( const char* attrName, const TQCString& value ) {
111 addAttribute( attrName, value.data() );
116 void addAttribute( const char* attrName, const char* value );
127 addTextNode( str.utf8() );
131 addTextNode( cstr.data() );
140 void addTextNode( const char* cstr );
151 void addProcessingInstruction( const char* cstr );
159 void addCompleteElement( const char* cstr );
168 void addCompleteElement( TQIODevice* dev );
178 void addManifestEntry( const TQString& fullPath, const TQString& mediaType );
184 void addConfigItem( const TQString & configName, const TQString& value );
186 void addConfigItem( const TQString & configName, bool value );
188 void addConfigItem( const TQString & configName, int value );
190 void addConfigItem( const TQString & configName, double value );
192 void addConfigItem( const TQString & configName, long value );
194 void addConfigItem( const TQString & configName, short value );
208 void addTextSpan( const TQString& text );
215 void addTextSpan( const TQString& text, const TQMap<int, int>& tabCache );
221 int indentLevel() const { return m_tags.size() + m_baseIndentLevel; }
225 Tag( const char* t = 0, bool ind = true )
226 : tagName( t ), hasChildren( false ), lastChildIsText( false ),
227 openingTagClosed( false ), indentInside( ind ) {}
230 bool lastChildIsText;
231 bool openingTagClosed;
240 void writeString( const TQString& str );
247 inline void writeCString( const char* cstr ) {
248 m_dev->writeBlock( cstr, tqstrlen( cstr ) );
250 inline void writeChar( char c ) {
253 inline void closeStartElement( Tag& tag ) {
254 if ( !tag.openingTagClosed ) {
255 tag.openingTagClosed = true;
259 char* escapeForXML( const char* source, int length ) const;
260 bool prepareForChild();
261 void prepareForTextNode();
265 TQValueStack<Tag> m_tags;
266 int m_baseIndentLevel;
271 char* m_indentBuffer;
273 char* m_escapeBuffer;
274 static const int s_escapeBufferLen = 10000;
A class for writing out XML (to any TQIODevice), with a special attention on performance.
void addTextNode(const TQString &str) Overloaded version of addTextNode( const char* ), which is a bit slower because it needs to convert s...
void addTextNode(const TQCString &cstr) Overloaded version of the one taking a const char* argument.
void addAttribute(const char *attrName, const TQCString &value) Overloaded version of the one taking a const char* argument, for convenience.
void addAttribute(const char *attrName, uint value) Add an attribute whose value is an unsigned integer.
void addAttribute(const char *attrName, int value) Add an attribute whose value is an integer.
void addAttribute(const char *attrName, const TQString &value) Overloaded version of addAttribute( const char*, const char* ), which is a bit slower because it need...
|