stx::AnyScalar Class Reference

AnyScalar constructs objects holding a typed scalar value. More...

#include <AnyScalar.h>

List of all members.

Public Types

enum  attrtype_t {
  ATTRTYPE_INVALID = 0x00, ATTRTYPE_BOOL = 0x01, ATTRTYPE_CHAR = 0x10, ATTRTYPE_SHORT = 0x11,
  ATTRTYPE_INTEGER = 0x12, ATTRTYPE_LONG = 0x13, ATTRTYPE_BYTE = 0x20, ATTRTYPE_WORD = 0x21,
  ATTRTYPE_DWORD = 0x22, ATTRTYPE_QWORD = 0x23, ATTRTYPE_FLOAT = 0x30, ATTRTYPE_DOUBLE = 0x31,
  ATTRTYPE_STRING = 0x40
}
 Enumeration establishing identifiers for all supported types. More...

Public Member Functions

 AnyScalar (attrtype_t t=ATTRTYPE_INVALID)
 Create a new empty AnyScalar object of given type.
 AnyScalar (bool b)
 Construct a new AnyScalar object of type ATTRTYPE_BOOL and set the given boolean value.
 AnyScalar (char c)
 Construct a new AnyScalar object of type ATTRTYPE_CHAR and set the given char value.
 AnyScalar (short s)
 Construct a new AnyScalar object of type ATTRTYPE_SHORT and set the given short value.
 AnyScalar (int i)
 Construct a new AnyScalar object of type ATTRTYPE_INTEGER and set the given integer value.
 AnyScalar (long i)
 Construct a new AnyScalar object of type ATTRTYPE_INTEGER and set the given integer value.
 AnyScalar (long long l)
 Construct a new AnyScalar object of type ATTRTYPE_LONG and set the given long value.
 AnyScalar (unsigned char c)
 Construct a new AnyScalar object of type ATTRTYPE_BYTE and set the given unsigned value.
 AnyScalar (unsigned short s)
 Construct a new AnyScalar object of type ATTRTYPE_WORD and set the given unsigned value.
 AnyScalar (unsigned int i)
 Construct a new AnyScalar object of type ATTRTYPE_DWORD and set the given unsigned value.
 AnyScalar (unsigned long i)
 Construct a new AnyScalar object of type ATTRTYPE_DWORD and set the given unsigned value.
 AnyScalar (unsigned long long l)
 Construct a new AnyScalar object of type ATTRTYPE_QWORD and set the given unsigned value.
 AnyScalar (float f)
 Construct a new AnyScalar object of type ATTRTYPE_FLOAT and set the given floating point value.
 AnyScalar (double d)
 Construct a new AnyScalar object of type ATTRTYPE_DOUBLE and set the given floating point value.
 AnyScalar (const char *s)
 Construct a new AnyScalar object of type ATTRTYPE_STRING and set the given string value.
 AnyScalar (const std::string &s)
 Construct a new AnyScalar object of type ATTRTYPE_STRING and set the given string value.
 ~AnyScalar ()
 Destroy the object: free associated string memory if necessary.
 AnyScalar (const AnyScalar &a)
 Copy-constructor to deal with enclosed strings.
AnyScalaroperator= (const AnyScalar &a)
 Assignment operator to deal with enclosed strings.
bool operator== (const AnyScalar &a) const
 Comparison operator.
bool operator!= (const AnyScalar &a) const
 Comparison operator: Directly compares type _and_ value.
attrtype_t getType () const
 Return the type identifier of the object.
bool isBooleanType () const
 Returns true if this object contains a boolean value.
bool isIntegerType () const
 Returns true if this object contains one of the integer types.
bool isFloatingType () const
 Returns true if this object contains one of the floating point types.
bool convertType (attrtype_t t)
 Attempts to convert the current type/value into the given type.
void resetType (attrtype_t t)
 Changes the current type and resets the contents without attempting to convert the enclosed value.
std::string getTypeString () const
 Returns a string for this AnyScalar's type.
int getTypeLength () const
 Return the storage length of the type in bytes.
bool isFixedLength () const
 Boolean check if this type is of fixed length.
unsigned int getValueLength () const
 Return the storage length of this value (mark the different to getTypeLength()).
bool setInteger (int i)
 Change the value of the current object to i.
bool setLong (long long l)
 Change the value of the current object to l.
bool setDouble (double d)
 Change the value of the current object to d.
bool setString (const std::string &s)
 Change the value of the current object to s.
bool setStringQuoted (const std::string &s)
 Change the value of the current object to s.
AnyScalarsetAutoString (const std::string &input)
 Change the type _and_ value of the current object to s.
bool getBoolean () const
 Return the value converted to a boolean.
int getInteger () const
 Return the value converted to an integer.
unsigned int getUnsignedInteger () const
 Return the value converted to an unsigned integer.
int getInt () const
 Alias for getInteger().
unsigned int getUInt () const
 Alias for getUnsignedInteger().
long long getLong () const
 Return the value converted to a long integer.
unsigned long long getUnsignedLong () const
 Return the value converted to an unsigned long integer.
unsigned long long getULong () const
 Alias for getUnsignedLong().
double getDouble () const
 Return the value converted to a double.
std::string getString () const
 Return the value converted to a string.
std::string getStringQuoted () const
 Return the value converted to a quoted string.
AnyScalar operator- () const
 Unary prefix - operator.
AnyScalar operator+ (const AnyScalar &b) const
 Instantiation of binary_arith_op for "+" plus.
AnyScalar operator- (const AnyScalar &b) const
 Instantiation of binary_arith_op for "-" minus.
AnyScalar operator * (const AnyScalar &b) const
 Instantiation of binary_arith_op for "*" multiplication.
AnyScalar operator/ (const AnyScalar &b) const
 Instantiation of binary_arith_op for "/" division.
AnyScalar add (const AnyScalar &b) const
 Alias for operator+ in script languages.
AnyScalar subtract (const AnyScalar &b) const
 Alias for operator- in script languages.
AnyScalar multiply (const AnyScalar &b) const
 Alias for operator* in script languages.
AnyScalar divide (const AnyScalar &b) const
 Alias for operator/ in script languages.
bool equal_to (const AnyScalar &b) const
 Instantiation of binary_comp_op for "==" equality.
bool not_equal_to (const AnyScalar &b) const
 Instantiation of binary_comp_op for "!=" inequality.
bool less (const AnyScalar &b) const
 Instantiation of binary_comp_op for "<" less-than.
bool greater (const AnyScalar &b) const
 Instantiation of binary_comp_op for ">" greater-than.
bool less_equal (const AnyScalar &b) const
 Instantiation of binary_comp_op for "<=" less-or-equal-than.
bool greater_equal (const AnyScalar &b) const
 Instantiation of binary_comp_op for ">=" greater-or-equal-than.

Static Public Member Functions

static bool isValidAttrtype (attrtype_t at)
 Returns true if the attrtype_t is a valid type identifier.
static attrtype_t stringToType (const std::string &s)
 Returns the attrtype identifier of a string, throws ConversionException if s does not specify a valid type name.
static attrtype_t stringToType (const char *s)
 Returns the attrtype identifier a string, throws ConversionException if it does not specify a valid type name.
static std::string getTypeString (attrtype_t at)
 Returns a const char* for each attrtype_t.
static int getTypeLength (attrtype_t t)
 Return the storage length of the type in bytes.
static bool isFixedLength (attrtype_t t)
 Boolean check if this type is of fixed length.

Private Member Functions

template<template< typename Type > class Operator, char OpName>
AnyScalar binary_arith_op (const AnyScalar &b) const
 Binary arithmetic template operator.
template<template< typename Type > class Operator, int OpNum>
bool binary_comp_op (const AnyScalar &b) const
 Binary comparison template operator.

Private Attributes

attrtype_t atype
 The currently set type in the union.
value_t val
 Union holding the current value of set type.

Classes

union  value_t
 Union type to holding the current value of an AnyScalar. More...


Detailed Description

AnyScalar constructs objects holding a typed scalar value.

It supports boolean values, integer values both signed and unsigned, floating point values and strings. The class provides operators which will compare scalars between other scalars by converting them into a common domain. Furthermore arithmetic operator will compose one or two scalars where the calculation is done in the "higher" domain.

Definition at line 45 of file AnyScalar.h.


Member Enumeration Documentation

enum stx::AnyScalar::attrtype_t

Enumeration establishing identifiers for all supported types.

All "small" integer types are included, because the class use originally designed for serializing large amounts of data.

Enumerator:
ATTRTYPE_INVALID  Flag identifier for an uninitialized object.
ATTRTYPE_BOOL  A boolean type holding only true and false.
ATTRTYPE_CHAR  Character type, not viewed as a letter or digit, but as 8 bit signed integer.

ATTRTYPE_SHORT  Short signed integer type, 2 bytes long.
ATTRTYPE_INTEGER  Medium signed integer type, 4 bytes long.
ATTRTYPE_LONG  Long (long) signed integer type, 8 bytes long.
ATTRTYPE_BYTE  Byte type, not viewed as a letter or digit, but as 8 bit unsigned integer.

ATTRTYPE_WORD  Short unsigned integer type, 2 bytes long.
ATTRTYPE_DWORD  Medium unsigned integer type, 4 bytes long.
ATTRTYPE_QWORD  Long (long) unsigned integer type, 8 bytes long.
ATTRTYPE_FLOAT  Single precision floating point type, 4 bytes long.
ATTRTYPE_DOUBLE  Double precision floating point type, 8 bytes long.
ATTRTYPE_STRING  String type, variable length.

Needs much extra care to handle memory allocation.

Definition at line 51 of file AnyScalar.h.


Constructor & Destructor Documentation

stx::AnyScalar::AnyScalar ( bool  b  )  [inline]

Construct a new AnyScalar object of type ATTRTYPE_BOOL and set the given boolean value.

Definition at line 145 of file AnyScalar.h.

References stx::AnyScalar::value_t::_int, and val.

stx::AnyScalar::AnyScalar ( char  c  )  [inline]

Construct a new AnyScalar object of type ATTRTYPE_CHAR and set the given char value.

Definition at line 155 of file AnyScalar.h.

References stx::AnyScalar::value_t::_int, and val.

stx::AnyScalar::AnyScalar ( short  s  )  [inline]

Construct a new AnyScalar object of type ATTRTYPE_SHORT and set the given short value.

Definition at line 163 of file AnyScalar.h.

References stx::AnyScalar::value_t::_int, and val.

stx::AnyScalar::AnyScalar ( int  i  )  [inline]

Construct a new AnyScalar object of type ATTRTYPE_INTEGER and set the given integer value.

Definition at line 170 of file AnyScalar.h.

References stx::AnyScalar::value_t::_int, and val.

stx::AnyScalar::AnyScalar ( long  i  )  [inline]

Construct a new AnyScalar object of type ATTRTYPE_INTEGER and set the given integer value.

Definition at line 177 of file AnyScalar.h.

References stx::AnyScalar::value_t::_int, and val.

stx::AnyScalar::AnyScalar ( long long  l  )  [inline]

Construct a new AnyScalar object of type ATTRTYPE_LONG and set the given long value.

Definition at line 184 of file AnyScalar.h.

References stx::AnyScalar::value_t::_long, and val.

stx::AnyScalar::AnyScalar ( unsigned char  c  )  [inline]

Construct a new AnyScalar object of type ATTRTYPE_BYTE and set the given unsigned value.

Definition at line 191 of file AnyScalar.h.

References stx::AnyScalar::value_t::_uint, and val.

stx::AnyScalar::AnyScalar ( unsigned short  s  )  [inline]

Construct a new AnyScalar object of type ATTRTYPE_WORD and set the given unsigned value.

Definition at line 198 of file AnyScalar.h.

References stx::AnyScalar::value_t::_uint, and val.

stx::AnyScalar::AnyScalar ( unsigned int  i  )  [inline]

Construct a new AnyScalar object of type ATTRTYPE_DWORD and set the given unsigned value.

Definition at line 205 of file AnyScalar.h.

References stx::AnyScalar::value_t::_uint, and val.

stx::AnyScalar::AnyScalar ( unsigned long  i  )  [inline]

Construct a new AnyScalar object of type ATTRTYPE_DWORD and set the given unsigned value.

Definition at line 212 of file AnyScalar.h.

References stx::AnyScalar::value_t::_uint, and val.

stx::AnyScalar::AnyScalar ( unsigned long long  l  )  [inline]

Construct a new AnyScalar object of type ATTRTYPE_QWORD and set the given unsigned value.

Definition at line 219 of file AnyScalar.h.

References stx::AnyScalar::value_t::_ulong, and val.

stx::AnyScalar::AnyScalar ( float  f  )  [inline]

Construct a new AnyScalar object of type ATTRTYPE_FLOAT and set the given floating point value.

Definition at line 226 of file AnyScalar.h.

References stx::AnyScalar::value_t::_float, and val.

stx::AnyScalar::AnyScalar ( double  d  )  [inline]

Construct a new AnyScalar object of type ATTRTYPE_DOUBLE and set the given floating point value.

Definition at line 233 of file AnyScalar.h.

References stx::AnyScalar::value_t::_double, and val.

stx::AnyScalar::AnyScalar ( const char *  s  )  [inline]

Construct a new AnyScalar object of type ATTRTYPE_STRING and set the given string value.

Definition at line 240 of file AnyScalar.h.

References stx::AnyScalar::value_t::_string, and val.

stx::AnyScalar::AnyScalar ( const std::string &  s  )  [inline]

Construct a new AnyScalar object of type ATTRTYPE_STRING and set the given string value.

Definition at line 250 of file AnyScalar.h.

References stx::AnyScalar::value_t::_string, and val.

stx::AnyScalar::AnyScalar ( const AnyScalar a  )  [inline]

Copy-constructor to deal with enclosed strings.

Transfers type and value.

Definition at line 267 of file AnyScalar.h.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_string, stx::AnyScalar::value_t::_uint, stx::AnyScalar::value_t::_ulong, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, and val.


Member Function Documentation

AnyScalar& stx::AnyScalar::operator= ( const AnyScalar a  )  [inline]

Assignment operator to deal with enclosed strings.

Transfers type and value.

Definition at line 312 of file AnyScalar.h.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_string, stx::AnyScalar::value_t::_uint, stx::AnyScalar::value_t::_ulong, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, and val.

bool stx::AnyScalar::operator== ( const AnyScalar a  )  const

Comparison operator.

Directly compares type _and_ value. Does NOT attempt to convert the values into a common domain.

Definition at line 38 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_string, stx::AnyScalar::value_t::_uint, stx::AnyScalar::value_t::_ulong, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, and val.

bool stx::AnyScalar::operator!= ( const AnyScalar a  )  const [inline]

Comparison operator: Directly compares type _and_ value.

Does NOT attempt to convert the values into a common domain.

Definition at line 373 of file AnyScalar.h.

bool stx::AnyScalar::convertType ( attrtype_t  t  ) 

Attempts to convert the current type/value into the given type.

Returns false if the value could not be represented in the new type, the new type is set nonetheless. See the getXXX below on how the new value is computed from the old type.

Definition at line 1132 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_string, stx::AnyScalar::value_t::_uint, stx::AnyScalar::value_t::_ulong, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, getBoolean(), getDouble(), getInteger(), getLong(), getString(), getUnsignedInteger(), and val.

Referenced by binary_arith_op(), binary_comp_op(), stx::Grammar::PNCastExpr::evaluate(), stx::Grammar::PNCastExpr::evaluate_const(), and operator-().

void stx::AnyScalar::resetType ( attrtype_t  t  ) 

Changes the current type and resets the contents without attempting to convert the enclosed value.

Definition at line 1113 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_string, stx::AnyScalar::value_t::_ulong, ATTRTYPE_STRING, atype, and val.

Referenced by setAutoString().

static attrtype_t stx::AnyScalar::stringToType ( const std::string &  s  )  [inline, static]

Returns the attrtype identifier of a string, throws ConversionException if s does not specify a valid type name.

Definition at line 421 of file AnyScalar.h.

Referenced by stx::Grammar::build_expr().

AnyScalar::attrtype_t stx::AnyScalar::stringToType ( const char *  s  )  [static]

Returns the attrtype identifier a string, throws ConversionException if it does not specify a valid type name.

Definition at line 80 of file AnyScalar.cc.

References ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, and ATTRTYPE_WORD.

int stx::AnyScalar::getTypeLength (  )  const [inline]

Return the storage length of the type in bytes.

Beware that getTypeLength(bool) == 0.

Definition at line 443 of file AnyScalar.h.

References atype.

Referenced by isFixedLength().

int stx::AnyScalar::getTypeLength ( attrtype_t  t  )  [static]

Return the storage length of the type in bytes.

Beware that getTypeLength(bool) == 0.

Definition at line 165 of file AnyScalar.cc.

References ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, and ATTRTYPE_WORD.

bool stx::AnyScalar::setInteger ( int  i  ) 

Change the value of the current object to i.

Converting the integer to this object's type if necessary.

Definition at line 266 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_string, stx::AnyScalar::value_t::_uint, stx::AnyScalar::value_t::_ulong, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, and val.

Referenced by setDouble(), and setString().

bool stx::AnyScalar::setLong ( long long  l  ) 

Change the value of the current object to l.

Converting the long long integer to this object's type if necessary. If the long long does not fully fit into the current type, then this function returns false.

Definition at line 357 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_string, stx::AnyScalar::value_t::_uint, stx::AnyScalar::value_t::_ulong, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, and val.

Referenced by setDouble(), and setString().

bool stx::AnyScalar::setDouble ( double  d  ) 

Change the value of the current object to d.

Converting the floating point to this object's type if necessary.

Definition at line 449 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_string, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, setInteger(), setLong(), and val.

bool stx::AnyScalar::setString ( const std::string &  s  ) 

Change the value of the current object to s.

Converting the string to this object's type if necessary. If this string cannot be converted to say an integer, then this function returns false.

Definition at line 503 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_string, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, setInteger(), setLong(), and val.

Referenced by stx::Grammar::PNConstant::PNConstant(), and setStringQuoted().

bool stx::AnyScalar::setStringQuoted ( const std::string &  s  ) 

Change the value of the current object to s.

This string s must be quoted: "str". This function resolves escape sequences like
.

Definition at line 604 of file AnyScalar.cc.

References setString().

Referenced by stx::Grammar::PNConstant::PNConstant().

AnyScalar & stx::AnyScalar::setAutoString ( const std::string &  input  ) 

Change the type _and_ value of the current object to s.

The current type is set if the given string can be converted to an integer or a floating point number. This was required because e.g. the usual input from files or perl are all untyped strings. The following input conversions are tested and yield the given types:

Returns:
reference to this for chaining.

Definition at line 649 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_string, ATTRTYPE_DOUBLE, ATTRTYPE_INTEGER, ATTRTYPE_LONG, ATTRTYPE_STRING, resetType(), and val.

bool stx::AnyScalar::getBoolean (  )  const

Return the value converted to a boolean.

If the enclosed value could not be converted this function throws a ConversionException.

Definition at line 696 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_string, stx::AnyScalar::value_t::_uint, stx::AnyScalar::value_t::_ulong, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, and val.

Referenced by convertType().

int stx::AnyScalar::getInteger (  )  const

Return the value converted to an integer.

If the enclosed value could not be converted this function throws a ConversionException.

Definition at line 750 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_string, stx::AnyScalar::value_t::_uint, stx::AnyScalar::value_t::_ulong, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, and val.

Referenced by binary_arith_op(), binary_comp_op(), convertType(), stx::Grammar::PNBinaryLogicExpr::evaluate(), stx::Grammar::PNBinaryLogicExpr::evaluate_const(), and getInt().

unsigned int stx::AnyScalar::getUnsignedInteger (  )  const

Return the value converted to an unsigned integer.

If the enclosed value could not be converted this function throws a ConversionException.

Definition at line 803 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_string, stx::AnyScalar::value_t::_uint, stx::AnyScalar::value_t::_ulong, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, and val.

Referenced by convertType(), and getUInt().

long long stx::AnyScalar::getLong (  )  const

Return the value converted to a long integer.

If the enclosed value could not be converted this function throws a ConversionException.

Definition at line 850 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_string, stx::AnyScalar::value_t::_ulong, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, and val.

Referenced by binary_arith_op(), binary_comp_op(), and convertType().

unsigned long long stx::AnyScalar::getUnsignedLong (  )  const

Return the value converted to an unsigned long integer.

If the enclosed value could not be converted this function throws a ConversionException.

Definition at line 899 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_string, stx::AnyScalar::value_t::_uint, stx::AnyScalar::value_t::_ulong, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, and val.

Referenced by binary_comp_op(), and getULong().

double stx::AnyScalar::getDouble (  )  const

Return the value converted to a double.

If the enclosed value could not be converted this function throws a ConversionException.

Definition at line 949 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_string, stx::AnyScalar::value_t::_ulong, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, and val.

Referenced by binary_arith_op(), binary_comp_op(), and convertType().

std::string stx::AnyScalar::getString (  )  const

Return the value converted to a string.

This function never throws ConversionException.

Definition at line 993 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_string, stx::AnyScalar::value_t::_uint, stx::AnyScalar::value_t::_ulong, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, and val.

Referenced by convertType(), getStringQuoted(), stx::operator<<(), and stx::Grammar::PNConstant::toString().

std::string stx::AnyScalar::getStringQuoted (  )  const

Return the value converted to a quoted string.

This function never throws ConversionException. It calls getString() and adds " and escape sequences.

Definition at line 1051 of file AnyScalar.cc.

References getString().

Referenced by stx::Grammar::PNConstant::toString().

AnyScalar stx::AnyScalar::operator- (  )  const

Unary prefix - operator.

Attempts to convert the AnyScalar to a numeric value.

Definition at line 1232 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_uint, stx::AnyScalar::value_t::_ulong, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, convertType(), and val.

template<template< typename Type > class Operator, char OpName>
AnyScalar stx::AnyScalar::binary_arith_op ( const AnyScalar b  )  const [inline, private]

Binary arithmetic template operator.

Converts the two AnyScalars into the largest type of their common field. If a string cannot be converted to a numeric of the same field as the other operand a ConversionException is thrown.

Conversion chart: * signifies the operator

Definition at line 1289 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_string, stx::AnyScalar::value_t::_uint, stx::AnyScalar::value_t::_ulong, AnyScalar(), ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, convertType(), getDouble(), getInteger(), getLong(), and val.

Referenced by operator-(), and operator/().

template<template< typename Type > class Operator, int OpNum>
bool stx::AnyScalar::binary_comp_op ( const AnyScalar b  )  const [inline, private]

Binary comparison template operator.

Converts the two AnyScalars into the largest type of their common field. If a string cannot be converted to a numeric of the same field as the other operand a ConversionException is thrown. Operator is the STL operator class. OpNum is an identifier for the operator name string within the template.

Conversion chart: * signifies the operator

Definition at line 1816 of file AnyScalar.cc.

References stx::AnyScalar::value_t::_double, stx::AnyScalar::value_t::_float, stx::AnyScalar::value_t::_int, stx::AnyScalar::value_t::_long, stx::AnyScalar::value_t::_string, stx::AnyScalar::value_t::_uint, stx::AnyScalar::value_t::_ulong, ATTRTYPE_BOOL, ATTRTYPE_BYTE, ATTRTYPE_CHAR, ATTRTYPE_DOUBLE, ATTRTYPE_DWORD, ATTRTYPE_FLOAT, ATTRTYPE_INTEGER, ATTRTYPE_INVALID, ATTRTYPE_LONG, ATTRTYPE_QWORD, ATTRTYPE_SHORT, ATTRTYPE_STRING, ATTRTYPE_WORD, atype, convertType(), getDouble(), getInteger(), getLong(), getUnsignedLong(), and val.


The documentation for this class was generated from the following files:
Generated on Tue Jul 17 16:51:58 2007 for STX Expression Parser by  doxygen 1.5.2