resonance 1.0.1
Loading...
Searching...
No Matches
Py::List Class Reference

Handle on a Python list. More...

#include <list.h>

Inheritance diagram for Py::List:
Collaboration diagram for Py::List:

Public Member Functions

 List (int nSize=0)
 Create a list of a given length.
 List (const Object &ob)
 Take another handle's reference as a list.
virtual bool accepts (PyObject *pyob) const
 Accept only a list.
virtual int capacity () const
 Report the sentinel rather than the length, as Py::String does.
void append (const Object &ob)
 Append one element.
Public Member Functions inherited from Py::SeqBase< Object >
 SeqBase (const Object &ob)
 Take a new reference to an existing object as a sequence.
virtual int max_size () const
 Longest sequence this handle could address.
virtual void swap (SeqBase< Object > &other)
 Exchange references with another handle of the same kind.
virtual int size () const
 Number of elements.
virtual Object getItem (int i) const
 Read one element.
virtual void setItem (int i, const Object &value)
 Write one element.
int length () const
 Number of elements, read without the table.
seqref< Object > operator[] (int i)
 Address one element.
iterator begin ()
 Address the first element.
iterator end ()
 Address one past the last element.
Public Member Functions inherited from Py::Object
 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.

Additional Inherited Members

Public Attributes inherited from Py::Object
PyObject * mPtr
 Wrapped reference, null only between release() and the next assignment.
Protected Member Functions inherited from Py::SeqBase< Object >
 SeqBase ()
 Produce a handle on None for a derived class that fills it in afterwards.
 SeqBase (PyObject *pyob)
 Take a borrowed reference on behalf of a derived class.
Protected Member Functions inherited from Py::Object
void release ()
 Release the reference and empty the handle.
void set (PyObject *pyob)
 Replace the reference with a borrowed one and add a count of its own.
void validate ()
 Enforce this type's accepts() test on the stored reference.

Detailed Description

Handle on a Python list.

Its RTTI descriptor is at 0x00902180. It has Py::SeqBase<Py::Object> at offset 0 as its one base.

The MetHelpScreen translation unit carries a private copy of the nine-entry vtable at 0x00802560, with the type function at 0x00316f20. Against the SeqBase<Object> table it differs in accepts() and capacity(), the two overrides declared below at that unit's copies.

Constructor & Destructor Documentation

◆ List() [1/2]

Py::List::List ( int nSize = 0)
inlineexplicit

Create a list of a given length.

Inline, built as Py::Tuple's sized constructor is. The base starts on an empty tuple, the body replaces it with a new list through set(), and every slot is filled with None. PythonExtension::getattr_methods() at 0x005ad5e0 expands it with the default length.

Parameters
nSizeThe number of elements.

◆ List() [2/2]

Py::List::List ( const Object & ob)
inlineexplicit

Take another handle's reference as a list.

Inline. MetHelpScreen::FillTexts() at 0x00313208 expands it as three vptr stores, each followed by validate().

Parameters
obThe handle to copy.

Member Function Documentation

◆ accepts()

virtual bool Py::List::accepts ( PyObject * pyob) const
inlinevirtual

Accept only a list.

Parameters
pyobThe reference to test.
Returns
True when the reference is a list.
Ghidra address:
NTSC-U/C: 0x00317100
Ghidra address:
PAL: 0x005f0b78

Reimplemented from Py::SeqBase< Object >.

◆ capacity()

virtual int Py::List::capacity ( ) const
inlinevirtual

Report the sentinel rather than the length, as Py::String does.

Returns
The value max_size() reports.
Ghidra address:
NTSC-U/C: 0x003170d8
Ghidra address:
PAL: 0x005f0b50

Reimplemented from Py::SeqBase< Object >.

◆ append()

void Py::List::append ( const Object & ob)
inline

Append one element.

Inline. PythonExtension::getattr_methods() at 0x005ad5e0 expands it.

Parameters
obThe element.

The documentation for this class was generated from the following file: