nsTAutoString_CharT Subclass of nsTString_CharT that adds support for stack-based string allocation. It is normally not a good idea to use this class on the heap, because it will allocate space which may be wasted if the string it contains is significantly smaller or any larger than 64 characters. NAMES: nsAutoString for wide characters nsCAutoString for narrow characters
No public members.
void nsCAutoString()
- sourceconstructors
void nsCAutoString(char)
- sourcevoid nsCAutoString(const char*, PRUint32)
- sourcevoid nsCAutoString(const nsCAutoString&)
- sourcevoid nsCAutoString(const nsACString_internal&)
- sourcevoid nsCAutoString(const nsCSubstringTuple&)
- sourcensCAutoString& operator=(const nsCAutoString&)
- sourcensCString& operator=(const nsCString&)
- sourcensACString_internal& operator=(char)
- sourcensACString_internal& operator=(const char*)
- sourcensACString_internal& operator=(const nsACString_internal&)
- sourcensACString_internal& operator=(const nsCSubstringTuple&)
- sourcechar* get() const
- sourcereturns the null-terminated string
PRInt32 Find(const nsCString&, PRBool, PRInt32, PRInt32) const
- sourceSearch for the given substring within this string. @param aString is substring to be sought in this @param aIgnoreCase selects case sensitivity @param aOffset tells us where in this string to start searching @param aCount tells us how far from the offset we are to search. Use -1 to search the whole string. @return offset in string, or kNotFound
PRInt32 Find(const char*, PRBool, PRInt32, PRInt32) const
- sourcePRInt32 RFind(const nsCString&, PRBool, PRInt32, PRInt32) const
- sourceThis methods scans the string backwards, looking for the given string @param aString is substring to be sought in this @param aIgnoreCase tells us whether or not to do caseless compare @param aOffset tells us where in this string to start searching. Use -1 to search from the end of the string. @param aCount tells us how many iterations to make starting at the given offset. @return offset in string, or kNotFound
PRInt32 RFind(const char*, PRBool, PRInt32, PRInt32) const
- sourcePRInt32 RFindChar(PRUnichar, PRInt32, PRInt32) const
- sourcePRInt32 FindCharInSet(const char*, PRInt32) const
- sourceThis method searches this string for the first character found in the given string. @param aString contains set of chars to be found @param aOffset tells us where in this string to start searching (counting from left) @return offset in string, or kNotFound
PRInt32 FindCharInSet(const nsCString&, PRInt32) const
- sourcePRInt32 RFindCharInSet(const char*, PRInt32) const
- sourceThis method searches this string for the last character found in the given string. @param aString contains set of chars to be found @param aOffset tells us where in this string to start searching (counting from left) @return offset in string, or kNotFound
PRInt32 RFindCharInSet(const nsCString&, PRInt32) const
- sourcePRInt32 Compare(const char*, PRBool, PRInt32) const
- sourceCompares a given string to this string. @param aString is the string to be compared @param aIgnoreCase tells us how to treat case @param aCount tells us how many chars to compare @return -1,0,1
PRBool EqualsIgnoreCase(const char*, PRInt32) const
- sourceEquality check between given string and this string. @param aString is the string to check @param aIgnoreCase tells us how to treat case @param aCount tells us how many chars to compare @return boolean
float ToFloat(PRInt32*) const
- sourcePerform string to float conversion. @param aErrorCode will contain error if one occurs @return float rep of string value
PRInt32 ToInteger(PRInt32*, PRUint32) const
- sourcePRUint32 Mid(nsCString&, PRUint32, PRUint32) const
- sourcePRUint32 Left(nsCString&, PRUint32) const
- sourcePRUint32 Right(nsCString&, PRUint32) const
- sourcePRBool SetCharAt(PRUnichar, PRUint32)
- sourceSet a char inside this string at given index @param aChar is the char you want to write into this string @param anIndex is the ofs where you want to write the given char @return TRUE if successful
void StripChars(const char*)
- sourceThese methods are used to remove all occurrences of the characters found in aSet from this string. @param aSet -- characters to be cut from this
void StripWhitespace()
- sourceThis method strips whitespace throughout the string.
void Trim(const char*, PRBool, PRBool, PRBool)
- sourceThis method trims characters found in aTrimSet from either end of the underlying string. @param aSet -- contains chars to be trimmed from both ends @param aEliminateLeading @param aEliminateTrailing @param aIgnoreQuotes -- if true, causes surrounding quotes to be ignored @return this
void CompressWhitespace(PRBool, PRBool)
- sourceThis method strips whitespace from string. You can control whether whitespace is yanked from start and end of string as well. @param aEliminateLeading controls stripping of leading ws @param aEliminateTrailing controls stripping of trailing ws
void AppendInt(PRInt32, PRInt32)
- sourceAppend the given integer to this string
void AppendInt(PRUint32, PRInt32)
- sourceAppend the given unsigned integer to this string
void AppendInt(PRInt64, PRInt32)
- sourcechar* Data() const
- sourceaccessors
PRUint32 Length() const
- sourcePRBool IsEmpty() const
- sourcePRBool IsVoid() const
- sourcePRBool IsTerminated() const
- sourcechar CharAt(PRUint32) const
- sourcechar operator[](PRUint32) const
- sourcechar First() const
- sourcechar Last() const
- sourcePRUint32 CountChar(char) const
- sourcePRInt32 FindChar(char, PRUint32) const
- sourcePRBool Equals(const nsACString_internal&) const
- sourceequality
PRBool Equals(const nsACString_internal&, const nsCStringComparator&) const
- sourcePRBool Equals(const char*) const
- sourcePRBool Equals(const char*, const nsCStringComparator&) const
- sourcePRBool EqualsASCII(const char*, PRUint32) const
- sourceAn efficient comparison with ASCII that can be used even for wide strings. Call this version when you know the length of 'data'.
PRBool EqualsASCII(const char*) const
- sourceAn efficient comparison with ASCII that can be used even for wide strings. Call this version when 'data' is null-terminated.
PRBool EqualsLiteral(const char (&)[N]) const
- sourcePRBool EqualsLiteral(char (&)[N]) const
- sourcePRBool LowerCaseEqualsLiteral(const char (&)[N]) const
- sourcePRBool LowerCaseEqualsLiteral(char (&)[N]) const
- sourcevoid Assign(char)
- sourceassignment
void Assign(const char*, PRUint32)
- sourcevoid Assign(const nsACString_internal&)
- sourcevoid Assign(const nsCSubstringTuple&)
- sourcevoid AssignLiteral(const char (&)[N])
- sourcevoid AssignLiteral(char (&)[N])
- sourcevoid Adopt(char*, PRUint32)
- sourcevoid Replace(PRUint32, PRUint32, char)
- sourcebuffer manipulation
void Replace(PRUint32, PRUint32, const char*, PRUint32)
- sourcevoid Replace(PRUint32, PRUint32, const nsACString_internal&)
- sourcevoid Replace(PRUint32, PRUint32, const nsCSubstringTuple&)
- sourcevoid ReplaceASCII(PRUint32, PRUint32, const char*, PRUint32)
- sourcevoid AppendASCII(const char*, PRUint32)
- sourcevoid AppendLiteral(const char (&)[N])
- sourcevoid AppendLiteral(char (&)[N])
- sourcensACString_internal& operator+=(char)
- sourcensACString_internal& operator+=(const char*)
- sourcensACString_internal& operator+=(const nsACString_internal&)
- sourcensACString_internal& operator+=(const nsCSubstringTuple&)
- sourcevoid Insert(char, PRUint32)
- sourcevoid Insert(const char*, PRUint32, PRUint32)
- sourcevoid Insert(const nsACString_internal&, PRUint32)
- sourcevoid Insert(const nsCSubstringTuple&, PRUint32)
- sourcevoid Cut(PRUint32, PRUint32)
- sourcevoid SetCapacity(PRUint32)
- sourcebuffer sizing
void SetLength(PRUint32)
- sourcevoid Truncate(PRUint32)
- sourcePRUint32 GetData(const char**) const
- sourceGet a const pointer to the string's internal buffer. The caller MUST NOT modify the characters at the returned address. @returns The length of the buffer in characters.
PRUint32 GetMutableData(char**, PRUint32)
- sourceGet a pointer to the string's internal buffer, optionally resizing the buffer first. If size_type(-1) is passed for newLen, then the current length of the string is used. The caller MAY modify the characters at the returned address (up to but not exceeding the length of the string). @returns The length of the buffer in characters or 0 if unable to satisfy the request due to low-memory conditions.
void SetIsVoid(PRBool)
- sourcestring data is never null, but can be marked void. if true, the string will be truncated. @see nsTSubstring::IsVoid
void StripChar(char, PRInt32)
- sourceThis method is used to remove all occurrences of aChar from this string. @param aChar -- char to be stripped @param aOffset -- where in this string to start stripping chars