Value Struct Reference

An XML value, used to represent typed XML PCDATA elements. More...

#include <value.h>

List of all members.

Public Member Functions

 Value ()
 Constructor.
 Value (const char *_str_val)
 Constructor.
 Value (long double _num_val)
 Constructor.
virtual ~Value ()
const char * getStrVal ()
 Returns the string representation of this value.
long double getNumVal ()
 Returns the numeric representation of this value.
VALUE_TYPE getType ()
 Returns the type of the Value object.
void setStrVal (const char *_str_val)
 Initializes the str_val member variable.
void setNumVal (long double _num_val)
 Initializes the num_val member variable.
void reset ()
 Resets the data structure.

Public Attributes

const char * str_val
 Field to store the string value.
long double num_val
 Field to store the numeric value.
VALUE_TYPE type
 Specifies the type of instantiated objects.


Detailed Description

An XML value, used to represent typed XML PCDATA elements.

GCX currently supports to basic types, namely xsd::string and xsd::numeric. This struct provides fields for both string and numeric content and automatically casts values if requested.

Note:
The GCX type system is not complete, but implements a minimalistic but useful part of the XML/XQuery type system.
Author:
Michael Schmidt

Gunnar Jehl

Version:
2.1
License:
Software License Agreement (BSD License)

Definition at line 54 of file value.h.


Constructor & Destructor Documentation

Value::Value (  ) 

Constructor.

Constructor - creating object.

Definition at line 37 of file value.cpp.

Value::Value ( const char *  _str_val  ) 

Constructor.

Constructor - creating object for a value of type xsd::string.

Parameters:
[in] _str_val Pointer to a char object.

Definition at line 40 of file value.cpp.

Value::Value ( long double  _num_val  ) 

Constructor.

Constructor - creating object for a value of type xsd::numeric.

Parameters:
[in] _num_val Numeric value.

Definition at line 45 of file value.cpp.

Value::~Value (  )  [virtual]

Destructor.

Definition at line 50 of file value.cpp.

References reset().


Member Function Documentation

long double Value::getNumVal (  )  [inline]

Returns the numeric representation of this value.

If the field xsd_numeric is not initialized, a cast will be triggered, trying to convert xsd_string into a numeric value.

Return values:
long double The numeric representations of this value, if any.
Exceptions:
Throws an error (InvalidCastException) if the string cannot be converted.

Definition at line 92 of file value.h.

Referenced by FunctTruncateExpression::calculateValue(), FunctRoundHalfToEvenExpression::calculateValue(), FunctRoundExpression::calculateValue(), FunctFloorExpression::calculateValue(), FunctCoverExpression::calculateValue(), FunctCeilingExpression::calculateValue(), FunctAbsExpression::calculateValue(), and CondOperandExpression::evalRelOp().

const char * Value::getStrVal (  )  [inline]

Returns the string representation of this value.

Straightforwardly returns the corresponding field of the struct.

Return values:
const char* Pointer to the string representation of this value.

Definition at line 83 of file value.h.

References str_val.

Referenced by CondOperandExpression::evalRelOp().

VALUE_TYPE Value::getType (  )  [inline]

Returns the type of the Value object.

Due to the minimalistic type system, this will either be either xsd_string, xsd_numeric.

Return values:
VALUE_TYPE The type of the Value object.

Definition at line 109 of file value.h.

References type.

Referenced by FunctTruncateExpression::calculateValue(), FunctRoundHalfToEvenExpression::calculateValue(), FunctRoundExpression::calculateValue(), FunctFloorExpression::calculateValue(), FunctCoverExpression::calculateValue(), FunctCeilingExpression::calculateValue(), and FunctAbsExpression::calculateValue().

void Value::reset (  ) 

Resets the data structure.

Resets the data structure, by emptying its member variables.

Return values:
void 

Definition at line 68 of file value.cpp.

References num_val, str_val, and type.

Referenced by ~Value().

void Value::setNumVal ( long double  _num_val  ) 

void Value::setStrVal ( const char *  _str_val  ) 


Member Data Documentation

long double Value::num_val

Field to store the numeric value.

Field to store the numeric value, if any.

Definition at line 148 of file value.h.

Referenced by reset(), setNumVal(), and setStrVal().

const char * Value::str_val

Field to store the string value.

This field may be empty, i.e. point to NULL.

Definition at line 142 of file value.h.

Referenced by getStrVal(), reset(), setNumVal(), and setStrVal().

Specifies the type of instantiated objects.

Set either to xsd_numeric or xsd_string.

Definition at line 154 of file value.h.

Referenced by CondOperandExpression::evalRelOp(), getType(), reset(), setNumVal(), and setStrVal().


Generated on Sun May 24 20:20:31 2009 for G(arbage) C(ollected) X(Query) Engine by  doxygen 1.5.9