comparison plugin/PluginInstance.h @ 55:6befca60ab4e

* added to- and from- XML methods to PluginInstance
author Chris Cannam
date Wed, 22 Mar 2006 13:23:50 +0000
parents d397ea0a79f5
children 2157fa46c1e7
comparison
equal deleted inserted replaced
54:709d63d90028 55:6befca60ab4e
17 #define _PLUGIN_INSTANCE_H_ 17 #define _PLUGIN_INSTANCE_H_
18 18
19 #include <string> 19 #include <string>
20 #include <vector> 20 #include <vector>
21 21
22 #include "base/XmlExportable.h"
23
24 class QXmlAttributes;
25
22 /** 26 /**
23 * A base class for plugins with optional configurable parameters, 27 * A base class for plugins with optional configurable parameters,
24 * programs, etc. 28 * programs, etc.
25 * 29 *
26 * This does not provide the necessary interfaces to instantiate or 30 * This does not provide the necessary interfaces to instantiate or
28 * plugin types may have quite different operating structures. This 32 * plugin types may have quite different operating structures. This
29 * class just specifies the necessary interface to show editable 33 * class just specifies the necessary interface to show editable
30 * controls for the plugin to the user. 34 * controls for the plugin to the user.
31 */ 35 */
32 36
33 class PluginInstance 37 class PluginInstance : public XmlExportable
34 { 38 {
35 public: 39 public:
36 /** 40 /**
37 * Get the computer-usable name of the plugin. This should be 41 * Get the computer-usable name of the plugin. This should be
38 * reasonably short and contain no whitespace or punctuation 42 * reasonably short and contain no whitespace or punctuation
68 72
69 struct ParameterDescriptor 73 struct ParameterDescriptor
70 { 74 {
71 /** 75 /**
72 * The name of the parameter, in computer-usable form. Should 76 * The name of the parameter, in computer-usable form. Should
73 * be reasonably short and without whitespace or punctuation. 77 * be reasonably short, and may only contain the characters
78 * [a-zA-Z0-9_].
74 */ 79 */
75 std::string name; 80 std::string name;
76 81
77 /** 82 /**
78 * The human-readable name of the parameter. 83 * The human-readable name of the parameter.
151 /** 156 /**
152 * Select a program. (If the given program name is not one of the 157 * Select a program. (If the given program name is not one of the
153 * available programs, do nothing.) 158 * available programs, do nothing.)
154 */ 159 */
155 virtual void selectProgram(std::string) { } 160 virtual void selectProgram(std::string) { }
161
162 /**
163 * Export plugin settings to XML.
164 */
165 virtual QString toXmlString(QString indent = "",
166 QString extraAttributes = "") const;
167
168 /**
169 * Set the parameters and program of a plugin from a set of XML
170 * attributes. This is a partial inverse of toXmlString.
171 */
172 virtual void setParameters(const QXmlAttributes &);
173
174 protected:
175 QString stripInvalidParameterNameCharacters(QString) const;
156 }; 176 };
157 177
158 #endif 178 #endif