All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
te::layout::Variant Class Reference

Class acts like a union for some C++/TerraLib5 data types. Responsible for storing the value. Any data type, not included in the convertValue method in this class, it will be by default "std::string". Storing value types: More...

#include <Variant.h>

Public Member Functions

virtual void clear ()
 Reset state of object. Null state. More...
 
virtual std::string convertToString ()
 Converts the value to a string. More...
 
virtual void fromPtree (boost::property_tree::ptree tree, EnumType *type)
 
EnumTypegetType ()
 Returns data type of this object. More...
 
virtual bool isComplex ()
 Return true if value is not of common C++ data type, false otherwise. More...
 
bool isNull ()
 Returns true if no value has been set, false otherwise. More...
 
bool operator!= (const Variant &other)
 
bool operator== (const Variant &other)
 
template<typename ValueType >
void setValue (ValueType value, EnumType *type)
 Stores a copy of value. More...
 
bool toBool ()
 Returns the value of boolean type. (The setValue method received a boolean) More...
 
te::color::RGBAColor toColor ()
 Returns the value of te::color::RGBAColor type. (The setValue method received a te::color::RGBAColor). Complex type. More...
 
double toDouble ()
 Returns the value of double type. (The setValue method received a double) More...
 
float toFloat ()
 Returns the value of float type. (The setValue method received a float) More...
 
Font toFont ()
 Returns the value of te::layout::Font type. (The setValue method received a te::layout::Font). Complex type. More...
 
int toInt ()
 Returns the value of int type. (The setValue method received a int) More...
 
long toLong ()
 Returns the value of long type. (The setValue method received a long) More...
 
std::string toString ()
 Returns the value of string type. (The setValue method received a string) More...
 
 Variant ()
 Constructor. More...
 
 Variant (EnumType *type, const void *valueCopy)
 Constructor. More...
 
virtual ~Variant ()
 Destructor. More...
 

Protected Member Functions

virtual void convertValue (const void *valueCopy)
 Discovers the type of the value and sets for the corresponding attribute (storage). Any type of data, not included in this class, it will be by default "std::string". More...
 
virtual double string2Double (std::string str)
 Convert a string representation of a number into a double value. More...
 
virtual float string2Float (std::string str)
 Convert a string representation of a number into a float value. More...
 
virtual int string2Int (std::string str)
 Convert a string representation of a number into a int value. More...
 
virtual long string2Long (std::string str)
 Convert a string representation of a number into a long value. More...
 
virtual bool toBool (std::string str)
 Convert a string value into a boolean representation of a string. Ex.: true, false. More...
 
virtual std::string toString (int value)
 Convert a int value into a string representation of a number. More...
 
template<typename ValueType >
void variantSetValue (Variant &v, const ValueType &value, EnumType *type)
 Stores a copy of value. More...
 

Protected Attributes

bool m_bValue
 value of boolean type More...
 
te::color::RGBAColor m_colorValue
 value of te::color::RGBAColor type More...
 
bool m_complex
 true if value is not of common C++ data type, false otherwise More...
 
double m_dValue
 value of double type More...
 
Font m_fontValue
 value of te::layout::Font type More...
 
float m_fValue
 value of float type More...
 
int m_iValue
 value of int type More...
 
long m_lValue
 value of long type More...
 
bool m_null
 true if no value has been set, false otherwise More...
 
std::string m_sValue
 value of string type More...
 
EnumTypem_type
 data type of this object More...
 

Detailed Description

Class acts like a union for some C++/TerraLib5 data types. Responsible for storing the value. Any data type, not included in the convertValue method in this class, it will be by default "std::string". Storing value types:

Definition at line 80 of file Variant.h.

Constructor & Destructor Documentation

te::layout::Variant::Variant ( )

Constructor.

Definition at line 41 of file Variant.cpp.

References te::common::Singleton< Enums >::getInstance(), and m_type.

te::layout::Variant::Variant ( EnumType type,
const void *  valueCopy 
)

Constructor.

data type value pointer (real data)

Definition at line 55 of file Variant.cpp.

References convertValue().

te::layout::Variant::~Variant ( )
virtual

Destructor.

Definition at line 72 of file Variant.cpp.

Member Function Documentation

void te::layout::Variant::clear ( )
virtual
void te::layout::Variant::convertValue ( const void *  valueCopy)
protectedvirtual
te::layout::EnumType * te::layout::Variant::getType ( )

Returns data type of this object.

Definition at line 77 of file Variant.cpp.

Referenced by operator!=(), operator==(), and te::layout::Property::setValue().

bool te::layout::Variant::isComplex ( )
virtual

Return true if value is not of common C++ data type, false otherwise.

Parameters
trueif value is not of common C++ data type, false otherwise

Definition at line 512 of file Variant.cpp.

bool te::layout::Variant::isNull ( )

Returns true if no value has been set, false otherwise.

Returns
true if no value has been set, false otherwise

Definition at line 351 of file Variant.cpp.

Referenced by te::layout::DialogPropertiesBrowser::getLayoutType().

bool te::layout::Variant::operator!= ( const Variant other)
inline

Definition at line 323 of file Variant.h.

References getType(), toBool(), toColor(), toDouble(), toFloat(), toInt(), toLong(), and toString().

bool te::layout::Variant::operator== ( const Variant other)
inline

Definition at line 302 of file Variant.h.

References getType(), toBool(), toColor(), toDouble(), toFloat(), toInt(), toLong(), and toString().

template<typename ValueType >
void te::layout::Variant::setValue ( ValueType  value,
EnumType type 
)
inline

Stores a copy of value.

Parameters
valuecopies the value to be stored
typedata type

Definition at line 288 of file Variant.h.

Referenced by te::layout::PropertiesUtils::addDynamicOptions(), te::layout::TextGridSettingsOutside::eventFilter(), te::layout::ScaleModel::getProperties(), te::layout::LegendModel::getProperties(), te::layout::GridMapModel::getProperties(), te::layout::VariantPropertiesBrowser::getProperty(), te::layout::GridSettingsOutside::on_chkBottomGeoText_clicked(), te::layout::GridSettingsOutside::on_chkBottomPlanarText_clicked(), te::layout::GridSettingsOutside::on_chkBottomRotateGeoText_clicked(), te::layout::GridSettingsOutside::on_chkBottomRotatePlanarText_clicked(), te::layout::GridSettingsOutside::on_chkDegreesGeoText_clicked(), te::layout::GridSettingsOutside::on_chkLeftGeoText_clicked(), te::layout::GridSettingsOutside::on_chkLeftPlanarText_clicked(), te::layout::GridSettingsOutside::on_chkLeftRotateGeoText_clicked(), te::layout::GridSettingsOutside::on_chkLeftRotatePlanarText_clicked(), te::layout::GridSettingsOutside::on_chkLowerLeftCornerGeoText_clicked(), te::layout::GridSettingsOutside::on_chkLowerRightCornerGeoText_clicked(), te::layout::GridSettingsOutside::on_chkMinutesGeoText_clicked(), te::layout::GridSettingsOutside::on_chkRightGeoText_clicked(), te::layout::GridSettingsOutside::on_chkRightPlanarText_clicked(), te::layout::GridSettingsOutside::on_chkRightRotateGeoText_clicked(), te::layout::GridSettingsOutside::on_chkRightRotatePlanarText_clicked(), te::layout::GridSettingsOutside::on_chkSecondsGeoText_clicked(), te::layout::GridSettingsOutside::on_chkShowGeodesic_clicked(), te::layout::GridSettingsOutside::on_chkShowPlanar_clicked(), te::layout::GridSettingsOutside::on_chkSuperscriptGeoText_clicked(), te::layout::GridSettingsOutside::on_chkSuperscriptPlanarText_clicked(), te::layout::GridSettingsOutside::on_chkTopGeoText_clicked(), te::layout::GridSettingsOutside::on_chkTopPlanarText_clicked(), te::layout::GridSettingsOutside::on_chkTopRotateGeoText_clicked(), te::layout::GridSettingsOutside::on_chkTopRotatePlanarText_clicked(), te::layout::GridSettingsOutside::on_chkUpperLeftCornerGeoText_clicked(), te::layout::GridSettingsOutside::on_chkUpperRightCornerGeoText_clicked(), te::layout::GridSettingsOutside::on_chkVisibleCornerTextsGeoText_clicked(), te::layout::GridSettingsOutside::on_chkVisibleTextsGeoText_clicked(), te::layout::GridSettingsOutside::on_chkVisibleTextsPlanarText_clicked(), te::layout::GridSettingsOutside::on_ckbClip_clicked(), te::layout::GridSettingsOutside::on_ckDefineScale_clicked(), te::layout::TextGridSettingsOutside::on_cmbBorderStyle_currentIndexChanged(), te::layout::TextGridSettingsOutside::on_cmbCellAlign_currentIndexChanged(), te::layout::TextGridSettingsOutside::on_cmbColumnsWidthConstraints_currentIndexChanged(), te::layout::GridSettingsOutside::on_cmbCornerGeoFont_currentIndexChanged(), te::layout::GridSettingsOutside::on_cmbCornerGeoTextSize_currentIndexChanged(), te::layout::GridSettingsOutside::on_cmbGeoFont_currentIndexChanged(), te::layout::GridSettingsOutside::on_cmbGeoTextSize_currentIndexChanged(), te::layout::GridSettingsOutside::on_cmbGridStyle_currentIndexChanged(), te::layout::TextGridSettingsOutside::on_cmbHeaderAlign_currentIndexChanged(), te::layout::GridSettingsOutside::on_cmbLineType_currentIndexChanged(), te::layout::GridSettingsOutside::on_cmbLineWidth_currentIndexChanged(), te::layout::GridSettingsOutside::on_cmbPlanarFont_currentIndexChanged(), te::layout::GridSettingsOutside::on_cmbPlanarLineType_currentIndexChanged(), te::layout::GridSettingsOutside::on_cmbPlanarLineWidth_currentIndexChanged(), te::layout::GridSettingsOutside::on_cmbPlanarStyle_currentIndexChanged(), te::layout::GridSettingsOutside::on_cmbPlanarTextSize_currentIndexChanged(), te::layout::GridSettingsOutside::on_cmbScale_currentIndexChanged(), te::layout::TextGridSettingsOutside::on_cmbTableWidthConstraints_currentIndexChanged(), te::layout::GridSettingsOutside::on_cmbUnit_currentIndexChanged(), te::layout::GridSettingsOutside::on_lneCornerHrzGeoDisplacement_editingFinished(), te::layout::GridSettingsOutside::on_lneCornerVrtGeoDisplacement_editingFinished(), te::layout::TextGridSettingsOutside::on_lneEdtBorderWidth_editingFinished(), te::layout::TextGridSettingsOutside::on_lneEdtColumnsNumber_editingFinished(), te::layout::TextGridSettingsOutside::on_lneEdtColumnsWidth_editingFinished(), te::layout::TextGridSettingsOutside::on_lneEdtRowsNumber_editingFinished(), te::layout::TextGridSettingsOutside::on_lneEdtTablePadding_editingFinished(), te::layout::TextGridSettingsOutside::on_lneEdtTableSpacing_editingFinished(), te::layout::TextGridSettingsOutside::on_lneEdtTableWidth_editingFinished(), te::layout::GridSettingsOutside::on_lneHorizontalGap_editingFinished(), te::layout::GridSettingsOutside::on_lneHrzGeoDisplacement_editingFinished(), te::layout::GridSettingsOutside::on_lneHrzPlanarDisplacement_editingFinished(), te::layout::GridSettingsOutside::on_lneHrzPlanarGap_editingFinished(), te::layout::GridSettingsOutside::on_lneVerticalGap_editingFinished(), te::layout::GridSettingsOutside::on_lneVrtGeoDisplacement_editingFinished(), te::layout::GridSettingsOutside::on_lneVrtPlanarDisplacement_editingFinished(), te::layout::GridSettingsOutside::on_lneVrtPlanarGap_editingFinished(), te::layout::GridSettingsOutside::on_lneX1_editingFinished(), te::layout::GridSettingsOutside::on_lneX2_editingFinished(), te::layout::GridSettingsOutside::on_lneX3_editingFinished(), te::layout::GridSettingsOutside::on_lneX4_editingFinished(), te::layout::GridSettingsOutside::on_lneY1_editingFinished(), te::layout::GridSettingsOutside::on_lneY2_editingFinished(), te::layout::GridSettingsOutside::on_lneY3_editingFinished(), te::layout::GridSettingsOutside::on_lneY4_editingFinished(), te::layout::GridSettingsOutside::on_pbCornerTextGeoColor_clicked(), te::layout::GridSettingsOutside::on_pbGridTextGeoColor_clicked(), te::layout::GridSettingsOutside::on_pbGridTextPlanarColor_clicked(), te::layout::GridSettingsOutside::on_pbLineColor_clicked(), te::layout::GridSettingsOutside::on_pbPlanarLineColor_clicked(), te::layout::GridSettingsOutside::on_xGridInitialPoint_geo_textField_editingFinished(), te::layout::GridSettingsOutside::on_xGridInitialPoint_planar_textField_editingFinished(), te::layout::GridSettingsOutside::on_yGridInitialPoint_geo_textField_editingFinished(), te::layout::GridSettingsOutside::on_yGridInitialPoint_planar_textField_editingFinished(), te::layout::PointModel::pointProperty(), te::layout::ScaleModel::scaleProperty(), and te::layout::Property::setValue().

double te::layout::Variant::string2Double ( std::string  str)
protectedvirtual

Convert a string representation of a number into a double value.

Parameters
strstring representation of a number
Returns
double value

Definition at line 424 of file Variant.cpp.

float te::layout::Variant::string2Float ( std::string  str)
protectedvirtual

Convert a string representation of a number into a float value.

Parameters
strstring representation of a number
Returns
float value

Definition at line 468 of file Variant.cpp.

int te::layout::Variant::string2Int ( std::string  str)
protectedvirtual

Convert a string representation of a number into a int value.

Parameters
strstring representation of a number
Returns
int value

Definition at line 446 of file Variant.cpp.

long te::layout::Variant::string2Long ( std::string  str)
protectedvirtual

Convert a string representation of a number into a long value.

Parameters
strstring representation of a number
Returns
long value

Definition at line 490 of file Variant.cpp.

bool te::layout::Variant::toBool ( std::string  str)
protectedvirtual

Convert a string value into a boolean representation of a string. Ex.: true, false.

Parameters
strstring value
Returns
boolean representation of a string. Ex.: true, false

Definition at line 525 of file Variant.cpp.

float te::layout::Variant::toFloat ( )

Returns the value of float type. (The setValue method received a float)

Returns
value of float type

Definition at line 331 of file Variant.cpp.

Referenced by operator!=(), and operator==().

te::layout::Font te::layout::Variant::toFont ( )

Returns the value of te::layout::Font type. (The setValue method received a te::layout::Font). Complex type.

Returns
value of te::layout::Font type

Definition at line 346 of file Variant.cpp.

Referenced by te::layout::TextModel::updateProperties(), and te::layout::LegendModel::updateProperties().

long te::layout::Variant::toLong ( )

Returns the value of long type. (The setValue method received a long)

Returns
value of long type

Definition at line 326 of file Variant.cpp.

Referenced by operator!=(), and operator==().

std::string te::layout::Variant::toString ( int  value)
protectedvirtual

Convert a int value into a string representation of a number.

Parameters
valueint value
Returns
string representation of a number

Definition at line 517 of file Variant.cpp.

template<typename ValueType >
void te::layout::Variant::variantSetValue ( Variant v,
const ValueType &  value,
EnumType type 
)
inlineprotected

Stores a copy of value.

Parameters
vthis object
valuecopies the value to be stored
typedata type

Definition at line 296 of file Variant.h.

Member Data Documentation

bool te::layout::Variant::m_bValue
protected

value of boolean type

Definition at line 279 of file Variant.h.

te::color::RGBAColor te::layout::Variant::m_colorValue
protected

value of te::color::RGBAColor type

Definition at line 280 of file Variant.h.

bool te::layout::Variant::m_complex
protected

true if value is not of common C++ data type, false otherwise

Definition at line 284 of file Variant.h.

double te::layout::Variant::m_dValue
protected

value of double type

Definition at line 275 of file Variant.h.

Font te::layout::Variant::m_fontValue
protected

value of te::layout::Font type

Definition at line 281 of file Variant.h.

float te::layout::Variant::m_fValue
protected

value of float type

Definition at line 278 of file Variant.h.

int te::layout::Variant::m_iValue
protected

value of int type

Definition at line 276 of file Variant.h.

long te::layout::Variant::m_lValue
protected

value of long type

Definition at line 277 of file Variant.h.

bool te::layout::Variant::m_null
protected

true if no value has been set, false otherwise

Definition at line 283 of file Variant.h.

std::string te::layout::Variant::m_sValue
protected

value of string type

Definition at line 274 of file Variant.h.

EnumType* te::layout::Variant::m_type
protected

data type of this object

Definition at line 282 of file Variant.h.

Referenced by Variant().


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