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

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

#include <qcstring.h>

Public Types

enum  SizeTag { ExplicitSize }
 creates a string with room for size characters More...
 

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 (std::string_view sv)
 
QCStringoperator= (std::string_view sv)
 
 QCString (int)=delete
 
 QCString (const JavaCCString &s)
 For converting a JavaCC string.
 
QCStringoperator= (const JavaCCString &s)
 
 QCString (size_t size, SizeTag t)
 
 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 isEmpty () const
 Returns TRUE iff the string is empty.
 
size_t length () const
 Returns the length of the string, not counting the 0-terminator. More...
 
size_t 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.
 
std::string_view view () const
 
char * rawData ()
 Returns a writable pointer to the data.
 
void resize (size_t newlen)
 
void clear ()
 
void reserve (size_t size)
 Reserve space for size bytes without changing the string contents.
 
void 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 quoted () const
 
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
 
QCString repeat (unsigned int n) const
 
QCStringinsert (size_t index, const QCString &s)
 
QCStringinsert (size_t index, std::string_view 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)
 
QCStringappend (std::string_view s)
 
QCStringprepend (const char *s)
 
QCStringprepend (const QCString &s)
 
QCStringprepend (const std::string &s)
 
QCStringprepend (std::string_view s)
 
QCStringremove (size_t index, size_t len)
 
QCStringreplace (size_t index, size_t len, const char *s)
 
short toShort (bool *ok=nullptr, int base=10) const
 
uint16_t toUShort (bool *ok=nullptr, int base=10) const
 
int toInt (bool *ok=nullptr, int base=10) const
 
uint32_t toUInt (bool *ok=nullptr, int base=10) const
 
long toLong (bool *ok=nullptr, int base=10) const
 
unsigned long toULong (bool *ok=nullptr, int base=10) const
 
uint64_t toUInt64 (bool *ok=nullptr, int base=10) const
 
QCStringsetNum (short n)
 
QCStringsetNum (uint16_t n)
 
QCStringsetNum (int n)
 
QCStringsetNum (uint32_t n)
 
QCStringsetNum (long n)
 
QCStringsetNum (long long n)
 
QCStringsetNum (unsigned long long n)
 
QCStringsetNum (unsigned long 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
 
const std::string & str () const
 
QCStringoperator+= (const QCString &s)
 
QCStringoperator+= (const std::string &s)
 
QCStringoperator+= (std::string_view 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[] (size_t i)
 Indexing operator. More...
 
const char & operator[] (size_t 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

Member Enumeration Documentation

◆ SizeTag

creates a string with room for size characters

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

Constructor & Destructor Documentation

◆ QCString() [1/2]

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

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()

void 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.

◆ length()

size_t 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[] ( size_t  i)
inline

Indexing operator.

Equivalent to at().

◆ size()

size_t QCString::size ( ) const
inline

Returns the length of the string, not counting the 0-terminator.


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