00001 /* -*- c++ -*- (for Emacs) 00002 * 00003 * attributedoc.h 00004 * 00005 * Created by Aidan Lane on Mon Dec 19 2005. 00006 * Copyright (c) 2005 Optimisation and Constraint Solving Group, 00007 * Monash University. All rights reserved. 00008 * 00009 * This program is free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software 00021 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 */ 00023 00024 #ifndef ATTRIBUTEDOC_H 00025 #define ATTRIBUTEDOC_H 00026 00027 00028 #include "doc.h" 00029 00030 #include <QHash> 00031 #include <QReadWriteLock> 00032 #include <QVariant> 00033 00034 #include "attributedocevents.h" 00035 00036 class AttributeDocController; 00037 00038 00039 class AttributeDoc : public Doc { 00040 00041 Q_OBJECT 00042 00043 public: 00044 AttributeDoc( QObject* parent ); 00045 AttributeDoc( const QString& name, QObject* parent ); 00046 00047 AttributeDocController* attributeDocController() const; 00048 00049 QHash<int, QVariant> attributes() const; 00050 QVariant attributeValue( int type ) const; 00051 bool containsAttribute( int type ) const; 00052 00053 00054 protected: 00055 virtual void dispatchEvent( MEvent* ); 00056 virtual void changeControllerEvent( MChangeControllerEvent* ); 00057 virtual void attributesSetValuesEvent( MAttributesSetValuesEvent* ); 00058 virtual void attributesRemoveEvent( MAttributesRemoveEvent* ); 00059 00060 00061 private: 00062 QHash<int, QVariant> m_attributes; 00063 mutable QReadWriteLock m_attributesLock; 00064 00065 // Caches: 00066 AttributeDocController* c_attributeDocController; 00067 }; 00068 00069 00070 #endif // ! ATTRIBUTEDOC_H
1.5.2