doxygen
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 (const QCString &s)=default
 
QCStringoperator= (const QCString &s)=default
 
 QCString (QCString &&s)=default
 
QCStringoperator= (QCString &&s)=default
 
 QCString (const std::string &s)
 
 QCString (std::string &&s)
 
 QCString (uint 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 char *str)
 replaces the contents by that of string s. More...
 
QCStringoperator= (const std::string &s)
 
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, not counting the 0-terminator. More...
 
uint size () const
 Returns the length of the string, not counting 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.
 
bool resize (uint newlen)
 Resizes the string to hold newlen characters (this value should also count 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...
 
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 findRev (char c, int index=-1, bool cs=TRUE) const
 
int findRev (const char *str, int index=-1, bool cs=TRUE) const
 
int contains (char c, bool cs=TRUE) const
 
int contains (const char *str, bool cs=TRUE) const
 
bool stripPrefix (const QCString &prefix)
 
bool stripPrefix (const char *prefix)
 
QCString left (uint len) const
 
QCString right (uint len) const
 
QCString mid (uint index, uint len=(uint) -1) const
 
QCString lower () const
 
QCString upper () const
 
QCString stripWhiteSpace () const
 
QCString simplifyWhiteSpace () const
 
QCStringinsert (uint index, const QCString &s)
 
QCStringinsert (uint index, const char *s)
 
QCStringinsert (uint index, char c)
 
QCStringappend (char c)
 
QCStringappend (const char *s)
 
QCStringappend (const QCString &s)
 
QCStringappend (const std::string &s)
 
QCStringprepend (const char *s)
 
QCStringprepend (const QCString &s)
 
QCStringprepend (const std::string &s)
 
QCStringremove (uint index, uint len)
 
QCStringreplace (uint index, uint len, const char *s)
 
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
 
std::string str () const
 
QCStringoperator+= (const QCString &s)
 
QCStringoperator+= (const std::string &s)
 
QCStringoperator+= (const char *s)
 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 std::string as the underlying string type

Constructor & Destructor Documentation

◆ QCString() [1/3]

QCString::QCString ( uint  size)
inlineexplicit

creates a string with room for size characters

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

◆ QCString() [2/3]

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() [3/3]

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.

◆ 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, not counting the 0-terminator.

Equivalent to size().

◆ operator+=() [1/2]

QCString& QCString::operator+= ( const char *  s)
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=()

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

replaces the contents by that of string s.

replaces the contents by that of C string str.

◆ operator[]()

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

Indexing operator.

Equivalent to at().

◆ resize()

bool QCString::resize ( uint  newlen)
inline

Resizes the string to hold newlen characters (this value should also count 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, not counting 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: