EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PyRep.h
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Zhur
24  Updates: Allan
25 */
26 
27 #ifndef EVE_PY_REP_H
28 #define EVE_PY_REP_H
29 
30 class PyInt;
31 class PyLong;
32 class PyFloat;
33 class PyBool;
34 class PyBuffer;
35 class PyString;
36 class PyWString;
37 class PyToken;
38 class PyTuple;
39 class PyList;
40 class PyDict;
41 class PyNone;
42 class PySubStruct;
43 class PySubStream;
44 class PyChecksumedStream;
45 class PyObject;
46 class PyObjectEx;
47 class PyPackedRow;
48 
49 class PyVisitor;
50 class DBRowDescriptor;
51 
56 #define PyIncRef(op) (op)->IncRef()
57 #define PyDecRef(op) (op)->DecRef()
58 
59 /* Macros to use in case the object pointer may be NULL */
60 #define PySafeIncRef(op) if (op != nullptr) PyIncRef( op )
61 #define PySafeDecRef(op) if (op != nullptr) PyDecRef( op )
62 
66 class PyRep : public RefObject
67 {
68 public:
72  enum PyType
73  {
74  PyTypeMin = 0,
75  PyTypeInt = 1,
84  PyTypeList = 10,
85  PyTypeDict = 11,
86  PyTypeNone = 12,
94  };
95 
96  /* PyType functions */
97 
98  PyType GetType() const { return mType; }
99 
100  bool IsInt() const { return mType == PyTypeInt; }
101  bool IsLong() const { return mType == PyTypeLong; }
102  bool IsFloat() const { return mType == PyTypeFloat; }
103  bool IsBool() const { return mType == PyTypeBool; }
104  bool IsBuffer() const { return mType == PyTypeBuffer; }
105  bool IsString() const { return mType == PyTypeString; }
106  bool IsWString() const { return mType == PyTypeWString; }
107  bool IsToken() const { return mType == PyTypeToken; }
108  bool IsTuple() const { return mType == PyTypeTuple; }
109  bool IsList() const { return mType == PyTypeList; }
110  bool IsDict() const { return mType == PyTypeDict; }
111  bool IsNone() const { return mType == PyTypeNone; }
112  bool IsSubStruct() const { return mType == PyTypeSubStruct; }
113  bool IsSubStream() const { return mType == PyTypeSubStream; }
114  bool IsChecksumedStream() const { return mType == PyTypeChecksumedStream; }
115  bool IsObject() const { return mType == PyTypeObject; }
116  bool IsObjectEx() const { return mType == PyTypeObjectEx; }
117  bool IsPackedRow() const { return mType == PyTypePackedRow; }
118 
119  const char* TypeString() const;
120 
121  // tools for easy access, less typecasting...
122  PyInt* AsInt() { assert( IsInt() ); return (PyInt*)this; }
123  const PyInt* AsInt() const { assert( IsInt() ); return (const PyInt*)this; }
124  PyLong* AsLong() { assert( IsLong() ); return (PyLong*)this; }
125  const PyLong* AsLong() const { assert( IsLong() ); return (const PyLong*)this; }
126  PyFloat* AsFloat() { assert( IsFloat() ); return (PyFloat*)this; }
127  const PyFloat* AsFloat() const { assert( IsFloat() ); return (const PyFloat*)this; }
128  PyBool* AsBool() { assert( IsBool() ); return (PyBool*)this; }
129  const PyBool* AsBool() const { assert( IsBool() ); return (const PyBool*)this; }
130  PyBuffer* AsBuffer() { assert( IsBuffer() ); return (PyBuffer*)this; }
131  const PyBuffer* AsBuffer() const { assert( IsBuffer() ); return (const PyBuffer*)this; }
132  PyString* AsString() { assert( IsString() ); return (PyString*)this; }
133  const PyString* AsString() const { assert( IsString() ); return (const PyString*)this; }
134  PyWString* AsWString() { assert( IsWString() ); return (PyWString*)this; }
135  const PyWString* AsWString() const { assert( IsWString() ); return (const PyWString*)this; }
136  PyToken* AsToken() { assert( IsToken() ); return (PyToken*)this; }
137  const PyToken* AsToken() const { assert( IsToken() ); return (const PyToken*)this; }
138  PyTuple* AsTuple() { assert( IsTuple() ); return (PyTuple*)this; }
139  const PyTuple* AsTuple() const { assert( IsTuple() ); return (const PyTuple*)this; }
140  PyList* AsList() { assert( IsList() ); return (PyList*)this; }
141  const PyList* AsList() const { assert( IsList() ); return (const PyList*)this; }
142  PyDict* AsDict() { assert( IsDict() ); return (PyDict*)this; }
143  const PyDict* AsDict() const { assert( IsDict() ); return (const PyDict*)this; }
144  PyNone* AsNone() { assert( IsNone() ); return (PyNone*)this; }
145  const PyNone* AsNone() const { assert( IsNone() ); return (const PyNone*)this; }
146  PySubStruct* AsSubStruct() { assert( IsSubStruct() ); return (PySubStruct*)this; }
147  const PySubStruct* AsSubStruct() const { assert( IsSubStruct() ); return (const PySubStruct*)this; }
148  PySubStream* AsSubStream() { assert( IsSubStream() ); return (PySubStream*)this; }
149  const PySubStream* AsSubStream() const { assert( IsSubStream() ); return (const PySubStream*)this; }
151  const PyChecksumedStream* AsChecksumedStream() const { assert( IsChecksumedStream() ); return (const PyChecksumedStream*)this; }
152  PyObject* AsObject() { assert( IsObject() ); return (PyObject*)this; }
153  const PyObject* AsObject() const { assert( IsObject() ); return (const PyObject*)this; }
154  PyObjectEx* AsObjectEx() { assert( IsObjectEx() ); return (PyObjectEx*)this; }
155  const PyObjectEx* AsObjectEx() const { assert( IsObjectEx() ); return (const PyObjectEx*)this; }
156  PyPackedRow* AsPackedRow() { assert( IsPackedRow() ); return (PyPackedRow*)this; }
157  const PyPackedRow* AsPackedRow() const { assert( IsPackedRow() ); return (const PyPackedRow*)this; }
158 
159  using RefObject::IncRef;
160  using RefObject::DecRef;
161 
168  void Dump( FILE* into, const char* pfx ) const;
175  void Dump( LogType type, const char* pfx ) const;
176 
182  virtual PyRep* Clone() const = 0;
191  virtual bool visit( PyVisitor& v ) const = 0;
199  virtual int32 hash() const;
200 
201  // this is used when PyRep can be either String or WString.
202  static std::string StringContent(PyRep* pRep);
203  // this is used when PyRep can be either Int or Long
204  // None returns 0, Float is converted to int64
205  static int64 IntegerValue(PyRep* pRep);
206  // this is used when PyRep can be either Int or Long
207  // None returns 0. Returned as unsigned 32b int
208  static uint32 IntegerValueU32(PyRep* pRep);
209 
210 protected:
211  PyRep( PyType t );
212  // copy c'tor
213  PyRep( const PyRep& oth );
214  // move c'tor
215  PyRep(PyRep&& oth) = delete;
216  // copy assignment
217  PyRep& operator= (const PyRep& oth) = default;
218  // move assignment
219  PyRep& operator= (PyRep&& oth) = default;
220 
221  virtual ~PyRep() { /* do we need to do anything here? */ }
222 
223  const PyType mType;
224 };
225 
231 class PyInt : public PyRep
232 {
233 public:
234  PyInt( const int32 i );
235  // copy c'tor
236  PyInt( const PyInt& oth );
237  // move c'tor
238  PyInt(PyInt&& oth) = delete;
239  // copy assignment
240  PyInt& operator= (const PyInt& oth) = delete;
241  // move assignment
242  PyInt& operator= (PyInt&& oth) = delete;
243 
244  PyRep* Clone() const;
245  bool visit( PyVisitor& v ) const;
246 
247  int32 value() const { return mValue; }
248 
249  int32 hash() const;
250 
251 protected:
252  virtual ~PyInt() { /* do we need to do anything here? */ }
253  const int32 mValue;
254 };
255 
261 class PyLong : public PyRep
262 {
263 public:
264  PyLong( const int64 i );
265  // copy c'tor
266  PyLong( const PyLong& oth );
267  // move c'tor
268  PyLong(PyLong&& oth) = delete;
269  // copy assignment
270  PyLong& operator= (const PyLong& oth) = delete;
271  // move assignment
272  PyLong& operator= (PyLong&& oth) = delete;
273 
274 
275  PyRep* Clone() const;
276  bool visit( PyVisitor& v ) const;
277 
278  int64 value() const { return mValue; }
279 
280  int32 hash() const;
281 
282 protected:
283  virtual ~PyLong() { /* do we need to do anything here? */ }
284  const int64 mValue;
285 };
286 
292 class PyFloat : public PyRep
293 {
294 public:
295  PyFloat( const double& i );
296  // copy c'tor
297  PyFloat( const PyFloat& oth );
298  // move c'tor
299  PyFloat(PyFloat&& oth) = delete;
300  // copy assignment
301  PyFloat& operator= (const PyFloat& oth) = delete;
302  // move assignment
303  PyFloat& operator= (PyFloat&& oth) = delete;
304 
305 
306  PyRep* Clone() const;
307  bool visit( PyVisitor& v ) const;
308 
309  double value() const { return mValue; }
310 
311  int32 hash() const;
312 
313 protected:
314  virtual ~PyFloat() { /* do we need to do anything here? */ }
315  const double mValue;
316 };
317 
323 class PyBool : public PyRep
324 {
325 public:
326  PyBool( bool i );
327  // copy c'tor
328  PyBool( const PyBool& oth );
329  // move c'tor
330  PyBool(PyBool&& oth) = delete;
331  // copy assignment
332  PyBool& operator= (const PyBool& oth) = delete;
333  // move assignment
334  PyBool& operator= (PyBool&& oth) = delete;
335 
336 
337  PyRep* Clone() const;
338  bool visit( PyVisitor& v ) const;
339 
340  bool value() const { return mValue; }
341 
342 protected:
343  virtual ~PyBool() { /* do we need to do anything here? */ }
344  const bool mValue;
345 };
346 
352 class PyNone : public PyRep
353 {
354 public:
355  PyNone();
356  // copy c'tor
357  PyNone( const PyNone& oth );
358  // move c'tor
359  PyNone(PyNone&& oth) = delete;
360  // copy assignment
361  PyNone& operator= (const PyNone& oth) = delete;
362  // move assignment
363  PyNone& operator= (PyNone&& oth) = delete;
364 
365 
366  PyRep* Clone() const;
367  bool visit( PyVisitor& v ) const;
368 
369  int32 hash() const;
370 
371 protected:
372  virtual ~PyNone() { /* do we need to do anything here? */ }
373 };
374 
382 class PyBuffer : public PyRep
383 {
384 public:
386  PyBuffer( size_t len, const uint8& value );
388  template<typename Iter>
389  PyBuffer( Iter first, Iter last );
391  PyBuffer( const Buffer& buffer );
393  PyBuffer( Buffer** buffer );
395  PyBuffer( const PyString& str );
397  PyBuffer( const PyBuffer& oth );
398 
399  PyRep* Clone() const;
400  bool visit( PyVisitor& v ) const;
401 
407  const Buffer& content() const { return *mValue; }
408 
409  int32 hash() const;
410 
416  size_t size() const;
417 
418 protected:
419  virtual ~PyBuffer();
420 
421  const Buffer* const mValue;
422  mutable int32 mHashCache;
423 };
424 
430 class PyString : public PyRep
431 {
432 public:
434  PyString( const char* str );
436  PyString( const char* str, size_t len );
438  template<typename Iter>
439  PyString( Iter first, Iter last );
441  PyString( const std::string& str );
442 
444  PyString( const PyBuffer& buf );
446  PyString( const PyToken& token );
448  PyString( const PyString& oth );
449 
450  PyRep* Clone() const;
451  bool visit( PyVisitor& v ) const;
452 
458  const std::string& content() const { return mValue; }
459 
460  // updated to use std::hash for strings. better checks without collision (so far)
461  int32 hash() const;
462 
463 protected:
464  virtual ~PyString();
465  const std::string mValue;
466  mutable int32 mHashCache;
467 };
468 
475 class PyWString : public PyRep
476 {
477 public:
479  PyWString( const char* str, size_t len );
481  template<typename Iter>
482  PyWString( Iter first, Iter last );
484  PyWString( const std::string& str );
485 
487  PyWString( const PyString& str );
489  PyWString( const PyWString& oth );
490 
491  PyRep* Clone() const;
492  bool visit( PyVisitor& v ) const;
493 
499  const std::string& content() const { return mValue; }
500 
506  size_t size() const;
507 
508  // updated to use std::hash for strings. better checks without collision (so far)
509  int32 hash() const;
510 
511 protected:
512  virtual ~PyWString() { /* do we need to do anything here? */ }
513  const std::string mValue;
514  mutable int32 mHashCache;
515 };
516 
522 class PyToken : public PyRep
523 {
524 public:
526  PyToken( const char* token );
528  PyToken( const char* token, size_t len );
530  template<typename Iter>
531  PyToken( Iter first, Iter last );
533  PyToken( const std::string& token );
534 
536  PyToken( const PyString& token );
538  PyToken( const PyToken& oth );
539  // move c'tor
540  PyToken(PyToken&& oth) = delete;
541  // copy assignment
542  PyToken& operator= (const PyToken& oth) = delete;
543  // move assignment
544  PyToken& operator= (PyToken&& oth) = delete;
545 
546 
547  PyRep* Clone() const;
548  bool visit( PyVisitor& v ) const;
549 
555  const std::string& content() const { return mValue; }
556 
557 protected:
558  virtual ~PyToken() { /* do we need to do anything here? */ }
559  const std::string mValue;
560 };
561 
567 class PyTuple : public PyRep
568 {
569 public:
570  typedef std::vector<PyRep*> storage_type;
571  typedef storage_type::iterator iterator;
572  typedef storage_type::const_iterator const_iterator;
573 
574  PyTuple( size_t item_count );
575  // copy c'tor
576  PyTuple( const PyTuple& oth );
577  // move c'tor
578  PyTuple(PyTuple&& oth) = delete;
579  // copy assignment
580  PyTuple& operator= (const PyTuple& oth);
581  // move assignment
582  PyTuple& operator= (PyTuple&& oth) = delete;
583 
584 
585  PyRep* Clone() const;
586  bool visit( PyVisitor& v ) const;
587 
588  const_iterator begin() const { return items.begin(); }
589  const_iterator end() const { return items.end(); }
590 
591  size_t size() const { return items.size(); }
592  bool empty() const { return items.empty(); }
593  void clear();
594 
602  PyRep* GetItem( size_t index ) const { return items.at( index ); }
603 
610  void SetItem( size_t index, PyRep* object )
611  {
612  PyRep** rep = &items.at( index );
613 
614  PySafeDecRef( *rep );
615  if (object == nullptr)
616  *rep = new PyNone();
617  else
618  *rep = object;
619  PyIncRef( *rep );
620  }
621 
622  void SetItemInt( size_t index, int32 val ) { SetItem( index, new PyInt( val ) ); }
623  void SetItemString( size_t index, const char* str ) { SetItem( index, new PyString( str ) ); }
624 
625  int32 hash() const;
626 
627  // This needs to be public for now.
628  storage_type items;
629 
630 protected:
631  virtual ~PyTuple();
632 };
633 
639 class PyList : public PyRep
640 {
641 public:
642  typedef std::vector<PyRep*> storage_type;
643  typedef storage_type::iterator iterator;
644  typedef storage_type::const_iterator const_iterator;
645 
646  PyList( size_t item_count = 0 );
647  // copy c'tor
648  PyList( const PyList& oth );
649  // move c'tor
650  PyList(PyList&& oth) = delete;
651  // copy assignment
652  PyList& operator= (const PyList& oth);
653  // move assignment
654  PyList& operator= (PyList&& oth) = delete;
655 
656 
657  PyRep* Clone() const;
658  bool visit( PyVisitor& v ) const;
659 
660  const_iterator begin() const { return items.begin(); }
661  const_iterator end() const { return items.end(); }
662 
663  size_t size() const { return items.size(); }
664  bool empty() const { return items.empty(); }
665  void clear();
666 
674  PyRep* GetItem( size_t index ) const { return items.at( index ); }
675 
682  void SetItem( size_t index, PyRep* object )
683  {
684  PyRep** rep = &items.at( index );
685 
686  PySafeDecRef( *rep );
687  if (object == nullptr)
688  *rep = new PyNone();
689  else
690  *rep = object;
691  PyIncRef( *rep );
692  }
699  void SetItemString( size_t index, const char* str ) { SetItem( index, new PyString( str ) ); }
700 
701  void AddItem( PyRep* i ) { items.push_back( i ); }
702  void AddItemInt( int32 intval ) { AddItem( new PyInt( intval ) ); }
703  void AddItemLong( int64 intval ) { AddItem( new PyLong( intval ) ); }
704  void AddItemReal( double realval ) { AddItem( new PyFloat( realval ) ); }
705  void AddItemString( const char* str ) { AddItem( new PyString( str ) ); }
706 
707  // This needs to be public:
708  storage_type items;
709 
710 protected:
711  virtual ~PyList();
712 };
713 
719 class PyDict : public PyRep
720 {
721 protected:
722  // hash function
723  class _hash : public std::unary_function<PyRep*, size_t>
724  {
725  public:
726  size_t operator()( const PyRep* _Keyval ) const
727  {
728  assert( _Keyval );
729 
730  return (size_t)_Keyval->hash();
731  }
732  };
733 
734  // comparison function
735  class _comp : public std::binary_function<PyRep*, PyRep*, bool>
736  {
737  public:
738  bool operator()( const PyRep* _Arg1, const PyRep* _Arg2 ) const
739  {
740  assert( _Arg1 );
741  assert( _Arg2 );
742 
743  return ( _Arg1->hash() == _Arg2->hash() );
744  }
745  };
746 
747 public:
748  typedef std::unordered_map<PyRep*, PyRep*, _hash, _comp> storage_type;
749  typedef storage_type::iterator iterator;
750  typedef storage_type::const_iterator const_iterator;
751 
752  PyDict();
753  // copy c'tor
754  PyDict( const PyDict& oth );
755  // move c'tor
756  PyDict(PyDict&& oth) = delete;
757  // copy assignment
758  PyDict& operator= (const PyDict& oth);
759  // move assignment
760  PyDict& operator= (PyDict&& oth) = delete;
761 
762 
763  PyRep* Clone() const;
764  bool visit( PyVisitor& v ) const;
765 
766  const_iterator begin() const { return items.begin(); }
767  const_iterator end() const { return items.end(); }
768 
769  size_t size() const { return items.size(); }
770  bool empty() const { return items.empty(); }
771  void clear();
772 
780  PyRep* GetItem( PyRep* key ) const;
788  PyRep* GetItemString( const char* key ) const;
789 
799  void SetItem( PyRep* key, PyRep* value );
800  void SetItem( const char* key, PyRep* value ) { SetItem(new PyString(key), value); }
801  void SetItem( const char* key, const char* value ) { SetItem(new PyString(key), new PyString(value)); }
802 
812  void SetItemString( const char* key, PyRep* value ) { SetItem( new PyString( key ), value ); }
813 
814  storage_type items;
815 
816 protected:
817  virtual ~PyDict();
818 };
819 
826 class PyObject : public PyRep
827 {
828 public:
829  PyObject( const char* type, PyRep* args );
830  PyObject( PyString* type, PyRep* args );
831  // copy c'tor
832  PyObject( const PyObject& oth );
833  // move c'tor
834  PyObject(PyObject&& oth) = delete;
835  // copy assignment
836  PyObject& operator= (const PyObject& oth);
837  // move assignment
838  PyObject& operator= (PyObject&& oth) = delete;
839 
840 
841  PyRep* Clone() const;
842  bool visit( PyVisitor& v ) const;
843 
844  PyString* type() const { return mType; }
845  PyRep* arguments() const { return mArguments; }
846 
847 protected:
848  virtual ~PyObject();
849 
852 };
853 
861 class PyObjectEx : public PyRep
862 {
863 public:
864  typedef PyList list_type;
867 
868  typedef PyDict dict_type;
871 
872  PyObjectEx( bool is_type_2, PyRep* header );
873  // copy c'tor
874  PyObjectEx( const PyObjectEx& oth );
875  // move c'tor
876  PyObjectEx(PyObjectEx&& oth) = delete;
877  // copy assignment
878  PyObjectEx& operator= (const PyObjectEx& oth);
879  // move assignment
880  PyObjectEx& operator= (PyObjectEx&& oth) = delete;
881 
882 
883  PyRep* Clone() const;
884  bool visit( PyVisitor& v ) const;
885 
886  PyRep* header() const { return mHeader; }
887  bool isType2() const { return mIsType2; }
888 
889  list_type& list() { return *mList; }
890  const list_type& list() const { return *mList; }
891 
892  dict_type& dict() { return *mDict; }
893  const dict_type& dict() const { return *mDict; }
894 
895 
896 protected:
897  virtual ~PyObjectEx();
898 
899  PyRep* const mHeader;
900  const bool mIsType2;
901 
902  list_type* const mList;
903  dict_type* const mDict;
904 };
905 
912 {
913 public:
914  PyObjectEx_Type1( PyToken* type, PyTuple* args, bool enclosed=false );
915  PyObjectEx_Type1( PyObjectEx_Type1* args1, PyTuple* args2, bool enclosed=false );
916  PyObjectEx_Type1( PyToken* type, PyTuple* args, PyDict* keywords, bool enclosed=false );
917  PyObjectEx_Type1( PyToken* type, PyTuple* args, PyList* keywords, bool enclosed=false );
918 
919  PyToken* GetType() const;
920  PyTuple* GetArgs() const;
921  PyDict* GetKeywords() const;
922 
923  PyRep* FindKeyword( const char* keyword ) const;
924 
925 protected:
926  virtual ~PyObjectEx_Type1() { /* do we need to do anything here? */ }
927  static PyTuple* _CreateHeader( PyToken* type, PyTuple* args, bool enclosed=false );
928  static PyTuple* _CreateHeader( PyObjectEx_Type1* args1, PyTuple* args2, bool enclosed=false );
929  static PyTuple* _CreateHeader( PyToken* type, PyTuple* args, PyDict* keywords, bool enclosed=false );
930  static PyTuple* _CreateHeader( PyToken* type, PyTuple* args, PyList* keywords, bool enclosed=false );
931 };
932 
939 {
940 public:
941  PyObjectEx_Type2( PyTuple* args, PyDict* keywords, bool enclosed=false );
942  PyObjectEx_Type2( PyToken* args, PyDict* keywords, bool enclosed=false );
943 
944  PyTuple* GetArgs() const;
945  PyDict* GetKeywords() const;
946 
947  PyRep* FindKeyword( const char* keyword ) const;
948 
949 protected:
950  virtual ~PyObjectEx_Type2() { /* do we need to do anything here? */ }
951  static PyTuple* _CreateHeader( PyTuple* args, PyDict* keywords, bool enclosed=false );
952  static PyTuple* _CreateHeader( PyToken* args, PyDict* keywords, bool enclosed=false );
953 };
954 
961 class PyPackedRow : public PyRep
962 {
963 public:
967 
969  // copy c'tor
970  PyPackedRow( const PyPackedRow& oth );
971  // move c'tor
972  PyPackedRow(PyPackedRow&& oth) = delete;
973  // copy assignment
974  PyPackedRow& operator= (const PyPackedRow& oth);
975  // move assignment
976  PyPackedRow& operator= (PyPackedRow&& oth) = delete;
977 
978 
979  PyRep* Clone() const;
980  bool visit( PyVisitor& v ) const;
981 
982  // Header:
983  DBRowDescriptor* header() const { return mHeader; }
984 
985  // Fields:
986  const_iterator begin() const { return mFields->begin(); }
987  const_iterator end() const { return mFields->end(); }
988  void clear() { mFields->clear(); }
989 
990  PyRep* GetField( size_t index ) const { return mFields->GetItem( index ); }
991 
992  bool SetField( uint32 index, PyRep* value );
993  bool SetField( const char* colName, PyRep* value );
994 
995  int32 hash() const;
996 
997 protected:
998  virtual ~PyPackedRow();
999 
1001  storage_type* const mFields;
1002 };
1003 
1004 class PySubStruct : public PyRep
1005 {
1006 public:
1007  PySubStruct( PyRep* t );
1008  // copy c'tor
1009  PySubStruct( const PySubStruct& oth );
1010  // move c'tor
1011  PySubStruct(PySubStruct&& oth) = delete;
1012  // copy assignment
1013  PySubStruct& operator= (const PySubStruct& oth) = delete;
1014  // move assignment
1015  PySubStruct& operator= (PySubStruct&& oth) = delete;
1016 
1017 
1018  PyRep* Clone() const;
1019  bool visit( PyVisitor& v ) const;
1020 
1021  PyRep* sub() const { return mSub; }
1022 
1023 protected:
1024  virtual ~PySubStruct();
1025 
1026  PyRep* const mSub;
1027 };
1028 
1029 class PySubStream : public PyRep
1030 {
1031 public:
1032  PySubStream( PyRep* rep );
1033  PySubStream( PyBuffer* buffer );
1034  // copy c'tor
1035  PySubStream( const PySubStream& oth );
1036  // move c'tor
1037  PySubStream(PySubStream&& oth) = delete;
1038  // copy assignment
1039  PySubStream& operator= (const PySubStream& oth) = delete;
1040  // move assignment
1041  PySubStream& operator= (PySubStream&& oth) = delete;
1042 
1043 
1044  PyRep* Clone() const;
1045  bool visit( PyVisitor& v ) const;
1046 
1047  PyBuffer* data() const { return mData; }
1048  PyRep* decoded() const { return mDecoded; }
1049 
1050  //call to ensure that `data` represents `decoded` IF DATA IS NULL
1051  void EncodeData() const;
1052 
1053  //call to ensure that `decoded` represents `data` IF DECODED IS NULL
1054  void DecodeData() const;
1055 
1056 protected:
1057  virtual ~PySubStream();
1058 
1059  //if both are non-NULL, they are considered to be equivalent
1060  mutable PyBuffer* mData;
1061  mutable PyRep* mDecoded;
1062 };
1063 
1065 {
1066 public:
1067  PyChecksumedStream( PyRep* t, uint32 sum );
1068  // copy c'tor
1069  PyChecksumedStream( const PyChecksumedStream& oth );
1070  // move c'tor
1071  PyChecksumedStream(PyChecksumedStream&& oth) = delete;
1072  // copy assignment
1073  PyChecksumedStream& operator= (const PyChecksumedStream& oth) = delete;
1074  // move assignment
1076 
1077 
1078  PyRep* Clone() const;
1079  bool visit( PyVisitor& v ) const;
1080 
1081  PyRep* stream() const { return mStream; }
1082  uint32 checksum() const { return mChecksum; }
1083 
1084 protected:
1085  virtual ~PyChecksumedStream();
1086 
1087  PyRep* const mStream;
1089 };
1090 
1091 
1092 /* note: these need to be in header since they are templates ... we don't mess
1093  * the class definitions up with them, we stick them here instead to have them
1094  * all together.
1095  */
1096 template<typename Iter>
1097 inline PyBuffer::PyBuffer( Iter first, Iter last ) : PyRep( PyRep::PyTypeBuffer ), mValue( new Buffer( first, last ) ), mHashCache( -1 ) {}
1098 template<typename Iter>
1099 inline PyString::PyString( Iter first, Iter last ) : PyRep( PyRep::PyTypeString ), mValue( first, last ), mHashCache( -1 ) {}
1100 template<typename Iter>
1101 inline PyWString::PyWString( Iter first, Iter last ) : PyRep( PyRep::PyTypeWString ), mValue( first, last ), mHashCache( -1 ) {}
1102 template<typename Iter>
1103 inline PyToken::PyToken( Iter first, Iter last ) : PyRep( PyRep::PyTypeToken ), mValue( first, last ) {}
1104 
1105 
1106 /************************************************************************/
1107 /* tuple helper functions */
1108 /************************************************************************/
1109 PyTuple* new_tuple(int64 arg1);
1110 PyTuple* new_tuple(int64 arg1, int64 arg2);
1111 /* strings */
1112 PyTuple* new_tuple(const char* arg1);
1113 PyTuple* new_tuple(const char* arg1, const char* arg2);
1114 PyTuple* new_tuple(const char* arg1, const char* arg2, const char* arg3);
1115 PyTuple* new_tuple(const char* arg1, const char* arg2, PyTuple* arg3);
1116 /* mixed */
1117 PyTuple* new_tuple(const char* arg1, PyRep* arg2, PyRep* arg3);
1118 PyTuple* new_tuple(PyRep* arg1);
1119 PyTuple* new_tuple(PyRep* arg1, PyRep* arg2);
1120 PyTuple* new_tuple(PyRep* arg1, PyRep* arg2, PyRep* arg3);
1121 
1122 
1124 {
1125 public:
1126  BuiltinSet() : PyObjectEx_Type1( new PyToken("collections.defaultdict"), new_tuple(new PyToken("__builtin__.set")) ) {}
1127 
1128 protected:
1129  virtual ~BuiltinSet() { /* do we need to do anything here? */ }
1130 };
1131 
1133 {
1134 public:
1135  CacheOK() : PyObjectEx_Type1( new PyToken("objectCaching.CacheOK"), new_tuple("CacheOK") ) {}
1136 
1137 protected:
1138  virtual ~CacheOK() { /* do we need to do anything here? */ }
1139 };
1140 
1141 
1152 #include "../../eve-core/utils/Singleton.h"
1153 
1155 : public Singleton< pyStatic >
1156 {
1157 public:
1159  {
1160  m_none = new PyNone();
1161  m_zero = new PyInt(0);
1162  m_one = new PyInt(1);
1163  m_negone = new PyInt(-1);
1164  m_true = new PyBool(true);
1165  m_false = new PyBool(false);
1166  m_dict = new PyDict();
1167  m_list = new PyList();
1168  m_tuple = new PyTuple(0);
1169  }
1170 
1172  {
1173  PyDecRef(m_none);
1174  PyDecRef(m_zero);
1175  PyDecRef(m_one);
1176  PyDecRef(m_negone);
1177  PyDecRef(m_true);
1178  PyDecRef(m_false);
1179  PyDecRef(m_dict);
1180  PyDecRef(m_list);
1181  PyDecRef(m_tuple);
1182  }
1183 
1186  PyRep* NewOne() { PyIncRef(m_one); return m_one; }
1190 
1194 
1195 private:
1202 
1206 };
1207 
1208 //Singleton
1209 #define PyStatic \
1210  ( pyStatic::get() )
1211 
1212 #endif//EVE_PY_REP_H
dict_type *const mDict
Definition: PyRep.h:903
Base Python wire object.
Definition: PyRep.h:66
list_type & list()
Definition: PyRep.h:889
PyRep *const mStream
Definition: PyRep.h:1087
void clear()
Definition: PyRep.cpp:558
const PyInt * AsInt() const
Definition: PyRep.h:123
PyTuple * AsTuple()
Definition: PyRep.h:138
list_type::const_iterator const_list_iterator
Definition: PyRep.h:866
unsigned __int8 uint8
Definition: eve-compat.h:46
PyBool(bool i)
Definition: PyRep.cpp:320
PyWString(const char *str, size_t len)
Definition: PyRep.cpp:476
static std::string StringContent(PyRep *pRep)
Definition: PyRep.cpp:103
~pyStatic()
Definition: PyRep.h:1171
static PyTuple * _CreateHeader(PyTuple *args, PyDict *keywords, bool enclosed=false)
Definition: PyRep.cpp:971
double value() const
Definition: PyRep.h:309
PyRep * NewZero()
Definition: PyRep.h:1185
CacheOK()
Definition: PyRep.h:1135
bool empty() const
Definition: PyRep.h:770
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:450
void DecRef() const
Decrements reference count of object by one.
Definition: RefPtr.h:101
void clear()
Definition: PyRep.cpp:680
PyTuple & operator=(const PyTuple &oth)
Definition: PyRep.cpp:567
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:804
PyRep * GetItem(size_t index) const
Returns Python object.
Definition: PyRep.h:602
Python string.
Definition: PyRep.h:430
int32 value() const
Definition: PyRep.h:247
PyRep * GetItemString(const char *key) const
Obtains database entry based on given key string.
Definition: PyRep.cpp:702
PyDict * m_dict
Definition: PyRep.h:1203
bool IsBuffer() const
Definition: PyRep.h:104
PyBool * AsBool()
Definition: PyRep.h:128
PyNone * AsNone()
Definition: PyRep.h:144
Python's dictionary.
Definition: PyRep.h:719
const Buffer & content() const
Get the const PyBuffer content.
Definition: PyRep.h:407
bool IsChecksumedStream() const
Definition: PyRep.h:114
void clear()
Definition: PyRep.h:988
const PyDict * AsDict() const
Definition: PyRep.h:143
virtual ~PyRep()
Definition: PyRep.h:221
size_t size() const
Definition: PyRep.h:591
bool IsTuple() const
Definition: PyRep.h:108
const PySubStruct * AsSubStruct() const
Definition: PyRep.h:147
PyRep * NewOne()
Definition: PyRep.h:1186
virtual ~PyToken()
Definition: PyRep.h:558
DBRowDescriptor * header() const
Definition: PyRep.h:983
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:156
const PyObjectEx * AsObjectEx() const
Definition: PyRep.h:155
PyTuple * GetArgs() const
Definition: PyRep.cpp:835
const PyNone * AsNone() const
Definition: PyRep.h:145
const std::string & content() const
Get the PyWString content.
Definition: PyRep.h:499
virtual PyRep * Clone() const =0
Clones object.
static PyTuple * _CreateHeader(PyToken *type, PyTuple *args, bool enclosed=false)
Definition: PyRep.cpp:867
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:1099
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:323
list_type::iterator list_iterator
Definition: PyRep.h:865
bool empty() const
Definition: PyRep.h:592
const PyFloat * AsFloat() const
Definition: PyRep.h:127
storage_type::iterator iterator
Definition: PyRep.h:749
PyBuffer * data() const
Definition: PyRep.h:1047
list_type *const mList
Definition: PyRep.h:902
PyPackedRow & operator=(const PyPackedRow &oth)
Definition: PyRep.cpp:1053
PyNone & operator=(const PyNone &oth)=delete
storage_type::const_iterator const_iterator
Definition: PyRep.h:572
PyString * mType
Definition: PyRep.h:850
void SetItemString(size_t index, const char *str)
Stores Python string.
Definition: PyRep.h:699
size_t operator()(const PyRep *_Keyval) const
Definition: PyRep.h:726
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:799
std::vector< PyRep * > storage_type
Definition: PyRep.h:642
PyRep * FindKeyword(const char *keyword) const
Definition: PyRep.cpp:959
void SetItem(const char *key, PyRep *value)
Definition: PyRep.h:800
A reference-counted object.
Definition: RefPtr.h:48
virtual ~PySubStream()
Definition: PyRep.cpp:1093
bool IsString() const
Definition: PyRep.h:105
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:617
PyObjectEx_Type2(PyTuple *args, PyDict *keywords, bool enclosed=false)
Definition: PyRep.cpp:942
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:773
PyRep * m_true
Definition: PyRep.h:1200
virtual ~PyObjectEx_Type1()
Definition: PyRep.h:926
storage_type::iterator iterator
Definition: PyRep.h:965
bool operator()(const PyRep *_Arg1, const PyRep *_Arg2) const
Definition: PyRep.h:738
Python floating point number.
Definition: PyRep.h:292
Python wide string.
Definition: PyRep.h:475
storage_type *const mFields
Definition: PyRep.h:1001
PyTuple * m_tuple
Definition: PyRep.h:1205
dict_type::iterator dict_iterator
Definition: PyRep.h:869
virtual ~PyPackedRow()
Definition: PyRep.cpp:1015
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:529
bool value() const
Definition: PyRep.h:340
const_iterator begin() const
Definition: PyRep.h:660
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:486
storage_type::iterator iterator
Definition: PyRep.h:643
PyObject & operator=(const PyObject &oth)
PyInt & operator=(const PyInt &oth)=delete
PyList & operator=(const PyList &oth)
Definition: PyRep.cpp:637
pyStatic()
Definition: PyRep.h:1158
storage_type::const_iterator const_iterator
Definition: PyRep.h:644
PyObject * AsObject()
Definition: PyRep.h:152
static uint32 IntegerValueU32(PyRep *pRep)
Definition: PyRep.cpp:134
bool IsObject() const
Definition: PyRep.h:115
const list_type & list() const
Definition: PyRep.h:890
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:376
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:241
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:455
int32 hash() const
virtual function to generate a hash value of a object.
Definition: PyRep.cpp:166
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:675
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:1151
PyList * mtList()
Definition: PyRep.h:1192
storage_type items
Definition: PyRep.h:814
Python tuple.
Definition: PyRep.h:567
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:1104
PyToken * GetType() const
Definition: PyRep.cpp:829
int32 mHashCache
Definition: PyRep.h:466
int32 hash() const
virtual function to generate a hash value of a object.
Definition: PyRep.cpp:349
PyList(size_t item_count=0)
Definition: PyRep.cpp:608
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
Definition: PyRep.cpp:84
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:1146
virtual ~PyDict()
Definition: PyRep.cpp:660
PyRep * NewFalse()
Definition: PyRep.h:1189
PyChecksumedStream & operator=(const PyChecksumedStream &oth)=delete
PyType GetType() const
Definition: PyRep.h:98
PyLong * AsLong()
Definition: PyRep.h:124
PyRep * m_none
Definition: PyRep.h:1196
const PyPackedRow * AsPackedRow() const
Definition: PyRep.h:157
virtual ~PySubStruct()
Definition: PyRep.cpp:1066
PyRep * arguments() const
Definition: PyRep.h:845
virtual ~PyObjectEx_Type2()
Definition: PyRep.h:950
const uint32 mChecksum
Definition: PyRep.h:1088
bool IsList() const
Definition: PyRep.h:109
const PyType mType
Definition: PyRep.h:223
PyRep *const mSub
Definition: PyRep.h:1026
virtual ~CacheOK()
Definition: PyRep.h:1138
void AddItem(PyRep *i)
Definition: PyRep.h:701
void AddItemReal(double realval)
Definition: PyRep.h:704
PyToken & operator=(const PyToken &oth)=delete
PyLong & operator=(const PyLong &oth)=delete
signed __int32 int32
Definition: eve-compat.h:49
PyRep * GetItem(size_t index) const
Returns Python object.
Definition: PyRep.h:674
void SetItemString(size_t index, const char *str)
Definition: PyRep.h:623
* args
Python boolean.
Definition: PyRep.h:323
PyRep * decoded() const
Definition: PyRep.h:1048
const double mValue
Definition: PyRep.h:315
PyRep *const mArguments
Definition: PyRep.h:851
PyRep * GetField(size_t index) const
Definition: PyRep.h:990
const int64 mValue
Definition: PyRep.h:284
PyString(const char *str)
Definition: PyRep.cpp:430
PySubStream * AsSubStream()
Definition: PyRep.h:148
const PyTuple * AsTuple() const
Definition: PyRep.h:139
size_t size() const
Obtains length of the buffer.
Definition: PyRep.cpp:422
PyRep * NewNone()
Definition: PyRep.h:1184
Python extended object.
Definition: PyRep.h:861
PyList * m_list
Definition: PyRep.h:1204
PyObject(const char *type, PyRep *args)
Definition: PyRep.cpp:762
Generic class for buffers.
Definition: Buffer.h:40
PyChecksumedStream * AsChecksumedStream()
Definition: PyRep.h:150
const std::string mValue
Definition: PyRep.h:559
PyDict dict_type
Definition: PyRep.h:868
void DecodeData() const
Definition: PyRep.cpp:1125
PyRep *const mHeader
Definition: PyRep.h:899
PyTuple * mtTuple()
Definition: PyRep.h:1193
PyObjectEx_Type1(PyToken *type, PyTuple *args, bool enclosed=false)
Definition: PyRep.cpp:820
Python object.
Definition: PyRep.h:826
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:548
std::unordered_map< PyRep *, PyRep *, _hash, _comp > storage_type
Definition: PyRep.h:748
Python object "blue.DBRowDescriptor".
Definition: PyDatabase.h:41
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:1076
Python's "none".
Definition: PyRep.h:352
virtual ~PyString()
Definition: PyRep.cpp:444
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:187
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
void IncRef() const
Increments reference count of object by one.
Definition: RefPtr.h:84
PyRep * GetItem(PyRep *key) const
Obtains a database entry based on given key object.
Definition: PyRep.cpp:691
storage_type::const_iterator const_iterator
Definition: PyRep.h:966
size_t size() const
Definition: PyRep.h:769
dict_type::const_iterator const_dict_iterator
Definition: PyRep.h:870
PyLong(const int64 i)
Definition: PyRep.cpp:179
const PyBool * AsBool() const
Definition: PyRep.h:129
PySubStruct & operator=(const PySubStruct &oth)=delete
storage_type items
Definition: PyRep.h:708
PyNone()
Definition: PyRep.cpp:336
PyList * AsList()
Definition: PyRep.h:140
PyRep * NewNegOne()
Definition: PyRep.h:1187
Python integer.
Definition: PyRep.h:231
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:682
PyDict * AsDict()
Definition: PyRep.h:142
int32 hash() const
virtual function to generate a hash value of a object.
Definition: PyRep.cpp:501
const PyWString * AsWString() const
Definition: PyRep.h:135
PyString * AsString()
Definition: PyRep.h:132
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:670
const PyObject * AsObject() const
Definition: PyRep.h:153
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:161
PyInt(const int32 i)
Definition: PyRep.cpp:153
int32 hash() const
virtual function to generate a hash value of a object.
Definition: PyRep.cpp:584
PyPackedRow * AsPackedRow()
Definition: PyRep.h:156
const PyBuffer * AsBuffer() const
Definition: PyRep.h:131
dict_type & dict()
Definition: PyRep.h:892
storage_type::iterator iterator
Definition: PyRep.h:571
virtual ~PyFloat()
Definition: PyRep.h:314
PyRep * NewTrue()
Definition: PyRep.h:1188
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:1026
const PyList * AsList() const
Definition: PyRep.h:141
PyRep * FindKeyword(const char *keyword) const
Definition: PyRep.cpp:853
void AddItemInt(int32 intval)
Definition: PyRep.h:702
virtual int32 hash() const
virtual function to generate a hash value of a object.
Definition: PyRep.cpp:96
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:328
PyChecksumedStream(PyRep *t, uint32 sum)
Definition: PyRep.cpp:1136
const_iterator begin() const
Definition: PyRep.h:986
#define PyDecRef(op)
Definition: PyRep.h:57
int32 hash() const
virtual function to generate a hash value of a object.
Definition: PyRep.cpp:256
PyToken(const char *token)
Definition: PyRep.cpp:517
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:246
PyTuple(size_t item_count)
Definition: PyRep.cpp:537
void clear()
Definition: PyRep.cpp:627
PyBool & operator=(const PyBool &oth)=delete
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:182
PyBuffer * mData
Definition: PyRep.h:1060
PyDict * GetKeywords() const
Definition: PyRep.cpp:953
PyBuffer * AsBuffer()
Definition: PyRep.h:130
unsigned __int32 uint32
Definition: eve-compat.h:50
int64 value() const
Definition: PyRep.h:278
int32 hash() const
virtual function to generate a hash value of a object.
Definition: PyRep.cpp:386
PyType
Python wire object types.
Definition: PyRep.h:72
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:1071
#define PyIncRef(op)
Definition: PyRep.h:56
void SetItem(const char *key, const char *value)
Definition: PyRep.h:801
PyString * type() const
Definition: PyRep.h:844
const std::string mValue
Definition: PyRep.h:465
std::vector< PyRep * > storage_type
Definition: PyRep.h:570
void AddItemString(const char *str)
Definition: PyRep.h:705
void SetItemInt(size_t index, int32 val)
Definition: PyRep.h:622
virtual ~PyLong()
Definition: PyRep.h:283
int32 mHashCache
Definition: PyRep.h:514
const PyLong * AsLong() const
Definition: PyRep.h:125
const std::string & content() const
Obtain token.
Definition: PyRep.h:555
const int32 mValue
Definition: PyRep.h:253
const_iterator begin() const
Definition: PyRep.h:766
Python token (eg. class name).
Definition: PyRep.h:522
const Buffer *const mValue
Definition: PyRep.h:421
virtual ~PyObject()
Definition: PyRep.cpp:767
PyObjectEx(bool is_type_2, PyRep *header)
Definition: PyRep.cpp:786
virtual ~PyTuple()
Definition: PyRep.cpp:542
PySubStruct(PyRep *t)
Definition: PyRep.cpp:1063
PyRep * m_zero
Definition: PyRep.h:1197
PyTuple * new_tuple(int64 arg1)
Definition: PyRep.cpp:1160
const bool mIsType2
Definition: PyRep.h:900
Wrapper class for PyObjectEx of type 1.
Definition: PyRep.h:911
PySubStruct * AsSubStruct()
Definition: PyRep.h:146
int32 hash() const
virtual function to generate a hash value of a object.
Definition: PyRep.cpp:192
uint32 checksum() const
Definition: PyRep.h:1082
bool IsObjectEx() const
Definition: PyRep.h:116
virtual ~BuiltinSet()
Definition: PyRep.h:1129
int32 hash() const
virtual function to generate a hash value of a object.
Definition: PyRep.cpp:460
virtual ~PyChecksumedStream()
Definition: PyRep.cpp:1141
bool IsNone() const
Definition: PyRep.h:111
bool IsDict() const
Definition: PyRep.h:110
signed __int64 int64
Definition: eve-compat.h:51
LogType
Definition: logsys.h:59
const_iterator end() const
Definition: PyRep.h:661
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:524
storage_type::const_iterator const_iterator
Definition: PyRep.h:750
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:1021
const std::string mValue
Definition: PyRep.h:513
bool IsBool() const
Definition: PyRep.h:103
bool IsPackedRow() const
Definition: PyRep.h:117
const_iterator end() const
Definition: PyRep.h:987
bool IsLong() const
Definition: PyRep.h:101
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:491
bool isType2() const
Definition: PyRep.h:887
PyRep * header() const
Definition: PyRep.h:886
virtual ~PyInt()
Definition: PyRep.h:252
bool IsFloat() const
Definition: PyRep.h:102
PySubStream & operator=(const PySubStream &oth)=delete
PyObjectEx & operator=(const PyObjectEx &oth)
Definition: PyRep.cpp:809
bool SetField(uint32 index, PyRep *value)
Definition: PyRep.cpp:1031
PyFloat(const double &i)
Definition: PyRep.cpp:238
PyRep(PyType t)
Definition: PyRep.cpp:73
virtual ~PyList()
Definition: PyRep.cpp:611
PyTuple * GetArgs() const
Definition: PyRep.cpp:947
PyDict()
Definition: PyRep.cpp:657
PyPackedRow(DBRowDescriptor *header)
Definition: PyRep.cpp:1010
void AddItemLong(int64 intval)
Definition: PyRep.h:703
Template used for singleton classes.
Definition: Singleton.h:43
const bool mValue
Definition: PyRep.h:344
PySubStream(PyRep *rep)
Definition: PyRep.cpp:1084
virtual ~PyObjectEx()
Definition: PyRep.cpp:791
int32 hash() const
virtual function to generate a hash value of a object.
Definition: PyRep.cpp:1047
const std::string & content() const
Get the PyString content.
Definition: PyRep.h:458
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:553
virtual ~PyWString()
Definition: PyRep.h:512
const_iterator end() const
Definition: PyRep.h:767
const PyToken * AsToken() const
Definition: PyRep.h:137
size_t size() const
Definition: PyRep.h:663
BuiltinSet()
Definition: PyRep.h:1126
virtual ~PyBuffer()
Definition: PyRep.cpp:371
#define PySafeDecRef(op)
Definition: PyRep.h:61
Python buffer.
Definition: PyRep.h:382
const PyString * AsString() const
Definition: PyRep.h:133
bool IsSubStream() const
Definition: PyRep.h:113
Packed row.
Definition: PyRep.h:961
PyRep * m_false
Definition: PyRep.h:1201
bool IsInt() const
Definition: PyRep.h:100
virtual ~PyBool()
Definition: PyRep.h:343
storage_type items
Definition: PyRep.h:628
PyRep * Clone() const
Clones object.
Definition: PyRep.cpp:339
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:622
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type() key(value)-Send an OnRemoteMessage" ) COMMAND( setbpattr
int32 mHashCache
Definition: PyRep.h:422
PyFloat & operator=(const PyFloat &oth)=delete
static int64 IntegerValue(PyRep *pRep)
Definition: PyRep.cpp:118
virtual ~PyNone()
Definition: PyRep.h:372
const_iterator end() const
Definition: PyRep.h:589
const dict_type & dict() const
Definition: PyRep.h:893
PyDict & operator=(const PyDict &oth)
Definition: PyRep.cpp:743
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:344
DBRowDescriptor *const mHeader
Definition: PyRep.h:1000
const PyChecksumedStream * AsChecksumedStream() const
Definition: PyRep.h:151
const_iterator begin() const
Definition: PyRep.h:588
PyFloat * AsFloat()
Definition: PyRep.h:126
PyInt * AsInt()
Definition: PyRep.h:122
PyBuffer(size_t len, const uint8 &value)
Definition: PyRep.cpp:359
size_t size() const
Obtains length of string.
Definition: PyRep.cpp:496
PyToken * AsToken()
Definition: PyRep.h:136
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:778
PyObjectEx * AsObjectEx()
Definition: PyRep.h:154
PyDict * mtDict()
Definition: PyRep.h:1191
PyRep * mDecoded
Definition: PyRep.h:1061
void SetItem(PyRep *key, PyRep *value)
SetItem adds or sets a database entry.
Definition: PyRep.cpp:713
bool visit(PyVisitor &v) const
Visits object.
Definition: PyRep.cpp:381
Wrapper class for PyObjectEx of type 2.
Definition: PyRep.h:938
PyList list_type
Definition: PyRep.h:864
PyRep * m_one
Definition: PyRep.h:1198
PyRep * sub() const
Definition: PyRep.h:1021
const char * TypeString() const
Definition: PyRep.cpp:76
bool empty() const
Definition: PyRep.h:664
const PySubStream * AsSubStream() const
Definition: PyRep.h:149
bool IsToken() const
Definition: PyRep.h:107
PyDict * GetKeywords() const
Definition: PyRep.cpp:841
void EncodeData() const
Definition: PyRep.cpp:1109
Python list.
Definition: PyRep.h:639
virtual bool visit(PyVisitor &v) const =0
Visits object.
PyList storage_type
Definition: PyRep.h:964
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry.
Definition: PyRep.h:812
bool IsSubStruct() const
Definition: PyRep.h:112
PyRep * m_negone
Definition: PyRep.h:1199
PyWString * AsWString()
Definition: PyRep.h:134
Python long integer.
Definition: PyRep.h:261
bool IsWString() const
Definition: PyRep.h:106
PyRep & operator=(const PyRep &oth)=default
PyRep * stream() const
Definition: PyRep.h:1081