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.
<map name="classes" id="classes"> <area shape="rect" href="http://developer.mozilla.org/en/nsAString_internal" coords="415,5,553,53" alt="" title="nsAString_internal"> <area shape="rect" href="http://developer.mozilla.org/en/nsString" coords="379,101,451,149" alt="" title="nsString"> <area shape="rect" href="http://developer.mozilla.org/en/nsDependentSubstring" coords="475,101,635,149" alt="" title="nsDependentSubstring"> <area shape="rect" href="http://developer.mozilla.org/en/nsFixedString" coords="151,197,257,245" alt="" title="nsFixedString"> <area shape="rect" href="http://developer.mozilla.org/en/nsXPIDLString" coords="284,197,396,245" alt="" title="nsXPIDLString"> <area shape="rect" href="http://developer.mozilla.org/en/nsDependentString" coords="420,197,559,245" alt="" title="nsDependentString"> <area shape="rect" href="http://developer.mozilla.org/en/nsPromiseFlatString" coords="583,197,727,245" alt="" title="nsPromiseFlatString"> <area shape="rect" href="http://developer.mozilla.org/en/nsAutoString" coords="152,293,253,341" alt="" title="nsAutoString"> <area shape="rect" href="http://developer.mozilla.org/en/NS_ConvertASCIItoUTF16" coords="5,389,192,437" alt="" title="NS_ConvertASCIItoUTF16"> <area shape="rect" href="http://developer.mozilla.org/en/NS_ConvertUTF8toUTF16" coords="216,389,400,437" alt="" title="NS_ConvertUTF8toUTF16"> <area shape="rect" href="http://developer.mozilla.org/en/nsAdoptingString" coords="277,293,405,341" alt="" title="nsAdoptingString"> </map>

Method Overview

Constructors
BeginReading
EndReading
BeginWriting
EndWriting
Data
Length
IsEmpty
IsVoid
IsTerminated
CharAt
operator[]
First
Last
CountChar
FindChar
Equals
EqualsASCII
EqualsLiteral(const char
EqualsLiteral(char
LowerCaseEqualsASCII
LowerCaseEqualsLiteral(const char
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

Data Members

No public members.

Methods

Constructors

void nsAString_internal(const nsSubstringTuple&) - source
this is public to support automatic conversion of tuple to string
base type, which helps avoid converting to nsTAString.

Parameters

  • nsSubstringTuple& tuple
void nsAString_internal(PRUnichar*, PRUint32, PRUint32) - source

Parameters

  • PRUnichar* data
  • PRUint32 length
  • PRUint32 flags

BeginReading

PRUnichar* BeginReading() const - source
reading iterators
nsReadingIterator<short unsigned int>& BeginReading(nsReadingIterator<short unsigned int>&) const - source
deprecated reading iterators

Parameters

  • nsReadingIterator<short unsigned int>& iter
PRUnichar*& BeginReading(const PRUnichar*&) const - source

Parameters

  • PRUnichar*& iter

EndReading

PRUnichar* EndReading() const - source
nsReadingIterator<short unsigned int>& EndReading(nsReadingIterator<short unsigned int>&) const - source

Parameters

  • nsReadingIterator<short unsigned int>& iter
PRUnichar*& EndReading(const PRUnichar*&) const - source

Parameters

  • PRUnichar*& iter

BeginWriting

PRUnichar* BeginWriting() - source
writing iterators
nsWritingIterator<short unsigned int>& BeginWriting(nsWritingIterator<short unsigned int>&) - source
deprecated writing iterators

Parameters

  • nsWritingIterator<short unsigned int>& iter
PRUnichar*& BeginWriting(PRUnichar*&) - source

Parameters

  • PRUnichar*& iter

EndWriting

PRUnichar* EndWriting() - source
nsWritingIterator<short unsigned int>& EndWriting(nsWritingIterator<short unsigned int>&) - source

Parameters

  • nsWritingIterator<short unsigned int>& iter
PRUnichar*& EndWriting(PRUnichar*&) - source

Parameters

  • PRUnichar*& iter

Data

PRUnichar* Data() const - source
accessors

Length

PRUint32 Length() const - source

IsEmpty

PRBool IsEmpty() const - source

IsVoid

PRBool IsVoid() const - source

IsTerminated

PRBool IsTerminated() const - source

CharAt

PRUnichar CharAt(PRUint32) const - source

Parameters

  • PRUint32 i

operator[]

PRUnichar operator[](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 - source

Parameters

  • PRUnichar* data
  • nsStringComparator& comp

EqualsASCII

PRBool EqualsASCII(const char*, PRUint32) const - source
An 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 - source
An 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 - source

Parameters

  • char* data
  • PRUint32 len
PRBool LowerCaseEqualsASCII(const char*) const - source

Parameters

  • char* data

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 (&)[N]) - source

AssignLiteral(char

void AssignLiteral(char (&)[N]) - source

operator=

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

Adopt

void Adopt(PRUnichar*, PRUint32) - source

Parameters

  • PRUnichar* data
  • PRUint32 length

Replace

void Replace(PRUint32, PRUint32, PRUnichar) - source
buffer manipulation

Parameters

  • PRUint32 cutStart
  • PRUint32 cutLength
  • PRUnichar c
void Replace(PRUint32, PRUint32, const PRUnichar*, PRUint32) - source

Parameters

  • PRUint32 cutStart
  • PRUint32 cutLength
  • PRUnichar* data
  • PRUint32 length
void Replace(PRUint32, PRUint32, const nsAString_internal&) - source

Parameters

  • PRUint32 cutStart
  • PRUint32 cutLength
  • nsAString_internal& str
void Replace(PRUint32, PRUint32, const nsSubstringTuple&) - source

Parameters

  • PRUint32 cutStart
  • PRUint32 cutLength
  • nsSubstringTuple& tuple

ReplaceASCII

void ReplaceASCII(PRUint32, PRUint32, const char*, PRUint32) - source

Parameters

  • PRUint32 cutStart
  • PRUint32 cutLength
  • char* data
  • PRUint32 length

Append

void Append(PRUnichar) - source

Parameters

  • PRUnichar c
void Append(const PRUnichar*, PRUint32) - source

Parameters

  • PRUnichar* data
  • PRUint32 length
void Append(const nsAString_internal&) - source

Parameters

  • nsAString_internal& str
void Append(const nsSubstringTuple&) - source

Parameters

  • nsSubstringTuple& tuple

AppendASCII

void AppendASCII(const char*, PRUint32) - source

Parameters

  • char* data
  • PRUint32 length

AppendLiteral(const char

void AppendLiteral(const char (&)[N]) - source

AppendLiteral(char

void AppendLiteral(char (&)[N]) - source

operator+=

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

Insert

void Insert(PRUnichar, PRUint32) - source

Parameters

  • PRUnichar c
  • PRUint32 pos
void Insert(const PRUnichar*, PRUint32, PRUint32) - source

Parameters

  • PRUnichar* data
  • PRUint32 pos
  • PRUint32 length
void Insert(const nsAString_internal&, PRUint32) - source

Parameters

  • nsAString_internal& str
  • PRUint32 pos
void Insert(const nsSubstringTuple&, PRUint32) - source

Parameters

  • nsSubstringTuple& tuple
  • PRUint32 pos

Cut

void Cut(PRUint32, PRUint32) - source

Parameters

  • PRUint32 cutStart
  • PRUint32 cutLength

SetCapacity

void SetCapacity(PRUint32) - source
buffer sizing

Parameters

  • PRUint32 newCapacity

SetLength

void SetLength(PRUint32) - source

Parameters

  • PRUint32 newLength

Truncate

void Truncate(PRUint32) - source

Parameters

  • PRUint32 newLength

GetData

PRUint32 GetData(const PRUnichar**) const - source
Get 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

  • PRUnichar** data

GetMutableData

PRUint32 GetMutableData(PRUnichar**, PRUint32) - source
Get 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

  • PRUnichar** data
  • PRUint32 newLen

SetIsVoid

void SetIsVoid(PRBool) - source
string 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(PRUnichar, PRInt32) - source
This 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

  • PRUnichar aChar
  • PRInt32 aOffset

Document Tags and Contributors

 Contributors to this page: teoli, bsmedberg
 Last updated by: bsmedberg,