KSpreadValue Class Reference
Provides a wrapper for cell value. More...
#include <kspread_value.h>
Public Types | |
enum | Type { Empty, Boolean, Integer, Float, String, Array, CellRange, Error } |
enum | Format { fmt_None, fmt_Boolean, fmt_Number, fmt_Percent, fmt_Money, fmt_DateTime, fmt_Date, fmt_Time, fmt_String } |
Public Member Functions | |
KSpreadValue () | |
KSpreadValue (Type _type) | |
virtual | ~KSpreadValue () |
KSpreadValue (const KSpreadValue &_value) | |
KSpreadValue & | operator= (const KSpreadValue &_value) |
KSpreadValue & | assign (const KSpreadValue &_value) |
KSpreadValue (bool b) | |
KSpreadValue (long i) | |
KSpreadValue (int i) | |
KSpreadValue (double f) | |
KSpreadValue (const QString &s) | |
KSpreadValue (const QDateTime &dt) | |
KSpreadValue (const QTime &time) | |
KSpreadValue (const QDate &date) | |
KSpreadValue (unsigned columns, unsigned rows) | |
Type | type () const |
Format | format () const |
bool | isEmpty () const |
bool | isBoolean () const |
bool | isInteger () const |
bool | isFloat () const |
bool | isNumber () const |
bool | isString () const |
bool | isArray () const |
bool | isError () const |
void | setValue (const KSpreadValue &v) |
void | setValue (bool b) |
void | setValue (long i) |
void | setValue (int i) |
void | setValue (double f) |
void | setValue (const QString &s) |
void | setError (const QString &msg) |
void | setValue (const QDateTime &dt) |
void | setValue (const QTime &dt) |
void | setValue (const QDate &dt) |
void | setFormat (Format fmt) |
bool | asBoolean () const |
long | asInteger () const |
double | asFloat () const |
QString | asString () const |
QDateTime | asDateTime () const |
QDate | asDate () const |
QTime | asTime () const |
KSpreadValue | element (unsigned column, unsigned row) const |
void | setElement (unsigned column, unsigned row, const KSpreadValue &value) |
unsigned | columns () const |
unsigned | rows () const |
QString | errorMessage () const |
void | detach () |
bool | allowComparison (const KSpreadValue &v) const |
int | compare (const KSpreadValue &v) const |
bool | equal (const KSpreadValue &v) const |
bool | less (const KSpreadValue &v) const |
bool | greater (const KSpreadValue &v) const |
bool | isZero () const |
Static Public Member Functions | |
static const KSpreadValue & | empty () |
static const KSpreadValue & | errorDIV0 () |
static const KSpreadValue & | errorNA () |
static const KSpreadValue & | errorNAME () |
static const KSpreadValue & | errorNUM () |
static const KSpreadValue & | errorNULL () |
static const KSpreadValue & | errorREF () |
static const KSpreadValue & | errorVALUE () |
static int | compare (double v1, double v2) |
static bool | isZero (double v) |
Protected Attributes | |
KSpreadValueData * | d |
Detailed Description
Provides a wrapper for cell value.Each cell in a worksheet must hold a value, either as enterred by user or as a result of formula evaluation. Default cell holds empty value.
KSpreadValue uses implicit data sharing to reduce memory usage.
Definition at line 39 of file kspread_value.h.
Constructor & Destructor Documentation
|
Creates an empty value, i.e holds nothing.
Definition at line 198 of file kspread_value.cc. Referenced by element(), and setElement(). |
|
Creates a value of certain type.
Definition at line 210 of file kspread_value.cc. |
|
Destroys the value.
Definition at line 204 of file kspread_value.cc. |
|
Creates a copy from another value.
Definition at line 218 of file kspread_value.cc. References assign(). |
|
Creates a boolean value.
Definition at line 231 of file kspread_value.cc. References setValue(). |
|
Creates an integer value.
Definition at line 238 of file kspread_value.cc. References setValue(). |
|
Creates an integer value.
Definition at line 245 of file kspread_value.cc. References setValue(). |
|
Create a floating-point value.
Definition at line 252 of file kspread_value.cc. References setValue(). |
|
Create a string value.
Definition at line 259 of file kspread_value.cc. References setValue(). |
|
Create a floating-point value from date/time. Internally date/time is represented as serial-number, i.e number of elapsed day since reference date. Day 61 is defined as March 1, 1900. Definition at line 266 of file kspread_value.cc. References setValue(). |
|
Create a floating-point value from time. See also note above. Definition at line 273 of file kspread_value.cc. References setValue(). |
|
Create a floating-point value from date. See also note above. Definition at line 280 of file kspread_value.cc. References setValue(). |
|
Create an array of values.
Definition at line 287 of file kspread_value.cc. |
Member Function Documentation
|
Assigns from another value. Because the data is implicitly shared, such assignment is very fast and doesn't consume additional memory. Definition at line 225 of file kspread_value.cc. References assign(). |
|
Assigns from another value. Same as above. Definition at line 298 of file kspread_value.cc. Referenced by KSpreadValue(), operator=(), and setValue(). |
|
Returns the type of the value.
Definition at line 307 of file kspread_value.cc. Referenced by allowComparison(), asBoolean(), asFloat(), asInteger(), asString(), compare(), errorMessage(), and KSpreadCell::setValue(). |
|
Returns the format of the value (i.e. how should it be interpreted) Definition at line 497 of file kspread_value.cc. Referenced by KSpread::ValueCalc::add(), and KSpread::ValueFormatter::determineFormatting(). |
|
Returns true if empty.
Definition at line 160 of file kspread_value.h. |
|
Returns true if the type of this value is Boolean.
Definition at line 165 of file kspread_value.h. Referenced by KSpread::ValueFormatter::determineFormatting(). |
|
Returns true if the type of this value is integer.
Definition at line 170 of file kspread_value.h. |
|
Returns true if the type of this value is floating-point.
Definition at line 175 of file kspread_value.h. |
|
Returns true if the type of this value is either integer or floating-point.
Definition at line 181 of file kspread_value.h. Referenced by KSpread::ValueCalc::add(). |
|
Returns true if the type of this value is string.
Definition at line 186 of file kspread_value.h. Referenced by KSpread::ValueFormatter::determineFormatting(). |
|
Returns true if the type of this value is array.
Definition at line 191 of file kspread_value.h. Referenced by KSpread::ValueFormatter::formatText(), and KSpread::ValueCalc::sum(). |
|
Returns true if this value holds error information.
Definition at line 196 of file kspread_value.h. Referenced by errorDIV0(), errorNA(), errorNAME(), errorNULL(), errorNUM(), errorREF(), and errorVALUE(). |
|
Sets this value to another value.
Definition at line 364 of file kspread_value.cc. References assign(). Referenced by KSpreadValue(), KSpread::ValueParser::parse(), and setValue(). |
|
Sets this value to boolean value.
Definition at line 313 of file kspread_value.cc. References detach(). |
|
Sets this value to integer value.
Definition at line 333 of file kspread_value.cc. References detach(). |
|
Sets this value to integer value.
Definition at line 342 of file kspread_value.cc. References detach(). |
|
Sets this value to floating-point value.
Definition at line 370 of file kspread_value.cc. References detach(). |
|
Sets this value to string value.
Definition at line 393 of file kspread_value.cc. References detach(). |
|
Sets this value to hold error message.
Definition at line 414 of file kspread_value.cc. References detach(). Referenced by KSpreadCell::calc(), errorDIV0(), errorNA(), errorNAME(), errorNULL(), errorNUM(), errorREF(), errorVALUE(), and KSpreadCell::makeFormula(). |
|
Sets this value to floating-point number representing the date/time.
Definition at line 436 of file kspread_value.cc. References setValue(). |
|
Sets this value to floating-point number representing the date.
Definition at line 449 of file kspread_value.cc. References setValue(). |
|
Sets this value to floating-point number representing the time.
Definition at line 459 of file kspread_value.cc. References setValue(). |
|
Sets format information for this value.
Definition at line 502 of file kspread_value.cc. Referenced by KSpread::ValueCalc::add(), KSpread::ValueCalc::log(), KSpread::ValueParser::parse(), and KSpread::ValueCalc::sum(). |
|
Returns the boolean value of this value. Call this function only if isBoolean() returns true. Definition at line 322 of file kspread_value.cc. References type(). Referenced by compare(). |
|
Returns the integer value of this value. Call this function only if isNumber() returns true. Definition at line 351 of file kspread_value.cc. References type(). Referenced by compare(). |
|
Returns the floating-point value of this value. Call this function only if isNumber() returns true. Definition at line 379 of file kspread_value.cc. References type(). Referenced by asDate(), asTime(), compare(), KSpread::ValueFormatter::determineFormatting(), and KSpread::ValueFormatter::formatText(). |
|
Returns the string value of this value. Call this function only if isString() returns true. Definition at line 402 of file kspread_value.cc. References type(). Referenced by compare(). |
|
Returns the date/time representation of this value.
Definition at line 470 of file kspread_value.cc. References asDate(), and asTime(). Referenced by KSpread::ValueFormatter::formatText(). |
|
Returns the date representation of this value.
Definition at line 476 of file kspread_value.cc. References asFloat(). Referenced by asDateTime(), and KSpread::ValueFormatter::formatText(). |
|
Returns the time representation of this value.
Definition at line 487 of file kspread_value.cc. References asFloat(). Referenced by asDateTime(). |
|
Return an element in the array value. Do not call if isArray() is false. Definition at line 507 of file kspread_value.cc. References empty(), and KSpreadValue(). Referenced by KSpread::ValueFormatter::formatText(), and KSpread::ValueCalc::sum(). |
|
Sets an element in the array value. Do not use if isArray() is false. Definition at line 515 of file kspread_value.cc. References detach(), and KSpreadValue(). |
|
If this value is an array, return the number of columns. Note that return value is undefined if isArray() returns false. Definition at line 523 of file kspread_value.cc. Referenced by KSpread::ValueCalc::sum(). |
|
If this value is an array, return the number of rows. Note that return value is undefined if isArray() returns false. Definition at line 530 of file kspread_value.cc. Referenced by KSpread::ValueCalc::sum(). |
|
Returns error message associated with this value. Call this function only if isError() returns true. Definition at line 422 of file kspread_value.cc. References type(). Referenced by compare(). |
|
Detaches itself from shared value data, i.e make a private, deep copy of the data. Usually this function is called automatically so you don't have to care about it. Definition at line 600 of file kspread_value.cc. Referenced by setElement(), setError(), and setValue(). |
|
Returns constant reference to empty value.
Definition at line 538 of file kspread_value.cc. Referenced by KSpreadCell::calc(), KSpreadCell::checkTextInput(), element(), and KSpreadCell::~KSpreadCell(). |
|
Returns constant reference to #DIV/0! error. This is used to indicate that a formula divides by 0 (zero). Definition at line 544 of file kspread_value.cc. References isError(), and setError(). Referenced by KSpread::ValueCalc::log(). |
|
Returns constant reference to #N/A error. This is to indicate that a value is not available to a function. Definition at line 552 of file kspread_value.cc. References isError(), and setError(). Referenced by KSpread::ValueCalc::log(). |
|
Returns constant reference to #NAME? error. This is to indicate that certain text inside formula is not recognized, possibly a misspelled name or name that does not exist. Definition at line 560 of file kspread_value.cc. References isError(), and setError(). |
|
Returns constant reference to #NUM! error. This is to indicate a problem with a number in a formula. Definition at line 568 of file kspread_value.cc. References isError(), and setError(). |
|
Returns constant reference to #NULL! error. This is to indicate that two area do not intersect. Definition at line 576 of file kspread_value.cc. References isError(), and setError(). |
|
Returns constant reference to #REF! error. This is used to indicate an invalid cell reference. Definition at line 584 of file kspread_value.cc. References isError(), and setError(). |
|
Returns constant reference to #VALUE! error. This is to indicate that wrong type of argument or operand is used, usually within a function call, e.g SIN("some text"). Definition at line 592 of file kspread_value.cc. References isError(), and setError(). |
|
Returns true if it is OK to compare this value with v. If this function returns false, then return value of compare is undefined. Definition at line 644 of file kspread_value.cc. References type(). |
|
Returns -1, 0, 1, depends whether this value is less than, equal to, or greater than v.
Definition at line 677 of file kspread_value.cc. References asBoolean(), asFloat(), asInteger(), asString(), errorMessage(), and type(). |
|
Returns true if this value is equal to v.
Definition at line 783 of file kspread_value.cc. References compare(). |
|
Returns true if this value is less than v.
Definition at line 788 of file kspread_value.cc. References compare(). |
|
Returns true if this value is greater than v.
Definition at line 793 of file kspread_value.cc. References compare(). |
The documentation for this class was generated from the following files: