|
Krita Source Code Documentation
|
#include <KoXmlWriter.h>
Inheritance diagram for KoXmlWriter:Classes | |
| struct | Tag |
Public Member Functions | |
| void | addAttribute (const char *attrName, bool value) |
| void | addAttribute (const char *attrName, const char *value) |
| void | addAttribute (const char *attrName, const QByteArray &value) |
| Overloaded version of the one taking a const char* argument, for convenience. | |
| void | addAttribute (const char *attrName, const QString &value) |
| void | addAttribute (const char *attrName, double value) |
| void | addAttribute (const char *attrName, float value) |
| void | addAttribute (const char *attrName, int value) |
| void | addAttribute (const char *attrName, uint value) |
| void | addCompleteElement (QIODevice *dev) |
| void | addManifestEntry (const QString &fullPath, const QString &mediaType) |
| void | addTextNode (const char *cstr) |
| Adds a text node as a child of the current element. | |
| void | addTextNode (const QByteArray &cstr) |
| Overloaded version of the one taking a const char* argument. | |
| void | addTextNode (const QString &str) |
| void | endDocument () |
| Call this to terminate an XML document. | |
| void | endElement () |
| KoXmlWriter (QIODevice *dev, int indentLevel=0) | |
| Private (QIODevice *dev_, int indentLevel=0) | |
| void | startDocument (const char *rootElemName, const char *publicId=0, const char *systemId=0) |
| void | startElement (const char *tagName, bool indentInside=true) |
| ~KoXmlWriter () | |
| Destructor. | |
| ~Private () | |
Public Attributes | |
| int | baseIndentLevel |
| QIODevice * | dev |
| char * | escapeBuffer |
| char * | indentBuffer |
| QStack< Tag > | tags |
Private Member Functions | |
| void | closeStartElement (Tag &tag) |
| char * | escapeForXML (const char *source, int length) const |
| KoXmlWriter (const KoXmlWriter &) | |
| KoXmlWriter & | operator= (const KoXmlWriter &) |
| bool | prepareForChild (bool indentInside=true) |
| void | prepareForTextNode () |
| void | writeChar (char c) |
| void | writeCString (const char *cstr) |
| void | writeIndent () |
| Write out followed by the number of spaces required. | |
Private Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
Private Attributes | |
| Private *const | d |
Private Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
A class for writing out XML (to any QIODevice), with a special attention on performance. The XML is being written out along the way, which avoids requiring the entire document in memory (like QDom does).
Definition at line 19 of file KoXmlWriter.cpp.
|
inline |
Definition at line 27 of file KoXmlWriter.cpp.
|
explicit |
Create a KoXmlWriter instance to write out an XML document into the given QIODevice.
Definition at line 42 of file KoXmlWriter.cpp.
References d, s_escapeBufferLen, and s_indentBufferLength.
| KoXmlWriter::~KoXmlWriter | ( | ) |
|
private |
|
inline |
Add an attribute whose value is an bool It is written as "true" or "false" based on value
Definition at line 80 of file KoXmlWriter.h.
References value().
| void KoXmlWriter::addAttribute | ( | const char * | attrName, |
| const char * | value ) |
Add an attribute to the current element.
Definition at line 213 of file KoXmlWriter.cpp.
References d, escaped, escapeForXML(), value(), writeChar(), and writeCString().
| void KoXmlWriter::addAttribute | ( | const char * | attrName, |
| const QByteArray & | value ) |
Overloaded version of the one taking a const char* argument, for convenience.
Definition at line 200 of file KoXmlWriter.cpp.
References d, escaped, escapeForXML(), value(), writeChar(), and writeCString().
|
inline |
Overloaded version of addAttribute( const char*, const char* ), which is a bit slower because it needs to convert value to utf8 first.
Definition at line 61 of file KoXmlWriter.h.
References value().
| void KoXmlWriter::addAttribute | ( | const char * | attrName, |
| double | value ) |
Add an attribute whose value is a floating point number The number is written out with the highest possible precision (unlike QString::number and setNum, which default to 6 digits)
Definition at line 225 of file KoXmlWriter.cpp.
References addAttribute(), KisDomUtils::toString(), and value().
| void KoXmlWriter::addAttribute | ( | const char * | attrName, |
| float | value ) |
Add an attribute whose value is a floating point number The number is written out with the highest possible precision (unlike QString::number and setNum, which default to 6 digits)
Definition at line 230 of file KoXmlWriter.cpp.
References addAttribute(), KisDomUtils::toString(), and value().
|
inline |
Add an attribute whose value is an integer
Definition at line 67 of file KoXmlWriter.h.
References value().
Add an attribute whose value is an unsigned integer
Definition at line 73 of file KoXmlWriter.h.
References value().
| void KoXmlWriter::addCompleteElement | ( | QIODevice * | dev | ) |
This is quite a special-purpose method, not for everyday use. It adds a complete element (with its attributes and child elements) as a child of the current element. The iodevice is supposed to be escaped for XML already, so it will usually come from another KoXmlWriter. This is usually used with KTempFile.
Definition at line 128 of file KoXmlWriter.cpp.
References d, prepareForChild(), and warnStore.
| void KoXmlWriter::addManifestEntry | ( | const QString & | fullPath, |
| const QString & | mediaType ) |
Special helper for writing "manifest" files This is equivalent to startElement/2*addAttribute/endElement This API will probably have to change (or not be used anymore) when we add support for encrypting/signing.
Definition at line 316 of file KoXmlWriter.cpp.
References addAttribute(), endElement(), and startElement().
| void KoXmlWriter::addTextNode | ( | const char * | cstr | ) |
Adds a text node as a child of the current element.
This is appends the literal content of str to the contents of the element. E.g. addTextNode( "foo" ) inside a <p> element gives <p>foo</p>, and startElement( "b" ); endElement( "b" ); addTextNode( "foo" ) gives <p><b/>foo</p>
Definition at line 191 of file KoXmlWriter.cpp.
References d, escaped, escapeForXML(), prepareForTextNode(), and writeCString().
| void KoXmlWriter::addTextNode | ( | const QByteArray & | cstr | ) |
Overloaded version of the one taking a const char* argument.
Definition at line 181 of file KoXmlWriter.cpp.
References d, escaped, escapeForXML(), prepareForTextNode(), and writeCString().
|
inline |
Overloaded version of addTextNode( const char* ), which is a bit slower because it needs to convert str to utf8 first.
Definition at line 115 of file KoXmlWriter.h.
Definition at line 192 of file KoXmlWriter.h.
References KoXmlWriter::Tag::openingTagClosed.
| void KoXmlWriter::endDocument | ( | ) |
Call this to terminate an XML document.
Definition at line 78 of file KoXmlWriter.cpp.
References d, and writeChar().
| void KoXmlWriter::endElement | ( | ) |
Terminate the current element. After this you should start a new one (sibling), add a sibling text node, or close another one (end of siblings).
Definition at line 159 of file KoXmlWriter.cpp.
References d, KoXmlWriter::Tag::hasChildren, KoXmlWriter::Tag::indentInside, KoXmlWriter::Tag::lastChildIsText, KoXmlWriter::Tag::tagName, warnStore, writeChar(), writeCString(), and writeIndent().
|
private |
Definition at line 245 of file KoXmlWriter.cpp.
References d, length(), s_escapeBufferLen, and source().
|
private |
|
private |
Definition at line 86 of file KoXmlWriter.cpp.
References closeStartElement(), d, and writeIndent().
|
private |
Definition at line 103 of file KoXmlWriter.cpp.
References closeStartElement(), and d.
|
inline |
Definition at line 22 of file KoXmlWriter.cpp.
| void KoXmlWriter::startDocument | ( | const char * | rootElemName, |
| const char * | publicId = 0, | ||
| const char * | systemId = 0 ) |
Start the XML document. This writes out the <?xml?> tag with utf8 encoding, and the DOCTYPE.
| rootElemName | the name of the root element, used in the DOCTYPE tag. |
| publicId | the public identifier, e.g. "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" |
| systemId | the system identifier, e.g. "office.dtd" or a full URL to it. |
Definition at line 60 of file KoXmlWriter.cpp.
References d, and writeCString().
| void KoXmlWriter::startElement | ( | const char * | tagName, |
| bool | indentInside = true ) |
Start a new element, as a child of the current element.
| tagName | the name of the tag. |
| indentInside | if set to false, there will be no indentation inside this tag. This is useful for elements where whitespace matters. |
Definition at line 115 of file KoXmlWriter.cpp.
References d, prepareForChild(), writeChar(), and writeCString().
|
private |
|
private |
Definition at line 325 of file KoXmlWriter.cpp.
References d.
|
private |
Write out
followed by the number of spaces required.
Definition at line 235 of file KoXmlWriter.cpp.
References d, and s_indentBufferLength.
| int KoXmlWriter::baseIndentLevel |
Definition at line 35 of file KoXmlWriter.cpp.
|
private |
Definition at line 203 of file KoXmlWriter.h.
| QIODevice* KoXmlWriter::dev |
Definition at line 33 of file KoXmlWriter.cpp.
| char* KoXmlWriter::escapeBuffer |
Definition at line 39 of file KoXmlWriter.cpp.
| char* KoXmlWriter::indentBuffer |
Definition at line 37 of file KoXmlWriter.cpp.
Definition at line 34 of file KoXmlWriter.cpp.