annotate base/XmlExportable.h @ 591:7065e921f122

* add reviewFileForAppend callback
author Chris Cannam
date Thu, 14 May 2009 15:48:07 +0000
parents 7aa1de571880
children b4a8d8221eaf
rev   line source
Chris@49 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@3 2
Chris@3 3 /*
Chris@52 4 Sonic Visualiser
Chris@52 5 An audio file viewer and annotation editor.
Chris@52 6 Centre for Digital Music, Queen Mary, University of London.
Chris@52 7 This file copyright 2006 Chris Cannam.
Chris@3 8
Chris@52 9 This program is free software; you can redistribute it and/or
Chris@52 10 modify it under the terms of the GNU General Public License as
Chris@52 11 published by the Free Software Foundation; either version 2 of the
Chris@52 12 License, or (at your option) any later version. See the file
Chris@52 13 COPYING included with this distribution for more information.
Chris@3 14 */
Chris@3 15
Chris@3 16 #ifndef _XML_EXPORTABLE_H_
Chris@3 17 #define _XML_EXPORTABLE_H_
Chris@3 18
Chris@3 19 #include <QString>
Chris@3 20
Chris@123 21 class QTextStream;
Chris@123 22
Chris@3 23 class XmlExportable
Chris@3 24 {
Chris@3 25 public:
Chris@27 26 virtual ~XmlExportable() { }
Chris@27 27
Chris@123 28 /**
Chris@123 29 * Stream this exportable object out to XML on a text stream.
Chris@123 30 */
Chris@123 31 virtual void toXml(QTextStream &stream,
Chris@123 32 QString indent = "",
Chris@314 33 QString extraAttributes = "") const = 0;
Chris@123 34
Chris@123 35 /**
Chris@314 36 * Convert this exportable object to XML in a string. The default
Chris@314 37 * implementation calls toXml and returns the result as a string.
Chris@314 38 * Do not override this unless you really know what you're doing.
Chris@123 39 */
Chris@3 40 virtual QString toXmlString(QString indent = "",
Chris@314 41 QString extraAttributes = "") const;
Chris@3 42
Chris@3 43 static QString encodeEntities(QString);
Chris@3 44
Chris@387 45 static QString encodeColour(int r, int g, int b);
Chris@4 46
Chris@85 47 static int getObjectExportId(const void *); // thread-safe
Chris@3 48 };
Chris@3 49
Chris@3 50 #endif