Search completed in 1.32 seconds.
nsAString (External)
Class Declaration This header provides wrapper classes around the frozen string API which are roughly equivalent to the internal string classes. ...
... Class Declaration This header provides wrapper classes around the frozen string API which are roughly equivalent to the internal string classes. ...
...e Parameters PRUint32 <anonymous> EndWriting PRUnichar* EndWriting() - source SetLength PRBool SetLength(PRUint32) - source Parameters PRUint32 aLen Length PRUint32 Length() const - source IsEmpty PRBool IsEmpty() const - source SetIsVoid void SetIsVoid(PRBool) - source Parameters PRBool val IsVoid PRBool IsVoid() const - source Assign void Assign(const
nsAString&) - source Parameters
nsAString& aString void Assign(const PRUnichar*, PRUint32) - source Parameters PRUnichar* aData PRUint32 aLength void Assign(PRUnichar) - source Parameters PRUnichar aChar AssignLiteral void AssignLiteral(const char*) - source Parameters char* aStr operator=
nsAString& operator=(const
nsAString&) - source Parameters
nsAString& aString
nsAString& o...
...And 15 more matches
nsAString_internal
Class Declaration nsTSubstring is the most abstract class in the string hierarchy. It represents a single contiguous array of characters, which may or may not be null-terminated. This type is not instantiated directly. A sub-class is instantiated instead. For example, see nsTString. NAMES:
nsAString for wide characters nsACString for narrow characters Many of the accessors on nsTSubstring are inlined as an optimization. ...
...s, which may or may not be null-terminated. This type is not instantiated directly. A sub-class is instantiated instead. For example, see nsTString. NAMES:
nsAString for wide characters nsACString for narrow characters Many of the accessors on nsTSubstring are inlined as an optimization. ...
...ed. This type is not instantiated directly. A sub-class is instantiated instead. For example, see nsTString. NAMES:
nsAString for wide characters nsACString for narrow characters Many of the accessors on nsTSubstring are inlined as an optimization. ...
...And 9 more matches
nsAString
size_type [PRUint32] Type used to represent the number of double-byte units stored in the string. index_type [PRUint32] Type used to represent an offset into the string. Methods BeginReading The BeginReading function returns a const pointer to the first element of the string's internal buffer. ...
... size_type [PRUint32] Type used to represent the number of double-byte units stored in the string. index_type [PRUint32] Type used to represent an offset into the string. Methods BeginReading The BeginReading function returns a const pointer to the first element of the string's internal buffer. ...
...end of a string's internal buffer. Insert The Insert family of functions inserts a value into a string's internal buffer. Cut The Cut function removes a section of the string's internal buffer. Operators operator= This operator is a shortcut for the Assign family of functions. operator+= This operator is a shortcut for the Append family of functions. Remarks The
nsAString class is never instantiated directly. It should be instantiated using a subclass, such as nsEmbedString .
nsAString corresponds to the AString and DOMString XPIDL data types.
nsAString by itself does not imply a particular character encoding. That is, it may be used to store UTF-16 characters, UCS-2 characters, or any random double-byte data. The character encoding in use for a particular nsAStri...
...And 2 more matches
Mozilla internal string guide
base classes, but share the same APIs. As a result, you cannot assign a 8-bit string to a 16-bit string without some kind of conversion helper class or routine. For the purpose of this document, we will refer to the 16-bit string classes in class documentation. Every 16-bit class has an equivalent 8-bit class: Naming convention for wide and narrow string classes Wide Narrow
nsAString nsACString nsString nsCString nsAutoString nsAutoCString etc... The string classes distinguish, as part of the type hierarchy, between strings that must have a null-terminator at the end of their buffer (ns[C]String) and strings that are not required to have a null-terminator (nsA[C]String). nsA[C]String is the base of the string classes (since it impose...
...he ""_ns and u""_ns user-defined string literals. nsLiteral[C]String is trivially constructible and destructible, and therefore does not emit construction/destruction code when stored in statics, as opposed to the other string classes. The Major String Classes The list below describes the main base classes. Once you are familiar with them, see the appendix describing What Class to Use When.
nsAString/nsACString: the abstract base class for all strings. It provides an API for assignment, individual character access, basic manipulation of characters in the string, and string comparison. This class corresponds to the XPIDL AString parameter type.
nsAString is not necessarily null-terminated. nsString/nsCString: builds on
nsAString by guaranteeing a null-terminated storage. This allows for a met...
...ss, basic manipulation of characters in the string, and string comparison. This class corresponds to the XPIDL AString parameter type.
nsAString is not necessarily null-terminated. nsString/nsCString: builds on
nsAString by guaranteeing a null-terminated storage. This allows for a method (.get()) to access the underlying character buffer. The remainder of the string classes inherit from either
nsAString or nsString. Thus, every string class is compatible with
nsAString. Since every string derives from
nsAString (or nsACString), they all share a simple API. Common read-only methods: .Length() - the number of code units (bytes for 8-bit string classes and char16_ts for 16-bit string classes) in the string. .IsEmpty() - the fastest way of determining if the string has any value. Use this inste...
...And 46 more matches
nsDependentSubstring external
Length IsEmpty SetIsVoid IsVoid Assign AssignLiteral operator= Replace Append AppendLiteral operator+= Insert Cut Truncate StripChars StripWhitespace Trim DefaultComparator Compare(const PRUnichar*, PRInt32 (*) Compare(const
nsAString&, PRInt32 (*) Equals(const PRUnichar*, PRInt32 (*) Equals(const
nsAString&, PRInt32 (*) operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find(const
nsAString&, PRInt32 (*) Find(const
nsAString&, PRUint32, PRInt32 (*) Find ...
...) Equals(const PRUnichar*, PRInt32 (*) Equals(const
nsAString&, PRInt32 (*) operator< operator<= operator== operator>= operator> operator!= EqualsLiteral LowerCaseEqualsLiteral Find(const
nsAString&, PRInt32 (*) Find(const
nsAString&, PRUint32, PRInt32 (*) Find RFind(const
nsAString&, PRInt32 (*) RFind(const
nsAString&, PRInt32, PRInt32 (*) RFind FindChar RFindChar AppendInt ToInteger Base Classes nsStringContainer Data Members No public members. Methods Constructors void nsDependentSubstring_external() - source void nsDependentSubstring_external(const PRUnichar*, PRUint32) - sou...
...AppendInt ToInteger Base Classes nsStringContainer Data Members No public members. ...
...And 22 more matches
PromiseFlatString (External)
RFind FindChar RFindChar AppendInt ToInteger Base Classes nsStringContainer Data Members No public members. ...
...ndChar RFindChar AppendInt ToInteger Base Classes nsStringContainer Data Members No public members. ...
... ToInteger Base Classes nsStringContainer Data Members No public members. ...
...And 19 more matches
nsAutoString (External)
RFind FindChar RFindChar AppendInt ToInteger Base Classes nsStringContainer Data Members No public members. ...
...ndChar RFindChar AppendInt ToInteger Base Classes nsStringContainer Data Members No public members. ...
... ToInteger Base Classes nsStringContainer Data Members No public members. ...
...And 19 more matches
nsString external
ind FindChar RFindChar AppendInt ToInteger Base Classes nsStringContainer Data Members No public members. ...
...AppendInt ToInteger Base Classes nsStringContainer Data Members No public members. ...
...g& aReadable void nsString_external(const PRUnichar*, PRUint32) - source Parameters PRUnichar* aData PRUint32 aLength get PRUnichar* get() const - source operator= nsString_external& operator=(const nsString_external&) - source Parameters nsString_external& aString
nsAString& operator=(const
nsAString&) - source Parameters
nsAString& aString
nsAString& operator=(const PRUnichar*) - source Parameters PRUnichar* aPtr
nsAString& operator=(PRUnichar) - source Parameters PRUnichar aChar Adopt void Adopt(const PRUnichar*, PRUint32) - source Parameter...
...And 17 more matches
nsStringContainer (External)
Methods BeginReading PRUint32 BeginReading(const PRUnichar**, const PRUnichar**) const - source Returns the length, beginning, and end of a string in one operation. Parameters PRUnichar** begin PRUnichar** end PRUnichar* BeginReading() const - source EndReading PRUnichar* End...
...rs PRUint32 aLen Length PRUint32 Length() const - source IsEmpty PRBool IsEmpty() const - source SetIsVoid void SetIsVoid(PRBool) - source Parameters PRBool val IsVoid PRBool IsVoid() const - source Assign void Assign(const
nsAString&) - source Parameters
nsAString& aString void Assign(const PRUnichar*, PRUint32) - source Parameters PRUnichar* aData PRUint32 aLength void Assign(PRUnichar) - source Parameters PRUnichar aChar AssignLiteral void AssignLiteral(const char*) - source Parameters ...
... aString void Assign(const PRUnichar*, PRUint32) - source Parameters PRUnichar* aData PRUint32 aLength void Assign(PRUnichar) - source Parameters PRUnichar aChar AssignLiteral void AssignLiteral(const char*) - source Parameters char* aStr operator=
nsAString& operator=(const
nsAString&) - source Parameters
nsAString& aString
nsAString& operator=(const PRUnichar*) - source Parameters PRUnichar* aPtr
nsAString& operator=(PRUnichar) - source Parameters PRUnichar aChar Replace void Replace(PRUint32, PRUint32, const PRUnichar*, PRUint32) - ...
...And 16 more matches
NS ConvertASCIItoUTF16 external
ng& aStr void NS_ConvertASCIItoUTF16_external(const char*, PRUint32) - source Parameters char* aData PRUint32 aLength get PRUnichar* get() const - source operator= nsString_external& operator=(const nsString_external&) - source Parameters nsString_external& aString
nsAString& operator=(const
nsAString&) - source Parameters
nsAString& aString
nsAString& operator=(const PRUnichar*) - source Parameters PRUnichar* aPtr
nsAString& operator=(PRUnichar) - source Parameters PRUnichar aChar Adopt void Adopt(const PRUnichar*, PRUint32) - source Parameter...
...rs PRUint32 aLen Length PRUint32 Length() const - source IsEmpty PRBool IsEmpty() const - source SetIsVoid void SetIsVoid(PRBool) - source Parameters PRBool val IsVoid PRBool IsVoid() const - source Assign void Assign(const
nsAString&) - source Parameters
nsAString& aString void Assign(const PRUnichar*, PRUint32) - source Parameters PRUnichar* aData PRUint32 aLength void Assign(PRUnichar) - source Parameters PRUnichar aChar AssignLiteral void AssignLiteral(const char*) - source Parameters ...
... void Replace(PRUint32, PRUint32, const PRUnichar*, PRUint32) - source Parameters PRUint32 cutStart PRUint32 cutLength PRUnichar* data PRUint32 length void Replace(PRUint32, PRUint32, PRUnichar) - source Parameters PRUint32 cutStart PRUint32 cutLength PRUnichar c void Replace(PRUint32, PRUint32, const
nsAString&) - source Parameters PRUint32 cutStart PRUint32 cutLength
nsAString& readable Append void Append(PRUnichar) - source Parameters PRUnichar c void Append(const PRUnichar*, PRUint32) - source Parameters PRUnichar* data PRUint32 length void Append(const
nsAString&) - so...
...And 15 more matches
NS ConvertUTF8toUTF16 external
ing& aStr void NS_ConvertUTF8toUTF16_external(const char*, PRUint32) - source Parameters char* aData PRUint32 aLength get PRUnichar* get() const - source operator= nsString_external& operator=(const nsString_external&) - source Parameters nsString_external& aString
nsAString& operator=(const
nsAString&) - source Parameters
nsAString& aString
nsAString& operator=(const PRUnichar*) - source Parameters PRUnichar* aPtr
nsAString& operator=(PRUnichar) - source Parameters PRUnichar aChar Adopt void Adopt(const PRUnichar*, PRUint32) - source Parameter...
...rs PRUint32 aLen Length PRUint32 Length() const - source IsEmpty PRBool IsEmpty() const - source SetIsVoid void SetIsVoid(PRBool) - source Parameters PRBool val IsVoid PRBool IsVoid() const - source Assign void Assign(const
nsAString&) - source Parameters
nsAString& aString void Assign(const PRUnichar*, PRUint32) - source Parameters PRUnichar* aData PRUint32 aLength void Assign(PRUnichar) - source Parameters PRUnichar aChar AssignLiteral void AssignLiteral(const char*) - source Parameters ...
... void Replace(PRUint32, PRUint32, const PRUnichar*, PRUint32) - source Parameters PRUint32 cutStart PRUint32 cutLength PRUnichar* data PRUint32 length void Replace(PRUint32, PRUint32, PRUnichar) - source Parameters PRUint32 cutStart PRUint32 cutLength PRUnichar c void Replace(PRUint32, PRUint32, const
nsAString&) - source Parameters PRUint32 cutStart PRUint32 cutLength
nsAString& readable Append void Append(PRUnichar) - source Parameters PRUnichar c void Append(const PRUnichar*, PRUint32) - source Parameters PRUnichar* data PRUint32 length void Append(const
nsAString&) - so...
...And 15 more matches
nsDependentString external
ngth Rebind void Rebind(const PRUnichar*, PRUint32) - source Parameters PRUnichar* aData PRUint32 aLength get PRUnichar* get() const - source operator= nsString_external& operator=(const nsString_external&) - source Parameters nsString_external& aString
nsAString& operator=(const
nsAString&) - source Parameters
nsAString& aString
nsAString& operator=(const PRUnichar*) - source Parameters PRUnichar* aPtr
nsAString& operator=(PRUnichar) - source Parameters PRUnichar aChar Adopt void Adopt(const PRUnichar*, PRUint32) - source Parameter...
...rs PRUint32 aLen Length PRUint32 Length() const - source IsEmpty PRBool IsEmpty() const - source SetIsVoid void SetIsVoid(PRBool) - source Parameters PRBool val IsVoid PRBool IsVoid() const - source Assign void Assign(const
nsAString&) - source Parameters
nsAString& aString void Assign(const PRUnichar*, PRUint32) - source Parameters PRUnichar* aData PRUint32 aLength void Assign(PRUnichar) - source Parameters PRUnichar aChar AssignLiteral void AssignLiteral(const char*) - source Parameters ...
... void Replace(PRUint32, PRUint32, const PRUnichar*, PRUint32) - source Parameters PRUint32 cutStart PRUint32 cutLength PRUnichar* data PRUint32 length void Replace(PRUint32, PRUint32, PRUnichar) - source Parameters PRUint32 cutStart PRUint32 cutLength PRUnichar c void Replace(PRUint32, PRUint32, const
nsAString&) - source Parameters PRUint32 cutStart PRUint32 cutLength
nsAString& readable Append void Append(PRUnichar) - source Parameters PRUnichar c void Append(const PRUnichar*, PRUint32) - source Parameters PRUnichar* data PRUint32 length void Append(const
nsAString&) - so...
...And 15 more matches
WebIDL bindings
rgument Type Return Type Dictionary/Member Type any JS::Handle<JS::Value> JS::MutableHandle<JS::Value> JS::Value boolean bool bool bool byte int8_t int8_t int8_t ByteString const nsACString& nsCString& (outparam) nsACString& (outparam) nsCString Date mozilla::dom::Date DOMString const
nsAString& mozilla::dom::DOMString& (outparam)
nsAString& (outparam) nsString& (outparam) nsString UTF8String const nsACString& nsACString& (outparam) nsCString double double double double float float float float interface: non-nullable Foo& already_addRefed<Foo> Foo* OwningNonNull<Foo> interface: nullable ...
... They will be in the compartment of the passed-in JSContext. any return values become a JS::MutableHandle<JS::Value> out param appended to the argument list. This comes after...
... They will be in the compartment of the passed-in JSContext. any return values become a JS::MutableHandle<JS::Value> out param appended to the argument list. This comes after all IDL arguments, but before the ErrorResult&, if an...
...And 14 more matches
nsPromiseFlatString
ar AssignLiteral(char Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral(const char AppendLiteral(char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid StripChar Base Classes nsString Data Members No public members. ...
...ace ReplaceASCII Append AppendASCII AppendLiteral(const char AppendLiteral(char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid StripChar Base Classes nsString Data Members No public members. ...
...oid StripChar Base Classes nsString Data Members No public members. ...
...And 8 more matches
nsAutoString
nsFixedString Data Members No public members. ...
...bers. ...
...arameters nsAutoString& str void nsAutoString(const
nsAString_internal&) - source Parameters
nsAString_internal& str void nsAutoString(const nsSubstringTuple&) - source Parameters nsSubstringTuple& tuple operator= nsAutoString& operator=(const nsAutoString&) - source Parameters nsAutoString& str nsString& operator=(const nsString&) - source Parameters nsString& str
nsAString_internal& operator=(PRUnichar) - source Parameters PRUnichar c
nsAString_internal& operator=(const PRUnichar*) - source Parameters PRUnichar* data
nsAString_internal& operator=(const
nsAString_internal&) - source Parameters
nsAString_internal& str
nsAString_internal& operator=(const nsSubstringTuple&) - source Parameters nsSubstringTuple& tuple get PRUnichar* get() con...
...And 6 more matches
nsDependentString
rs No public members. Methods Constructors void nsDependentString(const PRUnichar*, const PRUnichar*) - source constructors Parameters PRUnichar* start PRUnichar* end void nsDependentString(const PRUnichar*, PRUint32) - source Parameters PRUnichar* data PRUint32 length void nsDependentString(const PRUnichar*) - source Parameters PRUnichar* data void nsDependentString(const
nsAString_internal&) - source Parameters
nsAString_internal& str void nsDependentString() - source AssertValid void AssertValid() - source verify restrictions Rebind void Rebind(const PRUnichar*) - source allow this class to be bound to a different string... Parameters PRUnichar* data void Rebind(const PRUnichar*, PRUint32) - source Parameters PRUnichar* data PRUint32 length ...
...nichar*) - source allow this class to be bound to a different string... ...
...eters PRUnichar* data void Rebind(const PRUnichar*, PRUint32) - source Parameters PRUnichar* data PRUint32 length void Rebind(const PRUnichar*, const PRUnichar*) - source Parameters PRUnichar* start PRUnichar* end operator= nsString& operator=(const nsString&) - source Parameters nsString& str
nsAString_internal& operator=(PRUnichar) - source Parameters PRUnichar c
nsAString_internal& operator=(const PRUnichar*) - source Parameters PRUnichar* data
nsAString_internal& operator=(const
nsAString_internal&) - source Parameters
nsAString_internal& str
nsAString_internal& operator=(const nsSubstringTuple&) - source Parameters nsSubstringTuple& tuple get PRUnichar* get() const - source returns the null-terminated string Find PRInt32 Find(const ...
...And 6 more matches
nsDependentSubstring
r LowerCaseEqualsLiteral(char Assign AssignASCII AssignLiteral(const char AssignLiteral(char operator= Adopt Replace ReplaceASCII Append AppendASCII AppendLiteral(const char AppendLiteral(char operator+= Insert Cut SetCapacity SetLength Truncate GetData GetMutableData SetIsVoid StripChar Base Classes
nsAString_internal Data Members No public members. Methods Constructors void nsDependentSubstring(const
nsAString_internal&, PRUint32, PRUint32) - source Parameters
nsAString_internal& str PRUint32 startPos PRUint32 length void nsDependentSubstring(const PRUnichar*, const PRUnichar*) - source Parameters PRUnichar* start PRUnichar* end void nsDependentSubstring(const nsReadingIterator<sh...
...ring(const PRUnichar*, const PRUnichar*) - source Parameters PRUnichar* start PRUnichar* end void nsDependentSubstring(const nsReadingIterator<short unsigned int>&, const nsReadingIterator<short unsigned int>&) - source Parameters nsReadingIterator<short unsigned int>& start nsReadingIterator<short unsigned int>& end void nsDependentSubstring() - source Rebind void Rebind(const
nsAString_internal&, PRUint32, PRUint32) - source Parameters
nsAString_internal& <anonymous> PRUint32 startPos PRUint32 length void Rebind(const PRUnichar*, const PRUnichar*) - source Parameters PRUnichar* start PRUnichar* end BeginReading PRUnichar* BeginReading() const - source reading iterators nsReadingIterator<short unsigned int>& BeginReading(nsReadingIterator<short unsigned int>&...
...ator[](PRUint32) const - source Parameters PRUint32 i First PRUnichar First() const - source Last PRUnichar Last() const - source CountChar PRUint32 CountChar(PRUnichar) const - source Parameters PRUnichar <anonymous> FindChar PRInt32 FindChar(PRUnichar, PRUint32) const - source Parameters PRUnichar <anonymous> PRUint32 offset Equals PRBool Equals(const
nsAString_internal&) const - source equality Parameters
nsAString_internal& <anonymous> PRBool Equals(const
nsAString_internal&, const nsStringComparator&) const - source Parameters
nsAString_internal& <anonymous> nsStringComparator& <anonymous> PRBool Equals(const PRUnichar*) const - source Parameters PRUnichar* data PRBool Equals(const PRUnichar*, const nsStringComparator&) const - sour...
...And 6 more matches
nsString
Methods Constructors void nsString() - source constructors void nsString(PRUnichar) - source Parameters PRUnichar c void nsString(const PRUnichar*, PRUint32) - source Parameters PRUnichar* data PRUint32 length void nsString(const nsString&) - source Parameters nsString& str void nsString(const nsSubstringTuple&) - source Par...
...Constructors void nsString() - source constructors void nsString(PRUnichar) - source Parameters PRUnichar c void nsString(const PRUnichar*, PRUint32) - source Parameters PRUnichar* data PRUint32 length void nsString(const nsString&) - source Parameters nsString& str void nsString(const nsSubstringTuple&) - source Parameters nsSubstringTuple& tuple void nsString(const
nsAString_internal&) - source Parameters
nsAString_internal& readable operator= nsString& operator=(const nsString&) - source Parameters nsString& str
nsAString_internal& operator=(PRUnichar) - source Parameters PRUnichar c
nsAString_internal& operator=(const PRUnichar*) - source Parameters PRUnichar* data
nsAString_internal& operator=(const
nsAString_internal&) - source Param...
...al&) - source Parameters
nsAString_internal& readable operator= nsString& operator=(const nsString&) - source Parameters nsString& str
nsAString_internal& operator=(PRUnichar) - source Parameters PRUnichar c
nsAString_internal& operator=(const PRUnichar*) - source Parameters PRUnichar* data
nsAString_internal& operator=(const
nsAString_internal&) - source Parameters
nsAString_internal& str
nsAString_internal& operator=(const nsSubstringTuple&) - source Parameters nsSubstringTuple& tuple get PRUnichar* get() const - source returns the null-terminated string Find PRInt32 Find(const nsCString&, PRBool, PRInt32, PRInt32) const - source Search for the given substring within this string. @param aString is substring to be sought in this @param aIg...
...And 6 more matches
Index
erence This operator+= is a shortcut for the Append family of functions. 1163 operator= XPCOM, XPCOM API Reference This operator is a shortcut for the Assign family of functions. 1164 nsACString (External) NeedsContent, Reference, Reference(2), strings Class Declaration 1165 nsACString_internal Class Declaration 1166
nsAString XPCOM, XPCOM API Reference The
nsAString abstract class represents a character string composed of double-byte storage units. This class is typically used to represent Unicode character arrays. 1167 Append XPCOM, XPCOM API Reference The Append family of functions appends a value to the end of a string's internal buffer. 1168 Assign XPCOM, XPCOM API Ref...
... Replace XPCOM, XPCOM API Reference The Replace family of functions sets the value of a string's internal buffer. 1175 operator+= XPCOM, XPCOM API Reference This operator+= is a shortcut for the Append family of functions. 1176 operator= XPCOM, XPCOM API Reference This operator= is a shortcut for the Append family of functions. ...
... of functions sets the value of a string's internal buffer. 1175 operator+= XPCOM, XPCOM API Reference This operator+= is a shortcut for the Append family of functions. 1176 operator= XPCOM, XPCOM API Reference This operator= is a shortcut for the Append family of functions. ...
...And 5 more matches
NS_StringCopy
Return Values The NS_StringCopy function returns NS_OK if successful. Otherwise, it returns an error code. Remarks This function is designed to allow the implementation to efficiently assign the same value to two string objects. ...
... Return Values The NS_StringCopy function returns NS_OK if successful. Otherwise, it returns an error code. Remarks This function is designed to allow the implementation to efficiently assign the same value to two string objects. ...
... Return Values The NS_StringCopy function returns NS_OK if successful. Otherwise, it returns an error code. Remarks This function is designed to allow the implementation to efficiently assign the same value to two string objects. ...
...And 5 more matches
String Quick Reference - Archive of obsolete content
Function declarations What: Use abstract classes instead of concrete classes when passing strings across function boundaries Why: using abstract classes allows the caller to choose the storage mechanism, allowing for possible sharing or more efficient handling of string fragments. ...
...t classes instead of concrete classes when passing strings across function boundaries Why: using abstract classes allows the caller to choose the storage mechanism, allowing for possible sharing or more efficient handling of string fragments. ...
...of concrete classes when passing strings across function boundaries Why: using abstract classes allows the caller to choose the storage mechanism, allowing for possible sharing or more efficient handling of string fragments. ...
...And 4 more matches
NS_ConvertASCIItoUTF16
oid NS_ConvertASCIItoUTF16(const char*, PRUint32) - source Parameters char* aCString PRUint32 aLength void NS_ConvertASCIItoUTF16(const nsACString_internal&) - source Parameters nsACString_internal& aCString operator= nsAutoString& operator=(const nsAutoString&) - source Parameters nsAutoString& str nsString& operator=(const nsString&) - source Parameters nsString& str
nsAString_internal& operator=(PRUnichar) - source Parameters PRUnichar c
nsAString_internal& operator=(const PRUnichar*) - source Parameters PRUnichar* data
nsAString_internal& operator=(const
nsAString_internal&) - source Parameters
nsAString_internal& str
nsAString_internal& operator=(const nsSubstringTuple&) - source Parameters nsSubstringTuple& tuple get PRUnichar* get() con...
...ator[](PRUint32) const - source Parameters PRUint32 i First PRUnichar First() const - source Last PRUnichar Last() const - source CountChar PRUint32 CountChar(PRUnichar) const - source Parameters PRUnichar <anonymous> FindChar PRInt32 FindChar(PRUnichar, PRUint32) const - source Parameters PRUnichar <anonymous> PRUint32 offset Equals PRBool Equals(const
nsAString_internal&) const - source equality Parameters
nsAString_internal& <anonymous> PRBool Equals(const
nsAString_internal&, const nsStringComparator&) const - source Parameters
nsAString_internal& <anonymous> nsStringComparator& <anonymous> PRBool Equals(const PRUnichar*) const - source Parameters PRUnichar* data PRBool Equals(const PRUnichar*, const nsStringComparator&) const - sour...
... LowerCaseEqualsLiteral(const char PRBool LowerCaseEqualsLiteral(const char (&)[N]) const - source LowerCaseEqualsLiteral(char PRBool LowerCaseEqualsLiteral(char (&)[N]) const - source Assign void Assign(PRUnichar) - source assignment Parameters PRUnichar c void Assign(const PRUnichar*, PRUint32) - source Parameters PRUnichar* data PRUint32 length void Assign(const
nsAString_internal&) - source Parameters
nsAString_internal& <anonymous> void Assign(const nsSubstringTuple&) - source Parameters nsSubstringTuple& <anonymous> AssignASCII void AssignASCII(const char*, PRUint32) - source Parameters char* data PRUint32 length void AssignASCII(const char*) - source Parameters char* data AssignLiteral(const char void AssignLiteral(const char (&...
...And 4 more matches
NS_ConvertUTF8toUTF16
void NS_ConvertUTF8toUTF16(const char*, PRUint32) - source Parameters char* aCString PRUint32 aLength void NS_ConvertUTF8toUTF16(const nsACString_internal&) - source Parameters nsACString_internal& aCString operator= nsAutoString& operator=(const nsAutoString&) - source Parameters nsAutoString& str nsString& operator=(const nsString&) - source Parameters nsString& str
nsAString_internal& operator=(PRUnichar) - source Parameters PRUnichar c
nsAString_internal& operator=(const PRUnichar*) - source Parameters PRUnichar* data
nsAString_internal& operator=(const
nsAString_internal&) - source Parameters
nsAString_internal& str
nsAString_internal& operator=(const nsSubstringTuple&) - source Parameters nsSubstringTuple& tuple get PRUnichar* get() con...
...ator[](PRUint32) const - source Parameters PRUint32 i First PRUnichar First() const - source Last PRUnichar Last() const - source CountChar PRUint32 CountChar(PRUnichar) const - source Parameters PRUnichar <anonymous> FindChar PRInt32 FindChar(PRUnichar, PRUint32) const - source Parameters PRUnichar <anonymous> PRUint32 offset Equals PRBool Equals(const
nsAString_internal&) const - source equality Parameters
nsAString_internal& <anonymous> PRBool Equals(const
nsAString_internal&, const nsStringComparator&) const - source Parameters
nsAString_internal& <anonymous> nsStringComparator& <anonymous> PRBool Equals(const PRUnichar*) const - source Parameters PRUnichar* data PRBool Equals(const PRUnichar*, const nsStringComparator&) const - sour...
... LowerCaseEqualsLiteral(const char PRBool LowerCaseEqualsLiteral(const char (&)[N]) const - source LowerCaseEqualsLiteral(char PRBool LowerCaseEqualsLiteral(char (&)[N]) const - source Assign void Assign(PRUnichar) - source assignment Parameters PRUnichar c void Assign(const PRUnichar*, PRUint32) - source Parameters PRUnichar* data PRUint32 length void Assign(const
nsAString_internal&) - source Parameters
nsAString_internal& <anonymous> void Assign(const nsSubstringTuple&) - source Parameters nsSubstringTuple& <anonymous> AssignASCII void AssignASCII(const char*, PRUint32) - source Parameters char* data PRUint32 length void AssignASCII(const char*) - source Parameters char* data AssignLiteral(const char void AssignLiteral(const char (&...
...And 4 more matches
nsAdoptingString
r PRUint32 length void nsAdoptingString(const nsAdoptingString&) - source Parameters nsAdoptingString& str operator= nsAdoptingString& operator=(const nsAdoptingString&) - source Parameters nsAdoptingString& str nsXPIDLString& operator=(const nsXPIDLString&) - source Parameters nsXPIDLString& str nsString& operator=(const nsString&) - source Parameters nsString& str
nsAString_internal& operator=(PRUnichar) - source Parameters PRUnichar c
nsAString_internal& operator=(const PRUnichar*) - source Parameters PRUnichar* data
nsAString_internal& operator=(const
nsAString_internal&) - source Parameters
nsAString_internal& str
nsAString_internal& operator=(const nsSubstringTuple&) - source Parameters nsSubstringTuple& tuple operator const PRUnichar* ...
...CharAt(PRUint32) const - source Parameters PRUint32 i First PRUnichar First() const - source Last PRUnichar Last() const - source CountChar PRUint32 CountChar(PRUnichar) const - source Parameters PRUnichar <anonymous> FindChar PRInt32 FindChar(PRUnichar, PRUint32) const - source Parameters PRUnichar <anonymous> PRUint32 offset Equals PRBool Equals(const
nsAString_internal&) const - source equality Parameters
nsAString_internal& <anonymous> PRBool Equals(const
nsAString_internal&, const nsStringComparator&) const - source Parameters
nsAString_internal& <anonymous> nsStringComparator& <anonymous> PRBool Equals(const PRUnichar*) const - source Parameters PRUnichar* data PRBool Equals(const PRUnichar*, const nsStringComparator&) const - sour...
... LowerCaseEqualsLiteral(const char PRBool LowerCaseEqualsLiteral(const char (&)[N]) const - source LowerCaseEqualsLiteral(char PRBool LowerCaseEqualsLiteral(char (&)[N]) const - source Assign void Assign(PRUnichar) - source assignment Parameters PRUnichar c void Assign(const PRUnichar*, PRUint32) - source Parameters PRUnichar* data PRUint32 length void Assign(const
nsAString_internal&) - source Parameters
nsAString_internal& <anonymous> void Assign(const nsSubstringTuple&) - source Parameters nsSubstringTuple& <anonymous> AssignASCII void AssignASCII(const char*, PRUint32) - source Parameters char* data PRUint32 length void AssignASCII(const char*) - source Parameters char* data AssignLiteral(const char void AssignLiteral(const char (&...
...And 4 more matches
nsFixedString
ram storageSize the size of the fixed buffer @param length (optional) the length of the string already contained in the buffer Parameters PRUnichar* data PRUint32 storageSize void nsFixedString(PRUnichar*, PRUint32, PRUint32) - source Parameters PRUnichar* data PRUint32 storageSize PRUint32 length operator= nsString& operator=(const nsString&) - source Parameters nsString& str
nsAString_internal& operator=(PRUnichar) - source Parameters PRUnichar c
nsAString_internal& operator=(const PRUnichar*) - source Parameters PRUnichar* data
nsAString_internal& operator=(const
nsAString_internal&) - source Parameters
nsAString_internal& str
nsAString_internal& operator=(const nsSubstringTuple&) - source Parameters nsSubstringTuple& tuple get PRUnichar* get() con...
...ator[](PRUint32) const - source Parameters PRUint32 i First PRUnichar First() const - source Last PRUnichar Last() const - source CountChar PRUint32 CountChar(PRUnichar) const - source Parameters PRUnichar <anonymous> FindChar PRInt32 FindChar(PRUnichar, PRUint32) const - source Parameters PRUnichar <anonymous> PRUint32 offset Equals PRBool Equals(const
nsAString_internal&) const - source equality Parameters
nsAString_internal& <anonymous> PRBool Equals(const
nsAString_internal&, const nsStringComparator&) const - source Parameters
nsAString_internal& <anonymous> nsStringComparator& <anonymous> PRBool Equals(const PRUnichar*) const - source Parameters PRUnichar* data PRBool Equals(const PRUnichar*, const nsStringComparator&) const - sour...
... LowerCaseEqualsLiteral(const char PRBool LowerCaseEqualsLiteral(const char (&)[N]) const - source LowerCaseEqualsLiteral(char PRBool LowerCaseEqualsLiteral(char (&)[N]) const - source Assign void Assign(PRUnichar) - source assignment Parameters PRUnichar c void Assign(const PRUnichar*, PRUint32) - source Parameters PRUnichar* data PRUint32 length void Assign(const
nsAString_internal&) - source Parameters
nsAString_internal& <anonymous> void Assign(const nsSubstringTuple&) - source Parameters nsSubstringTuple& <anonymous> AssignASCII void AssignASCII(const char*, PRUint32) - source Parameters char* data PRUint32 length void AssignASCII(const char*) - source Parameters char* data AssignLiteral(const char void AssignLiteral(const char (&...
...And 4 more matches
nsXPIDLString
RUnichar* operator const PRUnichar*() const - source operator[] PRUnichar operator[](PRInt32) const - source Parameters PRInt32 i PRUnichar operator[](PRUint32) const - source Parameters PRUint32 i operator= nsXPIDLString& operator=(const nsXPIDLString&) - source Parameters nsXPIDLString& str nsString& operator=(const nsString&) - source Parameters nsString& str
nsAString_internal& operator=(PRUnichar) - source Parameters PRUnichar c
nsAString_internal& operator=(const PRUnichar*) - source Parameters PRUnichar* data
nsAString_internal& operator=(const
nsAString_internal&) - source Parameters
nsAString_internal& str
nsAString_internal& operator=(const nsSubstringTuple&) - source Parameters nsSubstringTuple& tuple get PRUnichar* get() con...
...CharAt(PRUint32) const - source Parameters PRUint32 i First PRUnichar First() const - source Last PRUnichar Last() const - source CountChar PRUint32 CountChar(PRUnichar) const - source Parameters PRUnichar <anonymous> FindChar PRInt32 FindChar(PRUnichar, PRUint32) const - source Parameters PRUnichar <anonymous> PRUint32 offset Equals PRBool Equals(const
nsAString_internal&) const - source equality Parameters
nsAString_internal& <anonymous> PRBool Equals(const
nsAString_internal&, const nsStringComparator&) const - source Parameters
nsAString_internal& <anonymous> nsStringComparator& <anonymous> PRBool Equals(const PRUnichar*) const - source Parameters PRUnichar* data PRBool Equals(const PRUnichar*, const nsStringComparator&) const - sour...
... LowerCaseEqualsLiteral(const char PRBool LowerCaseEqualsLiteral(const char (&)[N]) const - source LowerCaseEqualsLiteral(char PRBool LowerCaseEqualsLiteral(char (&)[N]) const - source Assign void Assign(PRUnichar) - source assignment Parameters PRUnichar c void Assign(const PRUnichar*, PRUint32) - source Parameters PRUnichar* data PRUint32 length void Assign(const
nsAString_internal&) - source Parameters
nsAString_internal& <anonymous> void Assign(const nsSubstringTuple&) - source Parameters nsSubstringTuple& <anonymous> AssignASCII void AssignASCII(const char*, PRUint32) - source Parameters char* data PRUint32 length void AssignASCII(const char*) - source Parameters char* data AssignLiteral(const char void AssignLiteral(const char (&...
...And 4 more matches
NS_StringSetDataRange
aCutStart [in] The starting index of the section to replace, measured in storage units. ...
...aCutStart [in] The starting index of the section to replace, measured in storage units. ...
...ing. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. Return Values The NS_StringSetDataRange function returns NS_OK if successful. Otherwise, it returns an error code. ...
...And 3 more matches
NS_ConvertUTF16toUTF8
StripChar Base Classes nsCAutoString Data Members No public members. ...
... Data Members No public members. ...
...(PRBool, PRBool) - source This method strips whitespace from string. You can control whether whitespace is yanked from start and end of string as well. ...
...And 2 more matches
NS_LossyConvertUTF16toASCII
toString Data Members No public members. ...
... Methods Constructors void NS_LossyConvertUTF16toASCII(const PRUnichar*) - source A helper class that converts a UTF-16 string to ASCII in a lossy manner Parameters PRUnichar* aString void NS_LossyConvertUTF16toASCII(const PRUnichar*, PRUint32) - source Parameters PRUnichar* aString PRUint32 aLength void NS_LossyConvertUTF16toASCII(const
nsAString_internal&) - source Parameters
nsAString_internal& aString operator= nsCAutoString& operator=(const nsCAutoString&) - source Parameters nsCAutoString& str nsCString& operator=(const nsCString&) - source Parameters nsCString& str nsACString_internal& operator=(char) - source Parameters char c nsACString_internal& operator=(const char*) - source Parameters char* data nsACString_internal& operator=(const nsAC...
...(PRBool, PRBool) - source This method strips whitespace from string. You can control whether whitespace is yanked from start and end of string as well. ...
...And 2 more matches
XPCOM glue classes
cking enabled will fail to compile.NS_POSTCONDITIONMacroNS_PRECONDITIONMacronsACStringThe nsACString abstract class represents a character string composed of single-byte storage units. ...
... will fail to compile.NS_POSTCONDITIONMacroNS_PRECONDITIONMacronsACStringThe nsACString abstract class represents a character string composed of single-byte storage units. ...
...age units. This class is typically used to represent ASCII or UTF-8 character arrays.nsACString (External)Class DeclarationnsACString_internalClass DeclarationnsAdoptingCStringClass DeclarationnsAdoptingStringClass Declaration
nsAStringThe
nsAString abstract class represents a character string composed of double-byte storage units. ...
...And 2 more matches
NS_UTF16ToCString
The source string should be encoded using the host byte order. aDestEncoding [in] The character encoding of the destination string. See nsCStringEncoding for the set of values that can be passed for this parameter. ...
...The source string should be encoded using the host byte order. aDestEncoding [in] The character encoding of the destination string. See nsCStringEncoding for the set of values that can be passed for this parameter. ...
...The source string should be encoded using the host byte order. aDestEncoding [in] The character encoding of the destination string. See nsCStringEncoding for the set of values that can be passed for this parameter. ...
...And 2 more matches
Extending a Protocol
This will matter later, as we will need to convert it to UTF-8 (using nsCString) to send it to the parent process. Now let's implement the method in ./dom/base/Navigator.cpp - we add a little bit of error boilerplate stuff, as is customary: already_AddRefed<Promise> Navigator::Echo(const nsAStrin...
...rite editor, open dom/webidl/Navigator.webidl At the end of the file, add: partial interface Navigator { [Throws] Promise<DOMString> echo(DOMString aString); }; Now we need to implement the Echo() method in C++, so open up ./dom/base/Navigator.h and let's add the method definition, so under public:: already_AddRefed<Promise> Echo(const
nsAString& aString, ErrorResult& aRv); We use
nsAString& as the DOMString comes in from JS as UTF-16. ...
...sAString& aString, ErrorResult& aRv); We use
nsAString& as the DOMString comes in from JS as UTF-16. This will matter later, as we will need to convert it to UTF-8 (using nsCString) to send it to the parent process. ...
...auto windowGlobalChild = mWindow->GetWindowGlobalChild(); // Let's get us a child! mEchoChild = windowGlobalChild->AllocPEchoChild(); // Let's make sure it's initialized and ready to send messages. windowGlobalChild->SendPEchoConstructor(mEchoChild); } return mEchoChild; } And finally... ...
NS_StringSetData
aData [in] A raw character array to copy into this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. ...
...aData [in] A raw character array to copy into this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. ...
...Otherwise, aData need not be null terminated. Return Values The NS_StringSetData function returns NS_OK if successful. Otherwise, it returns an error code. ...
... Example Code nsStringContainer str; rv = NS_StringContainerInit(str); if (NS_SUCCEEDED(rv)) { rv = NS_StringSetData(str, "hello world"); if (NS_SUCCEEDED(rv)) { // now, pass |str| to some function expecting a |const
nsAString&| parameter. } NS_StringContainerFinish(str); } History This function was frozen for Mozilla 1.7. See bug 239123 for details. See Also
nsAString ...
Index - Archive of obsolete content
source to use, only which one to consume. ...
...which one to consume. ...
...ned: always remember the -time option, or you may be hitting that physical reset button sooner than you would have liked! ...
Using XPCOM Utilities to Make Things Easier
y complex because they support the Gecko layout engine and other subsystems that manage large chunks of data. Additionally, in some versions of Mozilla the string classes support sequences of characters broken up into multiple fragments (fragments which may or may not be null terminated)[nulls-in-strings]. All string classes in XPCOM derive from one of two abstract classes[other-string-classes]:
nsAString and nsACString. The former handles double byte characters, and the latter tends to be used in more general circumstances, but both of these classes define the functionality of a string. You can see these classes being passed as arguments in many of the XPCOM interfaces we'll look at in the following chapters. Using Strings Explaining how all the string classes work is outside the scope of this ...
...ty for a much smaller footprint is the right way to go. The WebLock string classes don't need to append, concatenate, search, or do any other real work on the string data; they just need to represent char* and other data and pass them to methods that expect an nsACString. nsEmbedString and nsEmbedCString The strings used in this tutorial are nsEmbedString and nsEmbedCString, which implement the
nsAString abstract class and the nsACString abstract classes, respectively. This first example shows an nsEmbedCString being used to pass an nsACString to a method that's not expected to modify the string. // in IDL: method(in ACString thing); char* str = "How now brown cow?"; nsEmbedCString data(str); rv = object->Method(data); In this next example, the method is going to set the value of the string -...
...the memory pointed to by aStringURL after the call to url.get() is owned by the URL string object. If you need to keep this string data around past the lifetime of the string object, you must make a copy. String Size The examples above illustrate the use of the single byte string class, nsEmbedCString. The double byte version, nsEmbedString, has the same functionality but the constructor takes
nsAString and the .get() method returns the type PRUnichar*. Note that PRUnichar is a two byte value. In the coming chapters, you'll see examples that use this version in the WebLock component. Smart Pointers All of the interfaces that you've seen so far are reference counted. Leaking a reference by not releasing an object, as the code below demonstrates, can be a major problem. { nsISupports* value ...
nsAdoptingCString
(PRBool, PRBool) - source This method strips whitespace from string. You can control whether whitespace is yanked from start and end of string as well. ...
...ether whitespace is yanked from start and end of string as well. ...
...PRBool aEliminateLeading PRBool aEliminateTrailing AssignWithConversion void AssignWithConversion(const
nsAString_internal&) - source assign/append/insert with _LOSSY_ conversion Parameters
nsAString_internal& aString void AssignWithConversion(const PRUnichar*, PRInt32) - source Parameters PRUnichar* aData PRInt32 aLength AppendWithConversion void AppendWithConversion(const
nsAString_internal&) - source Parameters
nsAString_internal& aString void AppendWithConversion(const PRUnichar*, PRInt32) - source Parameters PRUnichar* aData PRInt32 aLength AppendInt void AppendInt(PRInt32, PRInt32) - source Append the given integer to this string Parameters PRInt32 aInteger PRInt32 aRadix void AppendInt(PRUint32, PRInt32) - source Append the given unsigned intege...
nsCAutoString
ol) - source This method strips whitespace from string. You can control whether whitespace is yanked from start and end of string as well. ...
... yanked from start and end of string as well. ...
... PRBool aEliminateTrailing AssignWithConversion void AssignWithConversion(const
nsAString_internal&) - source assign/append/insert with _LOSSY_ conversion Parameters
nsAString_internal& aString void AssignWithConversion(const PRUnichar*, PRInt32) - source Parameters PRUnichar* aData PRInt32 aLength AppendWithConversion void AppendWithConversion(const
nsAString_internal&) - source Parameters
nsAString_internal& aString void AppendWithConversion(const PRUnichar*, PRInt32) - source Parameters PRUnichar* aData PRInt32 aLength AppendInt void AppendInt(PRInt32, PRInt32) - source Append the given integer to this string Parameters PRInt32 aInteger PRInt32 aRadix void AppendInt(PRUint32, PRInt32) - source Ap...
nsCString
(PRBool, PRBool) - source This method strips whitespace from string. You can control whether whitespace is yanked from start and end of string as well. ...
...ether whitespace is yanked from start and end of string as well. ...
...PRBool aEliminateLeading PRBool aEliminateTrailing AssignWithConversion void AssignWithConversion(const
nsAString_internal&) - source assign/append/insert with _LOSSY_ conversion Parameters
nsAString_internal& aString void AssignWithConversion(const PRUnichar*, PRInt32) - source Parameters PRUnichar* aData PRInt32 aLength AppendWithConversion void AppendWithConversion(const
nsAString_internal&) - source Parameters
nsAString_internal& aString void AppendWithConversion(const PRUnichar*, PRInt32) - source Parameters PRUnichar* aData PRInt32 aLength AppendInt void AppendInt(PRInt32, PRInt32) - source Append the given integer to this string Parameters PRInt32 aInteger PRInt32 aRadix void AppendInt(PRUint32, PRInt32) - source Append the given unsigned intege...
nsDependentCString
(PRBool, PRBool) - source This method strips whitespace from string. You can control whether whitespace is yanked from start and end of string as well. ...
...ether whitespace is yanked from start and end of string as well. ...
...PRBool aEliminateLeading PRBool aEliminateTrailing AssignWithConversion void AssignWithConversion(const
nsAString_internal&) - source assign/append/insert with _LOSSY_ conversion Parameters
nsAString_internal& aString void AssignWithConversion(const PRUnichar*, PRInt32) - source Parameters PRUnichar* aData PRInt32 aLength AppendWithConversion void AppendWithConversion(const
nsAString_internal&) - source Parameters
nsAString_internal& aString void AppendWithConversion(const PRUnichar*, PRInt32) - source Parameters PRUnichar* aData PRInt32 aLength AppendInt void AppendInt(PRInt32, PRInt32) - source Append the given integer to this string Parameters PRInt32 aInteger PRInt32 aRadix void AppendInt(PRUint32, PRInt32) - source Append the given unsigned intege...
operator=
Return Values This operator returns a reference back to the object being modified to allow operator chaining. ...
... Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( const char_type* aData ); Parameters aData [in] A raw character array to append to this string. ...
...Data [in] A raw character array to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator=( char_type aChar ); Parameters aChar [in] A character to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. See Also
nsAString::Assign ...
nsFixedCString
(PRBool, PRBool) - source This method strips whitespace from string. You can control whether whitespace is yanked from start and end of string as well. ...
...ether whitespace is yanked from start and end of string as well. ...
...PRBool aEliminateLeading PRBool aEliminateTrailing AssignWithConversion void AssignWithConversion(const
nsAString_internal&) - source assign/append/insert with _LOSSY_ conversion Parameters
nsAString_internal& aString void AssignWithConversion(const PRUnichar*, PRInt32) - source Parameters PRUnichar* aData PRInt32 aLength AppendWithConversion void AppendWithConversion(const
nsAString_internal&) - source Parameters
nsAString_internal& aString void AppendWithConversion(const PRUnichar*, PRInt32) - source Parameters PRUnichar* aData PRInt32 aLength AppendInt void AppendInt(PRInt32, PRInt32) - source Append the given integer to this string Parameters PRInt32 aInteger PRInt32 aRadix void AppendInt(PRUint32, PRInt32) - source Append the given unsigned intege...
nsPromiseFlatCString
(PRBool, PRBool) - source This method strips whitespace from string. You can control whether whitespace is yanked from start and end of string as well. ...
...ether whitespace is yanked from start and end of string as well. ...
...PRBool aEliminateLeading PRBool aEliminateTrailing AssignWithConversion void AssignWithConversion(const
nsAString_internal&) - source assign/append/insert with _LOSSY_ conversion Parameters
nsAString_internal& aString void AssignWithConversion(const PRUnichar*, PRInt32) - source Parameters PRUnichar* aData PRInt32 aLength AppendWithConversion void AppendWithConversion(const
nsAString_internal&) - source Parameters
nsAString_internal& aString void AppendWithConversion(const PRUnichar*, PRInt32) - source Parameters PRUnichar* aData PRInt32 aLength AppendInt void AppendInt(PRInt32, PRInt32) - source Append the given integer to this string Parameters PRInt32 aInteger PRInt32 aRadix void AppendInt(PRUint32, PRInt32) - source Append the given unsigned intege...
nsXPIDLCString
(PRBool, PRBool) - source This method strips whitespace from string. You can control whether whitespace is yanked from start and end of string as well. ...
...ether whitespace is yanked from start and end of string as well. ...
...PRBool aEliminateLeading PRBool aEliminateTrailing AssignWithConversion void AssignWithConversion(const
nsAString_internal&) - source assign/append/insert with _LOSSY_ conversion Parameters
nsAString_internal& aString void AssignWithConversion(const PRUnichar*, PRInt32) - source Parameters PRUnichar* aData PRInt32 aLength AppendWithConversion void AppendWithConversion(const
nsAString_internal&) - source Parameters
nsAString_internal& aString void AppendWithConversion(const PRUnichar*, PRInt32) - source Parameters PRUnichar* aData PRInt32 aLength AppendInt void AppendInt(PRInt32, PRInt32) - source Append the given integer to this string Parameters PRInt32 aInteger PRInt32 aRadix void AppendInt(PRUint32, PRInt32) - source Append the given unsigned intege...
NS_StringAppendData
aData [in] A raw character array to copy into this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. ...
... aData [in] A raw character array to copy into this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. ...
...ple Code nsStringContainer str; NS_StringContainerInit(str); NS_StringSetData(str, L"hello"); NS_StringAppendData(str, L" world"); const PRUnichar* data; NS_StringGetData(str, &data); // data now points to the string: L"hello world" NS_StringContainerFinish(str); History This function was frozen for Mozilla 1.7. See bug 239123 for details. See Also NS_StringSetDataRange,
nsAString ...
NS_StringContainerInit
<< XPCOM API Reference Summary The NS_StringContainerInit function initializes a nsStringContainer instance for use as a
nsAString. This is a low-level API. #include "nsStringAPI.h" nsresult NS_StringContainerInit( nsStringContainer& aString ); Parameters aString [in] A nsStringContainer instance to be initialized. Return Values The NS_StringContainerInit function returns NS_OK if successful. Otherwise, it returns an error code. Remarks The nsStringContainer structure has unspecified size and layout. Its members may not be accessed directly. After a nsStringContainer object has been initialized, it may be used as an ordinary
nsAString object. The internal buffer allocated by a nsStringContainer is always null-terminated. With NS_StringContainerInit, the coder is requir...
...ssed directly. After a nsStringContainer object has been initialized, it may be used as an ordinary
nsAString object. The internal buffer allocated by a nsStringContainer is always null-terminated. With NS_StringContainerInit, the coder is required to call NS_StringContainerFinish when done with the nsStringContainer object. Therefore, it is generally better to use nsEmbedString, to instantiate a
nsAString object, since it automatically releases allocated memory when the object goes out of scope. Example Code nsStringContainer str; if (NS_SUCCEEDED(NS_StringContainerInit(str))) { // Now, |str| can be used with any function taking a
nsAString parameter. // Be sure to call this function to release any memory owned by |str| when done. NS_StringContainerFinish(str); } History This...
...Code nsStringContainer str; if (NS_SUCCEEDED(NS_StringContainerInit(str))) { // Now, |str| can be used with any function taking a
nsAString parameter. // Be sure to call this function to release any memory owned by |str| when done. ...
NS_StringCutData
aCutStart [in] The starting index of the section to remove, measured in storage units. aCutLength [in] The length of the section to remove, measured in storage units. Pass PR_UINT32_MAX to specify the length from aCutStart to the end of the string. ...
... aCutStart [in] The starting index of the section to remove, measured in storage units. aCutLength [in] The length of the section to remove, measured in storage units. Pass PR_UINT32_MAX to specify the length from aCutStart to the end of the string. ...
...tringContainerInit(str); NS_StringSetData(str, L"hello world"); // remove " world" portion of string NS_StringCutData(str, 5, PR_UINT32_MAX); const PRUnichar* data; NS_StringGetData(str, &data); // data now ponts to the string: L"hello" NS_StringContainerFinish(str); History This function was frozen for Mozilla 1.7. See bug 239123 for details. See Also NS_StringSetDataRange,
nsAString ...
NS_StringGetData
<< XPCOM API Reference Summary The NS_StringGetData function gives the caller access to the string's internal buffer. This is a low-level API. #include "nsStringAPI.h" PRUint32 NS_StringGetData( const
nsAString& aString, const PRUnichar** aData, PRBool* aTerminated ); Parameters aString [in] A
nsAString instance to inspect. aData [out] A const pointer to the string's internal buffer. aTerminated [out] This optional result parameter indicates whether or not aData is null-terminated. ...
... PRBool* aTerminated ); Parameters aString [in] A
nsAString instance to inspect. aData [out] A const pointer to the string's internal buffer. aTerminated [out] This optional result parameter indicates whether or not aData is null-terminated. Return Values The NS_StringGetData function returns the length of aData, measured in storage units (bytes). Example Code PRUint32 CountChar(const
nsAString& str, PRUnichar c) { const PRUnichar* data; PRUint32 len = NS_StringGetData(str, &data); PRUint32 count = 0; for (PRUint32 i = 0; i < len; ++i) { if (data[i] == c) ++count; } return count; } History This function was frozen for Mozilla 1.7. ...
...rage units (bytes). Example Code PRUint32 CountChar(const
nsAString& str, PRUnichar c) { const PRUnichar* data; PRUint32 len = NS_StringGetData(str, &data); PRUint32 count = 0; for (PRUint32 i = 0; i < len; ++i) { if (data[i] == c) ++count; } return count; } History This function was frozen for Mozilla 1.7. ...
XPCOM string functions
level API.NS_CStringSetDataThe NS_CStringSetData function copies data into the string's internal buffer. This is a low-level API.NS_CStringSetDataRangeThe NS_CStringSetDataRange function copies data into a section of the string's internal buffer. This is a low-level API.NS_CStringToUTF16The NS_CStringToUTF16 function converts the value of a nsACString instance to UTF-16 and stores the result in a
nsAString instance. NS_StringAppendDataThe NS_StringAppendData function appends data to the existing value of a
nsAString instance. This is a low-level API.NS_StringCloneDataThe NS_StringCloneData function returns a null-terminated, heap allocated copy of the string's internal buffer.NS_StringContainerFinishThe NS_StringContainerFinish function releases any memory allocated by a nsStringContainer insta...
...level API.NS_StringCloneDataThe NS_StringCloneData function returns a null-terminated, heap allocated copy of the string's internal buffer.NS_StringContainerFinishThe NS_StringContainerFinish function releases any memory allocated by a nsStringContainer instance. This is a low-level API.NS_StringContainerInitThe NS_StringContainerInit function initializes a nsStringContainer instance for use as a
nsAString. This is a low-level API.NS_StringCopyThe NS_StringCopy function copies the value from one
nsAString instance to another. This is a low-level API.NS_StringCutDataThe NS_StringCutData function removes a section of the string's internal buffer. This is a low-level API.NS_StringGetDataThe NS_StringGetData function gives the caller access to the string's internal buffer. This is a low-level API.NS_St...
...o the existing value of a nsACString instance. This is a low-level API.NS_StringSetDataThe NS_StringSetData function copies data into the string's internal buffer. This is a low-level API.NS_StringSetDataRangeThe NS_StringSetDataRange function copies data into a section of the string's internal buffer. This is a low-level API.NS_UTF16ToCStringThe NS_UTF16ToCString function converts the value of a
nsAString instance from UTF-16 to the specified multi-byte encoding and stores the result in a nsACString instance. ...
XPIDL
Types c...
...Types can of course b...
...entheses are parsable, I do not trust that they are properly handled by the xpidl handlers) is a string equivalent to the C++ type. XPIDL itself does not interpret this string, it just literally pastes it anywhere the native type is used. The interpretation of the type can be modified by having properties on the native declaration: Table 3: Native type definitions astring This is an
nsAString declaration. Overrides native string. cstring This is an nsACString declaration. Overrides native string. jsval This type gets const when an in type. Special in typelib. nsid This type gets const when an in type. Special in typelib. ptr The type is really (native str)* ref The type is really (native str)& utf8string This is a...
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
Extension code using internal linkage will need to migrate to use frozen linkage because internal linkage will not be available in Firefox 3. This document is a guide to common code patterns that may need to change to work with frozen linkage. Strings The most obvious change required by frozen linkage is using the frozen string API. ...
...cast<nsISupportsArray**>(result)); Ideally we would switch to nsIMutableArray, but in the mean time there's no point changing the same code twice. Note: #include nsISupportsArray.h before nsMsgUtils.h Convenience methods that work using either API. MsgLowerCaseEqualsLiteral(a8, literal) Replaces (a8).LowerCaseEqualsLiteral(literal). Note that the external API provides LowerCaseEqualsLiteral for
nsAString, but not nsACString. MsgRFindChar(str, ch, len) Replaces (str).RFindChar(ch, len) MsgCompressWhitespace(str) Replaces (str).CompressWhitespace(). Support for the optional parameters is not provided. MsgEscapeHTML(str) Replaces nsEscapeHTML(str) MsgEscapeHTML2(buffer, len) Replaces nsEscapeHTML2(buffer, len). Support for the other forms of nsEscapeHTML is not provided. ...
Debugging on Windows
apper=<mStaticAtom->mString,s> nsIAtom=<mString,su> ; the following are not necessary in vc8 nsCOMPtr<*>=<mRawPtr,x> nsRefPtr=<mRawPtr,x> nsAutoPtr=<mRawPtr,x> After you have made the changes and saved the file, you will need to restart Visual C++ for the changes to take effect. ...
... nsRefPtr=<mRawPtr,x> nsAutoPtr=<mRawPtr,x> After you have made the changes and saved the file, you will need to restart Visual C++ for the changes to take effect. For XPCOM Strings (the "external" string API) you can use the following values: ;; Mozilla (1.9) ; Internal Strings
nsAString_internal=<mData,su>, length=<mLength,u> nsACString_internal=<mData,s>, length=<mLength,u> ; XPCOM Strings
nsAString=<nsStringContainer.v,su>, length=<nsStringContainer.d1,u> nsACString=<nsCStringContainer.v,s>, length=<nsCStringContainer.d1,u> nsStringContainer=<v,su>, length=<d1,u> nsCStringContainer=<v,s>, length=<d1,u> There is a more extensive version of this file in progress in AutoExpForVC8. Avoiding stepping into certain functions You can avoid stepping into certain functions, such as nsCOMPtr metho...
Component Internals
classes directly, which allows the XPCOM library version to change without affecting the software. There is a slight footprint penalty to linking directly, but this gives your component freedom to work in any recent environment. If footprint is a big issue in your component or application, you can trim out the pieces you don't need. XPCOM String Classes The base string types that XPCOM uses are
nsAString and nsACString. These classes are described in the Mozilla String Guide (see Gecko Resources). The string classes that implement these abstract classes are another set of helpful, unfrozen classes in XPCOM. Most components and embedding applications need to link to some string class or other in order to utilize certain Gecko APIs, but the string code that Mozilla uses is highly complex and even ...
...other in order to utilize certain Gecko APIs, but the string code that Mozilla uses is highly complex and even more expensive than the glue code in terms of footprint (~100k). nsEmbedString and nsEmbedCString are available as very lightweight string implementations for component development, especially in small embedded applications. This string implementation does the bare minimum to support the
nsAString/nsACString functionality. In your own component, you can go "slim" and restrict yourself to the nsEmbedString or go "hog wild" and use any of the the other strings. WebLock restricts itself to using the simple nsEmbedString family of classes. String Classes and XPCOM The glue library provides stub functions for the public functions that XPCOM provides (see xpcom/build/nsXPCOM.h). When the gl...
Setting up the Gecko SDK
Next is the module code, this code is the entr...
... Next is the module code, this code is the entry point into your dll/component. #include "nsIGenericFactory.h" #include "CSpecialThing.h" NS_GENERIC_FACTO...
NS_NewLocalFile
This path does not need to reference an existing file. It is an error to pass a relative filesystem path. ...
... History This function was finalized for Mozilla 1.0. See bug 129279 for details. See Also nsILocalFile, nsIFile ...
NS ConvertUTF16toUTF8 external
ls operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind FindChar RFindChar AppendInt ToInteger Base Classes nsCString_external Data Members No public members. ...
... operator== operator>= operator> operator!= EqualsLiteral Find RFind FindChar RFindChar AppendInt ToInteger Base Classes nsCString_external Data Members No public members. ...
NS LossyConvertUTF16toASCII external
operator< operator<= operator== operator>= operator> operator!= EqualsLiteral Find RFind FindChar RFindChar AppendInt ToInteger Base Classes nsCString_external Data Members No public members. ...
...tor== operator>= operator> operator!= EqualsLiteral Find RFind FindChar RFindChar AppendInt ToInteger Base Classes nsCString_external Data Members No public members. ...
EndReading
PI Reference Summary The EndReading function returns a const char_type pointer to the element just beyond the last element of the string's internal buffer. ...
...s internal buffer. ...
operator+=
Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator+=( const char_type* aData ); Parameters aData [in] A raw character array to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. ...
...pend to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. self_type& operator+=( char_type aChar ); Parameters aChar [in] A character to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. See Also Append Parameters aString [in] A
nsAString to append to this string. Return Values This operator returns a reference back to the object being modified to allow operator chaining. See Also Append ...
nsEmbedString
<< XPCOM API Reference Summary The nsEmbedString concrete class provides a way to construct a
nsAString object that allocates null-terminated storage. #include "nsEmbedString.h" // Or: #include "nsStringGlue.h" if inside Gecko class nsEmbedString : public
nsAString { ... }; Typedefs self_type [nsEmbedString] An alias for the type of this class. abstract_string_type [
nsAString] An alias for the abstract string type this class specializes. Methods nsEmbedString Constructors for nsEmbedString. get The get function returns a const pointer to the string's null-terminated, internal buffer. Operators operator= This operator is a shortcut for the inherited
nsAString::Assign family of functions. Remarks The methods defined on nsEmbedString are implemented as inline wrappers around the ...
...on returns a const pointer to the string's null-terminated, internal buffer. Operators operator= This operator is a shortcut for the inherited
nsAString::Assign family of functions. ...
NS_CStringToUTF16
<< XPCOM API Reference Summary The NS_CStringToUTF16 function converts the value of a nsACString instance to UTF-16 and stores the result in a
nsAString instance. #include "nsStringAPI.h" nsresult NS_CStringToUTF16( const nsACString& aSrc, nsCStringEncoding aSrcEncoding,
nsAString& aDest ); Parameters aSrc [in] A nsACString instance containing the source string to be converted. aSrcEncoding [in] The character encoding of the source string. See nsCStringEncoding for the set of values that can be passed for this parameter. aDest [out] A
nsAString instance that will contain the result of the conversion. The result will be encoded using the host byte order. Return Values The NS_CStringToUTF16 function returns NS_OK if successful. Otherwise, it returns an error code. The s...
...eturns NS_OK if successful. ...
NS_StringCloneData
<< XPCOM API Reference Summary The NS_StringCloneData function returns a null-terminated, heap allocated copy of the string's internal buffer. #include "nsStringAPI.h" PRUnichar* NS_StringCloneData( const
nsAString& aString ); Parameters aString [in] A
nsAString instance whose data is to be cloned. Return Values The NS_StringCutData function returns a pointer to a null-terminated, heap allocated buffer on success. ...
...ring ); Parameters aString [in] A
nsAString instance whose data is to be cloned. Return Values The NS_StringCutData function returns a pointer to a null-terminated, heap allocated buffer on success. On failure it returns nsnull. The resulting buffer may be freed by calling nsMemory::Free. History This function was frozen for Mozilla 1.7. See bug 239716 for details. ...
Editor Embedding Guide - Archive of obsolete content
commandParam->GetBooleanValue("state_enabled",&boolval); Original Document Information Authors: Michael Judge (mjudge@netscape.com) Contributor: Kathleen Brade (brade@netscape.com) Last Updated Date: March 27, 2003 Original Document: A Guide to Embedding The Gecko Editor ...
Layout FAQ - Archive of obsolete content
You can work around it by removing display:table in the style rule with the "#main" selector or adding clear:both to it. Why does move movement disappear when I use mouse events to click and drag? Since the dragging action is involved, you might need to disable it. Try using event.preventDefault() What is the purpose of the NS_LossyConvertUCS2toASCII() function? This function converts an
nsAString to an nsACString by assuming that all the 16-bit units are ASCII and just dropping the high byte on them all. ...
DMD
*)(void const*), unsigned long*, unsigned long*, unsigned long*, unsigned long*, unsigned long*) const (/home/njn/moz/mi2/xpcom/base/nsCycleCollector.cpp:3029) 0x7f6860fdb6b1 #05: CycleCollectorMultiReporter::CollectReports(nsIMemoryMultiReporterCallback*, nsISupports*) (/home/njn/moz/mi2/xpcom/base/nsCycleCollector.cpp:3075) 0x7f6860fde432 #06: nsMemoryInfoDumper::DumpMemoryReportsToFileImpl(
nsAString_internal const&) (/home/njn/moz/mi2/xpcom/base/nsMemoryInfoDumper.cpp:626) 0x7f6860fece79 #07: nsMemoryInfoDumper::DumpMemoryReportsToFile(
nsAString_internal const&, bool, bool) (/home/njn/moz/mi2/xpcom/base/nsMemoryInfoDumper.cpp:344) 0x7f6860febaf9 #08: mozilla::(anonymous namespace)::DumpMemoryReportsRunnable::Run() (/home/njn/moz/mi2/xpcom/base/nsMemoryInfoDumper.cpp:58) 0x7f6860fefe03 } ...
Hacking Tips
ng pixel: Find the X/Y of a pixel that differs Use 'run Z' where Z is the mark in the log for TEST-START. For example in '[rr 28496 607198]REFTEST TEST-START | file:///home/bgirard/mozilla-central/tree/image/test/reftest/bmp/bmpsuite/b/wrapper.html?badpalettesize.bmp' Z would be 607198. ...
Secure Development Guidelines
lead to security bugs. PL_strncpyz This function copies a string and guarantees null termination. PL_strcatn The size argument for this function is the size of the buffer and it guarantees zero termination. ...
Detailed XPCOM hashtable guide
ns All of the above hashtables need a Hash Function. This function converts the key into a semi-unique integer. The mozilla codebase already contains hash functions for most key types, including narrow and wide strings, pointers, and most binary data: void* (or nsISupports*) cast using NS_PTR_TO_INT32 char* string nsCRT::HashCode() PRUnichar* string
nsAString HashString() nsACString nsID& nsIDHashKey::HashKey() Writing a good hash function is well beyond the scope of this document, and has been discussed extensively in computer-science circles for many years. There are many different types of hash functions. Mozilla has tuned a good general-purpose hash algorithm for strings and nsID. Original Document Information A...
nsACString_internal
Class Declaration nsTSubstring is the most abstract class in the string hierarchy. It represents a single contiguous array of characters, which may or may not be null-terminated. This type is not instantiated directly. A sub-class is instantiated instead. For example, see nsTString. NAMES:
nsAString for wide characters nsACString for narrow characters Many of the accessors on nsTSubstring are inlined as an optimization. <map id="classes" name="classes"> <area alt="" coords="456,5,605,53" href="http://developer.mozilla.org/en/nsACString_internal" shape="rect" title="nsACString_internal"> <area alt="" coords="415,101,497,149" href="http://developer.mozilla.org/en/nsCString" shape="rect" title="nsCString"> <area alt="" coords="521,101,689,149" href="http://developer.mozilla.org/en/nsDepe...
Append
void Append( const char_type* aData, size_type aDataLength = PR_UINT32_MAX ); Parameters aData [in] A raw character array to append to this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. ...
Assign
void Assign( const char_type* aData, size_type aDataLength = PR_UINT32_MAX ); Parameters aData [in] A raw character array to copy into this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. ...
BeginReading
ding function returns a const pointer to the first element of the string's internal buffer. const char_type* BeginReading() const; Remarks The resulting character array is not necessarily null-terminated. The length of the array is determined by the result of the Length method. ...
Insert
aPosition [in] An offset into the string's internal buffer specifying where to place the given characters. void Insert( const char_type* aData, index_type aPosition, size_type aDataLength = PR_UINT32_MAX ); Parameters aData [in] A raw character array to append to this string. ...