Chris@49: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@3: Chris@3: /* Chris@52: Sonic Visualiser Chris@52: An audio file viewer and annotation editor. Chris@52: Centre for Digital Music, Queen Mary, University of London. Chris@52: This file copyright 2006 Chris Cannam. Chris@3: Chris@52: This program is free software; you can redistribute it and/or Chris@52: modify it under the terms of the GNU General Public License as Chris@52: published by the Free Software Foundation; either version 2 of the Chris@52: License, or (at your option) any later version. See the file Chris@52: COPYING included with this distribution for more information. Chris@3: */ Chris@3: Chris@3: #ifndef _XML_EXPORTABLE_H_ Chris@3: #define _XML_EXPORTABLE_H_ Chris@3: Chris@3: #include Chris@3: #include Chris@3: Chris@123: class QTextStream; Chris@123: Chris@3: class XmlExportable Chris@3: { Chris@3: public: Chris@27: virtual ~XmlExportable() { } Chris@27: Chris@123: /** Chris@123: * Stream this exportable object out to XML on a text stream. Chris@123: */ Chris@123: virtual void toXml(QTextStream &stream, Chris@123: QString indent = "", Chris@314: QString extraAttributes = "") const = 0; Chris@123: Chris@123: /** Chris@314: * Convert this exportable object to XML in a string. The default Chris@314: * implementation calls toXml and returns the result as a string. Chris@314: * Do not override this unless you really know what you're doing. Chris@123: */ Chris@3: virtual QString toXmlString(QString indent = "", Chris@314: QString extraAttributes = "") const; Chris@3: Chris@3: static QString encodeEntities(QString); Chris@3: Chris@277: static QString encodeColour(QColor); Chris@4: Chris@85: static int getObjectExportId(const void *); // thread-safe Chris@3: }; Chris@3: Chris@3: #endif