Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class 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 Member Functions

 const_string ()
 Create empty string.

 const_string (const std::string &str)
 Initialize string from existing C++ string.

 const_string (const char *str)
 Initialize string from existing C string.

 const_string (const char *str, size_type len)
 Initialize string from existing C string of known length.

 ~const_string ()
 Destroy string.

const_stringoperator= (const char *str)
 Assignment operator, from C string.

const_stringoperator= (const const_string &cs)
 Assignment operator, from other const_string.

size_type length () const
 Return number of characters in the string.

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 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. Not necessarily 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.

As of MySQL++ 2.3, it makes a copy of the string we are initialized with, instead of just copying the pointer. This is required to avoid problems with the new SSQLS + BLOB support.


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:
Generated on Wed Jul 11 15:35:11 2007 for MySQL++ by doxygen 1.3.5