EHS Embedded HTTP Server  1.5.1.0
datum.h
1 /* $Id: datum.h 164 2013-04-11 08:44:21Z vaxpower $
2  *
3  * EHS is a library for embedding HTTP(S) support into a C++ application
4  *
5  * Copyright (C) 2004 Zachary J. Hansen
6  *
7  * Code cleanup, new features and bugfixes: Copyright (C) 2010 Fritz Elfert
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License version 2.1 as published by the Free Software Foundation;
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  *
22  * This can be found in the 'COPYING' file.
23  *
24  */
25 
26 #ifndef DATUM_H
27 #define DATUM_H
28 
29 #include <string>
30 
32 
36 class Datum {
37 
38  protected:
39 
41  std::string sDatum;
42 
43  public:
45  Datum ( ) : sDatum ( "" ) { }
46 
48  Datum ( const Datum & other ) : sDatum( other.sDatum ) { }
49 
51  Datum & operator=( const Datum & other );
52 
54  Datum & operator= ( unsigned long inUL );
55 
57  Datum & operator= ( long inLong );
58 
60  Datum & operator= ( unsigned int inUI );
61 
63  Datum & operator= ( int inInt );
64 
66  Datum & operator= ( double inDouble );
67 
69  Datum & operator= ( std::string isString );
70 
72  Datum & operator= ( char * ipsString );
73 
75  Datum & operator= ( const char * ipsString );
76 
78  Datum & operator= ( void * ipVoid );
79 
81  bool operator== ( const char * ipsString );
82 
84  operator int ( );
85 
87  int GetInt() { return (int)(*this); }
88 
90  operator unsigned long ( );
91 
93  operator long ( );
94 
96  operator double ( );
97 
99  operator std::string ( );
100 
102  operator const char * ( );
103 
105  const char * GetCharString ( ) { return (const char*)(*this); }
106 
107 
109  bool operator!= ( int );
110 
112  bool operator!= ( const char * );
113 
114 };
115 
116 #endif // DATUM_H
const char * GetCharString()
explicit accessor for const char *
Definition: datum.h:105
Datum()
Default constructor.
Definition: datum.h:45
int GetInt()
explicit accessor for int
Definition: datum.h:87
std::string sDatum
holds the data in string form
Definition: datum.h:41
bool operator==(const char *ipsString)
equality operator for const char * string
Datum & operator=(const Datum &other)
Assignment operator.
bool operator!=(int)
inequality operator to test against int
Datum(const Datum &other)
Copy constructor.
Definition: datum.h:48
class that makes it easy to go between numbers and strings
Definition: datum.h:36