EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PyObjectEx_Type1 Class Reference

Wrapper class for PyObjectEx of type 1. More...

#include "PyRep.h"

Inheritance diagram for PyObjectEx_Type1:
Collaboration diagram for PyObjectEx_Type1:

Public Member Functions

 PyObjectEx_Type1 (PyToken *type, PyTuple *args, bool enclosed=false)
 
 PyObjectEx_Type1 (PyObjectEx_Type1 *args1, PyTuple *args2, bool enclosed=false)
 
 PyObjectEx_Type1 (PyToken *type, PyTuple *args, PyDict *keywords, bool enclosed=false)
 
 PyObjectEx_Type1 (PyToken *type, PyTuple *args, PyList *keywords, bool enclosed=false)
 
PyTokenGetType () const
 
PyTupleGetArgs () const
 
PyDictGetKeywords () const
 
PyRepFindKeyword (const char *keyword) const
 
- Public Member Functions inherited from PyObjectEx
 PyObjectEx (bool is_type_2, PyRep *header)
 
 PyObjectEx (const PyObjectEx &oth)
 
 PyObjectEx (PyObjectEx &&oth)=delete
 
PyObjectExoperator= (const PyObjectEx &oth)
 
PyObjectExoperator= (PyObjectEx &&oth)=delete
 
PyRepClone () const
 Clones object. More...
 
bool visit (PyVisitor &v) const
 Visits object. More...
 
PyRepheader () const
 
bool isType2 () const
 
list_typelist ()
 
const list_typelist () const
 
dict_typedict ()
 
const dict_typedict () const
 
- Public Member Functions inherited from PyRep
PyType GetType () const
 
bool IsInt () const
 
bool IsLong () const
 
bool IsFloat () const
 
bool IsBool () const
 
bool IsBuffer () const
 
bool IsString () const
 
bool IsWString () const
 
bool IsToken () const
 
bool IsTuple () const
 
bool IsList () const
 
bool IsDict () const
 
bool IsNone () const
 
bool IsSubStruct () const
 
bool IsSubStream () const
 
bool IsChecksumedStream () const
 
bool IsObject () const
 
bool IsObjectEx () const
 
bool IsPackedRow () const
 
const char * TypeString () const
 
PyIntAsInt ()
 
const PyIntAsInt () const
 
PyLongAsLong ()
 
const PyLongAsLong () const
 
PyFloatAsFloat ()
 
const PyFloatAsFloat () const
 
PyBoolAsBool ()
 
const PyBoolAsBool () const
 
PyBufferAsBuffer ()
 
const PyBufferAsBuffer () const
 
PyStringAsString ()
 
const PyStringAsString () const
 
PyWStringAsWString ()
 
const PyWStringAsWString () const
 
PyTokenAsToken ()
 
const PyTokenAsToken () const
 
PyTupleAsTuple ()
 
const PyTupleAsTuple () const
 
PyListAsList ()
 
const PyListAsList () const
 
PyDictAsDict ()
 
const PyDictAsDict () const
 
PyNoneAsNone ()
 
const PyNoneAsNone () const
 
PySubStructAsSubStruct ()
 
const PySubStructAsSubStruct () const
 
PySubStreamAsSubStream ()
 
const PySubStreamAsSubStream () const
 
PyChecksumedStreamAsChecksumedStream ()
 
const PyChecksumedStreamAsChecksumedStream () const
 
PyObjectAsObject ()
 
const PyObjectAsObject () const
 
PyObjectExAsObjectEx ()
 
const PyObjectExAsObjectEx () const
 
PyPackedRowAsPackedRow ()
 
const PyPackedRowAsPackedRow () const
 
void Dump (FILE *into, const char *pfx) const
 Dumps object to file. More...
 
void Dump (LogType type, const char *pfx) const
 Dumps object to console. More...
 
virtual int32 hash () const
 virtual function to generate a hash value of a object. More...
 
- Public Member Functions inherited from RefObject
 RefObject (size_t initRefCount)
 Initializes reference count. More...
 
virtual ~RefObject ()
 Destructor; must be virtual. More...
 
size_t GetCount ()
 

Protected Member Functions

virtual ~PyObjectEx_Type1 ()
 
- Protected Member Functions inherited from PyObjectEx
virtual ~PyObjectEx ()
 
- Protected Member Functions inherited from PyRep
 PyRep (PyType t)
 
 PyRep (const PyRep &oth)
 
 PyRep (PyRep &&oth)=delete
 
PyRepoperator= (const PyRep &oth)=default
 
PyRepoperator= (PyRep &&oth)=default
 
virtual ~PyRep ()
 
- Protected Member Functions inherited from RefObject
void IncRef () const
 Increments reference count of object by one. More...
 
void DecRef () const
 Decrements reference count of object by one. More...
 

Static Protected Member Functions

static PyTuple_CreateHeader (PyToken *type, PyTuple *args, bool enclosed=false)
 
static PyTuple_CreateHeader (PyObjectEx_Type1 *args1, PyTuple *args2, bool enclosed=false)
 
static PyTuple_CreateHeader (PyToken *type, PyTuple *args, PyDict *keywords, bool enclosed=false)
 
static PyTuple_CreateHeader (PyToken *type, PyTuple *args, PyList *keywords, bool enclosed=false)
 

Additional Inherited Members

- Public Types inherited from PyObjectEx
typedef PyList list_type
 
typedef list_type::iterator list_iterator
 
typedef list_type::const_iterator const_list_iterator
 
typedef PyDict dict_type
 
typedef dict_type::iterator dict_iterator
 
typedef dict_type::const_iterator const_dict_iterator
 
- Public Types inherited from PyRep
enum  PyType {
  PyTypeMin = 0, PyTypeInt = 1, PyTypeLong = 2, PyTypeFloat = 3,
  PyTypeBool = 4, PyTypeBuffer = 5, PyTypeString = 6, PyTypeWString = 7,
  PyTypeToken = 8, PyTypeTuple = 9, PyTypeList = 10, PyTypeDict = 11,
  PyTypeNone = 12, PyTypeSubStruct = 13, PyTypeSubStream = 14, PyTypeChecksumedStream = 15,
  PyTypeObject = 16, PyTypeObjectEx = 17, PyTypePackedRow = 18, PyTypeError = 19
}
 Python wire object types. More...
 
- Static Public Member Functions inherited from PyRep
static std::string StringContent (PyRep *pRep)
 
static int64 IntegerValue (PyRep *pRep)
 
static uint32 IntegerValueU32 (PyRep *pRep)
 
- Protected Attributes inherited from PyObjectEx
PyRep *const mHeader
 
const bool mIsType2
 
list_type *const mList
 
dict_type *const mDict
 
- Protected Attributes inherited from PyRep
const PyType mType
 
- Protected Attributes inherited from RefObject
size_t mRefCount
 Reference count of instance. More...
 
bool mDeleted
 

Detailed Description

Wrapper class for PyObjectEx of type 1.

Author
Bloody.Rabbit

Definition at line 911 of file PyRep.h.

Constructor & Destructor Documentation

PyObjectEx_Type1::PyObjectEx_Type1 ( PyToken type,
PyTuple args,
bool  enclosed = false 
)

Definition at line 820 of file PyRep.cpp.

821 : PyObjectEx(false, _CreateHeader(type, args, enclosed)) { }
static PyTuple * _CreateHeader(PyToken *type, PyTuple *args, bool enclosed=false)
Definition: PyRep.cpp:867
PyObjectEx(bool is_type_2, PyRep *header)
Definition: PyRep.cpp:786
PyObjectEx_Type1::PyObjectEx_Type1 ( PyObjectEx_Type1 args1,
PyTuple args2,
bool  enclosed = false 
)

Definition at line 822 of file PyRep.cpp.

823 : PyObjectEx(false, _CreateHeader(args1, args2, enclosed)) { }
static PyTuple * _CreateHeader(PyToken *type, PyTuple *args, bool enclosed=false)
Definition: PyRep.cpp:867
PyObjectEx(bool is_type_2, PyRep *header)
Definition: PyRep.cpp:786
PyObjectEx_Type1::PyObjectEx_Type1 ( PyToken type,
PyTuple args,
PyDict keywords,
bool  enclosed = false 
)

Definition at line 824 of file PyRep.cpp.

825 : PyObjectEx(false, _CreateHeader(type, args, keywords, enclosed)) { }
static PyTuple * _CreateHeader(PyToken *type, PyTuple *args, bool enclosed=false)
Definition: PyRep.cpp:867
PyObjectEx(bool is_type_2, PyRep *header)
Definition: PyRep.cpp:786
PyObjectEx_Type1::PyObjectEx_Type1 ( PyToken type,
PyTuple args,
PyList keywords,
bool  enclosed = false 
)

Definition at line 826 of file PyRep.cpp.

827 : PyObjectEx(false, _CreateHeader(type, args, keywords, enclosed)) { }
static PyTuple * _CreateHeader(PyToken *type, PyTuple *args, bool enclosed=false)
Definition: PyRep.cpp:867
PyObjectEx(bool is_type_2, PyRep *header)
Definition: PyRep.cpp:786
virtual PyObjectEx_Type1::~PyObjectEx_Type1 ( )
inlineprotectedvirtual

Definition at line 926 of file PyRep.h.

926 { /* do we need to do anything here? */ }

Member Function Documentation

PyTuple * PyObjectEx_Type1::_CreateHeader ( PyToken type,
PyTuple args,
bool  enclosed = false 
)
staticprotected

Definition at line 867 of file PyRep.cpp.

References PyTuple::SetItem().

868 {
869  if (args == nullptr )
870  args = new PyTuple( 0 );
871 
872  PyTuple* body = new PyTuple( 2 );
873  if (enclosed) {
874  PyTuple* body1 = new PyTuple( 1 );
875  body1->SetItem( 0, type );
876 
877  body->SetItem( 0, body1 );
878  body->SetItem( 1, args );
879  } else {
880  body->SetItem( 0, type );
881  body->SetItem( 1, args );
882  }
883 
884  return body;
885 }
Python tuple.
Definition: PyRep.h:567
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610

Here is the call graph for this function:

PyTuple * PyObjectEx_Type1::_CreateHeader ( PyObjectEx_Type1 args1,
PyTuple args2,
bool  enclosed = false 
)
staticprotected

Definition at line 887 of file PyRep.cpp.

References PyTuple::SetItem().

888 {
889  if (args2 == nullptr )
890  args2 = new PyTuple( 0 );
891 
892  PyTuple* body = new PyTuple( 2 );
893  if (enclosed) {
894  PyTuple* body1 = new PyTuple( 1 );
895  body1->SetItem( 0, args1 );
896 
897  body->SetItem( 0, body1 );
898  body->SetItem( 1, args2 );
899  } else {
900  body->SetItem( 0, args1 );
901  body->SetItem( 1, args2 );
902  }
903 
904  return body;
905 }
Python tuple.
Definition: PyRep.h:567
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610

Here is the call graph for this function:

PyTuple * PyObjectEx_Type1::_CreateHeader ( PyToken type,
PyTuple args,
PyDict keywords,
bool  enclosed = false 
)
staticprotected

Definition at line 907 of file PyRep.cpp.

References codelog, PyTuple::SetItem(), and PyTuple::size().

908 {
909  if (args == nullptr )
910  args = new PyTuple( 0 );
911 
912  PyTuple* body = new PyTuple( keywords == nullptr ? 2 : 3 );
913  body->SetItem( 0, type );
914  body->SetItem( 1, args );
915  if (body->size() > 2 )
916  body->SetItem( 2, keywords );
917  if (enclosed)
918  codelog(COMMON__WARNING, "This constructor is used. please finish code.");
919 
920  return body;
921 }
size_t size() const
Definition: PyRep.h:591
Python tuple.
Definition: PyRep.h:567
#define codelog(type, fmt,...)
Definition: logsys.h:128
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610

Here is the call graph for this function:

PyTuple * PyObjectEx_Type1::_CreateHeader ( PyToken type,
PyTuple args,
PyList keywords,
bool  enclosed = false 
)
staticprotected

Definition at line 923 of file PyRep.cpp.

References codelog, PyTuple::SetItem(), and PyTuple::size().

924 {
925  if (args == nullptr )
926  args = new PyTuple( 0 );
927 
928  PyTuple* body = new PyTuple( keywords == nullptr ? 2 : 3 );
929  body->SetItem( 0, type );
930  body->SetItem( 1, args );
931  if (body->size() > 2 )
932  body->SetItem( 2, keywords );
933  if (enclosed)
934  codelog(COMMON__WARNING, "This constructor is used. please finish code.");
935 
936  return body;
937 }
size_t size() const
Definition: PyRep.h:591
Python tuple.
Definition: PyRep.h:567
#define codelog(type, fmt,...)
Definition: logsys.h:128
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610

Here is the call graph for this function:

PyRep * PyObjectEx_Type1::FindKeyword ( const char *  keyword) const

Definition at line 853 of file PyRep.cpp.

References PyDict::begin(), PyDict::end(), and GetKeywords().

Referenced by GPSTransportClosed::GetReasonArgs().

854 {
855  PyDict* kw = GetKeywords();
856 
857  PyDict::const_iterator cur = kw->begin();
858  for (; cur != kw->end(); ++cur) {
859  if (cur->first->IsString() )
860  if (cur->first->AsString()->content() == keyword )
861  return cur->second;
862  }
863 
864  return nullptr;
865 }
Python's dictionary.
Definition: PyRep.h:719
const_iterator begin() const
Definition: PyRep.h:766
storage_type::const_iterator const_iterator
Definition: PyRep.h:750
const_iterator end() const
Definition: PyRep.h:767
PyDict * GetKeywords() const
Definition: PyRep.cpp:841

Here is the call graph for this function:

Here is the caller graph for this function:

PyTuple * PyObjectEx_Type1::GetArgs ( ) const

Definition at line 835 of file PyRep.cpp.

References PyRep::AsTuple(), PyTuple::GetItem(), and PyObjectEx::header().

Referenced by DBRowDescriptor::_GetColumnList().

836 {
837  assert( header() != nullptr );
838  return header()->AsTuple()->GetItem( 1 )->AsTuple();
839 }
PyTuple * AsTuple()
Definition: PyRep.h:138
PyRep * GetItem(size_t index) const
Returns Python object.
Definition: PyRep.h:602
PyRep * header() const
Definition: PyRep.h:886

Here is the call graph for this function:

Here is the caller graph for this function:

PyDict * PyObjectEx_Type1::GetKeywords ( ) const

Definition at line 841 of file PyRep.cpp.

References PyRep::AsDict(), PyRep::AsTuple(), PyTuple::GetItem(), PyObjectEx::header(), PyTuple::items, and PyTuple::size().

Referenced by FindKeyword().

842 {
843  // This one is slightly more complicated since keywords are optional.
844  assert( header() != nullptr );
845  PyTuple* t = header()->AsTuple();
846 
847  if (t->size() < 3 )
848  t->items.push_back( new PyDict );
849 
850  return t->GetItem( 2 )->AsDict();
851 }
PyTuple * AsTuple()
Definition: PyRep.h:138
PyRep * GetItem(size_t index) const
Returns Python object.
Definition: PyRep.h:602
Python's dictionary.
Definition: PyRep.h:719
size_t size() const
Definition: PyRep.h:591
Python tuple.
Definition: PyRep.h:567
PyDict * AsDict()
Definition: PyRep.h:142
PyRep * header() const
Definition: PyRep.h:886
storage_type items
Definition: PyRep.h:628

Here is the call graph for this function:

Here is the caller graph for this function:

PyToken * PyObjectEx_Type1::GetType ( ) const

Definition at line 829 of file PyRep.cpp.

References PyRep::AsToken(), PyRep::AsTuple(), PyTuple::GetItem(), and PyObjectEx::header().

Referenced by BaseRowsetReader::iterator::GetAsString().

830 {
831  assert( header() != nullptr );
832  return header()->AsTuple()->GetItem( 0 )->AsToken();
833 }
PyTuple * AsTuple()
Definition: PyRep.h:138
PyRep * GetItem(size_t index) const
Returns Python object.
Definition: PyRep.h:602
PyRep * header() const
Definition: PyRep.h:886
PyToken * AsToken()
Definition: PyRep.h:136

Here is the call graph for this function:

Here is the caller graph for this function:


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