MySQL++ Reference Manual

Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members File Members

# mysqlpp::const_string Class Reference

Wrapper for `const char*` to make it behave in a way more useful to MySQL++. More...

`#include <const_string.h>`

List of all members.

## Public Types
typedef const char | value_type
| Type of the data stored in this object, when it is not equal to SQL null.
typedef unsigned int | size_type
| Type of "size" integers.
typedef const char & | const_reference
| Type used when returning a reference to a character in the string.
typedef const char * | const_iterator
| Type of iterators.
typedef const_iterator | iterator
| Same as const_iterator because the data cannot be changed.
## Public Methods
| const_string ()
| Create empty string.
| const_string (const char *str)
| Initialize string from existing C string.
const_string & | operator= (const char *str)
| Assignment operator.
size_type | size () const
| Return number of characters in string.
const_iterator | begin () const
| Return iterator pointing to the first character of the string.
const_iterator | end () const
| Return iterator pointing to one past the last character of the string.
size_type | length () const
| Return number of characters in the string.
size_type | max_size () const
| Return the maximum number of characters in the string.
const_reference | operator[] (size_type pos) const
| Return a reference to a character within the string.
const_reference | at (size_type pos) const
| Return a reference to a character within the string.
const char * | c_str () const
| Return a const pointer to the string data, null-terminated.
const char * | data () const
| Alias for c_str().
int | compare (const const_string &str) const
| Lexically compare this string to another.

## Detailed Description

Wrapper for `const char*` to make it behave in a way more useful to MySQL++.

This class implements a small subset of the standard string class.

Objects are created from an existing `const char*` variable by copying the pointer only. Therefore, the object pointed to by that pointer needs to exist for at least as long as the const_string object that wraps it.

## Member Function Documentation

const_reference mysqlpp::const_string::at | ( | size_type | pos | ) | const`[inline]`

| Return a reference to a character within the string. Unlike `operator[]()`, this function throws an `std::out_of_range` exception if the index isn't within range.

int mysqlpp::const_string::compare | ( | const const_string & | str | ) | const`[inline]`

  | Lexically compare this string to another. Parameters:
  str | string to compare against this one
  Return values:
  <0 | if str1 is lexically "less than" str2
  0 | if str1 is equal to str2
  >0 | if str1 is lexically "greater than" str2

size_type mysqlpp::const_string::max_size | ( |  | ) | const`[inline]`

| Return the maximum number of characters in the string. Because this is a `const` string, this is just an alias for size(); its size is always equal to the amount of data currently stored.

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

- const_string.h