• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

spl/IConvertable.h

00001 /*
00002  *   This file is part of the Standard Portable Library (SPL).
00003  *
00004  *   SPL is free software: you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation, either version 3 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   SPL 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
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with SPL.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 #ifndef _iconvertable_h
00018 #define _iconvertable_h
00019 
00020 #include <spl/types.h>
00021 #include <spl/Debug.h>
00022 #include <spl/BigInteger.h>
00023 #include <spl/Char.h>
00024 #include <spl/Date.h>
00025 #include <spl/DateTime.h>
00026 #include <spl/Decimal.h>
00027 #include <spl/Double.h>
00028 #include <spl/Int32.h>
00029 #include <spl/Int64.h>
00030 #include <spl/math/Math.h>
00031 #include <spl/Memory.h>
00032 #include <spl/String.h>
00033 #include <spl/UInt32.h>
00034 #include <spl/UInt64.h>
00035 
00045 class IConvertable : public IComparable, public IMemoryValidate
00046 {
00047 public:
00048         IConvertable();
00049         virtual ~IConvertable();
00050 
00051         virtual bool ToChar(char& c2) const = 0;
00052 
00053         virtual bool ToBool(bool& c2) const = 0;
00054 
00055         virtual bool ToByte(byte& c2) const = 0;
00056 
00057         virtual bool ToInt16(int16& c2) const = 0;
00058 
00059         virtual bool ToInt32(int32& c2) const = 0;
00060 
00061         virtual bool ToInt64(int64& c2) const = 0;
00062 
00063         virtual bool ToUInt32(uint32& c2) const = 0;
00064 
00065         virtual bool ToUInt64(uint64& c2) const = 0;
00066 
00067         //virtual bool ToBigInteger(const BigInteger& c2) const = 0;
00068 
00069         virtual bool ToFloat32(float32& c2) const = 0;
00070 
00071         virtual bool ToFloat64(float64& c2) const = 0;
00072 
00073         virtual bool ToDateTime(DateTime& c2) const = 0;
00074 
00075         virtual bool ToDate(Date& c2) const = 0;
00076 
00077         virtual bool ToDecimal(Decimal& c2) const = 0;
00078 
00079         virtual bool ToString(String& c2) const = 0;
00080 
00081         virtual String TypeName() const = 0;
00082 
00083         virtual bool Equals( const IComparable& a ) const = 0;
00084         virtual int Compare( const IComparable& a ) const = 0;
00085 
00088         virtual int32 MajicNumber() const = 0;
00089 
00090 #ifdef DEBUG
00091         virtual void ValidateMem() const = 0;
00092         virtual void CheckMem() const = 0;
00093 #endif
00094 };
00095 
00098 #endif