Chris@66: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
Chris@66: 
Chris@66: /*
Chris@66:     Sonic Visualiser
Chris@66:     An audio file viewer and annotation editor.
Chris@66:     Centre for Digital Music, Queen Mary, University of London.
Chris@66:     This file copyright 2006 Chris Cannam.
Chris@66:     
Chris@66:     This program is free software; you can redistribute it and/or
Chris@66:     modify it under the terms of the GNU General Public License as
Chris@66:     published by the Free Software Foundation; either version 2 of the
Chris@66:     License, or (at your option) any later version.  See the file
Chris@66:     COPYING included with this distribution for more information.
Chris@66: */
Chris@66: 
Chris@66: #ifndef _PLUGIN_XML_H_
Chris@66: #define _PLUGIN_XML_H_
Chris@66: 
Chris@66: #include "base/XmlExportable.h"
Chris@66: 
Chris@66: namespace Vamp { class PluginBase; }
Chris@66: 
Chris@66: class QXmlAttributes;
Chris@66: 
Chris@66: class PluginXml : public XmlExportable
Chris@66: {
Chris@66: public:
Chris@66:     PluginXml(Vamp::PluginBase *plugin);
Chris@66:     virtual ~PluginXml();
Chris@66: 
Chris@66:     /**
Chris@66:      * Export plugin settings to XML.
Chris@66:      */
Chris@314:     virtual void toXml(QTextStream &stream,
Chris@314:                        QString indent = "",
Chris@314:                        QString extraAttributes = "") const;
Chris@66: 
Chris@66:     /**
Chris@66:      * Set the parameters and program of a plugin from a set of XML
Chris@314:      * attributes.  This is a partial inverse of toXml.
Chris@66:      */
Chris@66:     virtual void setParameters(const QXmlAttributes &);
Chris@66: 
Chris@66:     /**
Chris@66:      * Set the parameters and program of a plugin from an XML plugin
Chris@314:      * element as returned by toXml.  This is a partial inverse of
Chris@314:      * toXml.
Chris@66:      */
Chris@66:     virtual void setParametersFromXml(QString xml);
Chris@66: 
Chris@81:     static QString encodeConfigurationChars(QString text);
Chris@81:     static QString decodeConfigurationChars(QString text);
Chris@81: 
Chris@66: protected:
Chris@66:     QString stripInvalidParameterNameCharacters(QString) const;
Chris@66: 
Chris@66:     Vamp::PluginBase *m_plugin;
Chris@66: };
Chris@66: 
Chris@66: #endif