Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
mitk::StringProperty Class Reference

Property for strings. More...

#include <mitkStringProperty.h>

Inheritance diagram for mitk::StringProperty:
Collaboration diagram for mitk::StringProperty:

Public Types

typedef std::string ValueType
 

Public Member Functions

 mitkClassMacro (StringProperty, BaseProperty)
 
Pointer Clone () const
 
 mitkNewMacro1Param (StringProperty, const char *)
 
 mitkNewMacro1Param (StringProperty, const std::string &)
 
virtual const char * GetValue () const
 
virtual void SetValue (const char *_arg)
 
std::string GetValueAsString () const override
 
bool ToJSON (nlohmann::json &j) const override
 Serialize property value(s) to JSON. More...
 
bool FromJSON (const nlohmann::json &j) override
 Deserialize property value(s) from JSON. More...
 
BasePropertyoperator= (const BaseProperty &property)
 Assigns property to this BaseProperty instance. More...
 
- Public Member Functions inherited from mitk::BaseProperty
 mitkClassMacroItkParent (BaseProperty, itk::Object)
 
Pointer Clone () const
 
bool operator== (const BaseProperty &property) const
 Subclasses must implement IsEqual(const BaseProperty&) to support comparison. More...
 
BasePropertyoperator= (const BaseProperty &property)
 Assigns property to this BaseProperty instance. More...
 
bool AssignProperty (const BaseProperty &property)
 Assigns property to this BaseProperty instance. More...
 

Static Public Member Functions

static Pointer New ()
 

Static Public Attributes

static const char * PATH
 
- Static Public Attributes inherited from mitk::BaseProperty
static const std::string VALUE_CANNOT_BE_CONVERTED_TO_STRING
 Default return value if a property which can not be returned as string. More...
 

Protected Member Functions

 StringProperty (const char *string=nullptr)
 
 StringProperty (const std::string &s)
 
 StringProperty (const StringProperty &)
 
- Protected Member Functions inherited from mitk::BaseProperty
 BaseProperty ()
 
 BaseProperty (const BaseProperty &other)
 
 ~BaseProperty () override
 

Protected Attributes

std::string m_Value
 

Detailed Description

Property for strings.

Definition at line 34 of file mitkStringProperty.h.

Member Typedef Documentation

◆ ValueType

typedef std::string mitk::StringProperty::ValueType

Definition at line 46 of file mitkStringProperty.h.

Constructor & Destructor Documentation

◆ StringProperty() [1/3]

mitk::StringProperty::StringProperty ( const char *  string = nullptr)
protected

◆ StringProperty() [2/3]

mitk::StringProperty::StringProperty ( const std::string &  s)
protected

◆ StringProperty() [3/3]

mitk::StringProperty::StringProperty ( const StringProperty )
protected

Member Function Documentation

◆ Clone()

Pointer mitk::StringProperty::Clone ( ) const

◆ FromJSON()

bool mitk::StringProperty::FromJSON ( const nlohmann::json j)
overridevirtual

Deserialize property value(s) from JSON.

Rely on exceptions for error handling when implementing deserialization.

Returns
False if not deserializable by design, true otherwise.

Implements mitk::BaseProperty.

◆ GetValue()

virtual const char* mitk::StringProperty::GetValue ( ) const
virtual

Referenced by mitk::DataNode::GetName().

◆ GetValueAsString()

std::string mitk::StringProperty::GetValueAsString ( ) const
overridevirtual

Reimplemented from mitk::BaseProperty.

◆ mitkClassMacro()

mitk::StringProperty::mitkClassMacro ( StringProperty  ,
BaseProperty   
)

◆ mitkNewMacro1Param() [1/2]

mitk::StringProperty::mitkNewMacro1Param ( StringProperty  ,
const char *   
)

◆ mitkNewMacro1Param() [2/2]

mitk::StringProperty::mitkNewMacro1Param ( StringProperty  ,
const std::string &   
)

◆ New()

static Pointer mitk::StringProperty::New ( )
static

◆ operator=()

BaseProperty& mitk::BaseProperty::operator=

Assigns property to this BaseProperty instance.

Subclasses must implement Assign(const BaseProperty&) and call the superclass Assign method for proper handling of polymorphic assignments. The assignment operator of the subclass should be disabled and the baseclass operator should be made visible using "using" statements.

◆ SetValue()

virtual void mitk::StringProperty::SetValue ( const char *  _arg)
virtual

Referenced by mitk::DataNode::SetName().

◆ ToJSON()

bool mitk::StringProperty::ToJSON ( nlohmann::json j) const
overridevirtual

Serialize property value(s) to JSON.

Rely on exceptions for error handling when implementing serialization.

Returns
False if not serializable by design, true otherwise.

Implements mitk::BaseProperty.

Member Data Documentation

◆ m_Value

std::string mitk::StringProperty::m_Value
protected

Definition at line 37 of file mitkStringProperty.h.

◆ PATH

const char* mitk::StringProperty::PATH
static

Definition at line 61 of file mitkStringProperty.h.


The documentation for this class was generated from the following file: