File indexing completed on 2024-06-02 04:34:50
0001 /*************************************************************************** 0002 primitive.h 0003 ------------------- 0004 begin : Tue Jun 20 2006 0005 copyright : Copyright (C) 2006, The University of Toronto 0006 email : netterfield@astro.utoronto.ca 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * * 0011 * This program is free software; you can redistribute it and/or modify * 0012 * it under the terms of the GNU General Public License as published by * 0013 * the Free Software Foundation; either version 2 of the License, or * 0014 * (at your option) any later version. * 0015 * * 0016 ***************************************************************************/ 0017 0018 #ifndef PRIMITIVE_H 0019 #define PRIMITIVE_H 0020 0021 #include <QPointer> 0022 0023 #include "kst_export.h" 0024 #include "object.h" 0025 #include "objectlist.h" 0026 #include "objectmap.h" 0027 #include "dataprimitive.h" 0028 0029 namespace Kst { 0030 0031 0032 class Primitive; 0033 typedef ObjectMap<Primitive> PrimitiveMap; 0034 0035 class KSTCORE_EXPORT Primitive : public Object 0036 { 0037 Q_OBJECT 0038 Q_PROPERTY(Object* provider READ provider WRITE setProvider) 0039 Q_PROPERTY(bool hidden READ hidden WRITE setHidden) 0040 0041 public: 0042 virtual const QString& typeString() const; 0043 static const QString staticTypeString; 0044 0045 // Must not be a ObjectPtr! 0046 virtual void setProvider(Object* obj); 0047 0048 inline ObjectPtr provider() const { return ObjectPtr(_provider); } 0049 0050 void setSlaveName(QString slaveName); 0051 QString slaveName() const { return _slaveName; } 0052 virtual QString propertyString() const; 0053 virtual QString sizeString() const; 0054 0055 virtual bool used() const; 0056 virtual void setUsed(bool used_in); 0057 0058 virtual ObjectList<Primitive> outputPrimitives() const = 0; 0059 0060 virtual PrimitiveMap metas() const = 0; 0061 0062 // used for sorting dataobjects by Document::sortedDataObjectList() 0063 virtual bool flagSet() const { return _flag; } 0064 virtual void setFlag(bool f) { _flag = f;} 0065 0066 public slots: 0067 bool hidden() const; 0068 void setHidden(bool hidden); 0069 0070 protected: 0071 Primitive(ObjectStore *store, Object* provider = 0L); 0072 0073 virtual ~Primitive(); 0074 0075 friend class ObjectStore; 0076 0077 virtual QString _automaticDescriptiveName() const; 0078 0079 QString _slaveName; 0080 0081 virtual qint64 minInputSerial() const; 0082 virtual qint64 maxInputSerialOfLastChange() const; 0083 0084 virtual void fatalError(const QString& msg); 0085 0086 protected: 0087 /** Possibly null. Be careful, this is non-standard usage of a KstShared. 0088 * FIXME: pretty sure this is wrong: it shouldn't be a qpointer... not sure 0089 * what should be going on here! */ 0090 QPointer<Object> _provider; 0091 0092 private: 0093 bool _flag; // used for sorting dataobjects by Document::sortedDataObjectList() 0094 bool _hidden; // don't show in lists 0095 }; 0096 0097 typedef SharedPtr<Primitive> PrimitivePtr; 0098 typedef ObjectList<Primitive> PrimitiveList; 0099 typedef ObjectMap<Primitive> PrimitiveMap; 0100 0101 } 0102 0103 #endif 0104 // vim: ts=2 sw=2 et