GweFactoryOption.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by the G System Team                               *
00003  *   http://www.g-system.at                                                *
00004  *                                                                         *
00005  *   Permission is hereby granted, free of charge, to any person obtaining *
00006  *   a copy of this software and associated documentation files (the       *
00007  *   "Software"), to deal in the Software without restriction, including   *
00008  *   without limitation the rights to use, copy, modify, merge, publish,   *
00009  *   distribute, sublicense, and/or sell copies of the Software, and to    *
00010  *   permit persons to whom the Software is furnished to do so, subject to *
00011  *   the following conditions:                                             *
00012  *                                                                         *
00013  *   The above copyright notice and this permission notice shall be        *
00014  *   included in all copies or substantial portions of the Software.       *
00015  *                                                                         *
00016  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
00017  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
00018  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
00019  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *
00020  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
00021  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
00022  *   OTHER DEALINGS IN THE SOFTWARE.                                       *
00023  ***************************************************************************/
00024 
00025 #ifndef GWEFACTORYOPTIONH
00026 #define GWEFACTORYOPTIONH
00027 
00028 #include <qobject.h>
00029 #include <qstring.h>
00030 #include <qstringlist.h>
00031 #include <qdom.h>
00032 #include <qmap.h>
00033 #include <QList>
00034 
00035 namespace GWE
00036 {
00037 
00059 class GweFactoryOption : public QObject
00060 {
00061   Q_OBJECT
00062   
00063   protected:
00064   
00069     QString OptionName;
00070   
00075     QString Description;
00076     
00081     QString Value;
00082         
00087     QMap<QString,GweFactoryOption*> SubOptions;
00088     
00089   protected:
00090   
00094     void deleteSubOption(const QString& option_name);
00095   
00100     void deleteAllSubOptions();
00101     
00102   public:
00103   
00107     GweFactoryOption(const QString& option_name, const QString& value = 0, const QString& description = 0);
00108     
00112     virtual ~GweFactoryOption();
00113     
00117     QString getOptionName() const;
00118     
00122     QString getDescription() const;
00123     
00127     QString getValue() const;
00128     
00132     bool hasSubOptions() const;
00133     
00140     QList<GweFactoryOption*> getSubOptions() const;
00141     
00145     GweFactoryOption* getSubOption(const QString& option_name);
00146     
00150     QString getValueOfSubOption(const QString& option_name);
00151     
00159     bool hasPredefinedValues() const;
00160     
00167     virtual QStringList getPredefinedValues() const;
00168     
00169   public slots:
00170   
00176     virtual void updateTree();
00177     
00182     virtual void setValue(const QString& value);
00183     
00188     virtual void setDescription(const QString& description);
00189     
00194     virtual void loadFromXml(const QDomElement& options);
00195     
00200     virtual void saveToXml(QDomElement storage);
00201     
00206     virtual void setValueOfSubOption(const QString& sub_option_name, const QString& value);
00207   
00208   signals:
00209   
00214     void valueChanged(const QString& new_value);
00215     
00220     void treeUpdated();
00221     
00222 };
00223 
00224 }
00225 
00226 #endif

Generated on Thu Nov 16 07:49:12 2006 for G System by  doxygen 1.4.7