NAME ^

classes/string.pmc - String PMC Class

DESCRIPTION ^

String extends mmd_default to provide a string for languages that want a string type without going to an S register. Acts as a wrapper for the functions in /src/string.c

Methods ^

void init()

Initializes the string.

void mark()

Marks the string as live.

PMC *clone()

Creates a copy of the string.

INTVAL get_integer()

Returns the integer representation of the string.

FLOATVAL get_number()

Returns the floating-point representation of the string.

BIGNUM *get_bignum()

Returns the big numbers representation of the string. (unimplemented, returns NULL)

STRING *get_string()

Returns the string itself.

INTVAL get_bool()

Returns the boolean value of the string.

VOID set_integer_native(INTVAL value)

Sets the value of the string to the integer value.

VOID set_number_native(FLOATVAL value)

Sets the value of the string to the floating-point value.

VOID set_bignum_native(BIGNUM *value)

Sets the value of the string to the big number value. (unimplemented, no-op)

VOID set_string_native(STRING *value)

Sets the value of the string to that of the specified string.

VOID assign_string_native(STRING *value)

Sets the value of the string to a copy of the specified string.

VOID set_string_same(PMC *value)

Sets the value of the string to the value of the specified String PMC.

VOID set_pmc(PMC *value)

Sets the value of the string to the string value of the specified PMC.

VOID assign_pmc(PMC *value)

Sets the value of the string to the string value of the specified PMC.

VOID bitwise_or(PMC *value, PMC *dest)

VOID bitwise_and(PMC *value, PMC *dest)

VOID bitwise_xor(PMC *value, PMC *dest)

VOID bitwise_ors(PMC *value, PMC *dest)

VOID bitwise_ors_str(PMC *value, PMC *dest)

VOID bitwise_ands(PMC *value, PMC *dest)

VOID bitwise_ands_str(PMC *value, PMC *dest)

VOID bitwise_xors(PMC *value, PMC *dest)

VOID bitwise_xors_str(PMC *value, PMC *dest)

VOID bitwise_nots(PMC *value)

These functions perform bitwise operations on entire strings, and place the result in dest.

VOID concatenate(PMC *value, PMC *dest)

Concatenates the string with value and places the result in dest.

VOID concatenate_str(STRING *value, PMC *dest)

Concatenates the string with value and places the result in dest.

INTVAL is_equal(PMC *value)

Compares the string with value; returns true if they match.

INTVAL is_equal_num(PMC *value)

Compares the numerical value of the string with that of value; returns true if they match.

INTVAL is_equal_str(PMC *value)

Compares the string with value; returns FALSE if they match.

INTVAL is_same(PMC *value)

Compares the string in this PMC with the one in the value PMC. Returns true if this PMC and the one in value are of the same PMC class and their strings are aliases of the same internal string.

(this can only happen if you use the set_string_native method)

INTVAL cmp(PMC *value)

Compares the string with value; returns -1 if the string is smaller, 0 if they are equal, and 1 if value is smaller.

INTVAL cmp_num(PMC *value)

Compares the numerical value of the string with that of value; returns -1 if the string is smaller, 0 if they are equal, and 1 if value is smaller.

INTVAL cmp_string(PMC *value)

Compares the string with value; returns -1 if the string is smaller, 0 if they are equal, and 1 if value is smaller.

void repeat(PMC *value, PMC *dest)

Repeats the string value times and places the result in dest.

void repeat_int(INTVAL value, PMC *dest)

Repeats the string value times and places the result in dest.

void substr(INTVAL offset, INTVAL length, PMC *dest)

Extracts the substring starting at offset, with size length, and places it in dest.

void substr(INTVAL offset, INTVAL length)

Extracts the substring starting at offset, with size length, and returns it.

INTVAL exists_keyed(PMC *key)

Returns true if the key'th character in the string exists. Negative numbers count from the end.

STRING *get_string_keyed(PMC *key)

Returns the key'th character in the string. Negative numbers count from the end.

void freeze(visit_info *info)

Used to archive the string.

void thaw(visit_info *info)

Used to unarchive the string.


parrot