CTempString Class Reference
[String Manipulations]

Search Toolkit Book for CTempString

#include <tempstr.hpp>

Inheritance diagram for CTempString:

Inheritance graph
[legend]
List of all members.

Detailed Description

CTempString implements a light-weight string on top of a storage buffer whose lifetime management is known and controlled.

CTempString is designed to perform no memory allocation but provide a string interaction interface conrguent with std::basic_string<char>. As such, CTempString provides a const-only access interface to its underlying storage. Care has been taken to avoid allocations and other expensive operations wherever possible.

Definition at line 63 of file tempstr.hpp.

std::basic_string<> compatibility typedefs and enums

typedef size_t size_type
typedef const char * const_iterator
static const size_type npos = static_cast<size_type>(-1)

Public Member Functions

 CTempString (void)
 CTempString (const char *str)
 CTempString (const char *str, size_type len)
 NCBI_DEPRECATED_CTOR (CTempString(const char *str, size_type pos, size_type len))
 Use CTempString(const char* str, size_type len) instead.
 CTempString (const string &str)
 NCBI_DEPRECATED_CTOR (CTempString(const string &str, size_type length))
 Use CTempString(const char* str, size_type pos, size_type len) instead.
 CTempString (const string &str, size_type pos, size_type len)
 CTempString (const CTempString &str)
 CTempString (const CTempString &str, size_type pos)
 CTempString (const CTempString &str, size_type pos, size_type len)
void Copy (string &dst, size_type pos, size_type length) const
 copy a substring into a string Somewhat similar to basic_string::assign()
 operator string (void) const
std::basic_string<> compatibility interface
CTempStringassign (const char *src_str, size_type len)
 Assign new values to the content of the a string.
CTempStringassign (const CTempString &src_str)
CTempStringassign (const CTempString &src_str, size_type off, size_type count)
const_iterator begin () const
 Return an iterator to the string's starting position.
const_iterator end () const
 Return an iterator to the string's ending position (one past the end of the represented sequence).
const char * data (void) const
 Return a pointer to the array represented.
size_type length (void) const
 Return the length of the represented array.
size_type size (void) const
 Return the length of the represented array.
bool empty (void) const
 Return true if the represented string is empty (i.e., the length is zero).
void clear (void)
 Clears the string.
void erase (size_type pos=0)
 Truncate the string at some specified position Note: basic_string<> supports additional erase() options that we do not provide here.
size_type find (const CTempString &match, size_type pos=0) const
 Find the first instance of the entire matching string within the current string, beginning at an optional offset.
size_type find (char match, size_type pos=0) const
 Find the first instance of a given character string within the current string, beginning at an optional offset.
size_type find_first_of (const CTempString &match, size_type pos=0) const
 Find the first occurrence of any character in the matching string within the current string, beginning at an optional offset.
size_type find_first_not_of (const CTempString &match, size_type pos=0) const
 Find the first occurrence of any character not in the matching string within the current string, beginning at an optional offset.
CTempString substr (size_type pos) const
 Obtain a substring from this string, beginning at a given offset.
CTempString substr (size_type pos, size_type len) const
 Obtain a substring from this string, beginning at a given offset and extending a specified length.
char operator[] (size_type pos) const
 Index into the current string and provide its character in a read- only fashion.
bool operator== (const char *str) const
 operator== for C-style strings
bool operator== (const string &str) const
 operator== for std::string strings
bool operator== (const CTempString &str) const
 operator== for CTempString strings
bool operator!= (const char *str) const
 operator!= for C-style strings
bool operator!= (const string &str) const
 operator!= for std::string strings
bool operator!= (const CTempString &str) const
 operator!= for CTempString strings
bool operator< (const char *str) const
 operator< for C-style strings
bool operator< (const string &str) const
 operator< for std::string strings
bool operator< (const CTempString &str) const
 operator< for CTempString strings

Private Member Functions

void x_Init (const char *str, size_type str_len, size_type pos, size_type len)
void x_Init (const char *str, size_type str_len, size_type pos)
bool x_Equals (const_iterator it2, size_type len2) const
bool x_Less (const_iterator it2, size_type len2) const

Private Attributes

const char * m_String
 Stored pointer to string.
size_type m_Length
 Length of string.


The documentation for this class was generated from the following file:
Generated on Wed Dec 9 08:11:26 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Wed Dec 09 08:20:04 2009 by modify_doxy.py rev. 173732