• Main Page
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

C:/Users/David/Documents/QtProjects/visualsc/scdatamodel/iattribute.h

Go to the documentation of this file.
00001 /*
00002     visualsc - Visual State Chart Editing for SCXML State Engines
00003     Copyright (C) 2011  David W. Drell (david@davidwdrell.net) and
00004     Contributing Authors:
00005 
00006 
00007     This program is free software: you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation, either version 3 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 */
00020 
00021 #ifndef IATTRIBUTE_H
00022 #define IATTRIBUTE_H
00023 
00024 #include <QString>
00025 #include <QVariant>
00026 #include <QMap>
00027 #include <QMapIterator>
00028 
00121 class IAttribute: public QObject
00122 {
00123     Q_OBJECT
00124 
00125 public:
00126 
00127     IAttribute() ;
00128 
00129     IAttribute(QObject *parent, QString initkey);
00130 
00131     IAttribute(const IAttribute& a);
00132 
00133     IAttribute& operator=(const IAttribute& a);
00134 
00135 //    enum AttributeType {
00136 //        aType_Name,
00137 //        aType_Position,
00138 //        aType_Size,
00139 //        aType_Path
00140 //    };
00141 
00142     virtual QString asString()=0;
00143     virtual void setValue(const QString value)  = 0 ;
00144     virtual QString key() const;
00145 
00146 signals:
00147     void changed( IAttribute* attr);
00148     void error(QString err);
00149 
00150 private:
00151     QString _key;
00152 
00153 };
00154 
00155 class GenericAttribute: public IAttribute
00156 {
00157 public:
00158 
00159     GenericAttribute();
00160 
00161     GenericAttribute(QObject *parent, QString initkey, QString initValue);
00162 
00163     GenericAttribute(const GenericAttribute& a);
00164 
00165     GenericAttribute& operator=(const GenericAttribute& a);
00166 
00167     virtual QString asString();
00168     virtual void setValue(const QString value);
00169 
00170 private:
00171     QString _value;
00172 
00173 };
00174 
00190 class IAttributeContainer : public QObject, public QMap<QString,IAttribute*>
00191 {
00192 
00193     Q_OBJECT
00194 
00195 public:
00196 
00197 
00198     IAttributeContainer(QObject *parent, QString key);
00199 
00200     IAttributeContainer(const IAttributeContainer& c);
00201 
00202     IAttributeContainer();
00203 
00204     ~IAttributeContainer();
00205 
00206 
00207     virtual QString key() ;
00208 
00219     bool addItem( IAttribute* attr);
00220 
00221 
00227     virtual void setAttributes(const IAttributeContainer& sourceAttrList) = 0;
00228 
00233     IAttributeContainer& operator=( const IAttributeContainer& copyFrom );
00234 
00235 signals:
00236 
00237     void attributeAdded(IAttribute *a);
00238     void attributeDeleted(IAttribute *a);
00239 
00240 private:
00241 
00242 
00243     QString _containerName;
00244 
00245 
00246 };
00247 
00248 #endif // IATTRIBUTE_H

Generated on Mon Sep 26 2011 06:59:24 for visualsc by  doxygen 1.7.1