Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkStringProperty.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkStringProperty_h
14 #define mitkStringProperty_h
15 
16 #include <itkConfigure.h>
17 
18 #include <mitkBaseProperty.h>
19 #include <MitkCoreExports.h>
20 
21 #include <string>
22 
23 namespace mitk
24 {
37  {
38  protected:
39  std::string m_Value;
40 
41  StringProperty(const char *string = nullptr);
42  StringProperty(const std::string &s);
43 
45 
47 
48  public:
50 
52  typedef std::string ValueType;
53 
54  itkFactorylessNewMacro(Self);
55  itkCloneMacro(Self);
57  mitkNewMacro1Param(StringProperty, const std::string&);
58 
63  itkGetStringMacro(Value);
64 
69  itkSetStringMacro(Value);
70 
75  std::string GetValueAsString() const override;
76 
83  bool ToJSON(nlohmann::json& j) const override;
84 
91  bool FromJSON(const nlohmann::json& j) override;
92 
94  static const char *PATH;
95 
96  using BaseProperty::operator=;
97 
98  private:
99  // purposely not implemented
100  StringProperty &operator=(const StringProperty &);
101 
102  bool IsEqual(const BaseProperty &property) const override;
103  bool Assign(const BaseProperty &property) override;
104  };
105 
106 } // namespace mitk
107 
108 #endif
#define MITKCORE_EXPORT
Abstract base class for properties.
Property for storing string values.
StringProperty(const StringProperty &)
mitkClassMacro(StringProperty, BaseProperty)
StringProperty(const char *string=nullptr)
std::string ValueType
The type of the value stored by this property.
bool FromJSON(const nlohmann::json &j) override
Deserialize the string value from JSON.
StringProperty(const std::string &s)
mitkNewMacro1Param(StringProperty, const std::string &)
mitkNewMacro1Param(StringProperty, const char *)
mitkCloneMacro(StringProperty)
bool ToJSON(nlohmann::json &j) const override
Serialize the string value to JSON.
static const char * PATH
Constant used as a convention for properties representing file paths.
std::string GetValueAsString() const override
Return the property value as a string.
nlohmann::json json
Find image slices visible on a given plane.