39 #ifndef __TERRALIB_LAYOUT_INTERNAL_VARIANT_H
40 #define __TERRALIB_LAYOUT_INTERNAL_VARIANT_H
43 #include "../enum/AbstractType.h"
44 #include "../../../color/RGBAColor.h"
46 #include "../enum/EnumType.h"
47 #include "../Config.h"
56 #include <boost/property_tree/ptree.hpp>
108 template <
typename ValueType>
109 void setValue(ValueType value,
EnumType* type);
114 virtual void fromPtree(boost::property_tree::ptree tree,
EnumType* type);
126 virtual bool isComplex();
133 std::string toString();
189 virtual std::string convertToString();
201 virtual void clear();
215 template <
typename ValueType>
216 void variantSetValue(
Variant &v,
const ValueType& value,
EnumType* type);
224 virtual void convertValue(
const void* valueCopy);
232 virtual double string2Double(std::string str);
240 virtual int string2Int(std::string str);
248 virtual float string2Float(std::string str);
256 virtual long string2Long(std::string str);
264 virtual std::string toString(
int value);
272 virtual bool toBool(std::string str);
287 template<
typename ValueType>
291 variantSetValue(*
this, v, type);
295 template <
typename ValueType>
297 const ValueType& value,
EnumType* type )
306 if(getType() == otherProp.
getType())
308 if(m_sValue == otherProp.
toString() &&
310 m_iValue == otherProp.
toInt() &&
311 m_lValue == otherProp.
toLong() &&
312 m_fValue == otherProp.
toFloat() &&
313 m_bValue == otherProp.
toBool() &&
314 m_colorValue == otherProp.
toColor()
327 if(getType() != otherProp.
getType())
332 if(getType() == otherProp.
getType())
334 if(m_sValue != otherProp.
toString() ||
336 m_iValue != otherProp.
toInt() ||
337 m_lValue != otherProp.
toLong() ||
338 m_fValue != otherProp.
toFloat() ||
339 m_colorValue != otherProp.
toColor()
346 if(m_bValue != otherProp.
toBool())
float m_fValue
value of float type
EnumType * getType()
Returns data type of this object.
#define TELAYOUTEXPORT
You can use this macro in order to export/import classes and functions from this module.
bool operator!=(const Variant &other)
te::da::Expression * operator==(const te::da::Expression &e1, const te::da::Expression &e2)
bool m_complex
true if value is not of common C++ data type, false otherwise
float toFloat()
Returns the value of float type. (The setValue method received a float)
EnumType * m_type
data type of this object
te::color::RGBAColor m_colorValue
value of te::color::RGBAColor type
Class acts like a union for some C++/TerraLib5 data types. Responsible for storing the value...
te::da::Expression * operator!=(const te::da::Expression &e1, const te::da::Expression &e2)
std::string m_sValue
value of string type
double toDouble()
Returns the value of double type. (The setValue method received a double)
bool m_null
true if no value has been set, false otherwise
void variantSetValue(Variant &v, const ValueType &value, EnumType *type)
Stores a copy of value.
bool operator==(const Variant &other)
double m_dValue
value of double type
Class that represents the value of an enumeration. An enumeration is made of "1..n" objects EnumType...
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
std::string toString()
Returns the value of string type. (The setValue method received a string)
long m_lValue
value of long type
Font m_fontValue
value of te::layout::Font type
te::color::RGBAColor toColor()
Returns the value of te::color::RGBAColor type. (The setValue method received a te::color::RGBAColor)...
long toLong()
Returns the value of long type. (The setValue method received a long)
bool m_bValue
value of boolean type
int m_iValue
value of int type
int toInt()
Returns the value of int type. (The setValue method received a int)
bool toBool()
Returns the value of boolean type. (The setValue method received a boolean)
void setValue(ValueType value, EnumType *type)
Stores a copy of value.