00001 /* liblookdb: lkinteger.h - Integer representation
00002 Copyright (C) 1998-2001 LOOK Systems
00003
00004 This library is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU Lesser General Public
00006 License as published by the Free Software Foundation; either
00007 version 2.1 of the License, or (at your option) any later version.
00008
00009 This library is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00012 Lesser General Public License for more details.
00013
00014 You should have received a copy of the GNU Lesser General Public
00015 License along with this library; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00017 */
00018 #ifndef LIBLOOKDB_LKINTEGER_H
00019 #define LIBLOOKDB_LKINTEGER_H
00020
00021 // $Id: lkinteger.h,v 1.4 2001/07/04 15:53:18 clive Exp $
00022
00023 #include "looktypes.h"
00024 #include "lktypebase.h"
00025
00026 #include "lkstring.h"
00027
00028 namespace look {
00029
00030 // *****************************************************
00031 // LookInteger class
00032 // *****************************************************
00033
00035
00040 class LOOKTYPES_DLL LookInteger : public LookTypeBase
00041 {
00042 public:
00043 // Constructors.
00044 LookInteger( long theValue = 0 );
00045
00046 // Destructor.
00047 ~LookInteger( void );
00048
00049 // Copy constructor.
00050 LookInteger( const LookInteger &theOther );
00051
00052 // Assignment operators
00053 LookInteger &operator=( const LookInteger &theOther );
00054 LookInteger &operator=( long theValue );
00055
00056 // get a copy
00057 LookTypeBase* GetNewCopy( void ) const;
00058
00059 // get my id
00060 long GetTypeID( void ) const;
00061
00062 // cast to long
00063 operator long( void ) const;
00064
00065 // Conversion to and from strings
00066 bool Set( const LookString& theString );
00067 LookString GetString( void ) const; // "1",
00068 LookString GetString( int theWidth ) const; // width 0, 1 ->"1",
00069 // width 2, ->"01",
00070
00071 // not implemented (anyone want to?)
00072 // IBM have rather a nice solution in their internationalisation classes
00073 //LookString GetSpelledString( void ) const; // "One"
00074
00075 // only implemented for numbers < 100 (ie days)
00076 LookString GetOrdinalString( void ) const; // "1st"
00077 LookString GetSpelledOrdinalString( void ) const; // "First"
00078
00079 // other operators
00080 LookInteger& operator+=( const LookInteger & );
00081 LookInteger& operator-=( const LookInteger & );
00082
00083 LookInteger operator+( const LookInteger & ) const;
00084 LookInteger operator-( const LookInteger & ) const;
00085
00086 protected:
00088 long itsValue;
00089 };
00090
00091
00092 } // end of "look" namespace
00093 #endif
1.2.8.1 written by Dimitri van Heesch,
© 1997-2001