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

Handle on a Python dictionary. More...

#include <dict.h>

Inheritance diagram for Py::Dict:
Collaboration diagram for Py::Dict:

Public Member Functions

 Dict ()
 Create an empty dictionary.
 Dict (PyObject *pyob)
 Take a borrowed reference to an existing dictionary.
virtual bool accepts (PyObject *pyob) const
 Accept only a dictionary.
Public Member Functions inherited from Py::MapBase< Object >
virtual void setItem (const HxStr &key, const Object &value)
 Store a value under a name.
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::MapBase< Object >
 MapBase ()
 Produce a handle on None for a derived class that fills it in afterwards.
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 dictionary.

Its RTTI descriptor is at 0x00902190. It has Py::MapBase<Py::Object> at offset 0 as its one base. Its accessor is at 0x0050d1a0.

The vtable at 0x00825818, copied at 0x00833248, has five entries, and only the type function, the destructor, and accepts() differ from the base table. Both setItem() slots repeat the base addresses.

Slot Member Address
0 compiler-generated type function 0x0050d1a0
1 compiler-generated destructor 0x0050d128
2 accepts 0x0050d248
3 inherited setItem taking a name 0x0050d6f8
4 inherited setItem taking a key object 0x0050d780

Because the base instantiation supplies no reader, neither does this class.

Constructor & Destructor Documentation

◆ Dict() [1/2]

Py::Dict::Dict ( )
inline

Create an empty dictionary.

The temporary owns the new reference from the interpreter while set() adds a count of its own, and the temporary releases the extra count before validate() runs. PyShell's member takes this path, so the body is recovered from 0x005072e8 rather than from a routine of its own.

◆ Dict() [2/2]

Py::Dict::Dict ( PyObject * pyob)
inlineexplicit

Take a borrowed reference to an existing dictionary.

Recovered from PyShell's constructor, where the reference comes from PyModule_GetDict(). The body is inlined at that site and has no address of its own.

Parameters
pyobThe dictionary to wrap.

Member Function Documentation

◆ accepts()

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

Accept only a dictionary.

Parameters
pyobThe reference to test.
Returns
True when the reference is a dictionary.
Ghidra address:
NTSC-U/C: 0x0050d248
Ghidra address:
PAL: 0x0054c700

Reimplemented from Py::MapBase< Object >.


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