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) |
EnumType * | getType () |
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... | |
EnumType * | m_type |
data type of this object More... | |
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:
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().
|
virtual |
Destructor.
Definition at line 72 of file Variant.cpp.
|
virtual |
Reset state of object. Null state.
Definition at line 356 of file Variant.cpp.
References te::layout::EnumDataType::getDataTypeNone(), te::layout::Enums::getEnumDataType(), and te::common::Singleton< Enums >::getInstance().
Referenced by te::layout::VariantPropertiesBrowser::getProperty().
|
virtual |
Converts the value to a string.
Definition at line 368 of file Variant.cpp.
References te::layout::EnumDataType::getDataTypeBool(), te::layout::EnumDataType::getDataTypeColor(), te::layout::EnumDataType::getDataTypeDouble(), te::layout::EnumDataType::getDataTypeFloat(), te::layout::EnumDataType::getDataTypeFont(), te::layout::EnumDataType::getDataTypeInt(), te::layout::EnumDataType::getDataTypeLong(), te::layout::EnumDataType::getDataTypeNone(), te::layout::EnumDataType::getDataTypeString(), te::layout::Enums::getEnumDataType(), and te::common::Singleton< Enums >::getInstance().
Referenced by te::layout::JSON::loadFromProperties(), and te::layout::JSON::searchProperty().
|
protectedvirtual |
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".
valueCopy | pointer of the value to be stored |
Definition at line 82 of file Variant.cpp.
References te::layout::EnumDataType::getDataTypeBool(), te::layout::EnumDataType::getDataTypeColor(), te::layout::EnumDataType::getDataTypeDouble(), te::layout::EnumDataType::getDataTypeFloat(), te::layout::EnumDataType::getDataTypeFont(), te::layout::EnumDataType::getDataTypeInt(), te::layout::EnumDataType::getDataTypeLong(), te::layout::EnumDataType::getDataTypeString(), te::layout::EnumDataType::getDataTypeStringList(), te::layout::Enums::getEnumDataType(), and te::common::Singleton< Enums >::getInstance().
Referenced by Variant().
|
virtual |
Definition at line 214 of file Variant.cpp.
References te::layout::EnumDataType::getDataTypeBool(), te::layout::EnumDataType::getDataTypeColor(), te::layout::EnumDataType::getDataTypeDouble(), te::layout::EnumDataType::getDataTypeFloat(), te::layout::EnumDataType::getDataTypeFont(), te::layout::EnumDataType::getDataTypeInt(), te::layout::EnumDataType::getDataTypeLong(), te::layout::EnumDataType::getDataTypeString(), te::layout::Enums::getEnumDataType(), te::common::Singleton< Enums >::getInstance(), and te::layout::EnumType::getName().
Referenced by te::layout::JSON::retrieve().
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().
|
virtual |
Return true if value is not of common C++ data type, false otherwise.
true | if 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.
Definition at line 351 of file Variant.cpp.
Referenced by te::layout::DialogPropertiesBrowser::getLayoutType().
|
inline |
Definition at line 323 of file Variant.h.
References getType(), toBool(), toColor(), toDouble(), toFloat(), toInt(), toLong(), and toString().
|
inline |
Definition at line 302 of file Variant.h.
References getType(), toBool(), toColor(), toDouble(), toFloat(), toInt(), toLong(), and toString().
|
inline |
Stores a copy of value.
value | copies the value to be stored |
type | data 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().
|
protectedvirtual |
Convert a string representation of a number into a double value.
str | string representation of a number |
Definition at line 424 of file Variant.cpp.
|
protectedvirtual |
Convert a string representation of a number into a float value.
str | string representation of a number |
Definition at line 468 of file Variant.cpp.
|
protectedvirtual |
Convert a string representation of a number into a int value.
str | string representation of a number |
Definition at line 446 of file Variant.cpp.
|
protectedvirtual |
Convert a string representation of a number into a long value.
str | string representation of a number |
Definition at line 490 of file Variant.cpp.
bool te::layout::Variant::toBool | ( | ) |
Returns the value of boolean type. (The setValue method received a boolean)
Definition at line 336 of file Variant.cpp.
Referenced by te::layout::VariantPropertiesBrowser::changeQtVariantPropertyValue(), te::layout::MenuBuilder::createMenu(), te::layout::TextGridSettingsOutside::initBool(), te::layout::GridSettingsOutside::initBool(), te::layout::TextGridSettingsOutside::initCombo(), te::layout::GridSettingsOutside::initCombo(), operator!=(), operator==(), te::layout::MapModel::updateProperties(), te::layout::GridMapModel::updateProperties(), and te::layout::ItemModelObservable::updateProperties().
|
protectedvirtual |
Convert a string value into a boolean representation of a string. Ex.: true, false.
str | string value |
Definition at line 525 of file Variant.cpp.
te::color::RGBAColor te::layout::Variant::toColor | ( | ) |
Returns the value of te::color::RGBAColor type. (The setValue method received a te::color::RGBAColor). Complex type.
Definition at line 341 of file Variant.cpp.
Referenced by te::layout::TextGridSettingsOutside::initColor(), te::layout::GridSettingsOutside::initColor(), operator!=(), operator==(), te::layout::LineModel::updateProperties(), te::layout::TitleModel::updateProperties(), te::layout::MapModel::updateProperties(), te::layout::LegendModel::updateProperties(), te::layout::GridMapModel::updateProperties(), and te::layout::ItemModelObservable::updateProperties().
double te::layout::Variant::toDouble | ( | ) |
Returns the value of double type. (The setValue method received a double)
Definition at line 316 of file Variant.cpp.
Referenced by te::layout::VariantPropertiesBrowser::changeQtVariantPropertyValue(), te::layout::AbstractBuildGraphicsItem::findCoordinate(), te::layout::TextGridSettingsOutside::initCombo(), te::layout::GridSettingsOutside::initCombo(), te::layout::TextGridSettingsOutside::initDouble(), te::layout::GridSettingsOutside::initDouble(), operator!=(), operator==(), te::layout::TitleModel::updateProperties(), te::layout::ScaleModel::updateProperties(), te::layout::MapModel::updateProperties(), te::layout::GridMapModel::updateProperties(), and te::layout::ItemModelObservable::updateProperties().
float te::layout::Variant::toFloat | ( | ) |
Returns the value of float type. (The setValue method received a float)
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.
Definition at line 346 of file Variant.cpp.
Referenced by te::layout::TextModel::updateProperties(), and te::layout::LegendModel::updateProperties().
int te::layout::Variant::toInt | ( | ) |
Returns the value of int type. (The setValue method received a int)
Definition at line 321 of file Variant.cpp.
Referenced by te::layout::VariantPropertiesBrowser::changeQtVariantPropertyValue(), te::layout::AbstractBuildGraphicsItem::findZValue(), te::layout::TextGridSettingsOutside::initCombo(), te::layout::GridSettingsOutside::initCombo(), te::layout::TextGridSettingsOutside::initInt(), te::layout::GridSettingsOutside::initInt(), operator!=(), operator==(), te::layout::TitleModel::updateProperties(), te::layout::GridMapModel::updateProperties(), and te::layout::ItemModelObservable::updateProperties().
long te::layout::Variant::toLong | ( | ) |
Returns the value of long type. (The setValue method received a long)
Definition at line 326 of file Variant.cpp.
Referenced by operator!=(), and operator==().
std::string te::layout::Variant::toString | ( | void | ) |
Returns the value of string type. (The setValue method received a string)
Definition at line 311 of file Variant.cpp.
Referenced by te::layout::VariantPropertiesBrowser::addAttribute(), te::layout::DialogPropertiesBrowser::addProperty(), te::layout::VariantPropertiesBrowser::changeQtVariantPropertyValue(), te::layout::TextGridSettingsOutside::initCombo(), te::layout::GridSettingsOutside::initCombo(), te::layout::TextGridSettingsOutside::initString(), te::layout::GridSettingsOutside::initString(), operator!=(), operator==(), te::layout::PointModel::updateProperties(), te::layout::TextModel::updateProperties(), te::layout::ImageModel::updateProperties(), te::layout::ScaleModel::updateProperties(), te::layout::MapModel::updateProperties(), te::layout::LegendModel::updateProperties(), te::layout::GridMapModel::updateProperties(), and te::layout::ItemModelObservable::updateProperties().
|
protectedvirtual |
Convert a int value into a string representation of a number.
value | int value |
Definition at line 517 of file Variant.cpp.
|
protected |
|
protected |
value of te::color::RGBAColor type
|
protected |
|
protected |
|
protected |
value of te::layout::Font type
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |