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

look::LookInteger Class Reference

Class representing an integer value. More...

#include <lkinteger.h>

Inheritance diagram for look::LookInteger::

look::LookTypeBase List of all members.

Public Methods

 LookInteger (long theValue=0)
 Constructor.

 ~LookInteger (void)
 Destructor.

 LookInteger (const LookInteger &theOther)
 Copy constructor.

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

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

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

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

 operator long (void) const
 Cast to long.

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

LookString GetString (void) const
 Conversion to a string. More...

LookString GetString (int theWidth) const
 Conversion to a string given a width. More...

LookString GetOrdinalString (void) const
 Convert to a ordinal string. More...

LookString GetSpelledOrdinalString (void) const
 Convert to a spelled ordinal string. More...

LookInteger& operator+= (const LookInteger &)
 Addition.

LookInteger& operator-= (const LookInteger &)
 Subtraction.

LookInteger operator+ (const LookInteger &) const
 Addition.

LookInteger operator- (const LookInteger &) const
 Subtraction.


Protected Attributes

long itsValue
 Its value.


Detailed Description

Class representing an integer value.

Internally it uses a long.

It can also be used to convert integers to and from strings.


Member Function Documentation

LookTypeBase * look::LookInteger::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::LookInteger::GetOrdinalString ( void ) const
 

Convert to a ordinal string.

Returns:
Ordinal string, eg 1st, 2nd, 11th, 21st, 103rd, 1004th

LookString look::LookInteger::GetSpelledOrdinalString ( void ) const
 

Convert to a spelled ordinal string.

This can only cope with 0-99 - used for LookDateTimeFormatter (so it can do "First of January").

If it is out of range, "Out of Range" is returned.

Returns:
Spelled ordinal string, eg First, Second, Eleventh, Twenty-first, Eightieth

LookString look::LookInteger::GetString ( int theWidth ) const
 

Conversion to a string given a width.

Converts to a decimal string, fitted to theWidth.

If theWidth is insufficient, '*' characters are returned.

Leading zeroes are prepended if necessary to ensure the returned string is wide enough.

Parameters:
theWidth   Width of string
Returns:
Converted string. It will always be theWidth characters long.

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

Conversion to a string.

Converts to a decimal string

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

Get Type ID.

Pseudo-rtti, or isA.

Returns:
LookIntegerID

Reimplemented from look::LookTypeBase.

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

Convert from decimal string.

Converts using strtol.

Returns false in case of overflow or invalid characters. If invalid characters, itsValue is still set as best it can.

Parameters:
theString   The string
Returns:
true for success


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