MySQL++  3.3.0
Public Types | Public Member Functions | List of all members
mysqlpp::tiny_int< VT > Class Template Reference

Class for holding an SQL TINYINT value. More...

#include <tiny_int.h>

Public Types

typedef tiny_int< VT > this_type
 alias for this object's type
 
typedef VT value_type
 alias for type of internal value
 

Public Member Functions

 tiny_int ()
 Default constructor. More...
 
 tiny_int (value_type v)
 Create object from any integral type that can be converted to a short int.
 
 operator bool () const
 Return truthiness of value.
 
 operator int () const
 Return value as an int.
 
 operator value_type () const
 Return raw data value with no size change.
 
this_typeoperator= (int v)
 Assign a new value to the object.
 
this_typeoperator+= (int v)
 Add another value to this object.
 
this_typeoperator-= (int v)
 Subtract another value to this object.
 
this_typeoperator*= (int v)
 Multiply this value by another object.
 
this_typeoperator/= (int v)
 Divide this value by another object.
 
this_typeoperator%= (int v)
 Divide this value by another object and store the remainder.
 
this_typeoperator&= (int v)
 Bitwise AND this value by another value.
 
this_typeoperator|= (int v)
 Bitwise OR this value by another value.
 
this_typeoperator^= (int v)
 Bitwise XOR this value by another value.
 
this_typeoperator<<= (int v)
 Shift this value left by v positions.
 
this_typeoperator>>= (int v)
 Shift this value right by v positions.
 
this_typeoperator++ ()
 Add one to this value and return that value.
 
this_typeoperator-- ()
 Subtract one from this value and return that value.
 
this_type operator++ (int)
 Add one to this value and return the previous value.
 
this_type operator-- (int)
 Subtract one from this value and return the previous value.
 
this_type operator- (const this_type &i) const
 Return this value minus i.
 
this_type operator+ (const this_type &i) const
 Return this value plus i.
 
this_type operator* (const this_type &i) const
 Return this value multiplied by i.
 
this_type operator/ (const this_type &i) const
 Return this value divided by i.
 
this_type operator% (const this_type &i) const
 Return the modulus of this value divided by i.
 
this_type operator| (const this_type &i) const
 Return this value bitwise OR'd by i.
 
this_type operator& (const this_type &i) const
 Return this value bitwise AND'd by i.
 
this_type operator^ (const this_type &i) const
 Return this value bitwise XOR'd by i.
 
this_type operator<< (const this_type &i) const
 Return this value bitwise shifted left by i.
 
this_type operator>> (const this_type &i) const
 Return this value bitwise shifted right by i.
 
bool operator== (const this_type &i) const
 Check for equality.
 
bool operator!= (const this_type &i) const
 Check for inequality.
 
bool operator< (const this_type &i) const
 Check that this object is less than another.
 
bool operator> (const this_type &i) const
 Check that this object is greater than another.
 
bool operator<= (const this_type &i) const
 Check this object is less than or equal to another.
 
bool operator>= (const this_type &i) const
 Check this object is greater than or equal to another.
 

Detailed Description

template<typename VT = signed char>
class mysqlpp::tiny_int< VT >

Class for holding an SQL TINYINT value.

This is required because the closest C++ type, char, doesn't have all the right semantics. For one, inserting a char into a stream won't give you a number. For another, if you don't specify signedness explicitly, C++ doesn't give a default, so it's signed on some platforms, unsigned on others.

The template parameter is intended to allow instantiating it as tiny_int<unsigned char> to hold TINYINT UNSIGNED values. There's nothing stopping you from using any other integer type if you want to be perverse, but please don't do that.

Several of the functions below accept an int argument, but internally we store the data as a char by default. Beware of integer overflows!

Constructor & Destructor Documentation

◆ tiny_int()

template<typename VT = signed char>
mysqlpp::tiny_int< VT >::tiny_int ( )
inline

Default constructor.

Value is uninitialized


The documentation for this class was generated from the following file: