00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef MYSQLPP_TINY_INT_H
00029 #define MYSQLPP_TINY_INT_H
00030
00031 namespace mysqlpp {
00032
00042
00043 class MYSQLPP_EXPORT tiny_int
00044 {
00045 public:
00049 tiny_int() { }
00050
00053 tiny_int(short int v) :
00054 value_(char(v))
00055 {
00056 }
00057
00059 operator short int() const
00060 {
00061 return static_cast<short int>(value_);
00062 }
00063
00065 tiny_int& operator =(short int v)
00066 {
00067 value_ = char(v);
00068 return *this;
00069 }
00070
00072 tiny_int& operator +=(short int v)
00073 {
00074 value_ += char(v);
00075 return *this;
00076 }
00077
00079 tiny_int& operator -=(short int v)
00080 {
00081 value_ -= char(v);
00082 return *this;
00083 }
00084
00086 tiny_int& operator *=(short int v)
00087 {
00088 value_ *= char(v);
00089 return *this;
00090 }
00091
00093 tiny_int& operator /=(short int v)
00094 {
00095 value_ /= char(v);
00096 return *this;
00097 }
00098
00101 tiny_int& operator %=(short int v)
00102 {
00103 value_ %= char(v);
00104 return *this;
00105 }
00106
00108 tiny_int& operator &=(short int v)
00109 {
00110 value_ &= char(v);
00111 return *this;
00112 }
00113
00115 tiny_int& operator |=(short int v)
00116 {
00117 value_ |= char(v);
00118 return *this;
00119 }
00120
00122 tiny_int& operator ^=(short int v)
00123 {
00124 value_ ^= char(v);
00125 return *this;
00126 }
00127
00129 tiny_int& operator <<=(short int v)
00130 {
00131 value_ <<= char(v);
00132 return *this;
00133 }
00134
00136 tiny_int& operator >>=(short int v)
00137 {
00138 value_ >>= char(v);
00139 return *this;
00140 }
00141
00143 tiny_int& operator ++()
00144 {
00145 value_++;
00146 return *this;
00147 }
00148
00150 tiny_int& operator --()
00151 {
00152 value_--;
00153 return *this;
00154 }
00155
00157 tiny_int operator ++(int)
00158 {
00159 tiny_int tmp = value_;
00160 value_++;
00161 return tmp;
00162 }
00163
00166 tiny_int operator --(int)
00167 {
00168 tiny_int tmp = value_;
00169 value_--;
00170 return tmp;
00171 }
00172
00174 tiny_int operator -(const tiny_int& i) const
00175 {
00176 return value_ - i;
00177 }
00178
00180 tiny_int operator +(const tiny_int& i) const
00181 {
00182 return value_ + i;
00183 }
00184
00186 tiny_int operator *(const tiny_int& i) const
00187 {
00188 return value_ * i;
00189 }
00190
00192 tiny_int operator /(const tiny_int& i) const
00193 {
00194 return value_ / i;
00195 }
00196
00198 tiny_int operator %(const tiny_int& i) const
00199 {
00200 return value_ % i;
00201 }
00202
00204 tiny_int operator |(const tiny_int& i) const
00205 {
00206 return value_ | i;
00207 }
00208
00210 tiny_int operator &(const tiny_int& i) const
00211 {
00212 return value_ & i;
00213 }
00214
00216 tiny_int operator ^(const tiny_int& i) const
00217 {
00218 return value_ ^ i;
00219 }
00220
00222 tiny_int operator <<(const tiny_int& i) const
00223 {
00224 return value_ << i;
00225 }
00226
00228 tiny_int operator >>(const tiny_int& i) const
00229 {
00230 return value_ >> i;
00231 }
00232
00233 private:
00234 char value_;
00235 };
00236
00237 }
00238
00239 #endif