class String

Dynamic shared String More...

Definition#include <String.hh>
InheritsData, Vector<Char>
Inherited byUString
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Members


Detailed Description

Dynamic shared String

String (size_t size = 0)

construct an empty String of a given size

Parameters:
sizepre-allocation size for this

String (const char *str, int len=0)

construct a String from a prefix of a char*

Parameters:
strchar* for initial value
sizesubstring size (0 == rest)

String (const String *str, size_t start=0, size_t l=0)

construct a String from a substring of a String*

Parameters:
strchar* for initial value
sizesubstring size (0 == rest)

String (const String &str, size_t start=0, size_t l=0)

construct a String from a substring of a String&

Parameters:
strchar* for initial value
sizesubstring size (0 == rest)

~String ()
[virtual]

destroy String

void check (int=0)
[const virtual]

check String integrity

Checks memory Guard (if any) and that string content is entirely within its allocation

Data * clone (void *where = (void*)
[const virtual]

copy constructor

Used as the destination of @see mutate when a copy on write mutable object is desired.

Parameters:
wherethe locale into which to clone this object

Returns: mutable copy of object

Data * mutate (void *where = (void*)
[const virtual]

create a mutable copy

Parameters:
wherethe locale into which to clone this object

Returns: mutable copy of object

bool truth ()
[const]

the String's truth value

We consider a String to be true if it's not empty

Returns: the object's truth value

Slot toconstruct ()
[const]

constructor arguments sufficient to recreate object

String is a basic type: it is its own constructor

Returns: identity

ostream & dump (ostream&)
[const virtual]

dump the String to a stream

Parameters:
ostreamstream onto which to dump the object

int order (const Slot &arg)
[const virtual]

order two Strings

Parameters:
argString to be ordered relative to this

Returns: 1,0,-1 depending on String order

bool equal (const Slot &arg)
[const virtual]

equality operator

Parameters:
argString to be compared to this

Returns: true/false depending on equality

bool isSequence ()

predicate - is a String a sequence?

Returns: constant true

int length ()
[const virtual]

String length

Returns: length of String

Slot concat (const Slot &arg)
[virtual]

concatenate two Strings

Parameters:
argString to concatenate to this

Returns: a String with arg concatenated to this

Slot slice (const Slot &start, const Slot &len)
[const virtual]

substring of String

Note that we use copy-on-write, so a substring points into the same storage as the string it's a substring of.

Parameters:
startindex of start of substring
lenlength of substring

Returns: the range of elements of this sequence 'from' for 'len'

Slot slice (const Slot &start)
[const virtual]

element of String

Note that we use copy-on-write, so a substring points into the same storage as the string it's a substring of.

Parameters:
startindex of start of substring
lenlength of substring

Returns: a string containing the single character at start

Slot replace (const Slot &from, const Slot &len, const Slot &value)
[virtual]

replace a String subrange with a String

Parameters:
fromreplacement-range start index
lenreplacement-range length

Returns: a copy of this with the replacement performed

Slot replace (const Slot &from, const Slot &val)
[virtual]

replace a String element with a String

Parameters:
fromreplacement-range start index

Returns: a copy of this with the replacement performed

Slot insert (const Slot &from, const Slot &val)
[virtual]

insert a String into this String at a given position

Parameters:
valuevalue to be inserted in this sequence
beforeelement index before which insertion is performed

Returns: a copy of this with the replacement performed

Slot insert (const Slot &val)
[virtual]

insert a String at the end of this String

This is really redundant with String::insert

Parameters:
valuevalue to be inserted in this String

Returns: a copy of this with the replacement performed

Slot del (const Slot &from, const Slot &len)
[virtual]

delete a substring from this String

Parameters:
fromdel-range start index
lendel-range length

Returns: a copy of this with the deletion performed

Slot del (const Slot &from)
[virtual]

delete an element from this String

Parameters:
fromdel-element index

Returns: a copy of this with the deletion performed

Slot search (const Slot &search)
[const virtual]

search for a matching substring

Parameters:
searchelement for which to search

Returns: the first of this String with search as a prefix

Slot iterator ()
[const]

Iterator over this sequence - identity

Returns: an Iterator

Slot toSequence ()
[const]

convert String to sequence - identity

bool More ()
[const]

predicate: is iterated sequence complete?

Returns: true iff iterator is not exhausted

Slot Current ()

current iterated element

Returns: iterated element

Slot Next ()

advance iterator over sequence

Returns: next iterated element

operator char * ()

convert to a C string

String * crypt (Slot &key)

encrypt String

String * uppercase ()

convert String to upper case

String * lowercase ()

convert String to lower case


Generated by: colin@sharedtech.dhis.org on Sat Nov 6 11:59:24 199.