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

Handle on a Python integer. More...

#include <int.h>

Inheritance diagram for Py::Int:
Collaboration diagram for Py::Int:

Public Member Functions

 Int (const Object &ob)
 Convert another handle's object to an integer.
 Int (long long nValue)
 Wrap the interpreter's 64-bit long as an integer.
Int & operator= (const Object &ob)
 Take another handle's object, converted to an integer.
Int & operator= (PyObject *pyob)
 Take a reference, converted to an integer.
Int & operator= (int nValue)
 Take a value.
Int & operator= (long long nValue)
 Take a 64-bit value, the same way as the int overload.
 operator long long () const
 Read the value.
virtual bool accepts (PyObject *pyob) const
 Accept only an integer.
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::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 integer.

Its RTTI descriptor is at 0x008efd90. It has Py::Object at offset 0 as its one base. Its accessor is at 0x004c63f8.

The vtable at 0x00821d58 has three entries, the same shape as Py::Object.

Slot Member Address
0 compiler-generated type function 0x004c63f8
1 compiler-generated destructor 0x004c6380
2 accepts 0x004c7218

Constructor & Destructor Documentation

◆ Int() [1/2]

Py::Int::Int ( const Object & ob)
explicit

Convert another handle's object to an integer.

The handle starts on None, takes the result of PyNumber_Int() at 0x004a3438 through set() from a Py::FromAPI temporary, releasing None, and runs validate() once more.

Parameters
obThe handle to convert.
Ghidra address:
NTSC-U/C: 0x004c4680
Ghidra address:
PAL: 0x00502908

◆ Int() [2/2]

Py::Int::Int ( long long nValue)
explicit

Wrap the interpreter's 64-bit long as an integer.

The handle starts on None, takes the result of PyInt_FromLong() at 0x00580c68 through set() from a Py::FromAPI temporary, releasing None, and runs validate() once more.

Parameters
nValueThe value to wrap.
Ghidra address:
NTSC-U/C: 0x004c44c0
Ghidra address:
PAL: 0x00502748

Member Function Documentation

◆ operator=() [1/4]

Int & Py::Int::operator= ( const Object & ob)

Take another handle's object, converted to an integer.

Parameters
obThe handle to convert.
Returns
This handle.
Ghidra address:
NTSC-U/C: 0x004c71f8
Ghidra address:
PAL: 0x00505420

◆ operator=() [2/4]

Int & Py::Int::operator= ( PyObject * pyob)

Take a reference, converted to an integer.

The handle takes the result of PyNumber_Int() through set() from a Py::FromAPI temporary, unless the reference is the one it already has.

Parameters
pyobThe reference to convert.
Returns
This handle.
Ghidra address:
NTSC-U/C: 0x004c4840
Ghidra address:
PAL: 0x00502ac8

◆ operator=() [3/4]

Int & Py::Int::operator= ( int nValue)

Take a value.

The value is wrapped by PyInt_FromLong() and then converted again by the reference assignment above.

Parameters
nValueThe value.
Returns
This handle.
Ghidra address:
NTSC-U/C: 0x004c4980
Ghidra address:
PAL: 0x00502c08

◆ operator=() [4/4]

Int & Py::Int::operator= ( long long nValue)

Take a 64-bit value, the same way as the int overload.

Parameters
nValueThe value.
Returns
This handle.
Ghidra address:
NTSC-U/C: 0x004c4a60
Ghidra address:
PAL: 0x00502ce8

◆ operator long long()

Py::Int::operator long long ( ) const

Read the value.

The out-of-line body forwards to PyInt_AsLong(). The result is the interpreter's 64-bit long. Callers test the result at full width before any narrowing.

Returns
The value.
Ghidra address:
NTSC-U/C: 0x004c7240
Ghidra address:
PAL: 0x00505468

◆ accepts()

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

Accept only an integer.

Parameters
pyobThe reference to test.
Returns
True when the reference is an integer.
Ghidra address:
NTSC-U/C: 0x004c7218
Ghidra address:
PAL: 0x00505440

Reimplemented from Py::Object.


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