MySQL++ Reference Manual

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

# mysqlpp::tiny_int< VT > Class Template Reference

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

`#include <tiny_int.h>`

List of all members.

## 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.
| 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_type & | operator= (int v)
| Assign a new value to the object.
this_type & | operator+= (int v)
| Add another value to this object.
this_type & | operator-= (int v)
| Subtract another value to this object.
this_type & | operator *= (int v)
| Multiply this value by another object.
this_type & | operator/= (int v)
| Divide this value by another object.
this_type & | operator%= (int v)
| Divide this value by another object and store the remainder.
this_type & | operator &= (int v)
| Bitwise AND this value by another value.
this_type & | operator|= (int v)
| Bitwise OR this value by another value.
this_type & | operator^= (int v)
| Bitwise XOR this value by another value.
this_type & | operator<<= (int v)
| Shift this value left by `v` positions.
this_type & | operator>>= (int v)
| Shift this value right by `v` positions.
this_type & | operator++ ()
| Add one to this value and return that value.
this_type & | operator-- ()
| 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`.

## 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

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:

- tiny_int.h