NorMIT-nav  18.04-rc6
An IGT application
cxStringProperty.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXSTRINGPROPERTY_H_
13 #define CXSTRINGPROPERTY_H_
14 
15 #include "cxResourceExport.h"
16 
17 #include <QDomElement>
18 #include <QStringList>
19 #include "cxStringPropertyBase.h"
20 #include "cxXmlOptionItem.h"
21 
22 namespace cx
23 {
24 
25 typedef boost::shared_ptr<class StringProperty> StringPropertyPtr;
26 
38 class cxResource_EXPORT StringProperty: public StringPropertyBase
39 {
40 Q_OBJECT
41 public:
45  static StringPropertyPtr initialize(const QString& uid, QString name, QString help, QString value, QStringList range, QDomNode root = QDomNode());
46  static StringPropertyPtr initialize(const QString& uid, QString name, QString help, QString value, QDomNode root = QDomNode());
47 
48 public:
49  // inherited interface
50  virtual QString getDisplayName() const;
51  virtual QString getUid() const;
52  virtual bool setValue(const QString& value);
53  virtual QString getValue() const;
54  virtual QString getHelp() const;
55  virtual void setHelp(QString val);
56  virtual QStringList getValueRange() const;
57  virtual void setValueRange(QStringList range);
58  virtual QString convertInternal2Display(QString internal);
59  virtual void setDisplayNames(std::map<QString, QString> names);
60  virtual std::map<QString, QString> getDisplayNames() const { return mDisplayNames; }
61 
62  virtual bool isReadOnly() const { return mIsReadOnly; }
63  virtual bool getAllowOnlyValuesInRange() const { return mAllowOnlyValuesInRange; }
64  void setReadOnly(bool val);
65  virtual void setDisplayName(QString val);
66 
67 
68 signals:
69  void valueWasSet();
70 
71 private:
73  QString mName;
74  QString mUid;
75  QString mHelp;
76  QString mValue;
77  QStringList mRange;
78  XmlOptionItem mStore;
79  std::map<QString, QString> mDisplayNames;
80  bool mIsReadOnly;
81  bool mAllowOnlyValuesInRange;
82 };
83 
84 
85 } // namespace cx
86 
87 #endif /* CXSTRINGPROPERTY_H_ */
virtual bool getAllowOnlyValuesInRange() const
Abstract interface for interaction with internal string-valued data.
Helper class for storing one string value in an xml document.
boost::shared_ptr< class StringProperty > StringPropertyPtr
virtual bool isReadOnly() const
Represents one option of the string type. The data are stored within a xml document.
virtual std::map< QString, QString > getDisplayNames() const
Namespace for all CustusX production code.