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

time.hh

00001 /*
00002 *  Name:      time.hh
00003 *  Author:    Rafael Jesus Alcantara Perez
00004 *  Summary:   UESQLC base SQL type time
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_TIME__
00027 #define _UESQL_TIME__
00028 
00029 #include <mpcl/text/local_date.hh>
00030 #include <mpcl/text/string.hh>
00031 #include "type.hh"
00032 
00033 
00035 namespace uesqlc
00036 {
00037 
00038   using mpcl::text::TLocalDate;
00039 
00041   class TTime         :
00042     public TLocalDate ,
00043     public IType
00044   {
00045 
00046     public:
00047 
00048       //
00049       //  C O N S T R U C T O R S
00050       //
00051 
00053       TTime (void)    :
00054         TLocalDate () ,
00055         IType      () {}
00056 
00058       TTime (const TTime& rktTIME) :
00059         TLocalDate (rktTIME)       ,
00060         IType      ()
00061       {
00062         setNull (rktTIME.isNull());
00063       }
00064 
00073       TTime (const int kiHOUR, const int kiMINUTE, const int kiSECOND) :
00074         TLocalDate (1970, 1, 1, kiHOUR, kiMINUTE, kiSECOND)            ,
00075         IType      ()
00076       {
00077         setNull (false);
00078       }
00079 
00080       explicit TTime (const char* pkcTIME) :
00081         TLocalDate (eEmpty)                ,
00082         IType      ()
00083       {
00084         set (pkcTIME);
00085       }
00086 
00087       explicit TTime (const std::string& rkyTIME) :
00088         TLocalDate (eEmpty)                       ,
00089         IType      ()
00090       {
00091         set (rkyTIME);
00092       }
00093 
00100       void* getBuffer (const std::size_t kzSIZE);
00101 
00108       void set (const char* pkcVALUE);
00109 
00116       void set (const std::string& rkyVALUE)
00117       {
00118         set (rkyVALUE.c_str());
00119       }
00120 
00121 
00122     public:
00123 
00124       //
00125       //  S E L E C T O R S
00126       //
00127 
00128       mpcl::text::TString get (void) const
00129       {
00130         mpcl::text::TString   yResult;
00131 
00132         if ( isNull() )
00133         {
00134           yResult = "null";
00135         }
00136         else
00137         {
00138           yResult = TLocalDate::get ("'%T'");
00139         }
00140         return yResult;
00141       }
00142 
00151       mpcl::text::TString get (const char* pkcTIME_FORMAT) const
00152       {
00153         mpcl::text::TString   yResult;
00154 
00155         if ( isNull() )
00156         {
00157           yResult = "null";
00158         }
00159         else
00160         {
00161           yResult = TLocalDate::get (pkcTIME_FORMAT);
00162         }
00163         return yResult;
00164       }
00165 
00166   };  // class TTime
00167 
00168 }  // namespace uesqlc
00169 
00170 
00171 #endif  // not _UESQL_TIME__

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