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

Python object "dbutil.CRowset". More...

#include "PyDatabase.h"

Inheritance diagram for CRowSet:
Collaboration diagram for CRowSet:

Public Member Functions

 CRowSet (DBRowDescriptor **rowDesc)
 
size_t GetRowCount () const
 
PyPackedRowGetRow (uint32 index) const
 
PyPackedRowNewRow ()
 
- Public Member Functions inherited from PyObjectEx_Type2
 PyObjectEx_Type2 (PyTuple *args, PyDict *keywords, bool enclosed=false)
 
 PyObjectEx_Type2 (PyToken *args, PyDict *keywords, bool enclosed=false)
 
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 ~CRowSet ()
 
DBRowDescriptor_GetRowDesc () const
 
- Protected Member Functions inherited from PyObjectEx_Type2
virtual ~PyObjectEx_Type2 ()
 
- 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_CreateArgs ()
 
static PyDict_CreateKeywords (DBRowDescriptor *rowDesc)
 
- Static Protected Member Functions inherited from PyObjectEx_Type2
static PyTuple_CreateHeader (PyTuple *args, PyDict *keywords, bool enclosed=false)
 
static PyTuple_CreateHeader (PyToken *args, PyDict *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

Python object "dbutil.CRowset".

This object contains DBRowDescriptor header and bunch of PyPackedRows.

Note
At the moment it's designed that once it's created, its header cannot be changed. I don't know whether it's correct or not, but it makes our life easier.
Author
Bloody.Rabbit

Definition at line 124 of file PyDatabase.h.

Constructor & Destructor Documentation

CRowSet::CRowSet ( DBRowDescriptor **  rowDesc)
Parameters
[in]rowDescDBRowDescriptor header to be used.

Definition at line 126 of file PyDatabase.cpp.

127 : PyObjectEx_Type2( _CreateArgs(), _CreateKeywords( *rowDesc ) )
128 {
129 
130 }
static PyTuple * _CreateArgs()
Definition: PyDatabase.cpp:158
PyObjectEx_Type2(PyTuple *args, PyDict *keywords, bool enclosed=false)
Definition: PyRep.cpp:942
static PyDict * _CreateKeywords(DBRowDescriptor *rowDesc)
Definition: PyDatabase.cpp:165
virtual CRowSet::~CRowSet ( )
inlineprotectedvirtual

Definition at line 151 of file PyDatabase.h.

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

Member Function Documentation

PyTuple * CRowSet::_CreateArgs ( )
staticprotected

Definition at line 158 of file PyDatabase.cpp.

References args, and PyTuple::SetItem().

159 {
160  PyTuple* args = new PyTuple( 1 );
161  args->SetItem( 0, new PyToken( "dbutil.CRowset" ) );
162  return args;
163 }
Python tuple.
Definition: PyRep.h:567
* args
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
Python token (eg. class name).
Definition: PyRep.h:522

Here is the call graph for this function:

PyDict * CRowSet::_CreateKeywords ( DBRowDescriptor rowDesc)
staticprotected

Definition at line 165 of file PyDatabase.cpp.

References PyDict::SetItemString().

166 {
167  assert( rowDesc );
168 
169  PyDict* keywords = new PyDict();
170  keywords->SetItemString( "header", rowDesc );
171 
172  //The Type_2 i had no longer used this
173  //uint32 cc = rowDesc->ColumnCount();
174  //PyList* columns = new PyList( cc );
175  //for( uint32 i(0); i < cc; ++i )
176  // columns->SetItem( i, new PyString( *rowDesc->GetColumnName( i ) ) );
177  //keywords->SetItemString( "columns", columns );
178 
179  return keywords;
180 }
Python's dictionary.
Definition: PyRep.h:719
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
Definition: PyRep.h:812

Here is the call graph for this function:

DBRowDescriptor * CRowSet::_GetRowDesc ( ) const
protected

Definition at line 141 of file PyDatabase.cpp.

References PyRep::AsObjectEx(), and PyObjectEx_Type2::FindKeyword().

Referenced by NewRow().

142 {
143  PyRep* r(FindKeyword( "header" ));
144  if (r != nullptr)
145  return (DBRowDescriptor*)r->AsObjectEx();
146  return nullptr;
147 }
Base Python wire object.
Definition: PyRep.h:66
PyRep * FindKeyword(const char *keyword) const
Definition: PyRep.cpp:959
Python object "blue.DBRowDescriptor".
Definition: PyDatabase.h:41

Here is the call graph for this function:

Here is the caller graph for this function:

PyPackedRow* CRowSet::GetRow ( uint32  index) const
inline
Parameters
[in]Indexof row to be returned.
Returns
Row with given index.

Definition at line 143 of file PyDatabase.h.

References PyRep::AsPackedRow(), PyList::GetItem(), and PyObjectEx::list().

Referenced by CFilterRowSet::GetRow().

143 { return list().GetItem( index )->AsPackedRow(); }
list_type & list()
Definition: PyRep.h:889
PyRep * GetItem(size_t index) const
Returns Python object.
Definition: PyRep.h:674
PyPackedRow * AsPackedRow()
Definition: PyRep.h:156

Here is the call graph for this function:

Here is the caller graph for this function:

size_t CRowSet::GetRowCount ( ) const
inline
Returns
Row count.

Definition at line 136 of file PyDatabase.h.

References PyObjectEx::list(), and PyList::size().

136 { return list().size(); }
list_type & list()
Definition: PyRep.h:889
size_t size() const
Definition: PyRep.h:663

Here is the call graph for this function:

PyPackedRow * CRowSet::NewRow ( )
Returns
New row which user may fill.

Definition at line 132 of file PyDatabase.cpp.

References _GetRowDesc(), PyList::AddItem(), and PyObjectEx::list().

Referenced by DBResultToCRowset(), SovereigntyDataMgr::GetCurrentSovData(), MarketDB::GetMarketGroups(), Inventory::List(), marshal_EVEMarshalTest(), and StaticDataMgr::SetBPMatlType().

133 {
134  //DBRowDescriptor* rowDesc = _GetRowDesc();
135  PyPackedRow* row = new PyPackedRow( _GetRowDesc() );
136 
137  list().AddItem( row );
138  return row;
139 }
list_type & list()
Definition: PyRep.h:889
void AddItem(PyRep *i)
Definition: PyRep.h:701
DBRowDescriptor * _GetRowDesc() const
Definition: PyDatabase.cpp:141
Packed row.
Definition: PyRep.h:961

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: