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 (size_t 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, size_t maxlen)
 creates a string from str and copies over the first maxlen characters. More...
 
QCStringoperator= (const char *str)
 replaces the contents by that of C string str. 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 ()
 Returns a writable pointer to the data.
 
bool resize (size_t newlen)
 Resizes the string to hold newlen characters (this value should also count the 0-terminator). More...
 
bool truncate (size_t 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 (size_t len) const
 
QCString right (size_t len) const
 
QCString mid (size_t index, size_t len=static_cast< size_t >(-1)) const
 
QCString lower () const
 
QCString upper () const
 
QCString stripWhiteSpace () const
 returns a copy of this string with leading and trailing whitespace removed
 
QCString removeWhiteSpace () const
 returns a copy of this string with all whitespace removed
 
QCString simplifyWhiteSpace () const
 return a copy of this string with leading and trailing whitespace removed and multiple whitespace characters replaced by a single space
 
QCStringinsert (size_t index, const QCString &s)
 
QCStringinsert (size_t index, const char *s)
 
QCStringinsert (size_t 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 (size_t index, size_t len)
 
QCStringreplace (size_t index, size_t 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
 
bool startsWith (const QCString &s) const
 
bool endsWith (const char *s) const
 
bool endsWith (const QCString &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 (size_t i)
 Returns a reference to the character at index i. More...
 
const char & at (size_t i) const
 
char & operator[] (int i)
 Indexing operator. More...
 
const char & operator[] (int i) const
 

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 ( size_t  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,
size_t  maxlen 
)
inline

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

Member Function Documentation

◆ at()

char& QCString::at ( size_t  i)
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 C string str.

◆ operator[]()

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

Indexing operator.

Equivalent to at().

◆ resize()

bool QCString::resize ( size_t  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 ( size_t  pos)
inline

Truncates the string at position pos.


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