Mercurial > hg > svcore
comparison base/XmlExportable.h @ 314:70a232b1f12a
* Make XmlExportable::toXml the function that is universally overridden (and
pure virtual) instead of toXmlString. Tidies up some classes, notably the
model classes, significantly. Closes #1794561.
author | Chris Cannam |
---|---|
date | Thu, 18 Oct 2007 10:15:07 +0000 |
parents | 3b8008d09541 |
children | 7aa1de571880 |
comparison
equal
deleted
inserted
replaced
313:29485aa03da4 | 314:70a232b1f12a |
---|---|
26 public: | 26 public: |
27 virtual ~XmlExportable() { } | 27 virtual ~XmlExportable() { } |
28 | 28 |
29 /** | 29 /** |
30 * Stream this exportable object out to XML on a text stream. | 30 * Stream this exportable object out to XML on a text stream. |
31 * | |
32 * The default implementation calls toXmlString and streams the | |
33 * resulting string. This is only appropriate for objects with | |
34 * short representations. Bigger objects should override this | |
35 * method so as to write to the stream directly and override | |
36 * toXmlString with a method that calls this one, so that the | |
37 * direct streaming method can be used when appropriate. | |
38 */ | 31 */ |
39 virtual void toXml(QTextStream &stream, | 32 virtual void toXml(QTextStream &stream, |
40 QString indent = "", | 33 QString indent = "", |
41 QString extraAttributes = "") const; | 34 QString extraAttributes = "") const = 0; |
42 | 35 |
43 /** | 36 /** |
44 * Convert this exportable object to XML in a string. | 37 * Convert this exportable object to XML in a string. The default |
38 * implementation calls toXml and returns the result as a string. | |
39 * Do not override this unless you really know what you're doing. | |
45 */ | 40 */ |
46 virtual QString toXmlString(QString indent = "", | 41 virtual QString toXmlString(QString indent = "", |
47 QString extraAttributes = "") const = 0; | 42 QString extraAttributes = "") const; |
48 | 43 |
49 static QString encodeEntities(QString); | 44 static QString encodeEntities(QString); |
50 | 45 |
51 static QString encodeColour(QColor); | 46 static QString encodeColour(QColor); |
52 | 47 |