doxygen
Classes | Public Member Functions | List of all members
QCString Class Reference

This is an alternative implementation of QCString. More...

#include <qcstring.h>

Public Member Functions

 QCString ()
 creates an empty string
 
 ~QCString ()
 destroys the string
 
 QCString (const QCString &s)
 makes a copy of a string. More...
 
 QCString (int size)
 creates a string with room for size characters More...
 
 QCString (const char *str)
 creates a string from a plain C string. More...
 
 QCString (const char *str, uint maxlen)
 creates a string from str and copies over the first maxlen characters. More...
 
QCStringoperator= (const QCString &s)
 replaces the contents by that of string s. More...
 
QCStringoperator= (const char *str)
 replaces the contents by that of C string str. More...
 
bool isNull () const
 Returns TRUE iff the string is empty. More...
 
bool isEmpty () const
 Returns TRUE iff the string is empty.
 
uint length () const
 Returns the length of the string, excluding the 0-terminator. More...
 
uint size () const
 Returns the length of the string, excluding the 0-terminator. More...
 
const char * data () const
 Returns a pointer to the contents of the string in the form of a 0-terminated C string.
 
char * rawData () const
 Returns a writable pointer to the data. More...
 
bool resize (uint newlen)
 Resizes the string to hold newlen characters (this value should include the 0-terminator). More...
 
bool truncate (uint pos)
 Truncates the string at position pos. More...
 
bool fill (char c, int len=-1)
 Fills a string with a predefined character. More...
 
QCString copy () const
 Returns a deep copy of the string. More...
 
QCStringsprintf (const char *format,...)
 
int find (char c, int index=0, bool cs=TRUE) const
 
int find (const char *str, int index=0, bool cs=TRUE) const
 
int find (const QCString &str, int index=0, bool cs=TRUE) const
 
int find (const QRegExp &rx, int index=0) const
 
int findRev (char c, int index=-1, bool cs=TRUE) const
 
int findRev (const char *str, int index=-1, bool cs=TRUE) const
 
int findRev (const QRegExp &rx, int index=-1) const
 
int contains (char c, bool cs=TRUE) const
 
int contains (const char *str, bool cs=TRUE) const
 
int contains (const QRegExp &rx) const
 
bool stripPrefix (const char *prefix)
 
QCString left (uint len) const
 
QCString right (uint len) const
 
QCString mid (uint index, uint len=0xffffffff) const
 
QCString lower () const
 
QCString upper () const
 
QCString stripWhiteSpace () const
 
QCString simplifyWhiteSpace () const
 
QCStringassign (const char *str)
 
QCStringinsert (uint index, const char *s)
 
QCStringinsert (uint index, char c)
 
QCStringappend (const char *s)
 
QCStringprepend (const char *s)
 
QCStringremove (uint index, uint len)
 
QCStringreplace (uint index, uint len, const char *s)
 
QCStringreplace (const QRegExp &rx, const char *str)
 
short toShort (bool *ok=0, int base=10) const
 
ushort toUShort (bool *ok=0, int base=10) const
 
int toInt (bool *ok=0, int base=10) const
 
uint toUInt (bool *ok=0, int base=10) const
 
long toLong (bool *ok=0, int base=10) const
 
ulong toULong (bool *ok=0, int base=10) const
 
uint64 toUInt64 (bool *ok=0, int base=10) const
 
QCStringsetNum (short n)
 
QCStringsetNum (ushort n)
 
QCStringsetNum (int n)
 
QCStringsetNum (uint n)
 
QCStringsetNum (long n)
 
QCStringsetNum (ulong n)
 
bool startsWith (const char *s) const
 
 operator const char * () const
 Converts the string to a plain C string.
 
QCStringoperator+= (const char *str)
 Appends string str to this string and returns a reference to the result. More...
 
QCStringoperator+= (char c)
 Appends character c to this string and returns a reference to the result. More...
 
char & at (uint i) const
 Returns a reference to the character at index i. More...
 
char & operator[] (int i) const
 Indexing operator. More...
 

Detailed Description

This is an alternative implementation of QCString.

It provides basically the same functions but uses reference counting and copy on write.

Constructor & Destructor Documentation

§ QCString() [1/4]

QCString::QCString ( const QCString s)
inline

makes a copy of a string.

§ QCString() [2/4]

QCString::QCString ( int  size)
inlineexplicit

creates a string with room for size characters

Parameters
[in]sizethe number of character to allocate (including the 0-terminator)

§ QCString() [3/4]

QCString::QCString ( const char *  str)
inline

creates a string from a plain C string.

Parameters
[in]strA zero terminated C string. When 0 an empty string is created.

§ QCString() [4/4]

QCString::QCString ( const char *  str,
uint  maxlen 
)
inline

creates a string from str and copies over the first maxlen characters.

Member Function Documentation

§ at()

char& QCString::at ( uint  i) const
inline

Returns a reference to the character at index i.

§ copy()

QCString QCString::copy ( ) const
inline

Returns a deep copy of the string.

§ fill()

bool QCString::fill ( char  c,
int  len = -1 
)
inline

Fills a string with a predefined character.

Parameters
[in]cthe character used to fill the string with.
[in]lenthe number of character to fill. Use -1 to fill the whole string.
Note
the string will be resized to contain len characters. The contents of the string will be lost.

§ isNull()

bool QCString::isNull ( ) const
inline

Returns TRUE iff the string is empty.

Equivalent to isEmpty().

§ length()

uint QCString::length ( ) const
inline

Returns the length of the string, excluding the 0-terminator.

Equivalent to size().

§ operator+=() [1/2]

QCString& QCString::operator+= ( const char *  str)
inline

Appends string str to this string and returns a reference to the result.

§ operator+=() [2/2]

QCString& QCString::operator+= ( char  c)
inline

Appends character c to this string and returns a reference to the result.

§ operator=() [1/2]

QCString& QCString::operator= ( const QCString s)
inline

replaces the contents by that of string s.

§ operator=() [2/2]

QCString& QCString::operator= ( const char *  str)
inline

replaces the contents by that of C string str.

§ operator[]()

char& QCString::operator[] ( int  i) const
inline

Indexing operator.

Equavalent to at().

§ rawData()

char* QCString::rawData ( ) const
inline

Returns a writable pointer to the data.

Warning
if the string is shared it will modifying the string directly and this will overwrite all copies as well!

§ resize()

bool QCString::resize ( uint  newlen)
inline

Resizes the string to hold newlen characters (this value should include the 0-terminator).

If the string is enlarged the contents will be left unmodified.

§ size()

uint QCString::size ( ) const
inline

Returns the length of the string, excluding the 0-terminator.

§ truncate()

bool QCString::truncate ( uint  pos)
inline

Truncates the string at position pos.


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