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

type.hh

00001 /*
00002 *  Name:      type.hh
00003 *  Author:    Rafael Jesus Alcantara Perez
00004 *  Summary:   UESQLC base SQL data type
00005 *  Date:      $Date: 2003/10/06 13:21:35 $
00006 *  Revision:  $Revision: 1.1 $
00007 *
00008 *  Copyright (C) 2002  Rafael Jesus Alcantara Perez <rafa@dedalo-ing.com>
00009 *
00010 *  This program is free software; you can redistribute it and/or modify
00011 *  it under the terms of the GNU General Public License as published by
00012 *  the Free Software Foundation; either version 2 of the License, or
00013 *  (at your option) any later version.
00014 *
00015 *  This program is distributed in the hope that it will be useful,
00016 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 *  GNU General Public License for more details.
00019 *
00020 *  You should have received a copy of the GNU General Public License
00021 *  along with this program; if not, write to the Free Software
00022 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00023 *  MA 02111-1307, USA.
00024 */
00025 
00026 #ifndef _UESQL_TYPE__
00027 #define _UESQL_TYPE__
00028 
00029 #include <mpcl/text/string.hh>
00030 
00031 
00033 namespace uesqlc
00034 {
00035 
00036   using std::string;
00037 
00039   class IType
00040   {
00041 
00042     private:
00043 
00045       bool   gIsNull;
00046 
00048       mutable char*   pcBuffer;
00049 
00050 
00051     public:
00052 
00054       typedef
00055         unsigned int
00056         size_type;
00057 
00058 
00059     protected:
00060 
00061       //
00062       //  C O N S T R U C T O R S
00063       //
00064 
00069       void setNull (bool gIS_NULL)
00070       {
00071         gIsNull = gIS_NULL;
00072       }
00073 
00074 
00075     public:
00076       
00077       //
00078       //  C O N S T R U C T O R S
00079       //
00080 
00082       IType (void)      :
00083         gIsNull  (true) ,
00084         pcBuffer (NULL) {}
00085 
00087       virtual ~IType (void)
00088       {
00089         if ( pcBuffer )
00090         {
00091           delete [] pcBuffer;
00092         }
00093       }
00094       
00101       void updateFromBuffer (void)
00102       {
00103         if ( pcBuffer )
00104         {
00105           set ((const char*) pcBuffer);
00106         }
00107       }
00108 
00113       virtual void set (const char* pkcVALUE) = 0;
00114       
00119       virtual void set (const string& rkyVALUE) = 0;
00120 
00121 
00122     public:
00123 
00124       //
00125       //  S E L E C T O R S
00126       //
00127 
00133       virtual mpcl::text::TString get (void) const = 0;
00134 
00141       void* getBuffer (const size_type kzSIZE) const
00142       {
00143         if ( pcBuffer )
00144         {
00145           delete [] pcBuffer;
00146         }
00147         pcBuffer = new char [kzSIZE + 1];
00148         return pcBuffer;
00149       }
00150 
00155       bool isNull (void) const
00156       {
00157         return gIsNull;
00158       }
00159 
00160   };  // class IType
00161   
00162 }  // namespace uesqlc
00163 
00164 
00165 #endif  // not _UESQL_TYPE__

Generated on Mon Oct 13 02:40:10 2003 for UESQLC by doxygen1.2.18