kspread
KSpread::Value Class Reference
#include <kspread_value.h>
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.
Value uses implicit data sharing to reduce memory usage.
Definition at line 41 of file 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 | |
Value () | |
Value (Type _type) | |
virtual | ~Value () |
Value (const Value &_value) | |
Value & | operator= (const Value &_value) |
Value & | assign (const Value &_value) |
Value (bool b) | |
Value (long i) | |
Value (int i) | |
Value (double f) | |
Value (const QString &s) | |
Value (const char *s) | |
Value (const QDateTime &dt) | |
Value (const QTime &time) | |
Value (const QDate &date) | |
Value (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 Value &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 |
Value | element (unsigned column, unsigned row) const |
void | setElement (unsigned column, unsigned row, const Value &value) |
unsigned | columns () const |
unsigned | rows () const |
QString | errorMessage () const |
void | detach () |
bool | allowComparison (const Value &v) const |
int | compare (const Value &v) const |
bool | equal (const Value &v) const |
bool | less (const Value &v) const |
bool | greater (const Value &v) const |
bool | operator== (const Value &v) const |
bool | isZero () const |
Static Public Member Functions | |
static const Value & | empty () |
static const Value & | errorDIV0 () |
static const Value & | errorNA () |
static const Value & | errorNAME () |
static const Value & | errorNUM () |
static const Value & | errorNULL () |
static const Value & | errorREF () |
static const Value & | errorVALUE () |
static int | compare (double v1, double v2) |
static bool | isZero (double v) |
Protected Attributes | |
ValueData * | d |
Constructor & Destructor Documentation
|
Creates an empty value, i.e holds nothing.
Definition at line 292 of file kspread_value.cc. |
|
Creates a value of certain type.
Definition at line 304 of file kspread_value.cc. |
|
Destroys the value.
Definition at line 298 of file kspread_value.cc. |
|
Creates a copy from another value.
Definition at line 312 of file kspread_value.cc. |
|
Creates a boolean value.
Definition at line 346 of file kspread_value.cc. |
|
Creates an integer value.
Definition at line 353 of file kspread_value.cc. |
|
Creates an integer value.
Definition at line 360 of file kspread_value.cc. |
|
Create a floating-point value.
Definition at line 367 of file kspread_value.cc. |
|
Create a string value.
Definition at line 374 of file kspread_value.cc. |
|
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 388 of file kspread_value.cc. |
|
Create a floating-point value from time. See also note above. Definition at line 395 of file kspread_value.cc. |
|
Create a floating-point value from date. See also note above. Definition at line 402 of file kspread_value.cc. |
|
Create an array of values.
Definition at line 409 of file kspread_value.cc. |
Member Function Documentation
|
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 766 of file kspread_value.cc. |
|
Returns the boolean value of this value. Call this function only if isBoolean() returns true. Definition at line 444 of file kspread_value.cc. |
|
Returns the date representation of this value.
Definition at line 598 of file kspread_value.cc. |
|
Returns the date/time representation of this value.
Definition at line 592 of file kspread_value.cc. |
|
Returns the floating-point value of this value. Call this function only if isNumber() returns true. Definition at line 501 of file kspread_value.cc. |
|
Returns the integer value of this value. Call this function only if isNumber() returns true. Definition at line 473 of file kspread_value.cc. |
|
Assigns from another value. Same as above. Definition at line 420 of file kspread_value.cc. |
|
Returns the string value of this value. Call this function only if isString() returns true. Definition at line 524 of file kspread_value.cc. |
|
Returns the time representation of this value.
Definition at line 609 of file kspread_value.cc. |
|
If this value is an array, return the number of columns. Returns 1 if isArray() returns false. Definition at line 645 of file kspread_value.cc. |
|
Returns -1, 0, 1, depends whether this value is less than, equal to, or greater than v.
Definition at line 802 of file kspread_value.cc. |
|
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 722 of file kspread_value.cc. |
|
Return an element in the array value.
Definition at line 629 of file kspread_value.cc. |
|
Returns constant reference to empty value.
Definition at line 660 of file kspread_value.cc. |
|
Returns true if this value is equal to v.
Definition at line 908 of file kspread_value.cc. |
|
Returns constant reference to DIV/0! error. This is used to indicate that a formula divides by 0 (zero). Definition at line 666 of file kspread_value.cc. |
|
Returns error message associated with this value. Call this function only if isError() returns true. Definition at line 544 of file kspread_value.cc. |
|
Returns constant reference to N/A error. This is to indicate that a value is not available to a function. Definition at line 674 of file kspread_value.cc. |
|
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 682 of file kspread_value.cc. |
|
Returns constant reference to NULL! error. This is to indicate that two area do not intersect. Definition at line 698 of file kspread_value.cc. |
|
Returns constant reference to NUM! error. This is to indicate a problem with a number in a formula. Definition at line 690 of file kspread_value.cc. |
|
Returns constant reference to REF! error. This is used to indicate an invalid cell reference. Definition at line 706 of file kspread_value.cc. |
|
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 714 of file kspread_value.cc. |
|
Returns the format of the value (i.e. how should it be interpreted) Definition at line 619 of file kspread_value.cc. |
|
Returns true if this value is greater than v.
Definition at line 920 of file kspread_value.cc. |
|
Returns true if the type of this value is array.
Definition at line 194 of file kspread_value.h. |
|
Returns true if the type of this value is Boolean.
Definition at line 168 of file kspread_value.h. |
|
Returns true if empty.
Definition at line 163 of file kspread_value.h. |
|
Returns true if this value holds error information.
Definition at line 199 of file kspread_value.h. |
|
Returns true if the type of this value is floating-point.
Definition at line 178 of file kspread_value.h. |
|
Returns true if the type of this value is integer.
Definition at line 173 of file kspread_value.h. |
|
Returns true if the type of this value is either integer or floating-point.
Definition at line 184 of file kspread_value.h. |
|
Returns true if the type of this value is string.
Definition at line 189 of file kspread_value.h. |
|
Returns true if this value is less than v.
Definition at line 914 of file kspread_value.cc. |
|
Assigns from another value. Because the data is implicitly shared, such assignment is very fast and doesn't consume additional memory. Definition at line 319 of file kspread_value.cc. |
|
If this value is an array, return the number of rows. Returns 1 if isArray() returns false. Definition at line 652 of file kspread_value.cc. |
|
Sets an element in the array value. Do not use if isArray() is false. Definition at line 637 of file kspread_value.cc. |
|
Sets this value to hold error message.
Definition at line 536 of file kspread_value.cc. |
|
Sets format information for this value.
Definition at line 624 of file kspread_value.cc. |
|
Sets this value to floating-point number representing the time.
Definition at line 581 of file kspread_value.cc. |
|
Sets this value to floating-point number representing the date.
Definition at line 571 of file kspread_value.cc. |
|
Sets this value to floating-point number representing the date/time.
Definition at line 558 of file kspread_value.cc. |
|
Sets this value to string value.
Definition at line 515 of file kspread_value.cc. |
|
Sets this value to floating-point value.
Definition at line 492 of file kspread_value.cc. |
|
Sets this value to integer value.
Definition at line 464 of file kspread_value.cc. |
|
Sets this value to integer value.
Definition at line 455 of file kspread_value.cc. |
|
Sets this value to boolean value.
Definition at line 435 of file kspread_value.cc. |
|
Sets this value to another value.
Definition at line 486 of file kspread_value.cc. |
|
Returns the type of the value.
Definition at line 429 of file kspread_value.cc. |
The documentation for this class was generated from the following files: