MvcCore/models/attributes/abstractelementattribute.h

Go to the documentation of this file.
00001 /*  -*- c++ -*-  (for Emacs)
00002  *
00003  *  abstractelementattribute.cpp
00004  *  Digest
00005  * 
00006  *  Imported into Digest by Aidan Lane on Thu Jun 9 2005.
00007  *  Modifications Copyright (c) 2005 Optimisation and Constraint Solving Group,
00008  *  Monash University. All rights reserved.
00009  *
00010  *  Nodal file:
00011  *
00012  *    project.cpp
00013  *    Nodal
00014  *
00015  *    Created by Aidan Lane on Wed Apr 6 2005.
00016  *    Copyright (c) 2005 CEMA, Monash University. All rights reserved.
00017  *
00018  *  This program is free software; you can redistribute it and/or modify
00019  *  it under the terms of the GNU General Public License as published by
00020  *  the Free Software Foundation; either version 2 of the License, or
00021  *  (at your option) any later version.
00022  *
00023  *  This program is distributed in the hope that it will be useful,
00024  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00025  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00026  *  GNU General Public License for more details.
00027  *
00028  *  You should have received a copy of the GNU General Public License
00029  *  along with this program; if not, write to the Free Software
00030  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00031  */
00032 
00033 #ifndef ABSTRACTELEMENTATTRIBUTE_H
00034 #define ABSTRACTELEMENTATTRIBUTE_H
00035 
00036 
00037 #include <QObject>
00038 
00039 #include <QReadWriteLock>
00040 #include <QString>
00041 #include <QVariant>
00042 
00043 #include "abstractelement.h"
00044 #include "domaccessiblestate.h"
00045 
00046 class QByteArray;
00047 
00048 
00060 class AbstractElementAttribute : public QObject, public DomAccessibleState {
00061 
00062   Q_OBJECT
00063 
00064 public:
00065   AbstractElementAttribute( AbstractElement* parent );
00066 
00067   // The following are pure-virtual, as to force sub-classes to implement them
00068   virtual int type() const = 0; // returns int, not Type, as to aid extensibility
00069   //virtual const QByteArray& key() const = 0; - declared in DomAccessibleState
00070   virtual const QString& title() const = 0;
00071 
00073   virtual int category() const { return 0; }
00074  
00075   QString  toString() const;
00076   bool     setData( const QString& data );
00077   QVariant toVariant() const;
00078   bool     setData( const QVariant& data );
00079 
00080   virtual QDomElement domElement( QDomDocument& doc ) const;
00081   virtual void initFromDomElement( const QDomElement& e,
00082                                    InitModeFlags modeFlags );
00083 
00084 
00085 protected:
00087   virtual QString  worker_toString() const = 0;
00089   virtual bool     worker_setData( const QString& data ) = 0;
00091   virtual QVariant worker_toVariant() const = 0;
00093   virtual bool     worker_setData( const QVariant& data ) = 0;
00094 
00095   mutable QReadWriteLock m_lock;
00096 };
00097 
00098 
00099 #endif // ! ABSTRACTELEMENTATTRIBUTE_H

Generated on Mon Jul 30 09:46:50 2007 for Digest by  doxygen 1.5.2