annotate base/XmlExportable.h @ 291:42e6c8360df1

* aiff -> aif extension
author Chris Cannam
date Fri, 24 Aug 2007 14:45:11 +0000
parents 3b8008d09541
children 70a232b1f12a
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 #include <QColor>
Chris@3 21
Chris@123 22 class QTextStream;
Chris@123 23
Chris@3 24 class XmlExportable
Chris@3 25 {
Chris@3 26 public:
Chris@27 27 virtual ~XmlExportable() { }
Chris@27 28
Chris@123 29 /**
Chris@123 30 * Stream this exportable object out to XML on a text stream.
Chris@123 31 *
Chris@123 32 * The default implementation calls toXmlString and streams the
Chris@123 33 * resulting string. This is only appropriate for objects with
Chris@123 34 * short representations. Bigger objects should override this
Chris@123 35 * method so as to write to the stream directly and override
Chris@123 36 * toXmlString with a method that calls this one, so that the
Chris@123 37 * direct streaming method can be used when appropriate.
Chris@123 38 */
Chris@123 39 virtual void toXml(QTextStream &stream,
Chris@123 40 QString indent = "",
Chris@123 41 QString extraAttributes = "") const;
Chris@123 42
Chris@123 43 /**
Chris@123 44 * Convert this exportable object to XML in a string.
Chris@123 45 */
Chris@3 46 virtual QString toXmlString(QString indent = "",
Chris@3 47 QString extraAttributes = "") const = 0;
Chris@3 48
Chris@3 49 static QString encodeEntities(QString);
Chris@3 50
Chris@277 51 static QString encodeColour(QColor);
Chris@4 52
Chris@85 53 static int getObjectExportId(const void *); // thread-safe
Chris@3 54 };
Chris@3 55
Chris@3 56 #endif