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

spl/IVariant.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 _ivariant_h
00018 #define _ivariant_h
00019 
00020 #include <spl/types.h>
00021 #include <spl/Debug.h>
00022 #include <spl/Compare.h>
00023 #include <spl/DateTime.h>
00024 #include <spl/Decimal.h>
00025 #include <spl/Exception.h>
00026 #include <spl/math/Math.h>
00027 #include <spl/Memory.h>
00028 #include <spl/RefCountPtr.h>
00029 #include <spl/String.h>
00030 
00040 class IVariant : public IConvertable
00041 {
00042 public:
00043         IVariant();
00044         ~IVariant();
00045 
00046         virtual bool ToBool() const = 0;
00047         virtual byte ToByte() const = 0;
00048         virtual int16 ToInt16() const = 0;
00049         virtual int32 ToInt32() const = 0;
00050         virtual int64 ToInt64() const = 0;
00051         virtual float32 ToFloat32() const = 0;
00052         virtual float64 ToFloat64() const = 0;
00053         virtual DateTime ToDateTime() const = 0;
00054         virtual Date ToDate() const = 0;
00055         virtual Decimal ToDecimal() const = 0;
00056         virtual StringPtr ToString() const = 0;
00057 
00058         virtual bool ToChar(char& c2) const = 0;
00059         virtual bool ToBool(bool& c2) const = 0;
00060         virtual bool ToByte(byte& c2) const = 0;
00061         virtual bool ToInt16(int16& c2) const = 0;
00062         virtual bool ToInt32(int32& c2) const = 0;
00063         virtual bool ToInt64(int64& c2) const = 0;
00064         virtual bool ToUInt32(uint32& c2) const = 0;
00065         virtual bool ToUInt64(uint64& c2) const = 0;
00066         //virtual bool ToBigInteger(const BigInteger& c2) const = 0;
00067         virtual bool ToFloat32(float32& c2) const = 0;
00068         virtual bool ToFloat64(float64& c2) const = 0;
00069         virtual bool ToDateTime(DateTime& c2) const = 0;
00070         virtual bool ToDate(Date& c2) const = 0;
00071         virtual bool ToDecimal(Decimal& c2) const = 0;
00072         virtual bool ToString(String& c2) const = 0;
00073 
00074         virtual bool Equals( const IComparable& a ) const = 0;
00075         virtual int Compare( const IComparable& a ) const = 0;
00076         virtual int32 MajicNumber() const = 0;
00077         virtual int32 HashCode() const = 0;
00078 
00079         virtual bool IsObject() const = 0;
00080 
00081         virtual String TypeName() const = 0;
00082 
00083 #ifdef DEBUG
00084         virtual void ValidateMem() const = 0;
00085         virtual void CheckMem() const = 0;
00086 #endif
00087 };
00088 
00091 #endif