114 _log(COMMON__ERROR,
"PyRep::StringContent() - Expected PyString or PyWString but got %s.", pRep->
TypeString());
122 else if (pRep->
IsInt())
137 else if (pRep->
IsInt())
158 return new PyInt( *
this );
184 return new PyLong( *
this );
194 #define PyLong_SHIFT 15
195 #define PyLong_BASE (1 << PyLong_SHIFT)
196 #define PyLong_MASK ((int)(PyLong_BASE - 1))
198 #define LONG_BIT_PyLong_SHIFT (8*sizeof(long) - PyLong_SHIFT)
232 #undef LONG_BIT_PyLong_SHIFT
253 # define INT32_MAX 2147483647L
258 #define Py_IS_INFINITY( X ) \
259 ( !finite( X ) && !isnan( X ) )
262 double intpart=0.0, fractpart=0.0;
270 fractpart = modf(v, &intpart);
271 if (fractpart == 0.0) {
277 v = v < 0 ? -271828.0 : 314159.0;
281 if (plong ==
nullptr)
308 v = (v - (double)hipart) * 2147483648.0;
309 x = hipart + (long)v + (expo << 15);
314 #undef Py_IS_INFINITY
325 return new PyBool( *
this );
341 return new PyNone( *
this );
353 return *((
int32*)&hash);
360 :
PyRep(
PyRep::PyTypeBuffer ), mValue( new
Buffer( len, value ) ), mHashCache( -1 ) {}
362 :
PyRep(
PyRep::PyTypeBuffer ), mValue( new
Buffer( buffer ) ), mHashCache( -1 ) {}
365 :
PyRep(
PyRep::PyTypeBuffer ), mValue( *buffer ), mHashCache( -1 ) { *buffer =
nullptr; }
367 :
PyRep(
PyRep::PyTypeBuffer ), mValue( new
Buffer( str.content().begin(), str.content().end() ) ), mHashCache( -1 ) {}
369 :
PyRep(
PyRep::PyTypeBuffer ), mValue( new
Buffer( buffer.content() ) ), mHashCache( buffer.mHashCache ) {}
392 unsigned char* p(
nullptr);
410 p = (
unsigned char *) &
content()[0];
414 x = (1000003*x) ^ *p++;
431 :
PyRep(
PyRep::PyTypeString ), mValue( str ), mHashCache( -1 ) {}
433 :
PyRep(
PyRep::PyTypeString ), mValue( str, len ), mHashCache( -1 ) {}
435 :
PyRep(
PyRep::PyTypeString ), mValue( str ), mHashCache( -1 ) {}
438 :
PyRep(
PyRep::PyTypeString ), mValue( (const char *) &buf.content()[0], buf.content().size() ), mHashCache( -1 ) {}
440 :
PyRep(
PyRep::PyTypeString ), mValue( token.content() ), mHashCache( -1 ) {}
442 :
PyRep(
PyRep::PyTypeString ), mValue( oth.mValue ), mHashCache( oth.mHashCache ) {}
477 :
PyRep(
PyRep::PyTypeWString ), mValue( str, len ), mHashCache( -1 ) {}
479 :
PyRep(
PyRep::PyTypeWString ), mValue( str ), mHashCache( -1 ) {}
482 :
PyRep(
PyRep::PyTypeWString ), mValue( str.content() ), mHashCache( -1 ) {}
484 :
PyRep(
PyRep::PyTypeWString ), mValue( oth.mValue ), mHashCache( oth.mHashCache ) {}
561 for (; cur !=
end; ++cur)
573 for (; cur !=
end && cur_oth != oth_end; ++cur, ++cur_oth)
575 if (*cur_oth ==
nullptr )
578 *cur = (*cur_oth)->Clone();
589 long mult = 1000003L;
592 y =
items[index++]->hash();
597 mult += (long)(82520L + len + len);
619 return new PyList( *
this );
630 for (; cur !=
end; ++cur)
643 for (; cur !=
end && cur_oth != oth_end; ++cur, ++cur_oth)
645 if (*cur_oth ==
nullptr )
648 *cur = (*cur_oth)->Clone();
672 return new PyDict( *
this );
683 for (; cur !=
items.end(); ++cur) {
693 assert( key !=
nullptr );
696 if (res ==
items.end() )
704 assert( key !=
nullptr );
715 if ( key ==
nullptr )
721 if (key->
hash() == -1)
726 if (itr ==
items.end()) {
728 items.insert( std::make_pair( key, value ) );
735 if (value ==
nullptr)
747 for (; cur !=
end; ++cur) {
748 if (cur->second ==
nullptr )
749 SetItem( cur->first->Clone(), nullptr );
751 SetItem( cur->first->Clone(), cur->second->Clone() );
761 :
PyRep(
PyRep::PyTypeObject), mType(type), mArguments(args) { }
765 :
PyRep(
PyRep::PyTypeObject), mType(new
PyString(*oth.type())), mArguments(oth.arguments()) { }
787 mHeader(header), mIsType2(is_type_2), mList(new
PyList()), mDict(new
PyDict()) { }
789 mHeader(oth.header()->
Clone()), mIsType2(oth.isType2()), mList(new
PyList()), mDict(new
PyDict()) { }
821 :
PyObjectEx(false, _CreateHeader(type, args, enclosed)) { }
823 :
PyObjectEx(false, _CreateHeader(args1, args2, enclosed)) { }
825 :
PyObjectEx(false, _CreateHeader(type, args, keywords, enclosed)) { }
827 :
PyObjectEx(false, _CreateHeader(type, args, keywords, enclosed)) { }
831 assert(
header() !=
nullptr );
837 assert(
header() !=
nullptr );
844 assert(
header() !=
nullptr );
858 for (; cur != kw->
end(); ++cur) {
859 if (cur->first->IsString() )
860 if (cur->first->AsString()->content() == keyword )
869 if (args ==
nullptr )
889 if (args2 ==
nullptr )
909 if (args ==
nullptr )
915 if (body->
size() > 2 )
918 codelog(COMMON__WARNING,
"This constructor is used. please finish code.");
925 if (args ==
nullptr )
931 if (body->
size() > 2 )
934 codelog(COMMON__WARNING,
"This constructor is used. please finish code.");
943 :
PyObjectEx( true, _CreateHeader( args, keywords, enclosed)) { }
945 :
PyObjectEx( true, _CreateHeader( args, keywords, enclosed)) { }
949 assert(
header() !=
nullptr );
955 assert(
header() !=
nullptr );
963 for (; cur != kw->
end(); ++cur)
964 if ( cur->first->IsString() )
965 if ( cur->first->AsString()->content() == keyword )
973 assert( args !=
nullptr );
974 if (keywords ==
nullptr )
991 assert( args !=
nullptr );
992 if (keywords ==
nullptr )
1011 :
PyRep(
PyRep::PyTypePackedRow), mHeader(header), mFields(new
PyList(header->ColumnCount()) ) { }
1013 :
PyRep(
PyRep::PyTypePackedRow), mHeader(oth.header()), mFields(new
PyList(oth.header()->ColumnCount())) { }
1033 if (!
header()->VerifyValue( index, value ) ) {
1087 mData( oth.data() == nullptr ? nullptr : new
PyBuffer( *oth.data() ) ),
1088 mDecoded( oth.decoded() == nullptr ? nullptr : oth.decoded()->
Clone() )
1116 sLog.Error(
"Marshal",
"Failed to marshal rep %p.",
mDecoded );
1137 :
PyRep(
PyRep::PyTypeChecksumedStream), mStream(t), mChecksum(sum) { }
1139 :
PyRep(
PyRep::PyTypeChecksumedStream), mStream(oth.stream()->
Clone()), mChecksum( oth.checksum()) { }
virtual bool VisitNone(const PyNone *rep)
PyWString(const char *str, size_t len)
static std::string StringContent(PyRep *pRep)
static PyTuple * _CreateHeader(PyTuple *args, PyDict *keywords, bool enclosed=false)
itemID[count] Create count or of the specified() x() y(z)-Jump to the specified position in space.Stopped." ) COMMAND( translocate
virtual bool VisitTuple(const PyTuple *rep)
the nested types Visitor
#define _log(type, fmt,...)
PyRep * Clone() const
Clones object.
PyTuple & operator=(const PyTuple &oth)
bool visit(PyVisitor &v) const
Visits object.
PyRep * GetItem(size_t index) const
Returns Python object.
PyRep * GetItemString(const char *key) const
Obtains database entry based on given key string.
virtual bool VisitSubStream(const PySubStream *rep)
const Buffer & content() const
Get the const PyBuffer content.
DBRowDescriptor * header() const
PyRep * Clone() const
Clones object.
virtual bool VisitDict(const PyDict *rep)
virtual bool VisitPackedRow(const PyPackedRow *rep)
PackedRow type visitor.
PyTuple * GetArgs() const
const std::string & content() const
Get the PyWString content.
static PyTuple * _CreateHeader(PyToken *type, PyTuple *args, bool enclosed=false)
PyRep * Clone() const
Clones object.
PyRep * Clone() const
Clones object.
storage_type::iterator iterator
virtual bool VisitString(const PyString *rep)
virtual bool VisitWString(const PyWString *rep)
PyPackedRow & operator=(const PyPackedRow &oth)
storage_type::const_iterator const_iterator
PyRep * Clone() const
Clones object.
PyRep * FindKeyword(const char *keyword) const
A reference-counted object.
PyRep * Clone() const
Clones object.
PyObjectEx_Type2(PyTuple *args, PyDict *keywords, bool enclosed=false)
PyRep * Clone() const
Clones object.
Python floating point number.
storage_type *const mFields
bool visit(PyVisitor &v) const
Visits object.
const_iterator begin() const
PyRep * Clone() const
Clones object.
storage_type::iterator iterator
PyList & operator=(const PyList &oth)
storage_type::const_iterator const_iterator
static uint32 IntegerValueU32(PyRep *pRep)
bool Marshal(const PyRep *rep, Buffer &into)
PyRep * Clone() const
Clones object.
PyRep * Clone() const
Clones object.
bool visit(PyVisitor &v) const
Visits object.
int32 hash() const
virtual function to generate a hash value of a object.
bool visit(PyVisitor &v) const
Visits object.
virtual bool VisitToken(const PyToken *rep)
bool visit(PyVisitor &v) const
Visits object.
virtual bool VisitReal(const PyFloat *rep)
bool visit(PyVisitor &v) const
Visits object.
PyToken * GetType() const
int32 hash() const
virtual function to generate a hash value of a object.
PyList(size_t item_count=0)
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
PyRep * Clone() const
Clones object.
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
virtual bool VisitLong(const PyLong *rep)
#define LONG_BIT_PyLong_SHIFT
#define sLog
Evaluates to a NewLog instance.
PyString(const char *str)
size_t size() const
Obtains length of the buffer.
virtual bool VisitObjectEx(const PyObjectEx *rep)
PyObject(const char *type, PyRep *args)
Generic class for buffers.
PyObjectEx_Type1(PyToken *type, PyTuple *args, bool enclosed=false)
PyRep * Clone() const
Clones object.
Python object "blue.DBRowDescriptor".
PyTuple * new_tuple(int64 arg1)
bool visit(PyVisitor &v) const
Visits object.
virtual bool VisitBoolean(const PyBool *rep)
bool visit(PyVisitor &v) const
Visits object.
#define codelog(type, fmt,...)
void SetItem(size_t index, PyRep *object)
Stores Python object.
PyRep * GetItem(PyRep *key) const
Obtains a database entry based on given key object.
virtual bool VisitSubStruct(const PySubStruct *rep)
wrapper types Visitor
void SetItem(size_t index, PyRep *object)
Stores Python object.
int32 hash() const
virtual function to generate a hash value of a object.
PyRep * Clone() const
Clones object.
bool visit(PyVisitor &v) const
Visits object.
int32 hash() const
virtual function to generate a hash value of a object.
storage_type::iterator iterator
bool visit(PyVisitor &v) const
Visits object.
PyRep * FindKeyword(const char *keyword) const
virtual int32 hash() const
virtual function to generate a hash value of a object.
bool visit(PyVisitor &v) const
Visits object.
PyChecksumedStream(PyRep *t, uint32 sum)
int32 hash() const
virtual function to generate a hash value of a object.
PyToken(const char *token)
#define Py_IS_INFINITY(X)
bool visit(PyVisitor &v) const
Visits object.
virtual bool VisitInteger(const PyInt *rep)
primitive data visitors
PyTuple(size_t item_count)
PyRep * Clone() const
Clones object.
PyDict * GetKeywords() const
int32 hash() const
virtual function to generate a hash value of a object.
PyType
Python wire object types.
PyRep * Clone() const
Clones object.
const char *const s_mTypeString[]
PyRep * Unmarshal(const Buffer &data)
Turns marshal stream into Python object.
const_iterator begin() const
Python token (eg. class name).
const Buffer *const mValue
PyObjectEx(bool is_type_2, PyRep *header)
Wrapper class for PyObjectEx of type 1.
int32 hash() const
virtual function to generate a hash value of a object.
int32 hash() const
virtual function to generate a hash value of a object.
virtual ~PyChecksumedStream()
virtual bool VisitObject(const PyObject *rep)
Object type visitor.
const_iterator end() const
PyRep * Clone() const
Clones object.
storage_type::const_iterator const_iterator
PyRep * Clone() const
Clones object.
bool visit(PyVisitor &v) const
Visits object.
PyObjectEx & operator=(const PyObjectEx &oth)
bool SetField(uint32 index, PyRep *value)
PyTuple * GetArgs() const
PyPackedRow(DBRowDescriptor *header)
int32 hash() const
virtual function to generate a hash value of a object.
const std::string & content() const
Get the PyString content.
bool visit(PyVisitor &v) const
Visits object.
const_iterator end() const
PyRep * Clone() const
Clones object.
bool visit(PyVisitor &v) const
Visits object.
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type() key(value)-Send an OnRemoteMessage" ) COMMAND( setbpattr
static int64 IntegerValue(PyRep *pRep)
const_iterator end() const
PyDict & operator=(const PyDict &oth)
bool visit(PyVisitor &v) const
Visits object.
DBRowDescriptor *const mHeader
const_iterator begin() const
PyBuffer(size_t len, const uint8 &value)
size_t size() const
Obtains length of string.
virtual bool VisitBuffer(const PyBuffer *rep)
bool visit(PyVisitor &v) const
Visits object.
entityID heal the character with the entityID note giving you detailed ship status information gives a list of all dynamic entities and players and their destinyState in this bubble shows some current destiny variables save all items
void SetItem(PyRep *key, PyRep *value)
SetItem adds or sets a database entry.
bool visit(PyVisitor &v) const
Visits object.
const char * TypeString() const
virtual bool VisitList(const PyList *rep)
PyDict * GetKeywords() const
virtual bool visit(PyVisitor &v) const =0
Visits object.
virtual bool VisitChecksumedStream(const PyChecksumedStream *rep)