filters

Swinder::Value Class Reference

#include <value.h>

List of all members.


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 42 of file value.h.


Public Types

enum  Type {
  Empty, Boolean, Integer, Float,
  String, CellRange, Array, Error
}

Public Member Functions

 Value ()
 Value (Type _type)
virtual ~Value ()
 Value (const Value &_value)
Valueoperator= (const Value &_value)
Valueassign (const Value &_value)
 Value (bool b)
 Value (int i)
 Value (double f)
 Value (const UString &s)
Type type () const
bool isEmpty () const
bool isBoolean () const
bool isInteger () const
bool isFloat () const
bool isNumber () const
bool isString () const
bool isError () const
void setValue (const Value &v)
void setValue (bool b)
void setValue (int i)
void setValue (double f)
void setValue (const UString &s)
void setError (const UString &msg)
bool asBoolean () const
int asInteger () const
double asFloat () const
UString asString () const
UString errorMessage () const
void detach ()

Static Public Member Functions

static const Valueempty ()
static const ValueerrorDIV0 ()
static const ValueerrorNA ()
static const ValueerrorNAME ()
static const ValueerrorNUM ()
static const ValueerrorNULL ()
static const ValueerrorREF ()
static const ValueerrorVALUE ()

Protected Attributes

ValueData * d

Constructor & Destructor Documentation

Value::Value (  ) 

Creates an empty value, i.e holds nothing.

Definition at line 96 of file value.cpp.

Value::Value ( Type  _type  ) 

Creates a value of certain type.

Definition at line 108 of file value.cpp.

Value::~Value (  )  [virtual]

Destroys the value.

Definition at line 102 of file value.cpp.

Value::Value ( const Value _value  ) 

Creates a copy from another value.

Definition at line 115 of file value.cpp.

Value::Value ( bool  b  ) 

Creates a boolean value.

Definition at line 128 of file value.cpp.

Value::Value ( int  i  ) 

Creates an integer value.

Definition at line 135 of file value.cpp.

Value::Value ( double  f  ) 

Create a floating-point value.

Definition at line 142 of file value.cpp.

Value::Value ( const UString s  ) 

Create a string value.

Definition at line 149 of file value.cpp.


Member Function Documentation

Value & Value::operator= ( const Value _value  ) 

Assigns from another value.

Because the data is implicitly shared, such assignment is very fast and doesn't consume additional memory.

Definition at line 122 of file value.cpp.

Value & Value::assign ( const Value _value  ) 

Assigns from another value.

Same as above.

Definition at line 157 of file value.cpp.

Value::Type Value::type (  )  const

Returns the type of the value.

Definition at line 166 of file value.cpp.

bool Swinder::Value::isEmpty (  )  const [inline]

Returns true if empty.

Definition at line 119 of file value.h.

bool Swinder::Value::isBoolean (  )  const [inline]

Returns true if the type of this value is Boolean.

Definition at line 124 of file value.h.

bool Swinder::Value::isInteger (  )  const [inline]

Returns true if the type of this value is integer.

Definition at line 129 of file value.h.

bool Swinder::Value::isFloat (  )  const [inline]

Returns true if the type of this value is floating-point.

Definition at line 134 of file value.h.

bool Swinder::Value::isNumber (  )  const [inline]

Returns true if the type of this value is either integer or floating-point.

Definition at line 140 of file value.h.

bool Swinder::Value::isString (  )  const [inline]

Returns true if the type of this value is string.

Definition at line 145 of file value.h.

bool Swinder::Value::isError (  )  const [inline]

Returns true if this value holds error information.

Definition at line 150 of file value.h.

void Value::setValue ( bool  b  ) 

Sets this value to boolean value.

Definition at line 172 of file value.cpp.

void Value::setValue ( int  i  ) 

Sets this value to integer value.

Definition at line 191 of file value.cpp.

void Value::setValue ( double  f  ) 

Sets this value to floating-point value.

Definition at line 218 of file value.cpp.

void Value::setValue ( const UString s  ) 

Sets this value to string value.

Definition at line 240 of file value.cpp.

void Value::setError ( const UString msg  ) 

Sets this value to hold error message.

Definition at line 259 of file value.cpp.

bool Value::asBoolean (  )  const

Returns the boolean value of this value.

Call this function only if isBoolean() returns true.

Definition at line 180 of file value.cpp.

int Value::asInteger (  )  const

Returns the integer value of this value.

Call this function only if isNumber() returns true.

Definition at line 199 of file value.cpp.

double Value::asFloat (  )  const

Returns the floating-point value of this value.

Call this function only if isNumber() returns true.

Definition at line 226 of file value.cpp.

UString Value::asString (  )  const

Returns the string value of this value.

Call this function only if isString() returns true.

Definition at line 248 of file value.cpp.

UString Value::errorMessage (  )  const

Returns error message associated with this value.

Call this function only if isError() returns true.

Definition at line 267 of file value.cpp.

void Value::detach (  ) 

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 340 of file value.cpp.

const Value & Value::empty (  )  [static]

Returns constant reference to empty value.

Definition at line 278 of file value.cpp.

const Value & Value::errorDIV0 (  )  [static]

Returns constant reference to DIV/0! error.

This is used to indicate that a formula divides by 0 (zero).

Definition at line 284 of file value.cpp.

const Value & Value::errorNA (  )  [static]

Returns constant reference to N/A error.

This is to indicate that a value is not available to a function.

Definition at line 292 of file value.cpp.

const Value & Value::errorNAME (  )  [static]

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 300 of file value.cpp.

const Value & Value::errorNUM (  )  [static]

Returns constant reference to NUM! error.

This is to indicate a problem with a number in a formula.

Definition at line 308 of file value.cpp.

const Value & Value::errorNULL (  )  [static]

Returns constant reference to NULL! error.

This is to indicate that two area do not intersect.

Definition at line 316 of file value.cpp.

const Value & Value::errorREF (  )  [static]

Returns constant reference to REF! error.

This is used to indicate an invalid cell reference.

Definition at line 324 of file value.cpp.

const Value & Value::errorVALUE (  )  [static]

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 332 of file value.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys