LangTag.String¶
Fields¶
None
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class LangTag.String¶
All the fields in the
LangTag.Stringstructure are private to theLangTag.Stringimplementation.- classmethod new(string)¶
- Parameters:
string (
str) – an initial string to set- Returns:
a new instance of
LangTag.String.- Return type:
Creates an instance of
LangTag.Stringwith string.
- append(str)¶
- Parameters:
str (
str) – the string to append onto the end of self- Returns:
the same self object
- Return type:
Adds a string onto the end of a
LangTag.String, expanding it if necessary.
- append_c(c)¶
- Parameters:
c (
int) – the byte to append onto the end of self- Returns:
the same self object.
- Return type:
Adds a byte onto the end of a
LangTag.String, expanding it if necessary.
- at(pos)¶
- Parameters:
pos (
int) – position in self where to obtain the byte- Returns:
the byte in self at pos
- Return type:
Obtain a byte in a
LangTag.Stringat pos. If pos is a negative, the position is calculated from current size. i.e. if the buffer contains “abc”, and pos is -1, this will returns ‘c’ then.
- clear()¶
Clean up the buffer in self.
- free(free_segment)¶
- Parameters:
free_segment (
int) – ifTrue, the actual character data is freed as well- Returns:
the character data of self (i.e.
Noneif free_segment isTrue)- Return type:
Frees the memory allocated for the
LangTag.String. If free_segment isTrueit also frees the character data. If it’sFalse, the caller gains ownership of the buffer and must free it after use with free().
- length()¶
- Returns:
the number of characters
- Return type:
Returns the number of characters in buffer for self.
- ref()¶
- Returns:
the same self object.
- Return type:
Increases the reference count of self.
- replace_c(pos, c)¶
- Parameters:
- Returns:
the same self object
- Return type:
Replaces a character in self at pos.
- unref()¶
Decreases the reference count of self. when its reference count drops to 0, the object is finalized (i.e. its memory is freed).