OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ot::PropertyBase Class Reference

The PropertyBase class is used to hold general Property information. More...

#include "PropertyBase.h"

Inheritance diagram for ot::PropertyBase:
ot::Serializable ot::Property ot::PropertyBool ot::PropertyColor ot::PropertyDirectory ot::PropertyDouble ot::PropertyFilePath ot::PropertyInt ot::PropertyPainter2D ot::PropertyString ot::PropertyStringList

Public Types

enum  PropertyFlag {
  NoFlags = 0x0000 , IsReadOnly = 0x0001 , IsProtected = 0x0002 , IsHidden = 0x0004 ,
  HasMultipleValues = 0x0008 , HasInputError = 0x0010 , IsDeletable = 0x0020 , AllowCustomValues = 0x1000 ,
  AllowMultiselection = 0x2000
}
 The PropertyFlag enum contains different settings for properties. More...
 
typedef Flags< PropertyFlagPropertyFlags
 The PropertyFlag enum contains different settings for properties.
 

Public Member Functions

 PropertyBase (PropertyFlags _flags=PropertyFlags(NoFlags))
 Default constructor.
 
 PropertyBase (const std::string &_name, PropertyFlags _flags=PropertyFlags(NoFlags))
 Assignment constructor.
 
 PropertyBase (const PropertyBase &_other)
 Copy constructor.
 
virtual ~PropertyBase ()
 Destructor.
 
PropertyBaseoperator= (const PropertyBase &_other)
 Assignment operator.
 
virtual void addToJsonObject (ot::JsonValue &_object, ot::JsonAllocator &_allocator) const override
 Add the object contents to the provided JSON object.
 
virtual void setFromJsonObject (const ot::ConstJsonObject &_object) override
 Will set the object contents from the provided JSON object.
 
void setPropertyName (const std::string &_name)
 
const std::string & getPropertyName (void) const
 
void setPropertyTitle (const std::string &_title)
 Set the property title If no title set the name will be used as title.
 
const std::string & getPropertyTitle (void) const
 Property title If no title set the name will be used as title.
 
void setPropertyTip (const std::string &_tip)
 
std::string & getPropertyTip (void)
 
const std::string & getPropertyTip (void) const
 
void setPropertyFlag (PropertyFlag _flag, bool _active=true)
 
void setPropertyFlags (PropertyFlags _flags)
 
PropertyFlagsgetPropertyFlags (void)
 
const PropertyFlagsgetPropertyFlags (void) const
 
void setSpecialType (const std::string &_type)
 
const std::string & getSpecialType (void) const
 
void addAdditionalPropertyData (const std::string &_key, const std::string &_data)
 
void setAdditionalPropertyData (const std::map< std::string, std::string > &_data)
 
const std::map< std::string, std::string > & getAllAdditionalPropertyData (void) const
 
std::string getAdditionalPropertyData (const std::string &_key) const
 
- Public Member Functions inherited from ot::Serializable
 Serializable ()
 
virtual ~Serializable ()
 

Static Public Member Functions

static std::string toString (PropertyFlag _flag)
 Creates a string representation of the provided PropertyFlag.
 
static PropertyFlag stringToFlag (const std::string &_flag)
 Returns the PropertyFlag that is represented by the string.
 
static std::list< std::string > toStringList (PropertyFlags _flags)
 Creates a list containing strings that represent the set PropertyFlags.
 
static PropertyFlags stringListToFlags (const std::list< std::string > &_flags)
 Returns the PropertyFlags that are represented by the string list.
 

Detailed Description

The PropertyBase class is used to hold general Property information.

Member Typedef Documentation

◆ PropertyFlags

The PropertyFlag enum contains different settings for properties.

Member Enumeration Documentation

◆ PropertyFlag

The PropertyFlag enum contains different settings for properties.

Enumerator
NoFlags 
IsReadOnly 

No property flags set.

IsProtected 

Property is read only.

IsHidden 

Property is protected.

HasMultipleValues 

Property is hidden to the user.

HasInputError 

Property has multiple values.

IsDeletable 

The value is invalid.

AllowCustomValues 

Property is deletable.

AllowMultiselection 

User may set user values (e.g. in the StringListProperty)

Constructor & Destructor Documentation

◆ PropertyBase() [1/3]

ot::PropertyBase::PropertyBase ( PropertyFlags _flags = PropertyFlags(NoFlags))

Default constructor.

Parameters
_flagsIntially set flags.

◆ PropertyBase() [2/3]

ot::PropertyBase::PropertyBase ( const std::string & _name,
PropertyFlags _flags = PropertyFlags(NoFlags) )

Assignment constructor.

Parameters
_nameProperty name.
_flagsIntially set flags.

◆ PropertyBase() [3/3]

ot::PropertyBase::PropertyBase ( const PropertyBase & _other)

Copy constructor.

Parameters
_otherOther PropertyBase.

◆ ~PropertyBase()

virtual ot::PropertyBase::~PropertyBase ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ addAdditionalPropertyData()

void ot::PropertyBase::addAdditionalPropertyData ( const std::string & _key,
const std::string & _data )
inline

◆ addToJsonObject()

void ot::PropertyBase::addToJsonObject ( ot::JsonValue & _object,
ot::JsonAllocator & _allocator ) const
overridevirtual

Add the object contents to the provided JSON object.

Parameters
_objectJson object reference
_allocatorAllocator

Implements ot::Serializable.

Reimplemented in ot::Property.

◆ getAdditionalPropertyData()

std::string ot::PropertyBase::getAdditionalPropertyData ( const std::string & _key) const

◆ getAllAdditionalPropertyData()

const std::map< std::string, std::string > & ot::PropertyBase::getAllAdditionalPropertyData ( void ) const
inline

◆ getPropertyFlags() [1/2]

PropertyFlags & ot::PropertyBase::getPropertyFlags ( void )
inline

◆ getPropertyFlags() [2/2]

const PropertyFlags & ot::PropertyBase::getPropertyFlags ( void ) const
inline

◆ getPropertyName()

const std::string & ot::PropertyBase::getPropertyName ( void ) const
inline

◆ getPropertyTip() [1/2]

std::string & ot::PropertyBase::getPropertyTip ( void )
inline

◆ getPropertyTip() [2/2]

const std::string & ot::PropertyBase::getPropertyTip ( void ) const
inline

◆ getPropertyTitle()

const std::string & ot::PropertyBase::getPropertyTitle ( void ) const
inline

Property title If no title set the name will be used as title.

◆ getSpecialType()

const std::string & ot::PropertyBase::getSpecialType ( void ) const
inline

◆ operator=()

ot::PropertyBase & ot::PropertyBase::operator= ( const PropertyBase & _other)

Assignment operator.

Parameters
_otherOther PropertyBase.

◆ setAdditionalPropertyData()

void ot::PropertyBase::setAdditionalPropertyData ( const std::map< std::string, std::string > & _data)
inline

◆ setFromJsonObject()

void ot::PropertyBase::setFromJsonObject ( const ot::ConstJsonObject & _object)
overridevirtual

Will set the object contents from the provided JSON object.

Parameters
_objectThe JSON object containing the information
Exceptions
Willthrow an exception if the provided object is not valid (members missing or invalid types)

Implements ot::Serializable.

Reimplemented in ot::Property.

◆ setPropertyFlag()

void ot::PropertyBase::setPropertyFlag ( PropertyFlag _flag,
bool _active = true )
inline

◆ setPropertyFlags()

void ot::PropertyBase::setPropertyFlags ( PropertyFlags _flags)
inline

◆ setPropertyName()

void ot::PropertyBase::setPropertyName ( const std::string & _name)
inline

◆ setPropertyTip()

void ot::PropertyBase::setPropertyTip ( const std::string & _tip)
inline

◆ setPropertyTitle()

void ot::PropertyBase::setPropertyTitle ( const std::string & _title)
inline

Set the property title If no title set the name will be used as title.

◆ setSpecialType()

void ot::PropertyBase::setSpecialType ( const std::string & _type)
inline

◆ stringListToFlags()

ot::PropertyBase::PropertyFlags ot::PropertyBase::stringListToFlags ( const std::list< std::string > & _flags)
static

Returns the PropertyFlags that are represented by the string list.

◆ stringToFlag()

ot::PropertyBase::PropertyFlag ot::PropertyBase::stringToFlag ( const std::string & _flag)
static

Returns the PropertyFlag that is represented by the string.

◆ toString()

std::string ot::PropertyBase::toString ( PropertyFlag _flag)
static

Creates a string representation of the provided PropertyFlag.

◆ toStringList()

std::list< std::string > ot::PropertyBase::toStringList ( PropertyFlags _flags)
static

Creates a list containing strings that represent the set PropertyFlags.


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