Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

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 name="classes" id="classes"> <area shape="rect" href="https://developer.mozilla.org/en/nsACString_internal" coords="456,5,605,53" alt="" title="nsACString_internal"> <area shape="rect" href="https://developer.mozilla.org/en/nsCString" coords="415,101,497,149" alt="" title="nsCString"> <area shape="rect" href="https://developer.mozilla.org/en/nsDependentCSubstring" coords="521,101,689,149" alt="" title="nsDependentCSubstring"> <area shape="rect" href="https://developer.mozilla.org/en/nsFixedCString" coords="172,197,289,245" alt="" title="nsFixedCString"> <area shape="rect" href="https://developer.mozilla.org/en/nsXPIDLCString" coords="315,197,437,245" alt="" title="nsXPIDLCString"> <area shape="rect" href="https://developer.mozilla.org/en/nsDependentCString" coords="461,197,611,245" alt="" title="nsDependentCString"> <area shape="rect" href="https://developer.mozilla.org/en/nsPromiseFlatCString" coords="635,197,787,245" alt="" title="nsPromiseFlatCString"> <area shape="rect" href="https://developer.mozilla.org/en/nsCAutoString" coords="173,293,285,341" alt="" title="nsCAutoString"> <area shape="rect" href="https://developer.mozilla.org/en/NS_LossyConvertUTF16toASCII" coords="5,389,227,437" alt="" title="NS_LossyConvertUTF16toASCII"> <area shape="rect" href="https://developer.mozilla.org/en/NS_ConvertUTF16toUTF8" coords="251,389,435,437" alt="" title="NS_ConvertUTF16toUTF8"> <area shape="rect" href="https://developer.mozilla.org/en/nsAdoptingCString" coords="309,293,445,341" alt="" title="nsAdoptingCString"> </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 nsACString_internal(const nsCSubstringTuple&) - source
this is public to support automatic conversion of tuple to string
base type, which helps avoid converting to nsTAString.

Parameters

  • nsCSubstringTuple& tuple
void nsACString_internal(char*, PRUint32, PRUint32) - source

Parameters

  • char* data
  • PRUint32 length
  • PRUint32 flags

BeginReading

char* BeginReading() const - source
reading iterators
nsReadingIterator<char>& BeginReading(nsReadingIterator<char>&) const - source
deprecated reading iterators

Parameters

  • nsReadingIterator<char>& iter
char*& BeginReading(const char*&) const - source

Parameters

  • char*& iter

EndReading

char* EndReading() const - source
nsReadingIterator<char>& EndReading(nsReadingIterator<char>&) const - source

Parameters

  • nsReadingIterator<char>& iter
char*& EndReading(const char*&) const - source

Parameters

  • char*& iter

BeginWriting

char* BeginWriting() - source
writing iterators
nsWritingIterator<char>& BeginWriting(nsWritingIterator<char>&) - source
deprecated writing iterators

Parameters

  • nsWritingIterator<char>& iter
char*& BeginWriting(char*&) - source

Parameters

  • char*& iter

EndWriting

char* EndWriting() - source
nsWritingIterator<char>& EndWriting(nsWritingIterator<char>&) - source

Parameters

  • nsWritingIterator<char>& iter
char*& EndWriting(char*&) - source

Parameters

  • char*& iter

Data

char* 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

char CharAt(PRUint32) const - source

Parameters

  • PRUint32 i

operator[]

char operator[](PRUint32) const - source

Parameters

  • PRUint32 i

First

char First() const - source

Last

char Last() const - source

CountChar

PRUint32 CountChar(char) const - source

Parameters

  • char <anonymous>

FindChar

PRInt32 FindChar(char, PRUint32) const - source

Parameters

  • char <anonymous>
  • PRUint32 offset

Equals

PRBool Equals(const nsACString_internal&) const - source
equality

Parameters

  • nsACString_internal& <anonymous>
PRBool Equals(const nsACString_internal&, const nsCStringComparator&) const - source

Parameters

  • nsACString_internal& <anonymous>
  • nsCStringComparator& <anonymous>
PRBool Equals(const char*) const - source

Parameters

  • char* data
PRBool Equals(const char*, const nsCStringComparator&) const - source

Parameters

  • char* data
  • nsCStringComparator& 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(char) - source
assignment

Parameters

  • char c
void Assign(const char*, PRUint32) - source

Parameters

  • char* data
  • PRUint32 length
void Assign(const nsACString_internal&) - source

Parameters

  • nsACString_internal& <anonymous>
void Assign(const nsCSubstringTuple&) - source

Parameters

  • nsCSubstringTuple& <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=

nsACString_internal& operator=(char) - source

Parameters

  • char c
nsACString_internal& operator=(const char*) - source

Parameters

  • char* data
nsACString_internal& operator=(const nsACString_internal&) - source

Parameters

  • nsACString_internal& str
nsACString_internal& operator=(const nsCSubstringTuple&) - source

Parameters

  • nsCSubstringTuple& tuple

Adopt

void Adopt(char*, PRUint32) - source

Parameters

  • char* data
  • PRUint32 length

Replace

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

Parameters

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

Parameters

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

Parameters

  • PRUint32 cutStart
  • PRUint32 cutLength
  • nsACString_internal& str
void Replace(PRUint32, PRUint32, const nsCSubstringTuple&) - source

Parameters

  • PRUint32 cutStart
  • PRUint32 cutLength
  • nsCSubstringTuple& tuple

ReplaceASCII

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

Parameters

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

Append

void Append(char) - source

Parameters

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

Parameters

  • char* data
  • PRUint32 length
void Append(const nsACString_internal&) - source

Parameters

  • nsACString_internal& str
void Append(const nsCSubstringTuple&) - source

Parameters

  • nsCSubstringTuple& 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+=

nsACString_internal& operator+=(char) - source

Parameters

  • char c
nsACString_internal& operator+=(const char*) - source

Parameters

  • char* data
nsACString_internal& operator+=(const nsACString_internal&) - source

Parameters

  • nsACString_internal& str
nsACString_internal& operator+=(const nsCSubstringTuple&) - source

Parameters

  • nsCSubstringTuple& tuple

Insert

void Insert(char, PRUint32) - source

Parameters

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

Parameters

  • char* data
  • PRUint32 pos
  • PRUint32 length
void Insert(const nsACString_internal&, PRUint32) - source

Parameters

  • nsACString_internal& str
  • PRUint32 pos
void Insert(const nsCSubstringTuple&, PRUint32) - source

Parameters

  • nsCSubstringTuple& 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 char**) 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

  • char** data

GetMutableData

PRUint32 GetMutableData(char**, 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

  • char** 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(char, 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

  • char aChar
  • PRInt32 aOffset

Document Tags and Contributors

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