libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
crn::ConfigElement Class Reference

A element of configuration. More...

#include <CRNConfigElement.h>

Public Member Functions

 ConfigElement ()
 Default constructor for serialization. More...
 
 ConfigElement (const String &nam, int val, const String &desc=U"")
 Creates a configuration element for an int value. More...
 
 ConfigElement (const String &nam, double val, const String &desc=U"")
 Creates a configuration element for a double value. More...
 
 ConfigElement (const String &nam, bool val, const String &desc=U"")
 Creates a configuration element for a boolean value. More...
 
 ConfigElement (const String &nam, const Prop3 &val, const String &desc=U"")
 Creates a configuration element for a Prop3 value. More...
 
 ConfigElement (const String &nam, const String &val, const String &desc=U"")
 Creates a configuration element for a String. More...
 
 ConfigElement (const String &nam, const StringUTF8 &val, const String &desc=U"")
 Creates a configuration element for a StringUTF8. More...
 
 ConfigElement (const String &nam, const Path &val, const String &desc=U"")
 Creates a configuration element for a Path. More...
 
 ConfigElement (const ConfigElement &)=delete
 
 ConfigElement (ConfigElement &&)=default
 
ConfigElementoperator= (const ConfigElement &)=delete
 
ConfigElementoperator= (ConfigElement &&)=default
 
 ~ConfigElement ()=default
 
String GetType () const
 Gets the inner type of data in the element. More...
 
const StringGetName () const noexcept
 Gets the translated name of the element. More...
 
const StringGetDescription () const noexcept
 Gets the description of the element. More...
 
const SObject & GetValue () noexcept
 Gets the inner representation of the element's value. More...
 
SCObject GetValue () const
 Gets the inner representation of the element's value. More...
 
template<typename T >
GetValue () const
 Gets the element's value. More...
 
template<typename T >
void SetValue (T val)
 Sets the element's value. More...
 
bool HasMinValue () const noexcept
 Tells if the element has min value. More...
 
const SObject & GetMinValue () noexcept
 Gets the inner representation of the element's min value. More...
 
SCObject GetMinValue () const
 Gets the inner representation of the element's min value. More...
 
template<typename T >
GetMinValue () const
 Gets the element's minimal value. More...
 
template<typename T >
void SetMinValue (T val)
 Sets the element's min value. More...
 
bool HasMaxValue () const noexcept
 Tells if the element has max value. More...
 
const SObject & GetMaxValue () noexcept
 Gets the inner representation of the element's max value. More...
 
SCObject GetMaxValue () const
 Gets the inner representation of the element's max value. More...
 
template<typename T >
GetMaxValue () const
 Gets the element's minimal value. More...
 
template<typename T >
void SetMaxValue (T val)
 Sets the element's max value. More...
 
const crn::VectorGetAllowedValues () const
 Returns the list of allowed values. More...
 
template<typename T >
const std::vector< T > GetAllowedValues () const
 Returns the list of allowed values. More...
 
template<typename Iter >
void SetAllowedValues (Iter b, Iter e)
 Sets the list of allowed values. More...
 
template<typename T >
void AddAllowedValue (T val)
 Adds a value to the list of allowed values. More...
 

Detailed Description

A element of configuration.

Helper class to store configuration values with their description

Author
Yann LEYDIER
Date
Oct 2011
Version
0.1

Definition at line 39 of file CRNConfigElement.h.

Constructor & Destructor Documentation

ConfigElement::ConfigElement ( )

Default constructor for serialization.

Default constructor for serialization.

Attention
Do NOT use

Definition at line 30 of file CRNConfigElement.cpp.

ConfigElement::ConfigElement ( const String nam,
int  val,
const String desc = U"" 
)

Creates a configuration element for an int value.

Creates a configuration element for an int value

Parameters
[in]namthe translated name of the element
[in]valthe initial value
[in]descthe description of the element

Definition at line 41 of file CRNConfigElement.cpp.

ConfigElement::ConfigElement ( const String nam,
double  val,
const String desc = U"" 
)

Creates a configuration element for a double value.

Creates a configuration element for a double value

Parameters
[in]namthe translated name of the element
[in]valthe initial value
[in]descthe description of the element

Definition at line 54 of file CRNConfigElement.cpp.

ConfigElement::ConfigElement ( const String nam,
bool  val,
const String desc = U"" 
)

Creates a configuration element for a boolean value.

Creates a configuration element for a boolean value

Parameters
[in]namthe translated name of the element
[in]valthe initial value
[in]descthe description of the element

Definition at line 67 of file CRNConfigElement.cpp.

ConfigElement::ConfigElement ( const String nam,
const Prop3 val,
const String desc = U"" 
)

Creates a configuration element for a Prop3 value.

Creates a configuration element for a Prop3 value

Parameters
[in]namthe translated name of the element
[in]valthe initial value
[in]descthe description of the element

Definition at line 80 of file CRNConfigElement.cpp.

ConfigElement::ConfigElement ( const String nam,
const String val,
const String desc = U"" 
)

Creates a configuration element for a String.

Creates a configuration element for a String

Parameters
[in]namthe translated name of the element
[in]valthe initial value
[in]descthe description of the element

Definition at line 93 of file CRNConfigElement.cpp.

ConfigElement::ConfigElement ( const String nam,
const StringUTF8 val,
const String desc = U"" 
)

Creates a configuration element for a StringUTF8.

Creates a configuration element for a StringUTF8

Parameters
[in]namthe translated name of the element
[in]valthe initial value
[in]descthe description of the element

Definition at line 106 of file CRNConfigElement.cpp.

ConfigElement::ConfigElement ( const String nam,
const Path val,
const String desc = U"" 
)

Creates a configuration element for a Path.

Creates a configuration element for a Path

Parameters
[in]namthe translated name of the element
[in]valthe initial value
[in]descthe description of the element

Definition at line 119 of file CRNConfigElement.cpp.

crn::ConfigElement::ConfigElement ( const ConfigElement )
delete
crn::ConfigElement::ConfigElement ( ConfigElement &&  )
default
crn::ConfigElement::~ConfigElement ( )
default

Member Function Documentation

template<typename T >
void crn::ConfigElement::AddAllowedValue ( val)
inline

Adds a value to the list of allowed values.

Parameters
[in]valthe value to add

Definition at line 173 of file CRNConfigElement.h.

const crn::Vector& crn::ConfigElement::GetAllowedValues ( ) const
inline

Returns the list of allowed values.

Definition at line 146 of file CRNConfigElement.h.

template<typename T >
const std::vector<T> crn::ConfigElement::GetAllowedValues ( ) const
inline

Returns the list of allowed values.

Exceptions
ExceptionInvalidArgumentimpossible to convert
Returns
the converted list of allowed values

Definition at line 151 of file CRNConfigElement.h.

const String& crn::ConfigElement::GetDescription ( ) const
inlinenoexcept

Gets the description of the element.

Definition at line 69 of file CRNConfigElement.h.

const SObject& crn::ConfigElement::GetMaxValue ( )
inlinenoexcept

Gets the inner representation of the element's max value.

Definition at line 120 of file CRNConfigElement.h.

SCObject crn::ConfigElement::GetMaxValue ( ) const
inline

Gets the inner representation of the element's max value.

Definition at line 122 of file CRNConfigElement.h.

template<typename T >
T crn::ConfigElement::GetMaxValue ( ) const
inline

Gets the element's minimal value.

Exceptions
ExceptionUninitializedno max value
ExceptionInvalidArgumentimpossible to convert

Definition at line 127 of file CRNConfigElement.h.

const SObject& crn::ConfigElement::GetMinValue ( )
inlinenoexcept

Gets the inner representation of the element's min value.

Definition at line 93 of file CRNConfigElement.h.

SCObject crn::ConfigElement::GetMinValue ( ) const
inline

Gets the inner representation of the element's min value.

Definition at line 95 of file CRNConfigElement.h.

template<typename T >
T crn::ConfigElement::GetMinValue ( ) const
inline

Gets the element's minimal value.

Exceptions
ExceptionUninitializedno min value
ExceptionInvalidArgumentimpossible to convert

Definition at line 100 of file CRNConfigElement.h.

const String& crn::ConfigElement::GetName ( ) const
inlinenoexcept

Gets the translated name of the element.

Definition at line 67 of file CRNConfigElement.h.

String ConfigElement::GetType ( ) const

Gets the inner type of data in the element.

Gets the inner type of data in the element

Exceptions
ExceptionUninitializedthe element was not initialized
ExceptionInvalidArgumentthe element is of unknown type
Returns
Int, Real, Prop3, String, StringUTF8 or Path

Definition at line 132 of file CRNConfigElement.cpp.

const SObject& crn::ConfigElement::GetValue ( )
inlinenoexcept

Gets the inner representation of the element's value.

Definition at line 71 of file CRNConfigElement.h.

SCObject crn::ConfigElement::GetValue ( ) const
inline

Gets the inner representation of the element's value.

Definition at line 73 of file CRNConfigElement.h.

template<typename T >
T crn::ConfigElement::GetValue ( ) const
inline

Gets the element's value.

Exceptions
ExceptionInvalidArgumentimpossible to convert
Returns
the converted element's value

Definition at line 78 of file CRNConfigElement.h.

bool crn::ConfigElement::HasMaxValue ( ) const
inlinenoexcept

Tells if the element has max value.

Definition at line 118 of file CRNConfigElement.h.

bool crn::ConfigElement::HasMinValue ( ) const
inlinenoexcept

Tells if the element has min value.

Definition at line 91 of file CRNConfigElement.h.

ConfigElement& crn::ConfigElement::operator= ( const ConfigElement )
delete
ConfigElement& crn::ConfigElement::operator= ( ConfigElement &&  )
default
template<typename Iter >
void crn::ConfigElement::SetAllowedValues ( Iter  b,
Iter  e 
)
inline

Sets the list of allowed values.

Parameters
[in]bthe beginning iterator
[in]ethe end iterator

Definition at line 164 of file CRNConfigElement.h.

template<typename T >
void crn::ConfigElement::SetMaxValue ( val)
inline

Sets the element's max value.

Exceptions
ExceptionUninitializedthe element was not initialized
Parameters
[in]valthe value to assign

Definition at line 137 of file CRNConfigElement.h.

template<typename T >
void crn::ConfigElement::SetMinValue ( val)
inline

Sets the element's min value.

Exceptions
ExceptionUninitializedthe element was not initialized
Parameters
[in]valthe value to assign

Definition at line 110 of file CRNConfigElement.h.

template<typename T >
void crn::ConfigElement::SetValue ( val)
inline

Sets the element's value.

Exceptions
ExceptionUninitializedthe element was not initialized
Parameters
[in]valthe value to assign

Definition at line 86 of file CRNConfigElement.h.


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