nsXPIDLCString 编辑
nsTXPIDLString extends nsTString such that: (1) mData can be null (2) objects of this type can be automatically cast to |const CharT*| (3) getter_Copies method is supported to adopt data allocated with NS_Alloc, such as "out string" parameters in XPIDL. NAMES: nsXPIDLString for wide characters nsXPIDLCString for narrow characters
Method Overview
Base Classes
Data Members
No public members.
Methods
Constructors
void nsXPIDLCString()
- sourcevoid nsXPIDLCString(const nsXPIDLCString&)
- sourceParameters
- nsXPIDLCString& str
operator const char*
char* operator const char*() const
- source
operator[]
char operator[](PRInt32) const
- sourceParameters
- PRInt32 i
char operator[](PRUint32) const
- sourceParameters
- PRUint32 i
operator=
nsXPIDLCString& operator=(const nsXPIDLCString&)
- sourceParameters
- nsXPIDLCString& str
nsCString& operator=(const nsCString&)
- sourceParameters
- nsCString& str
nsACString_internal& operator=(char)
- sourceParameters
- char c
nsACString_internal& operator=(const char*)
- sourceParameters
- char* data
nsACString_internal& operator=(const nsACString_internal&)
- sourceParameters
- nsACString_internal& str
nsACString_internal& operator=(const nsCSubstringTuple&)
- sourceParameters
- nsCSubstringTuple& tuple
get
char* get() const
- sourcereturns the null-terminated string
Find
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
Parameters
- nsCString& aString
- PRBool aIgnoreCase
- PRInt32 aOffset
- PRInt32 aCount
PRInt32 Find(const char*, PRBool, PRInt32, PRInt32) const
- sourceParameters
- char* aString
- PRBool aIgnoreCase
- PRInt32 aOffset
- PRInt32 aCount
RFind
PRInt32 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
Parameters
- nsCString& aString
- PRBool aIgnoreCase
- PRInt32 aOffset
- PRInt32 aCount
PRInt32 RFind(const char*, PRBool, PRInt32, PRInt32) const
- sourceParameters
- char* aCString
- PRBool aIgnoreCase
- PRInt32 aOffset
- PRInt32 aCount
RFindChar
PRInt32 RFindChar(PRUnichar, PRInt32, PRInt32) const
- sourceParameters
- PRUnichar aChar
- PRInt32 aOffset
- PRInt32 aCount
FindCharInSet
PRInt32 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
Parameters
- char* aString
- PRInt32 aOffset
PRInt32 FindCharInSet(const nsCString&, PRInt32) const
- sourceParameters
- nsCString& aString
- PRInt32 aOffset
RFindCharInSet
PRInt32 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
Parameters
- char* aString
- PRInt32 aOffset
PRInt32 RFindCharInSet(const nsCString&, PRInt32) const
- sourceParameters
- nsCString& aString
- PRInt32 aOffset
Compare
PRInt32 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
Parameters
- char* aString
- PRBool aIgnoreCase
- PRInt32 aCount
EqualsIgnoreCase
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
Parameters
- char* aString
- PRInt32 aCount
ToFloat
float ToFloat(PRInt32*) const
- sourcePerform string to float conversion. @param aErrorCode will contain error if one occurs @return float rep of string value
Parameters
- PRInt32* aErrorCode
ToInteger
PRInt32 ToInteger(PRInt32*, PRUint32) const
- sourceParameters
- PRInt32* aErrorCode
- PRUint32 aRadix
Mid
PRUint32 Mid(nsCString&, PRUint32, PRUint32) const
- sourceParameters
- nsCString& aResult
- PRUint32 aStartPos
- PRUint32 aCount
Left
PRUint32 Left(nsCString&, PRUint32) const
- sourceParameters
- nsCString& aResult
- PRUint32 aCount
Right
PRUint32 Right(nsCString&, PRUint32) const
- sourceParameters
- nsCString& aResult
- PRUint32 aCount
SetCharAt
PRBool 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
Parameters
- PRUnichar aChar
- PRUint32 aIndex
StripChars
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
Parameters
- char* aSet
StripWhitespace
void StripWhitespace()
- sourceThis method strips whitespace throughout the string.
ReplaceChar
void ReplaceChar(char, char)
- sourceswaps occurence of 1 string for another
Parameters
- char aOldChar
- char aNewChar
void ReplaceChar(const char*, char)
- sourceParameters
- char* aSet
- char aNewChar
ReplaceSubstring
void ReplaceSubstring(const nsCString&, const nsCString&)
- sourceParameters
- nsCString& aTarget
- nsCString& aNewValue
void ReplaceSubstring(const char*, const char*)
- sourceParameters
- char* aTarget
- char* aNewValue
Trim
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
Parameters
- char* aSet
- PRBool aEliminateLeading
- PRBool aEliminateTrailing
- PRBool aIgnoreQuotes
CompressWhitespace
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
Parameters
- PRBool aEliminateLeading
- PRBool aEliminateTrailing
AssignWithConversion
void AssignWithConversion(const nsAString_internal&)
- sourceassign/append/insert with _LOSSY_ conversion
Parameters
- nsAString_internal& aString
void AssignWithConversion(const PRUnichar*, PRInt32)
- sourceParameters
- PRUnichar* aData
- PRInt32 aLength
AppendWithConversion
void AppendWithConversion(const nsAString_internal&)
- sourceParameters
- nsAString_internal& aString
void AppendWithConversion(const PRUnichar*, PRInt32)
- sourceParameters
- PRUnichar* aData
- PRInt32 aLength
AppendInt
void AppendInt(PRInt32, PRInt32)
- sourceAppend the given integer to this string
Parameters
- PRInt32 aInteger
- PRInt32 aRadix
void AppendInt(PRUint32, PRInt32)
- sourceAppend the given unsigned integer to this string
Parameters
- PRUint32 aInteger
- PRInt32 aRadix
void AppendInt(PRInt64, PRInt32)
- sourceParameters
- PRInt64 aInteger
- PRInt32 aRadix
AppendFloat
void AppendFloat(float)
- sourceAppend the given float to this string
Parameters
- float aFloat
void AppendFloat(double)
- sourceParameters
- double aFloat
BeginReading
char* BeginReading() const
- sourcereading iterators
nsReadingIterator<char>& BeginReading(nsReadingIterator<char>&) const
- sourcedeprecated reading iterators
Parameters
- nsReadingIterator<char>& iter
char*& BeginReading(const char*&) const
- sourceParameters
- char*& iter
EndReading
char* EndReading() const
- sourcensReadingIterator<char>& EndReading(nsReadingIterator<char>&) const
- sourceParameters
- nsReadingIterator<char>& iter
char*& EndReading(const char*&) const
- sourceParameters
- char*& iter
BeginWriting
char* BeginWriting()
- sourcewriting iterators
nsWritingIterator<char>& BeginWriting(nsWritingIterator<char>&)
- sourcedeprecated writing iterators
Parameters
- nsWritingIterator<char>& iter
char*& BeginWriting(char*&)
- sourceParameters
- char*& iter
EndWriting
char* EndWriting()
- sourcensWritingIterator<char>& EndWriting(nsWritingIterator<char>&)
- sourceParameters
- nsWritingIterator<char>& iter
char*& EndWriting(char*&)
- sourceParameters
- char*& iter
Data
char* Data() const
- sourceaccessors
Length
PRUint32 Length() const
- source
IsEmpty
PRBool IsEmpty() const
- source
IsVoid
PRBool IsVoid() const
- source
IsTerminated
PRBool IsTerminated() const
- source
CharAt
char CharAt(PRUint32) const
- sourceParameters
- PRUint32 i
First
char First() const
- source
Last
char Last() const
- source
CountChar
PRUint32 CountChar(char) const
- sourceParameters
- char <anonymous>
FindChar
PRInt32 FindChar(char, PRUint32) const
- sourceParameters
- char <anonymous>
- PRUint32 offset
Equals
PRBool Equals(const nsACString_internal&) const
- sourceequality
Parameters
- nsACString_internal& <anonymous>
PRBool Equals(const nsACString_internal&, const nsCStringComparator&) const
- sourceParameters
- nsACString_internal& <anonymous>
- nsCStringComparator& <anonymous>
PRBool Equals(const char*) const
- sourceParameters
- char* data
PRBool Equals(const char*, const nsCStringComparator&) const
- sourceParameters
- char* data
- nsCStringComparator& comp
EqualsASCII
PRBool 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'.
Parameters
- char* data
- PRUint32 len
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.
Parameters
- char* data
EqualsLiteral(const char
PRBool EqualsLiteral(const char (&)[N]) const
- source
EqualsLiteral(char
PRBool EqualsLiteral(char (&)[N]) const
- source
LowerCaseEqualsASCII
PRBool LowerCaseEqualsASCII(const char*, PRUint32) const
- sourceParameters
- char* data
- PRUint32 len
PRBool LowerCaseEqualsASCII(const char*) const
- sourceParameters
- char* data
LowerCaseEqualsLiteral(const char
PRBool LowerCaseEqualsLiteral(const char (&)[N]) const
- source
LowerCaseEqualsLiteral(char
PRBool LowerCaseEqualsLiteral(char (&)[N]) const
- source
Assign
void Assign(char)
- sourceassignment
Parameters
- char c
void Assign(const char*, PRUint32)
- sourceParameters
- char* data
- PRUint32 length
void Assign(const nsACString_internal&)
- sourceParameters
- nsACString_internal& <anonymous>
void Assign(const nsCSubstringTuple&)
- sourceParameters
- nsCSubstringTuple& <anonymous>
AssignASCII
void AssignASCII(const char*, PRUint32)
- sourceParameters
- char* data
- PRUint32 length
void AssignASCII(const char*)
- sourceParameters
- char* data
AssignLiteral(const char
void AssignLiteral(const char (&)[N])
- source
AssignLiteral(char
void AssignLiteral(char (&)[N])
- source
Adopt
void Adopt(char*, PRUint32)
- sourceParameters
- char* data
- PRUint32 length
Replace
void Replace(PRUint32, PRUint32, char)
- sourcebuffer manipulation
Parameters
- PRUint32 cutStart
- PRUint32 cutLength
- char c
void Replace(PRUint32, PRUint32, const char*, PRUint32)
- sourceParameters
- PRUint32 cutStart
- PRUint32 cutLength
- char* data
- PRUint32 length
void Replace(PRUint32, PRUint32, const nsACString_internal&)
- sourceParameters
- PRUint32 cutStart
- PRUint32 cutLength
- nsACString_internal& str
void Replace(PRUint32, PRUint32, const nsCSubstringTuple&)
- sourceParameters
- PRUint32 cutStart
- PRUint32 cutLength
- nsCSubstringTuple& tuple
ReplaceASCII
void ReplaceASCII(PRUint32, PRUint32, const char*, PRUint32)
- sourceParameters
- PRUint32 cutStart
- PRUint32 cutLength
- char* data
- PRUint32 length
Append
void Append(char)
- sourceParameters
- char c
void Append(const char*, PRUint32)
- sourceParameters
- char* data
- PRUint32 length
void Append(const nsACString_internal&)
- sourceParameters
- nsACString_internal& str
void Append(const nsCSubstringTuple&)
- sourceParameters
- nsCSubstringTuple& tuple
AppendASCII
void AppendASCII(const char*, PRUint32)
- sourceParameters
- char* data
- PRUint32 length
AppendLiteral(const char
void AppendLiteral(const char (&)[N])
- source
AppendLiteral(char
void AppendLiteral(char (&)[N])
- source
operator+=
nsACString_internal& operator+=(char)
- sourceParameters
- char c
nsACString_internal& operator+=(const char*)
- sourceParameters
- char* data
nsACString_internal& operator+=(const nsACString_internal&)
- sourceParameters
- nsACString_internal& str
nsACString_internal& operator+=(const nsCSubstringTuple&)
- sourceParameters
- nsCSubstringTuple& tuple
Insert
void Insert(char, PRUint32)
- sourceParameters
- char c
- PRUint32 pos
void Insert(const char*, PRUint32, PRUint32)
- sourceParameters
- char* data
- PRUint32 pos
- PRUint32 length
void Insert(const nsACString_internal&, PRUint32)
- sourceParameters
- nsACString_internal& str
- PRUint32 pos
void Insert(const nsCSubstringTuple&, PRUint32)
- sourceParameters
- nsCSubstringTuple& tuple
- PRUint32 pos
Cut
void Cut(PRUint32, PRUint32)
- sourceParameters
- PRUint32 cutStart
- PRUint32 cutLength
SetCapacity
void SetCapacity(PRUint32)
- sourcebuffer sizing
Parameters
- PRUint32 newCapacity
SetLength
void SetLength(PRUint32)
- sourceParameters
- PRUint32 newLength
Truncate
void Truncate(PRUint32)
- sourceParameters
- PRUint32 newLength
GetData
PRUint32 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.
Parameters
- char** data
GetMutableData
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.
Parameters
- char** data
- PRUint32 newLen
SetIsVoid
void SetIsVoid(PRBool)
- sourcestring data is never null, but can be marked void. if true, the string will be truncated. @see nsTSubstring::IsVoid
Parameters
- PRBool <anonymous>
StripChar
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
Parameters
- char aChar
- PRInt32 aOffset
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论