|
| | String (PyObject *pyob) |
| | Take a borrowed reference to an existing string.
|
| | String (const HxStr &text) |
| | Build a Python string from a game string.
|
| | String (const char *pszText) |
| | Build a Python string from a C string.
|
| | String (const Object &ob) |
| | Take another handle's reference as a string.
|
| virtual bool | accepts (PyObject *pyob) const |
| | Accept only a string.
|
| virtual int | capacity () const |
| | Report the sentinel rather than the length.
|
| | operator HxStr () const |
| | Copy the text out of the Python string.
|
| virtual int | max_size () const |
| | Longest sequence this handle could address.
|
| virtual void | swap (SeqBase< Char > &other) |
| | Exchange references with another handle of the same kind.
|
| virtual int | size () const |
| | Number of elements.
|
| virtual Char | getItem (int i) const |
| | Read one element.
|
| virtual void | setItem (int i, const Char &value) |
| | Write one element.
|
| int | length () const |
| | Number of elements, read without the table.
|
| seqref< Char > | operator[] (int i) |
| | Address one element.
|
| iterator | begin () |
| | Address the first element.
|
| iterator | end () |
| | Address one past the last element.
|
| | Object (PyObject *pyob=Py_None) |
| | Take a borrowed reference and add a count of its own.
|
| | Object (const Object &other) |
| | Copy another handle and add a count of its own.
|
| virtual | ~Object () |
| | Release the reference.
|
| Object & | operator= (const Object &other) |
| | Replace the reference with another handle's.
|
| Object | getAttr (const HxStr &name) const |
| | Read one attribute.
|
| String | str () const |
| | Produce the text of str() applied to the object.
|
| HxStr | as_string () const |
| | Produce the text of str() applied to the object, as a game string.
|
| Type | type () const |
| | Produce the object's type.
|
| bool | isType (const Type &type) const |
| | Report whether the object's type is a given type.
|
| bool | isTuple () const |
| | Report whether the object is a tuple.
|
| bool | isList () const |
| | Report whether the object is a list.
|
Handle on a Python string.
Its RTTI descriptor is at 0x008f0990. It has Py::SeqBase<Py::Char> at offset 0 as its one base. Its accessor is at 0x004c65d8.
The vtable at 0x00821cb8 has nine entries, and the type function, the destructor, accepts(), and slot 4 differ from the base table.
| Slot | Member | Address |
| 0 | compiler-generated type function | 0x004c65d8 |
| 1 | compiler-generated destructor | 0x004c6560 |
| 2 | accepts | 0x004c73a8 |
| 3 | inherited max_size | 0x004c7260 |
| 4 | capacity | 0x004c7270 |
| 5 | inherited swap | 0x004c7890 |
| 6 | inherited size | 0x004c73d0 |
| 7 | inherited getItem | 0x004c7a48 |
| 8 | inherited setItem | 0x004c7bb8 |
The conversion to HxStr below is one half of the port's substitution of HxStr for std::string. Released PyCXX has the same member returning a std::string.
| virtual int Py::String::capacity |
( |
| ) |
const |
|
inlinevirtual |
Report the sentinel rather than the length.
The base returns size(), and this override tail-calls slot 3 instead, so the capacity of a Python string reads as the not-found sentinel. A Python string is immutable, so a capacity equal to its length would invite a caller to write into it.
- Returns
- The value max_size() reports.
- Ghidra address:
- NTSC-U/C: 0x004c7270
- Ghidra address:
- PAL: 0x00505498
Reimplemented from Py::SeqBase< Char >.