Main Page   Data Structures   File List   Data Fields  

MyMySQLPPTypeConv.cpp

Go to the documentation of this file.
00001 /*
00002         MyMySQL++ - Another MySQL++ API providing basic and easy access to MySQL functionality.
00003     Copyright (C) 2003 Stefan Schadt
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00039 #include "pch.h"
00040 #include "MyMySQLPPTypeConv.h"
00041 
00043 CMyMySQLPPTypeConv::CMyMySQLPPTypeConv(void)
00044 {
00045         m_data = NULL;
00046 }
00047 
00051 CMyMySQLPPTypeConv::CMyMySQLPPTypeConv(char *data)
00052 {
00053         m_data = NULL;
00054         if(data != NULL)
00055                 m_data = strdup(data);  
00056 }
00057 
00059 CMyMySQLPPTypeConv::~CMyMySQLPPTypeConv(void)
00060 {
00061         Free();
00062 }
00063 
00065 void CMyMySQLPPTypeConv::Free(void)
00066 {
00067         if(m_data != NULL)
00068                 free(m_data);
00069         m_data = NULL;
00070 }
00071 
00075 void CMyMySQLPPTypeConv::SetData(const char* data)
00076 {
00077         Free();
00078         if(data != NULL)
00079                 m_data = strdup(data);
00080 }
00081 
00085 const char* CMyMySQLPPTypeConv::GetData(void)
00086 {
00087         return m_data;
00088 }
00089 
00093 int CMyMySQLPPTypeConv::GetAsInt(void)
00094 {
00095         if(m_data == NULL)
00096                 return 0;
00097         return atoi(m_data);
00098 }
00099 
00103 CMyMySQLPPTypeConv::operator int(void)
00104 {
00105         return GetAsInt();
00106 }
00107 
00111 LPSTR CMyMySQLPPTypeConv::GetAsString(void)
00112 {
00113         return m_data;
00114 }
00115 
00119 CMyMySQLPPTypeConv::operator LPSTR(void)
00120 {
00121         return GetAsString();
00122 }
00123 
00127 double CMyMySQLPPTypeConv::GetAsDouble(void)
00128 {
00129         if(m_data == NULL)
00130                 return 0;
00131         return atof(m_data);
00132 }
00133 
00137 CMyMySQLPPTypeConv::operator double(void)
00138 {
00139         return GetAsDouble();
00140 }
00141 
00145 long CMyMySQLPPTypeConv::GetAsLong(void)
00146 {
00147         if(m_data == NULL)
00148                 return 0;
00149         return atol(m_data);
00150 }
00151 
00155 CMyMySQLPPTypeConv::operator long(void)
00156 {
00157         return GetAsLong();
00158 }
00159 
00163 __int64 CMyMySQLPPTypeConv::GetAsInt64(void)
00164 {
00165         if(m_data == NULL)
00166                 return 0;
00167         return _atoi64(m_data);
00168 }
00169 
00173 CMyMySQLPPTypeConv::operator __int64(void)
00174 {
00175         return GetAsInt64();
00176 }
00177 
00181 UINT CMyMySQLPPTypeConv::GetAsUInt(void)
00182 {
00183         if(m_data == NULL)
00184                 return 0;
00185         return atoi(m_data);
00186 }
00187 
00191 CMyMySQLPPTypeConv::operator UINT(void)
00192 {
00193         return GetAsUInt();
00194 }
00195 
00199 LPCSTR CMyMySQLPPTypeConv::GetAsConstString(void)
00200 {
00201         return m_data;
00202 }
00203 
00207 CMyMySQLPPTypeConv::operator LPCSTR(void)
00208 {
00209         return GetAsConstString();
00210 }

Generated on Thu Feb 20 16:15:50 2003 for MyMySQL++ by doxygen1.3-rc3