Forums  +  C++ and Sockets  +  C++ and SQL: MySQL, sqlite, ODBC  +  Miscellaneous Projects
Logo
~Database~
~ C++ ~
~Contact~

enum_t.h

Go to the documentation of this file.
00001 /*
00002 enum_t.h
00003 
00004 Copyright (C) 2004  Anders Hedstrom
00005 
00006 This program is made available under the terms of the GNU GPL.
00007 
00008 If you would like to use this program in a closed-source application,
00009 a separate license agreement is available. For information about 
00010 the closed-source license agreement for this program, please
00011 visit http://www.alhem.net/sqlwrapped/license.html and/or
00012 email license@alhem.net.
00013 
00014 This program is free software; you can redistribute it and/or
00015 modify it under the terms of the GNU General Public License
00016 as published by the Free Software Foundation; either version 2
00017 of the License, or (at your option) any later version.
00018 
00019 This program is distributed in the hope that it will be useful,
00020 but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022 GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License
00025 along with this program; if not, write to the Free Software
00026 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00027 */
00028 #ifndef _ENUM_T_H
00029 #define _ENUM_T_H
00030 
00031 #include <string>
00032 #include <map>
00033 #ifdef WIN32
00034 #include <config-win.h>
00035 #include <mysql.h>
00036 typedef unsigned __int64 uint64_t;
00037 #define strcasecmp stricmp
00038 #else
00039 #include <stdint.h>
00040 #endif
00041 
00042 #ifdef MYSQLW_NAMESPACE
00043 namespace MYSQLW_NAMESPACE {
00044 #endif
00045 
00046 
00048 class enum_t
00049 {
00050 public:
00051         enum_t(std::map<std::string, uint64_t>& );
00052 
00053         const std::string& String();
00054         unsigned short Value();
00055         const char *c_str();
00056 
00057         void operator=(const std::string& );
00058         void operator=(unsigned short);
00059         bool operator==(const std::string& );
00060         bool operator==(unsigned short);
00061         bool operator!=(const std::string& );
00062 
00063 private:
00064         std::map<std::string, uint64_t>& m_mmap;
00065         std::map<unsigned short, std::string> m_vmap;
00066         unsigned short m_value;
00067 
00068 };
00069 
00070 
00071 #ifdef MYSQLW_NAMESPACE
00072 } // namespace MYSQLW_NAMESPACE {
00073 #endif
00074 
00075 #endif // _ENUM_T_H
Page, code, and content Copyright (C) 2006 by Anders Hedström