Eneboo - Documentación para desarrolladores
Métodos públicos | Funciones relacionadas
Referencia de la Clase QCString

The QCString class provides an abstraction of the classic C zero-terminated char array (char *). Más...

#include <qcstring.h>

Diagrama de herencias de QCString
QByteArray QByteArray

Lista de todos los miembros.

Métodos públicos

 QCString ()
 QCString (int size)
 QCString (const QCString &s)
 QCString (const char *str)
 QCString (const char *str, uint maxlen)
 ~QCString ()
QCStringoperator= (const QCString &s)
QCStringoperator= (const char *str)
bool isNull () const
bool isEmpty () const
uint length () const
bool resize (uint newlen)
bool truncate (uint pos)
bool fill (char c, int len=-1)
QCString copy () const
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 QRegExp &, 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 &, 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 &) const
QCString left (uint len) const
QCString right (uint len) const
QCString mid (uint index, uint len=0xffffffff) const
QCString leftJustify (uint width, char fill=' ', bool trunc=FALSE) const
QCString rightJustify (uint width, char fill=' ', bool trunc=FALSE) const
QCString lower () const
QCString upper () const
QCString stripWhiteSpace () const
QCString simplifyWhiteSpace () const
QCStringinsert (uint index, const char *)
QCStringinsert (uint index, char)
QCStringappend (const char *)
QCStringprepend (const char *)
QCStringremove (uint index, uint len)
QCStringreplace (uint index, uint len, const char *)
QCStringreplace (const QRegExp &, const char *)
QCStringreplace (char c, const char *after)
QCStringreplace (const char *, const char *)
QCStringreplace (char, char)
short toShort (bool *ok=0) const
ushort toUShort (bool *ok=0) const
int toInt (bool *ok=0) const
uint toUInt (bool *ok=0) const
long toLong (bool *ok=0) const
ulong toULong (bool *ok=0) const
float toFloat (bool *ok=0) const
double toDouble (bool *ok=0) const
QCStringsetStr (const char *s)
QCStringsetNum (short)
QCStringsetNum (ushort)
QCStringsetNum (int)
QCStringsetNum (uint)
QCStringsetNum (long)
QCStringsetNum (ulong)
QCStringsetNum (float, char f='g', int prec=6)
QCStringsetNum (double, char f='g', int prec=6)
bool setExpand (uint index, char c)
 operator const char * () const
QCStringoperator+= (const char *str)
QCStringoperator+= (char c)
 QCString ()
 QCString (int size)
 QCString (const QCString &s)
 QCString (const char *str)
 QCString (const char *str, uint maxlen)
 ~QCString ()
QCStringoperator= (const QCString &s)
QCStringoperator= (const char *str)
bool isNull () const
bool isEmpty () const
uint length () const
bool resize (uint newlen)
bool truncate (uint pos)
bool fill (char c, int len=-1)
QCString copy () const
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 QRegExp &, 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 &, 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 &) const
QCString left (uint len) const
QCString right (uint len) const
QCString mid (uint index, uint len=0xffffffff) const
QCString leftJustify (uint width, char fill=' ', bool trunc=FALSE) const
QCString rightJustify (uint width, char fill=' ', bool trunc=FALSE) const
QCString lower () const
QCString upper () const
QCString stripWhiteSpace () const
QCString simplifyWhiteSpace () const
QCStringinsert (uint index, const char *)
QCStringinsert (uint index, char)
QCStringappend (const char *)
QCStringprepend (const char *)
QCStringremove (uint index, uint len)
QCStringreplace (uint index, uint len, const char *)
QCStringreplace (const QRegExp &, const char *)
QCStringreplace (char c, const char *after)
QCStringreplace (const char *, const char *)
QCStringreplace (char, char)
short toShort (bool *ok=0) const
ushort toUShort (bool *ok=0) const
int toInt (bool *ok=0) const
uint toUInt (bool *ok=0) const
long toLong (bool *ok=0) const
ulong toULong (bool *ok=0) const
float toFloat (bool *ok=0) const
double toDouble (bool *ok=0) const
QCStringsetStr (const char *s)
QCStringsetNum (short)
QCStringsetNum (ushort)
QCStringsetNum (int)
QCStringsetNum (uint)
QCStringsetNum (long)
QCStringsetNum (ulong)
QCStringsetNum (float, char f='g', int prec=6)
QCStringsetNum (double, char f='g', int prec=6)
bool setExpand (uint index, char c)
 operator const char * () const
QCStringoperator+= (const char *str)
QCStringoperator+= (char c)

Funciones relacionadas

(Observar que estas no son funciones miembro.)

void * qmemmove (void *dst, const void *src, uint len)
char * qstrdup (const char *src)
char * qstrcpy (char *dst, const char *src)
char * qstrncpy (char *dst, const char *src, uint len)
uint qstrlen (const char *str)
int qstrcmp (const char *str1, const char *str2)
int qstrncmp (const char *str1, const char *str2, uint len)
int qstricmp (const char *str1, const char *str2)
int qstrnicmp (const char *str1, const char *str2, uint len)
QDataStreamoperator<< (QDataStream &s, const QCString &str)
QDataStreamoperator>> (QDataStream &s, QCString &str)
bool operator== (const QCString &s1, const QCString &s2)
bool operator
bool operator
bool operator!= (const QCString &s1, const QCString &s2)
bool operator
bool operator
bool operator< (const QCString &s1, const char *s2)
bool operator
bool operator<= (const QCString &s1, const char *s2)
bool operator
bool operator> (const QCString &s1, const char *s2)
bool operator
bool operator>= (const QCString &s1, const char *s2)
bool operator
const QCString operator+ (const QCString &s1, const QCString &s2)
const QCString operator
const QCString operator
const QCString operator
const QCString operator

Descripción detallada

The QCString class provides an abstraction of the classic C zero-terminated char array (char *).

QCString inherits QByteArray, which is defined as QMemArray<char>. Since QCString is a QMemArray, it uses explicit sharing with a reference count.

QCString tries to behave like a more convenient {const char *}. The price of doing this is that some algorithms will perform badly. For example, append() is O(length()) since it scans for a null terminator. Although you might use QCString for text that is never exposed to the user, for most purposes, and especially for user-visible text, you should use QString. QString provides implicit sharing, Unicode and other internationalization support, and is well optimized.

Note that for the QCString methods that take a {const char *} parameter the {const char *} must either be 0 (null) or not-null and '\0' (NUL byte) terminated; otherwise the results are undefined.

A QCString that has not been assigned to anything is null, i.e. both the length and the data pointer is 0. A QCString that references the empty string ("", a single '\0' char) is empty. Both null and empty QCStrings are legal parameters to the methods. Assigning {const char *} 0 to QCString produces a null QCString.

The length() function returns the length of the string; resize() resizes the string and truncate() truncates the string. A string can be filled with a character using fill(). Strings can be left or right padded with characters using leftJustify() and rightJustify(). Characters, strings and regular expressions can be searched for using find() and findRev(), and counted using contains().

Strings and characters can be inserted with insert() and appended with append(). A string can be prepended with prepend(). Characters can be removed from the string with remove() and replaced with replace().

Portions of a string can be extracted using left(), right() and mid(). Whitespace can be removed using stripWhiteSpace() and simplifyWhiteSpace(). Strings can be converted to uppercase or lowercase with upper() and lower() respectively.

Strings that contain numbers can be converted to numbers with toShort(), toInt(), toLong(), toULong(), toFloat() and toDouble(). Numbers can be converted to strings with setNum().

Many operators are overloaded to work with QCStrings. QCString also supports some more obscure functions, e.g. sprintf(), setStr() and setExpand().

asciinotion Note on Character Comparisons

In QCString the notion of uppercase and lowercase and of which character is greater than or less than another character is locale dependent. This affects functions which support a case insensitive option or which compare or lowercase or uppercase their arguments. Case insensitive operations and comparisons will be accurate if both strings contain only ASCII characters. (If $LC_CTYPE is set, most Unix systems do "the right thing".) Functions that this affects include contains(), find(), findRev(), operator<(), operator<=(), operator>(), operator>=(), lower() and upper().

This issue does not apply to {QString}s since they represent characters using Unicode.

Performance note: The QCString methods for QRegExp searching are implemented by converting the QCString to a QString and performing the search on that. This implies a deep copy of the QCString data. If you are going to perform many QRegExp searches on a large QCString, you will get better performance by converting the QCString to a QString yourself, and then searching in the QString.


Documentación del constructor y destructor

QCString::QCString ( ) [inline]

Constructs a null string.

Ver también:
isNull()
QCString::QCString ( int  size)

Constructs a string with room for size characters, including the '\0'-terminator. Makes a null string if size == 0.

If size > 0, then the first and last characters in the string are initialized to '\0'. All other characters are uninitialized.

Ver también:
resize(), isNull()
QCString::QCString ( const QCString s) [inline]

Constructs a shallow copy s.

Ver también:
assign()
QCString::QCString ( const char *  str)

Constructs a string that is a deep copy of str.

If str is 0 a null string is created.

Ver también:
isNull()
QCString::QCString ( const char *  str,
uint  maxsize 
)

Constructs a string that is a deep copy of str. The copy will be at most maxsize bytes long including the '\0'-terminator.

Example:

    QCString str( "helloworld", 6 ); // assigns "hello" to str

If str contains a 0 byte within the first maxsize bytes, the resulting QCString will be terminated by this 0. If str is 0 a null string is created.

Ver también:
isNull()
QCString::~QCString ( )
QCString::QCString ( ) [inline]
QCString::QCString ( int  size)
QCString::QCString ( const QCString s) [inline]
QCString::QCString ( const char *  str)
QCString::QCString ( const char *  str,
uint  maxlen 
)
QCString::~QCString ( )

Documentación de las funciones miembro

QCString & QCString::append ( const char *  str) [inline]

Appends string str to the string and returns a reference to the string. Equivalent to operator+=().

QCString& QCString::append ( const char *  )
int QCString::contains ( const QRegExp rx) const

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Counts the number of overlapping occurrences of rx in the string.

Example:

    QString s = "banana and panama";
    QRegExp r = QRegExp( "a[nm]a", TRUE, FALSE );
    s.contains( r ); // 4 matches
Ver también:
find(), findRev()
Atención:
If you want to apply this function repeatedly to the same string it is more efficient to convert the string to a QString and apply the function to that.
int QCString::contains ( char  c,
bool  cs = TRUE 
) const
int QCString::contains ( const char *  str,
bool  cs = TRUE 
) const
int QCString::contains ( const QRegExp ) const
int QCString::contains ( const char *  str,
bool  cs = TRUE 
) const

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Returns the number of times str occurs in the string.

The match is case sensitive if cs is TRUE, or case insensitive if cs if FALSE.

This function counts overlapping substrings, for example, "banana" contains two occurrences of "ana".

Ver también:
findRev() Note on character comparisons
int QCString::contains ( char  c,
bool  cs = TRUE 
) const

Returns the number of times the character c occurs in the string.

The match is case sensitive if cs is TRUE, or case insensitive if cs if FALSE.

Ver también:
Note on character comparisons
QCString QCString::copy ( ) const
QCString QCString::copy ( ) const [inline]

Returns a deep copy of this string.

Ver también:
detach()
bool QCString::fill ( char  c,
int  len = -1 
)
bool QCString::fill ( char  c,
int  len = -1 
)

Fills the string with len bytes of character c, followed by a '\0'-terminator.

If len is negative, then the current string length is used.

Returns FALSE is len is nonnegative and there is not enough memory to resize the string; otherwise returns TRUE.

int QCString::find ( char  c,
int  index = 0,
bool  cs = TRUE 
) const
int QCString::find ( const char *  str,
int  index = 0,
bool  cs = TRUE 
) const
int QCString::find ( const QRegExp ,
int  index = 0 
) const
int QCString::find ( char  c,
int  index = 0,
bool  cs = TRUE 
) const

Finds the first occurrence of the character c, starting at position index.

The search is case sensitive if cs is TRUE, or case insensitive if cs is FALSE.

Returns the position of c, or -1 if c could not be found.

Ver también:
Note on character comparisons
int QCString::find ( const QRegExp rx,
int  index = 0 
) const

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Finds the first occurrence of the regular expression rx, starting at position index.

Returns the position of the next match, or -1 if rx was not found.

Atención:
If you want to apply this function repeatedly to the same string it is more efficient to convert the string to a QString and apply the function to that.
int QCString::find ( const char *  str,
int  index = 0,
bool  cs = TRUE 
) const

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Finds the first occurrence of the string str, starting at position index.

The search is case sensitive if cs is TRUE, or case insensitive if cs is FALSE.

Returns the position of str, or -1 if str could not be found.

Ver también:
Note on character comparisons
int QCString::findRev ( const QRegExp rx,
int  index = -1 
) const

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Finds the first occurrence of the regular expression rx, starting at position index and searching backwards.

Returns the position of the next match (backwards), or -1 if rx was not found.

Atención:
If you want to apply this function repeatedly to the same string it is more efficient to convert the string to a QString and apply the function to that.
int QCString::findRev ( char  c,
int  index = -1,
bool  cs = TRUE 
) const
int QCString::findRev ( const char *  str,
int  index = -1,
bool  cs = TRUE 
) const
int QCString::findRev ( const QRegExp ,
int  index = -1 
) const
int QCString::findRev ( char  c,
int  index = -1,
bool  cs = TRUE 
) const

Finds the first occurrence of the character c, starting at position index and searching backwards.

The search is case sensitive if cs is TRUE, or case insensitive if cs is FALSE.

Returns the position of c, or -1 if c could not be found.

Ver también:
Note on character comparisons
int QCString::findRev ( const char *  str,
int  index = -1,
bool  cs = TRUE 
) const

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Finds the first occurrence of the string str, starting at position index and searching backwards.

The search is case sensitive if cs is TRUE, or case insensitive if cs is FALSE.

Returns the position of str, or -1 if str could not be found.

Ver también:
Note on character comparisons
QCString& QCString::insert ( uint  index,
const char *   
)
QCString& QCString::insert ( uint  index,
char   
)
QCString & QCString::insert ( uint  index,
const char *  s 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Inserts string s into the string at position index.

If index is beyond the end of the string, the string is padded with spaces (ASCII 32) to length index and then s is appended.

    QCString s = "I like fish";
    s.insert( 2, "don't ");     // s == "I don't like fish"

    s = "x";                    // index 01234
    s.insert( 3, "yz" );        // s == "x  yz"
QCString & QCString::insert ( uint  index,
char  c 
)

Inserts character c into the string at position index and returns a reference to the string.

If index is beyond the end of the string, the string is padded with spaces (ASCII 32) to length index and then c is appended.

Example:

    QCString s = "Yes";
    s.insert( 3, '!');   // s == "Yes!"
Ver también:
remove(), replace()
bool QCString::isEmpty ( void  ) const [inline]

Returns TRUE if the string is empty, i.e. if length() == 0; otherwise returns FALSE. An empty string is not always a null string.

See example in isNull().

Ver también:
isNull(), length(), size()
bool QCString::isEmpty ( ) const
bool QCString::isNull ( ) const [inline]

Returns TRUE if the string is null, i.e. if data() == 0; otherwise returns FALSE. A null string is also an empty string.

Example:

    QCString a;         // a.data() == 0,  a.size() == 0, a.length() == 0
    QCString b == "";   // b.data() == "", b.size() == 1, b.length() == 0
    a.isNull();         // TRUE  because a.data() == 0
    a.isEmpty();        // TRUE  because a.length() == 0
    b.isNull();         // FALSE because b.data() == ""
    b.isEmpty();        // TRUE  because b.length() == 0
Ver también:
isEmpty(), length(), size()
bool QCString::isNull ( ) const
QCString QCString::left ( uint  len) const
QCString QCString::left ( uint  len) const

Returns a substring that contains the len leftmost characters of the string.

The whole string is returned if len exceeds the length of the string.

Example:

    QCString s = "Pineapple";
    QCString t = s.left( 4 );  // t == "Pine"
Ver también:
right(), mid()
QCString QCString::leftJustify ( uint  width,
char  fill = ' ',
bool  trunc = FALSE 
) const
QCString QCString::leftJustify ( uint  width,
char  fill = ' ',
bool  truncate = FALSE 
) const

Returns a string of length width (plus one for the terminating '\0') that contains this string padded with the fill character.

If the length of the string exceeds width and truncate is FALSE (the default), then the returned string is a copy of the string. If the length of the string exceeds width and truncate is TRUE, then the returned string is a left(width).

Example:

    QCString s("apple");
    QCString t = s.leftJustify(8, '.');  // t == "apple..."
Ver también:
rightJustify()
uint QCString::length ( ) const
uint QCString::length ( void  ) const [inline]

Returns the length of the string, excluding the '\0'-terminator. Equivalent to calling strlen(data()).

Null strings and empty strings have zero length.

Ver también:
size(), isNull(), isEmpty()
QCString QCString::lower ( ) const
QCString QCString::lower ( ) const

Returns a new string that is a copy of this string converted to lower case.

Example:

    QCString s("Credit");
    QCString t = s.lower();  // t == "credit"
Ver también:
upper() Note on character comparisons
QCString QCString::mid ( uint  index,
uint  len = 0xffffffff 
) const
QCString QCString::mid ( uint  index,
uint  len = 0xffffffff 
) const

Returns a substring that contains at most len characters from this string, starting at position index.

Returns a null string if the string is empty or if index is out of range. Returns the whole string from index if index+len exceeds the length of the string.

Example:

    QCString s = "Two pineapples";
    QCString t = s.mid( 4, 3 );     // t == "pin"
Ver también:
left(), right()
QCString::operator const char * ( ) const [inline]

Returns the string data.

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

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

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

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Appends character c to the string and returns a reference to the string.

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

Assigns a shallow copy of s to this string and returns a reference to this string.

QCString& QCString::operator= ( const QCString s)
QCString& QCString::operator= ( const char *  str)
QCString & QCString::prepend ( const char *  s) [inline]

Prepend s to the string. Equivalent to insert(0, s).

Ver también:
insert()
QCString& QCString::prepend ( const char *  )
QCString & QCString::remove ( uint  index,
uint  len 
)

Removes len characters from the string, starting at position index, and returns a reference to the string.

If index is out of range, nothing happens. If index is valid, but index + len is larger than the length of the string, the string is truncated at position index.

    QCString s = "Montreal";
    s.remove( 1, 4 );         // s == "Meal"
Ver también:
insert(), replace()
QCString& QCString::remove ( uint  index,
uint  len 
)
QCString & QCString::replace ( uint  index,
uint  len,
const char *  str 
)

Replaces len characters from the string, starting at position index, with str, and returns a reference to the string.

If index is out of range, nothing is removed and str is appended at the end of the string. If index is valid, but index + len is larger than the length of the string, str replaces the rest of the string from position index.

    QCString s = "Say yes!";
    s.replace( 4, 3, "NO" );  // s == "Say NO!"
Ver también:
insert(), remove()
QCString & QCString::replace ( const QRegExp rx,
const char *  str 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Replaces every occurrence of rx in the string with str. Returns a reference to the string.

Example:

    QString s = "banana";
    s.replace( QRegExp("a.*a"), "" );     // becomes "b"

    s = "banana";
    s.replace( QRegExp("^[bn]a"), "X" );  // becomes "Xnana"

    s = "banana";
    s.replace( QRegExp("^[bn]a"), "" );   // becomes "nana"
Atención:
If you want to apply this function repeatedly to the same string it is more efficient to convert the string to a QString and apply the function to that.
QCString & QCString::replace ( char  c,
const char *  after 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Replaces every occurrence of the character c in the string with after. Returns a reference to the string.

Example:

    QCString s = "a,b,c";
    s.replace( ',', " or " );
    // s == "a or b or c"
QCString & QCString::replace ( const char *  before,
const char *  after 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Replaces every occurrence of the string before in the string with the string after. Returns a reference to the string.

Example:

    QCString s = "Greek is Greek";
    s.replace( "Greek", "English" );
    // s == "English is English"
QCString & QCString::replace ( char  c1,
char  c2 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Replaces every occurrence of c1 with the char c2. Returns a reference to the string.

QCString& QCString::replace ( char  c,
const char *  after 
)
QCString& QCString::replace ( const QRegExp ,
const char *   
)
QCString& QCString::replace ( const char *  ,
const char *   
)
QCString& QCString::replace ( char  ,
char   
)
QCString& QCString::replace ( uint  index,
uint  len,
const char *   
)
bool QCString::resize ( uint  newlen)
bool QCString::resize ( uint  len)

Extends or shrinks the string to len bytes, including the '\0'-terminator.

A '\0'-terminator is set at position {len - 1} unless {len == 0}.

Example:

    QCString s = "resize this string";
    s.resize( 7 );                      // s == "resize"
Ver también:
truncate()
QCString QCString::right ( uint  len) const
QCString QCString::right ( uint  len) const

Returns a substring that contains the len rightmost characters of the string.

The whole string is returned if len exceeds the length of the string.

Example:

    QCString s = "Pineapple";
    QCString t = s.right( 5 );  // t == "apple"
Ver también:
left(), mid()
QCString QCString::rightJustify ( uint  width,
char  fill = ' ',
bool  trunc = FALSE 
) const
QCString QCString::rightJustify ( uint  width,
char  fill = ' ',
bool  truncate = FALSE 
) const

Returns a string of length width (plus one for the terminating '\0') that contains zero or more of the fill character followed by this string.

If the length of the string exceeds width and truncate is FALSE (the default), then the returned string is a copy of the string. If the length of the string exceeds width and truncate is TRUE, then the returned string is a left(width).

Example:

    QCString s("pie");
    QCString t = s.rightJustify(8, '.');  // t == ".....pie"
Ver también:
leftJustify()
bool QCString::setExpand ( uint  index,
char  c 
)
bool QCString::setExpand ( uint  index,
char  c 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.

Sets the character at position index to c and expands the string if necessary, padding with spaces.

Returns FALSE if index was out of range and the string could not be expanded; otherwise returns TRUE.

QCString& QCString::setNum ( int  )
QCString& QCString::setNum ( uint  )
QCString& QCString::setNum ( short  )
QCString& QCString::setNum ( double  ,
char  f = 'g',
int  prec = 6 
)
QCString & QCString::setNum ( uint  n) [inline]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.

Sets the string to the string representation of the number n and returns a reference to the string.

QCString& QCString::setNum ( float  ,
char  f = 'g',
int  prec = 6 
)
QCString& QCString::setNum ( ushort  )
QCString & QCString::setNum ( ushort  n) [inline]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.

Sets the string to the string representation of the number n and returns a reference to the string.

QCString & QCString::setNum ( int  n) [inline]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.

Sets the string to the string representation of the number n and returns a reference to the string.

QCString & QCString::setNum ( long  n)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Sets the string to the string representation of the number n and returns a reference to the string.

QCString & QCString::setNum ( ulong  n)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Sets the string to the string representation of the number n and returns a reference to the string.

QCString & QCString::setNum ( float  n,
char  f = 'g',
int  prec = 6 
) [inline]
QCString & QCString::setNum ( double  n,
char  f = 'g',
int  prec = 6 
)

Sets the string to the string representation of the number n and returns a reference to the string.

The format of the string representation is specified by the format character f, and the precision (number of digits after the decimal point) is specified with prec.

The valid formats for f are 'e', 'E', 'f', 'g' and 'G'. The formats are the same as for sprintf(); they are explained in QString::arg().

QCString& QCString::setNum ( ulong  )
QCString& QCString::setNum ( long  )
QCString & QCString::setNum ( short  n) [inline]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.

Sets the string to the string representation of the number n and returns a reference to the string.

QCString & QCString::setStr ( const char *  str)

Makes a deep copy of str. Returns a reference to the string.

QCString& QCString::setStr ( const char *  s)
QCString QCString::simplifyWhiteSpace ( ) const
QCString QCString::simplifyWhiteSpace ( ) const

Returns a new string that has white space removed from the start and the end, plus any sequence of internal white space replaced with a single space (ASCII 32).

White space means the decimal ASCII codes 9, 10, 11, 12, 13 and 32.

    QCString s = "  lots\t of\nwhite    space ";
    QCString t = s.simplifyWhiteSpace(); // t == "lots of white space"
Ver también:
stripWhiteSpace()
QCString& QCString::sprintf ( const char *  format,
  ... 
)
QCString & QCString::sprintf ( const char *  format,
  ... 
)

Implemented as a call to the native vsprintf() (see the manual for your C library).

If the string is shorter than 256 characters, this sprintf() calls resize(256) to decrease the chance of memory corruption. The string is resized back to its actual length before sprintf() returns.

Example:

    QCString s;
    s.sprintf( "%d - %s", 1, "first" );         // result < 256 chars

    QCString big( 25000 );                      // very long string
    big.sprintf( "%d - %s", 2, longString );    // result < 25000 chars
Atención:
All vsprintf() implementations will write past the end of the target string (*this) if the format specification and arguments happen to be longer than the target string, and some will also fail if the target string is longer than some arbitrary implementation limit.

Giving user-supplied arguments to sprintf() is risky: Sooner or later someone will paste a huge line into your application.

QCString QCString::stripWhiteSpace ( ) const

Returns a new string that has white space removed from the start and the end.

White space means the decimal ASCII codes 9, 10, 11, 12, 13 and 32.

Example:

    QCString s = " space ";
    QCString t = s.stripWhiteSpace();           // t == "space"
Ver también:
simplifyWhiteSpace()
QCString QCString::stripWhiteSpace ( ) const
double QCString::toDouble ( bool ok = 0) const
double QCString::toDouble ( bool ok = 0) const

Returns the string converted to a {double} value.

If ok is not 0: *ok is set to FALSE if the string is not a number, or if it has trailing garbage; otherwise *ok is set to TRUE.

float QCString::toFloat ( bool ok = 0) const

Returns the string converted to a {float} value.

If ok is not 0: *ok is set to FALSE if the string is not a number, or if it has trailing garbage; otherwise *ok is set to TRUE.

float QCString::toFloat ( bool ok = 0) const
int QCString::toInt ( bool ok = 0) const
int QCString::toInt ( bool ok = 0) const

Returns the string converted to a {int} value.

If ok is not 0: *ok is set to FALSE if the string is not a number, or if it has trailing garbage; otherwise *ok is set to TRUE.

long QCString::toLong ( bool ok = 0) const
long QCString::toLong ( bool ok = 0) const

Returns the string converted to a long value.

If ok is not 0: *ok is set to FALSE if the string is not a number, or if it has trailing garbage; otherwise *ok is set to TRUE.

short QCString::toShort ( bool ok = 0) const
short QCString::toShort ( bool ok = 0) const

Returns the string converted to a {short} value.

If ok is not 0: *ok is set to FALSE if the string is not a number, is out of range, or if it has trailing garbage; otherwise *ok is set to TRUE.

uint QCString::toUInt ( bool ok = 0) const

Returns the string converted to an {unsigned int} value.

If ok is not 0: *ok is set to FALSE if the string is not a number, or if it has trailing garbage; otherwise *ok is set to TRUE.

uint QCString::toUInt ( bool ok = 0) const
ulong QCString::toULong ( bool ok = 0) const
ulong QCString::toULong ( bool ok = 0) const

Returns the string converted to an {unsigned long} value.

If ok is not 0: *ok is set to FALSE if the string is not a number, or if it has trailing garbage; otherwise *ok is set to TRUE.

ushort QCString::toUShort ( bool ok = 0) const

Returns the string converted to an {unsigned short} value.

If ok is not 0: *ok is set to FALSE if the string is not a number, is out of range, or if it has trailing garbage; otherwise *ok is set to TRUE.

ushort QCString::toUShort ( bool ok = 0) const
bool QCString::truncate ( uint  pos)
bool QCString::truncate ( uint  pos) [inline]

Truncates the string at position pos.

Equivalent to calling resize(pos+1).

Example:

    QCString s = "truncate this string";
    s.truncate( 5 );                      // s == "trunc"
Ver también:
resize()
QCString QCString::upper ( ) const
QCString QCString::upper ( ) const

Returns a new string that is a copy of this string converted to upper case.

Example:

    QCString s( "Debit" );
    QCString t = s.upper();  // t == "DEBIT"
Ver también:
lower() Note on character comparisons

Documentación de las funciones relacionadas y clases amigas

bool operator [related]

Returns TRUE if s1 and s2 are equal; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) == 0.

bool operator [related]

Returns TRUE if s1 and s2 are different; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) != 0.

bool operator [related]

Returns TRUE if s1 and s2 are different; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) != 0.

bool operator [related]

Returns TRUE if s1 is less than s2; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) < 0.

Ver también:
Note on character comparisons
bool operator [related]

Returns TRUE if s1 is less than or equal to s2; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) <= 0.

Ver también:
Note on character comparisons
bool operator [related]

Returns TRUE if s1 is greater than s2; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) > 0.

Ver también:
Note on character comparisons
bool operator [related]

Returns TRUE if s1 and s2 are equal; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) == 0.

bool operator [related]

Returns TRUE if s1 is greater than or equal to s2; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) >= 0.

Ver también:
Note on character comparisons
const QCString operator [related]

Returns a string which consists of the concatenation of s1 and s2.

const QCString operator [related]

Returns a string which consists of the concatenation of s1 and s2.

const QCString operator [related]

Returns a string which consists of the concatenation of s and c.

const QCString operator [related]

Returns a string which consists of the concatenation of c and s.

bool operator!= ( const QCString s1,
const QCString s2 
) [related]

Returns TRUE if s1 and s2 are different; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) != 0.

const QCString operator+ ( const QCString s1,
const QCString s2 
) [related]

Returns a string which consists of the concatenation of s1 and s2.

bool operator< ( const QCString s1,
const char *  s2 
) [related]

Returns TRUE if s1 is less than s2; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) < 0.

Ver también:
Note on character comparisons
QDataStream & operator<< ( QDataStream s,
const QCString str 
) [related]

Writes string str to the stream s.

Ver también:
Format of the QDataStream operators
bool operator<= ( const QCString s1,
const char *  s2 
) [related]

Returns TRUE if s1 is less than or equal to s2; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) <= 0.

Ver también:
Note on character comparisons
bool operator== ( const QCString s1,
const QCString s2 
) [related]

Returns TRUE if s1 and s2 are equal; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) == 0.

bool operator> ( const QCString s1,
const char *  s2 
) [related]

Returns TRUE if s1 is greater than s2; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) > 0.

Ver también:
Note on character comparisons
bool operator>= ( const QCString s1,
const char *  s2 
) [related]

Returns TRUE if s1 is greater than or equal to s2; otherwise returns FALSE.

Equivalent to qstrcmp(s1, s2) >= 0.

Ver también:
Note on character comparisons
QDataStream & operator>> ( QDataStream s,
QCString str 
) [related]

Reads a string into str from the stream s.

Ver también:
Format of the QDataStream operators
void * qmemmove ( void *  dst,
const void *  src,
uint  len 
) [related]

This function is normally part of the C library. Qt implements memmove() for platforms that do not provide it.

memmove() copies len bytes from src into dst. The data is copied correctly even if src and dst overlap.

int qstrcmp ( const char *  str1,
const char *  str2 
) [related]

A safe strcmp() function.

Compares str1 and str2. Returns a negative value if str1 is less than str2, 0 if str1 is equal to str2 or a positive value if str1 is greater than str2.

Special case I: Returns 0 if str1 and str2 are both 0.

Special case II: Returns a random nonzero value if str1 is 0 or str2 is 0 (but not both).

Ver también:
qstrncmp() qstricmp() qstrnicmp() Note on character comparisons
char * qstrcpy ( char *  dst,
const char *  src 
) [related]

A safe strcpy() function.

Copies all characters up to and including the '\0' from src into dst and returns a pointer to dst.

char * qstrdup ( const char *  src) [related]

Returns a duplicate string.

Allocates space for a copy of src, copies it, and returns a pointer to the copy. If src is 0, it immediately returns 0.

The returned string must be deleted using delete[].

int qstricmp ( const char *  str1,
const char *  str2 
) [related]

A safe stricmp() function.

Compares str1 and str2 ignoring the case.

Returns a negative value if str1 is less than str2, 0 if str1 is equal to str2 or a positive value if str1 is greater than str2.

Special case I: Returns 0 if str1 and str2 are both 0.

Special case II: Returns a random nonzero value if str1 is 0 or str2 is 0 (but not both).

Ver también:
qstrcmp(), qstrncmp(), qstrnicmp() Note on character comparisons
uint qstrlen ( const char *  str) [related]

A safe strlen function.

Returns the number of characters that precede the terminating '\0'. or 0 if str is 0.

int qstrncmp ( const char *  str1,
const char *  str2,
uint  len 
) [related]

A safe strncmp() function.

Compares at most len bytes of str1 and str2.

Returns a negative value if str1 is less than str2, 0 if str1 is equal to str2 or a positive value if str1 is greater than str2.

Special case I: Returns 0 if str1 and str2 are both 0.

Special case II: Returns a random nonzero value if str1 is 0 or str2 is 0 (but not both).

Ver también:
qstrcmp(), qstricmp(), qstrnicmp() Note on character comparisons
char * qstrncpy ( char *  dst,
const char *  src,
uint  len 
) [related]

A safe strncpy() function.

Copies at most len bytes from src (stopping at len or the terminating '\0' whichever comes first) into dst and returns a pointer to dst. Guarantees that dst is '\0'-terminated. If src or dst is 0, returns 0 immediately.

Ver también:
qstrcpy()
int qstrnicmp ( const char *  str1,
const char *  str2,
uint  len 
) [related]

A safe strnicmp() function.

Compares at most len bytes of str1 and str2 ignoring the case.

Returns a negative value if str1 is less than str2, 0 if str1 is equal to str2 or a positive value if str1 is greater than str2.

Special case I: Returns 0 if str1 and str2 are both 0.

Special case II: Returns a random nonzero value if str1 is 0 or str2 is 0 (but not both).

Ver también:
qstrcmp(), qstrncmp() qstricmp() Note on character comparisons

La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'