DOMString

Proper DOMString implementation, with some added range capabilities.

Constructors

this
this()

Default constructor for DOMString. The resulting DOMString object refers to no string at all Difference from C++ implementation: Does not compare with 0

this
this(const(DOMString) other)

Copy constructor.

this
this(XMLCh* other)

Constructor to build a DOMString from an XML character array. (XMLCh is a UTF-16 character by default, can be configured with version labels)

this
this(XMLCh* other, size_t length)

Constructor to build a DOMString from a character array of given length.

this
this(const(char)* other)

Constructor to build a DOMString from an 8 bit character array.

this
this(T[] other)

Creates DOMString objects from standard D strings.

Members

Aliases

opDollar
alias opDollar = length
ptr
alias ptr = rawBuffer
Undocumented in source.

Functions

appendData
void appendData(XMLCh* other)

Append a null-terminated XMLCh * (Unicode) string to this string.

appendData
void appendData(XMLCh ch)

Append a single Unicode character to this string.

appendData
void appendData(DOMString other)

Appends the content of another DOMString to this string.

appendData
void appendData(T[] other)

Appends a D string to this string.

charAt
XMLCh charAt(size_t index)

Returns the character at the specified position.

clone
DOMString clone()

Makes a clone of a the DOMString.

compareString
int compareString(DOMString other)
Undocumented in source. Be warned that the author may not have intended to support it.
deleteData
void deleteData(size_t offset, size_t count)

Clears the data of this DOMString.

equals
bool equals(XMLCh* other)

Compare a DOMString with a null-terminated raw 16-bit character string.

equals
bool equals(DOMString other)

Tells if a DOMString contains the same character data as another.

equals
bool equals(T other)

Compares the content of a D string against a DOMString.

getDString
XMLCh[] getDString()

Returns the underlying array (string).

insertData
void insertData(size_t offset, DOMString data)

Inserts a string within the existing DOMString at an arbitrary position.

insertData
void insertData(size_t offset, XMLCh[] other)

Inserts a string of type XMLCh within the existing DOMString at an arbitrary position

moveAt
XMLCh moveAt(size_t pos)

Moves the front pointer to the given position.

moveBack
XMLCh moveBack()

Calls std.range.primitives.moveBack on the wrapped range, if possible. Otherwise, throws an UnsupportedRangeMethod exception

moveFront
XMLCh moveFront()

Calls std.range.primitives.moveFront on the wrapped range, if possible. Otherwise, throws an UnsupportedRangeMethod exception.

opApply
int opApply(int delegate(XMLCh) deleg)
int opApply(int delegate(size_t, XMLCh) deleg)

foreach iteration uses opApply, since one delegate call per loop iteration is faster than three virtual function calls. TO DO: Use metaprogramming to make it able to be used in all sorts of context.

opCast
T opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(R other)

Compares the string against various other types or itself using the == and != operators.

opIndex
XMLCh opIndex(size_t index)

Allows the characters to be accessed in an array-like fashion.

opOpAssign
auto opOpAssign(R rhs)

Implements easy array appending with operator overloading.

opSlice
DOMString opSlice(size_t from, size_t to)

Returns a slice of the string.

popBack
void popBack()

Moves the back pointer down by one.

popFront
void popFront()

Moves the front pointer up by one.

print
void print()

Dumps the DOMString on the console.

println
void println()

Dumps the DOMString on the console with a line feed at the end.

rawBuffer
XMLCh* rawBuffer()

Returns a handle to the raw buffer in the DOMString.

reserve
void reserve(size_t size)

Preallocate storage in the string to hold a given number of characters. A DOMString will grow its buffer on demand, as characters are added, but it can be more efficient to allocate once in advance, if the size is known.

substringData
DOMString substringData(size_t offset, size_t count)

Returns a sub-string of the DOMString starting at a specified position.

transcode
immutable(char)* transcode()

Returns a copy of the string, transcoded to the local code page. The caller owns the (char *) string that is returned, and is responsible for deleting it.

transcodeTo
T transcodeTo()

Templated transcoder.

transcodeToUTF16
wstring transcodeToUTF16()

Transcodes the string as a UTF-16 string

transcodeToUTF32
dstring transcodeToUTF32()

Transcodes the string as a UTF-32 string

transcodeToUTF8
string transcodeToUTF8()

Transcodes the string as a UTF-8 string

Properties

back
XMLCh back [@property getter]

Returns the back element of the range.

empty
bool empty [@property getter]

Returns true if all content of the string have been consumed.

front
XMLCh front [@property getter]

Returns the front element of the range.

length
size_t length [@property getter]

Returns the length of the string.

save
RandomAccessFinite!XMLCh save [@property getter]

Returns a copy of the DOMString.

Meta

Authors

László Szerémi Contains UTF-16 strings by default, but can be configured to either UTF-8 or UTF-32 with version labels.