bt_xstring Class Reference
[String Objects]

An eight bit character string class.

#include <bt_xstring.h>

List of all members.

Public Member Functions

const bt_xstringappend (const char *p, size_t n)
 Appends a character string.
const bt_xstringassign (const BT_UInt16 *str, size_t n)
 Replaces the value of the string object with the value of a fixed length UTF-16 string.
const bt_xstringassign (const char *str, size_t n)
 Replaces the value of the string object with the value of a fixed length character string.
const bt_xstringassign (const char *str)
 Replaces the value of the string object with the value of a null-terminated character string.
const bt_xstringassign (const bt_xstring &str)
 Replaces the value the string object with the value of another string object.
char at (size_t i) const
 Constant element access.
char & at (size_t i)
 Non-constant element access.
 bt_xstring (const BT_UInt16 *s)
 Constructs a bt_xstring object from a null-terminated UTF-16 string.
 bt_xstring (const char *s)
 Constructs a bt_xstring object from a null-terminated character string.
 bt_xstring (const BT_UInt16 *utf16_string, size_t n)
 Constructs a bt_xstring object from a fixed length UTF-16 string.
 bt_xstring (const char *s, size_t n)
 Constructs a bt_xstring object from a fixed length character string.
 bt_xstring (const bt_xstring &other, size_t pos, size_t n=npos)
 Constructs a bt_xstring object from a substring of another bt_xstring object.
 bt_xstring (const bt_xstring &other)
 Copy constructor.
 bt_xstring ()
 Default constructor constructs an empty string.
const char * c_str () const
 Converts value of the object to a null-terminated character string.
size_t capacity () const
 Return the capacity of this string.
int compare (const bt_xstring &str) const
 Compares (case-sensitive) this string to another.
size_t copy (char *p, size_t n, size_t pos=0) const
 Copies a portion of the contents of the object.
const char * data () const
 Converts the value of the object to a character string that is not null-terminated.
bool empty () const
 Returns true if string is empty, false otherwise.
const bt_xstringerase (size_t i, size_t n=npos)
 Deletes string contents.
const bt_xstringerase ()
 Deletes entire string contents.
bool find (char c) const
 Determines if a character exists in this string.
size_t find (const bt_xstring &s, size_t i=0) const
 Finds a string in this one.
const bt_xstringinsert (size_t pos, const char *s, size_t n=npos)
 Inserts a character string.
const bt_xstringinsert (size_t pos, char c, size_t n=1)
 Inserts a character.
const bt_xstringinsert (size_t pos, bt_xstring &p)
 Inserts a bt_xstring.
size_t length () const
 Returns the length of this string.
const bt_xstringoperator+= (char c)
 Append operator.
const bt_xstringoperator+= (const char *p)
 Append operator.
const bt_xstringoperator+= (const bt_xstring &p)
 Append operator.
const bt_xstringoperator= (const char *rhs)
 Replaces the value of the string object with the value of a null-terminated character string.
const bt_xstringoperator= (const bt_xstring &rhs)
 Replaces the value of the string object with the value of another string object.
char operator[] (size_t i) const
 Constant element access.
char & operator[] (size_t i)
 Non-constant element access.
size_t size () const
 Returns the length of this string.
 ~bt_xstring ()
 Destructor.

Static Public Attributes

static const size_t npos
 Represents a missing or unused value.


Constructor & Destructor Documentation

bt_xstring::bt_xstring (  ) 

Default constructor constructs an empty string.

bt_xstring::bt_xstring ( const bt_xstring other  ) 

Copy constructor.

Parameters:
other A bt_xstring object.

bt_xstring::bt_xstring ( const bt_xstring other,
size_t  pos,
size_t  n = npos 
)

Constructs a bt_xstring object from a substring of another bt_xstring object.

Parameters:
other A bt_xstring object.
pos Index of the beginning of the substring of other to be copied.
n Number of characters to be copied. Default value causes the remainder of the string to be copied.

bt_xstring::bt_xstring ( const char *  s,
size_t  n 
)

Constructs a bt_xstring object from a fixed length character string.

Parameters:
s A character string, not necessarily null-terminated.
n The number of characters to be copied.

bt_xstring::bt_xstring ( const BT_UInt16 utf16_string,
size_t  n 
)

Constructs a bt_xstring object from a fixed length UTF-16 string.

Parameters:
utf16_string A character string, not necessarily null-terminated.
n The number of characters to be copied.

bt_xstring::bt_xstring ( const char *  s  ) 

Constructs a bt_xstring object from a null-terminated character string.

Parameters:
s A null-terminated character string.

bt_xstring::bt_xstring ( const BT_UInt16 s  ) 

Constructs a bt_xstring object from a null-terminated UTF-16 string.

Parameters:
s A null-terminated UTF-16 string.

bt_xstring::~bt_xstring (  ) 

Destructor

Note that this destructor is not virtual. The class is not intended as a base class.


Member Function Documentation

const bt_xstring& bt_xstring::append ( const char *  p,
size_t  n 
)

Appends a character string.

Parameters:
p Pointer to string to append.
n Number of characters in the string to append.
Returns:
Reference to the modified bt_xstring.

const bt_xstring& bt_xstring::assign ( const BT_UInt16 str,
size_t  n 
)

Replaces the value of the string object with the value of a fixed length UTF-16 string.

Parameters:
str A UTF-16 string.
n The number of characters to be copied form str.
Returns:
A constant reference to the modified object.

const bt_xstring& bt_xstring::assign ( const char *  str,
size_t  n 
)

Replaces the value of the string object with the value of a fixed length character string.

Parameters:
str A character string.
n The number of characters to be copied form str.
Returns:
A constant reference to the modified object.

const bt_xstring& bt_xstring::assign ( const char *  str  ) 

Replaces the value of the string object with the value of a null-terminated character string.

Parameters:
str A null terminated character string.
Returns:
A constant reference to the modified object.

const bt_xstring& bt_xstring::assign ( const bt_xstring str  ) 

Replaces the value the string object with the value of another string object.

Parameters:
str The string object to be copied.
Returns:
A constant reference to the modified object.

char bt_xstring::at ( size_t  i  )  const

Constant element access.

Parameters:
i The zero-based index of a character in the string.
Returns:
The value of the character at i.

char& bt_xstring::at ( size_t  i  ) 

Non-constant element access.

Parameters:
i The zero-based index of the character to be modified.
Returns:
A reference to the indicated character.

const char* bt_xstring::c_str (  )  const

Converts value of the object to a null-terminated character string.

Returns:
A pointer to the null-terminated contents of the object.

size_t bt_xstring::capacity (  )  const

Returns the capacity of this string.

Returns:
The capacity of this string.

int bt_xstring::compare ( const bt_xstring str  )  const

Compares (case-sensitive) this string to another.

Parameters:
str String with which to compare this one.
Returns:
0 if they are equal; <0 if this comes before str in collation order; >0 if it comes after.

size_t bt_xstring::copy ( char *  p,
size_t  n,
size_t  pos = 0 
) const

Copies a portion of the contents of the object.

Parameters:
p A pointer to the destination of the copy.
n The maximum number of characters to be copied.
pos The index of the object to begin copying at.
Returns:
The actual number of characters copied.

const char* bt_xstring::data (  )  const

Converts the value of the object to a character string that is not null-terminated.

Returns:
A pointer to the contents of the object.

bool bt_xstring::empty (  )  const [inline]

Returns true if string is empty, false otherwise.

Returns:
True if string is empty, false otherwise.

const bt_xstring& bt_xstring::erase ( size_t  i,
size_t  n = npos 
)

Deletes the specified string contents.

Parameters:
i Start position.
n Number of characters to delete.
Returns:
Reference to the modified bt_xstring.

const bt_xstring& bt_xstring::erase (  ) 

Deletes entire string contents.

Returns:
Reference to the modified bt_xstring.

bool bt_xstring::find ( char  c  )  const

Determines if a given character exists in this string.

Parameters:
c Character to find.
Returns:
True if found, false otherwise.

size_t bt_xstring::find ( const bt_xstring s,
size_t  i = 0 
) const

Finds a string in this one.

Parameters:
s bt_xstring to find.
i Position from which to begin the search.
Returns:
Start position of the string if found, 0 otherwise.

const bt_xstring& bt_xstring::insert ( size_t  pos,
const char *  s,
size_t  n = npos 
)

Inserts a character string at the given position

Parameters:
pos Character position where insertion will occur.
s Character string to insert.
n Number of characters in the string to insert.
Returns:
Reference to the modified bt_xstring.

const bt_xstring& bt_xstring::insert ( size_t  pos,
char  c,
size_t  n = 1 
)

Inserts a character or characters at the given position

Parameters:
pos Character position where insertion will occur.
c Character to insert.
n Number of occurances of the character to insert.
Returns:
Reference to the modified bt_xstring.

const bt_xstring& bt_xstring::insert ( size_t  pos,
bt_xstring p 
)

Inserts a bt_xstring at the given position

Parameters:
pos Character position where insertion will occur.
p Reference to the bt_xtring to be inserted.
Returns:
Reference to the modified bt_xstring.

size_t bt_xstring::length (  )  const [inline]

Returns length of this string.

Returns:
The length of this string.

const bt_xstring& bt_xstring::operator+= ( char  c  ) 

Append operator.

Parameters:
c character to append.
Returns:
Reference to the modified bt_xstring.

const bt_xstring& bt_xstring::operator+= ( const char *  p  ) 

Append operator.

Parameters:
p character string to append.
Returns:
Reference to the modified bt_xstring.

const bt_xstring& bt_xstring::operator+= ( const bt_xstring p  ) 

Append operator.

Parameters:
p bt_xstring to append.
Returns:
Reference to the modified bt_xstring.

const bt_xstring& bt_xstring::operator= ( const char *  rhs  )  [inline]

Replaces the value of the string object with the value of a null-terminated character string.

Parameters:
rhs A null-terminated character string.
Returns:
A constant reference to the modified object.

const bt_xstring& bt_xstring::operator= ( const bt_xstring rhs  )  [inline]

Replaces the value of the string object with the value of another string object.

Parameters:
rhs The string object to be copied.
Returns:
A constant reference to the modified object.

char bt_xstring::operator[] ( size_t  i  )  const

Constant element access.

Parameters:
i The zero-based index of a character in the string.
Returns:
The value of the character at i.

char& bt_xstring::operator[] ( size_t  i  ) 

Non-constant element access.

Parameters:
i The zero-based index of the character to be modified.
Returns:
A reference to the indicated character.

size_t bt_xstring::size (  )  const

Returns length of this string.

Returns:
The length of this string.


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

Copyright © 2004-2008 Basis Technology Corporation. All Rights Reserved.