libqalculate-5.4.0
DataObject Class Reference

A a data set object. More...

#include <DataSet.h>

Public Member Functions

 DataObject (DataSet *parent_set)
 
void eraseProperty (DataProperty *property)
 
void setProperty (DataProperty *property, std::string s_value, int is_approximate=-1)
 
void setNonlocalizedKeyProperty (DataProperty *property, std::string s_value)
 
const MathStructuregetPropertyStruct (DataProperty *property)
 
const std::string & getProperty (DataProperty *property, int *is_approximate=NULL)
 
const std::string & getNonlocalizedKeyProperty (DataProperty *property)
 
std::string getPropertyInputString (DataProperty *property)
 
std::string getPropertyDisplayString (DataProperty *property)
 
bool isUserModified () const
 
void setUserModified (bool user_modified=true)
 
DataSetparentSet () const
 

Protected Attributes

std::vector< DataProperty * > properties
 
std::vector< std::string > s_properties
 
std::vector< std::string > s_nonlocalized_properties
 
std::vector< MathStructure * > m_properties
 
std::vector< int > a_properties
 
DataSetparent
 
bool b_uchanged
 

Detailed Description

A a data set object.

Data objects consist of property-value pairs.

Constructor & Destructor Documentation

◆ DataObject()

DataObject::DataObject ( DataSet * parent_set)

Create a data object.

Parameters
parent_setData set that the object will belong to.

Member Function Documentation

◆ eraseProperty()

void DataObject::eraseProperty ( DataProperty * property)

Unset (erase value) a property.

Parameters
propertyProperty to unset.

◆ getNonlocalizedKeyProperty()

const std::string & DataObject::getNonlocalizedKeyProperty ( DataProperty * property)

Returns unparsed untranslated value for a key property. Used when a text value is translated, but the original value still is needed as a reference key.

Parameters
propertyProperty to read.
Returns
Unparsed untranslated value or empty string if property value is not set.

◆ getProperty()

const std::string & DataObject::getProperty ( DataProperty * property,
int * is_approximate = NULL )

Returns unparsed value for a property.

Parameters
propertyProperty to read.
[out]is_approximateIf the value is approximate. Is set to 1 for approximate, 0 for exact, -1 for property default, if not NULL.
Returns
Unparsed value or empty string if property value is not set.

◆ getPropertyDisplayString()

std::string DataObject::getPropertyDisplayString ( DataProperty * property)

Returns value for a property in a format suitable for display with unit appended.

Parameters
propertyProperty to read.
Returns
Value in display format or empty string if property value is not set.

◆ getPropertyInputString()

std::string DataObject::getPropertyInputString ( DataProperty * property)

Returns value for a property in a format suitable for use in expressions with unit appended.

Parameters
propertyProperty to read.
Returns
Value in input format or empty string if property value is not set.

◆ getPropertyStruct()

const MathStructure * DataObject::getPropertyStruct ( DataProperty * property)

Returns parsed value for a property. Parses the text string value if not parsed before

Parameters
propertyProperty to read.
Returns
Parsed value or NULL if property value is not set.

◆ isUserModified()

bool DataObject::isUserModified ( ) const

If the object has been modified by the end user (if setUserModified() has been called).

Returns
true if the object has been modified by the user.

◆ parentSet()

DataSet * DataObject::parentSet ( ) const

Returns the data set that the object belongs to.

Returns
Parent data set.

◆ setNonlocalizedKeyProperty()

void DataObject::setNonlocalizedKeyProperty ( DataProperty * property,
std::string s_value )

Set an untranslated value for a key property. Used when a text value is translated, but the original value still is needed as a reference key.

Parameters
propertyProperty to set (must belong to parent data set).
s_valueValue for the property.

◆ setProperty()

void DataObject::setProperty ( DataProperty * property,
std::string s_value,
int is_approximate = -1 )

Set value for a property.

Parameters
propertyProperty to set (must belong to parent data set).
s_valueValue for the property.
is_approximateIf the value is approximate. 1 for approximate, 0 for exact, -1 for property default.

◆ setUserModified()

void DataObject::setUserModified ( bool user_modified = true)

Specify if the object has been modified by the end user.

Parameters
user_modifiedtrue if the object has been modified by the user.

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