Inheritance diagram for code::DataCell:
DataRow uses this type for internal storage.
Public Member Functions | |
DataCell (const std::string &data="", const std::string &name="SomeCell", const std::string &unit="dimensionless") | |
Build from string data. | |
DataCell (double data, const std::string &name, const std::string &unit="dimensionless", const std::string &format="%g") | |
Build from numeric data. | |
double | value () const |
Return numeric value. | |
double | value (const std::string &units) const |
Return numeric value in the specified units. | |
std::string | str (const std::string &format="%s") const |
Return string value. | |
SmartPtr< std::string > | numericStr (const std::string &unit="dimensionless", const std::string &format="%g") const |
Do numeric conversion, unit conversion, and reformatting back to string. | |
DataColumn | column () const |
Return a DataColumn whose only element is value stored by this DataCell. | |
bool | modify (const W2Unit &val, const std::string &format="%g") |
Store a numeric value in this DataCell. | |
void | modify (const std::string &data) |
Store a string value in this DataCell. | |
DataField | clone () const |
Return a completely separate copy of this field. | |
const std::string & | name () const |
Return field ID. | |
const std::string & | unit () const |
Return default unit specifier. | |
bool | validUnit (const std::string &unit) const |
Return true only if the internal unit can be converted to the specified unit. | |
Static Public Attributes | |
static const size_t | bufferSize = 4096 |
Size of character buffer used internally for sprintf(). | |
Protected Attributes | |
std::string | myData |
Internal storage. | |
std::string | myName |
Field name. | |
std::string | myUnit |
Default unit specifier. | |
Friends | |
class | DataColumn |
bool | operator< (const DataField &a, const DataField &b) |
Allows you to sort DataField objects by their name. |
code::DataCell::DataCell | ( | const std::string & | data = "" , |
|
const std::string & | name = "SomeCell" , |
|||
const std::string & | unit = "dimensionless" | |||
) |
Build from string data.
By default make an empty string.
code::DataCell::DataCell | ( | double | data, | |
const std::string & | name, | |||
const std::string & | unit = "dimensionless" , |
|||
const std::string & | format = "%g" | |||
) |
Build from numeric data.
DataField code::DataField::clone | ( | ) | const [inline, inherited] |
DataColumn code::DataCell::column | ( | ) | const |
Return a DataColumn whose only element is value stored by this DataCell.
void code::DataCell::modify | ( | const std::string & | data | ) | [inline] |
Store a string value in this DataCell.
bool code::DataCell::modify | ( | const W2Unit & | val, | |
const std::string & | format = "%g" | |||
) |
Store a numeric value in this DataCell.
Return false on failed unit conversion; otherwise, return true.
const std::string& code::DataField::name | ( | ) | const [inline, inherited] |
Return field ID.
SmartPtr< std::string > code::DataCell::numericStr | ( | const std::string & | unit = "dimensionless" , |
|
const std::string & | format = "%g" | |||
) | const |
Do numeric conversion, unit conversion, and reformatting back to string.
For an illegal unit conversion, a NULL SmartPtr<string> is returned.
std::string code::DataCell::str | ( | const std::string & | format = "%s" |
) | const |
Return string value.
const std::string& code::DataField::unit | ( | ) | const [inline, inherited] |
Return default unit specifier.
bool code::DataField::validUnit | ( | const std::string & | unit | ) | const [inherited] |
Return true only if the internal unit can be converted to the specified unit.
double code::DataCell::value | ( | const std::string & | units | ) | const |
Return numeric value in the specified units.
double code::DataCell::value | ( | ) | const |
Return numeric value.
friend class DataColumn [friend] |
Allows you to sort DataField objects by their name.
const size_t code::DataField::bufferSize = 4096 [static, inherited] |
Size of character buffer used internally for sprintf().
std::string code::DataCell::myData [protected] |
Internal storage.
std::string code::DataField::myName [protected, inherited] |
Field name.
std::string code::DataField::myUnit [protected, inherited] |
Default unit specifier.