Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

look::LookNumeric Class Reference

Class representing a number (integral or not). More...

#include <lknumeric.h>

Inheritance diagram for look::LookNumeric::

look::LookTypeBase List of all members.

Public Methods

 LookNumeric ()
 Constructor.

 LookNumeric (long theValue)
 Construct from long.

 LookNumeric (const LookInteger &theInt)
 Construct from LookInteger.

 LookNumeric (const LookMoney &theMoney)
 Construct from LookMoney.

 LookNumeric (const LookFloat &theFloat, int thePrecision)
 Construct from LookFloat. More...

 ~LookNumeric (void)
 Destructor.

 LookNumeric (const LookNumeric &theOther)
 Copy constructor.

LookNumeric& operator= (const LookNumeric &theOther)
 Assignment.

LookNumeric& operator= (long theValue)
 Assignment from long.

LookNumeric& operator= (const LookInteger &theInt)
 Assignment from LookInteger.

LookNumeric& operator= (const LookMoney &theMoney)
 Assignment from LookMoney.

LookTypeBaseGetNewCopy (void) const
 Get a new copy. More...

long GetTypeID (void) const
 Get Type ID. More...

void SetFloat (const LookFloat &theFloat, int thePrecision)
 Set from a float. More...

LookFloat GetFloat (void)
 Conversion to LookFloat.

LookInteger GetInteger (void)
 Conversion to LookInteger.

LookMoney GetMoney (void)
 Conversion to LookMoney.

bool Set (const LookString &theString)
 Conversion from string. More...

LookString GetString (void) const
 Get as a string. More...


Protected Attributes

LookString itsString
 Its value as a string.


Detailed Description

Class representing a number (integral or not).

This stores the number as a string, so there are no rounding issues.

Conversions to/from the various number types (LookInteger, LookMoney, LookFloat) are provided.

This is used when databases return numbers as strings (which for money is a good thing - better than float).


Constructor & Destructor Documentation

look::LookNumeric::LookNumeric ( const LookFloat & theFloat,
int thePrecision )
 

Construct from LookFloat.

This uses LookFloat::GetString() to get the string - a precision is required as floats can't necessarily be exactly represented in decimal.

Parameters:
theFloat   The float
thePrecision   The precision used in LookFloat::GetString()


Member Function Documentation

LookTypeBase * look::LookNumeric::GetNewCopy ( void ) const [virtual]
 

Get a new copy.

Virtual copy constructor, aka clone.

Returns:
A new copy of this. (You are responsible for deleting it).

Reimplemented from look::LookTypeBase.

LookString look::LookNumeric::GetString ( void ) const
 

Get as a string.

Returns:
itsString - no conversion necessary or performed.

long look::LookNumeric::GetTypeID ( void ) const [virtual]
 

Get Type ID.

Pseudo-rtti, or isA.

Returns:
LookNumericID

Reimplemented from look::LookTypeBase.

bool look::LookNumeric::Set ( const LookString & theString )
 

Conversion from string.

No checking is performed to see if theString is a number. This means subsequent conversion to number types may not work if theString is invalid.

Parameters:
theString   The string
Returns:
true

void look::LookNumeric::SetFloat ( const LookFloat & theFloat,
int thePrecision )
 

Set from a float.

A precision is required, so the assignment operator won't do. Uses LookFloat::GetString().

Parameters:
theFloat   The float
thePrecision   The precision


The documentation for this class was generated from the following files:
Generated at Thu Jan 17 12:53:09 2002 for liblookdb by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001