1 /*************************************************************************** 2 string.h - the base string type 3 ------------------- 4 begin : Sept 29, 2004 5 copyright : (C) 2004 by The University of Toronto 6 email : netterfield@astro.utoronto.ca 7 ***************************************************************************/ 8 9 /*************************************************************************** 10 * * 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License as published by * 13 * the Free Software Foundation; either version 2 of the License, or * 14 * (at your option) any later version. * 15 * * 16 ***************************************************************************/ 17 18 #ifndef STRING_H 19 #define STRING_H 20 21 #include "primitive.h" 22 23 class QXmlStreamWriter; 24 25 namespace Kst { 26 27 class ScriptInterface; 28 29 class KSTCORE_EXPORT String : public Primitive 30 { 31 Q_OBJECT 32 Q_PROPERTY(bool orphan READ orphan WRITE setOrphan) 33 34 public: 35 virtual const QString& typeString() const; 36 static const QString staticTypeString; 37 static const QString staticTypeTag; 38 39 virtual QString descriptionTip() const; 40 virtual QString sizeString() const; 41 virtual QString propertyString() const; 42 43 virtual ScriptInterface* createScriptInterface(); 44 45 protected: 46 String(ObjectStore *store); 47 48 friend class ObjectStore; 49 virtual QString _automaticDescriptiveName() const; 50 virtual void _initializeShortName(); 51 52 public: 53 /** Update the string. */ 54 virtual void internalUpdate(); 55 56 virtual ~String(); 57 /** Save information */ 58 virtual void save(QXmlStreamWriter &s); 59 60 String& operator=(const QString& v); 61 String& operator=(const char *v); 62 outputPrimitives()63 virtual ObjectList<Primitive> outputPrimitives() const { return ObjectList<Primitive>(); } metas()64 virtual PrimitiveMap metas() const { return PrimitiveMap(); } 65 66 public slots: 67 /* return the value of the string */ value()68 const QString& value() const { return _value; } 69 70 /** Set the value of the string - ignored for some types */ 71 void setValue(const QString& inV); 72 orphan()73 bool orphan() const { return _orphan; } setOrphan(bool orphan)74 void setOrphan(bool orphan) { _orphan = orphan; } 75 editable()76 bool editable() const { return _editable; } setEditable(bool editable)77 void setEditable(bool editable) { _editable = editable; } 78 79 protected: 80 QString _value; 81 82 private: 83 bool _orphan : 1; 84 bool _editable; 85 }; 86 87 typedef SharedPtr<String> StringPtr; 88 typedef ObjectList<String> StringList; 89 typedef ObjectMap<String> StringMap; 90 91 } 92 93 Q_DECLARE_METATYPE(Kst::String*) 94 95 #endif 96 // vim: ts=2 sw=2 et 97