comparison base/XmlExportable.h @ 123:0f37e92e1782

* 1502816 file export is too slow and memory-hungry Use text stream when writing to file instead of accumulating into a string. * 1500625 Auto-align in MIDI layer confusing Make value extents convert to Hz in return value * 1494623: Duplicate display of frame 0 from vamp plugin output
author Chris Cannam
date Thu, 15 Jun 2006 15:48:05 +0000
parents ea730e3f9ace
children 3b8008d09541
comparison
equal deleted inserted replaced
122:c1de4b4e9c29 123:0f37e92e1782
17 #define _XML_EXPORTABLE_H_ 17 #define _XML_EXPORTABLE_H_
18 18
19 #include <QString> 19 #include <QString>
20 #include <QColor> 20 #include <QColor>
21 21
22 class QTextStream;
23
22 class XmlExportable 24 class XmlExportable
23 { 25 {
24 public: 26 public:
25 virtual ~XmlExportable() { } 27 virtual ~XmlExportable() { }
26 28
29 /**
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 */
39 virtual void toXml(QTextStream &stream,
40 QString indent = "",
41 QString extraAttributes = "") const;
42
43 /**
44 * Convert this exportable object to XML in a string.
45 */
27 virtual QString toXmlString(QString indent = "", 46 virtual QString toXmlString(QString indent = "",
28 QString extraAttributes = "") const = 0; 47 QString extraAttributes = "") const = 0;
29 48
30 static QString encodeEntities(QString); 49 static QString encodeEntities(QString);
31 50