EvEmu
0.8.4
11 September 2021
|
Turns Python objects into marshal bytecode. More...
#include "EVEMarshal.h"
Public Member Functions | |
MarshalStream () | |
bool | Save (const PyRep *rep, Buffer &into) |
Protected Member Functions | |
bool | SaveStream (const PyRep *rep) |
template<typename T > | |
void | Put (const T &value) |
template<typename Iter > | |
void | Put (Iter first, Iter last) |
void | PutSizeEx (uint32 size) |
bool | VisitInteger (const PyInt *rep) |
bool | VisitLong (const PyLong *rep) |
Adds a long to the stream. More... | |
bool | VisitBoolean (const PyBool *rep) |
Adds a boolean to the stream. More... | |
bool | VisitReal (const PyFloat *rep) |
Adds a double to the stream. More... | |
bool | VisitNone (const PyNone *rep) |
Adds a None object to the stream. More... | |
bool | VisitBuffer (const PyBuffer *rep) |
Adds a buffer to the stream. More... | |
bool | VisitString (const PyString *rep) |
add a string object to the data stream More... | |
bool | VisitWString (const PyWString *rep) |
add a wide string object to the data stream More... | |
bool | VisitToken (const PyToken *rep) |
add a token object to the data stream More... | |
bool | VisitTuple (const PyTuple *rep) |
bool | VisitList (const PyList *rep) |
bool | VisitDict (const PyDict *rep) |
bool | VisitObject (const PyObject *rep) |
Adds an object to the stream. More... | |
bool | VisitObjectEx (const PyObjectEx *rep) |
Adds a New object to the stream. More... | |
bool | VisitPackedRow (const PyPackedRow *pyPackedRow) |
Adds a packed row to the stream. More... | |
bool | VisitSubStruct (const PySubStruct *rep) |
Adds a sub structure to the stream. More... | |
bool | VisitSubStream (const PySubStream *rep) |
Adds a sub stream to the stream. More... | |
bool | VisitChecksumedStream (const PyChecksumedStream *rep) |
Adds a checksumed stream to the stream. More... | |
![]() | |
virtual | ~PyVisitor () |
Private Member Functions | |
void | SaveVarInteger (const PyLong *v) |
bool | SaveRLE (const Buffer &in) |
Private Attributes | |
Buffer * | mBuffer |
Turns Python objects into marshal bytecode.
Definition at line 59 of file EVEMarshal.h.
MarshalStream::MarshalStream | ( | ) |
|
inlineprotected |
adds given value to the data stream
Definition at line 75 of file EVEMarshal.h.
References Buffer::Append(), and mBuffer.
Referenced by SaveRLE(), SaveVarInteger(), VisitBuffer(), VisitString(), VisitSubStream(), VisitToken(), and VisitWString().
|
inlineprotected |
adds given bytes to the data stream
Definition at line 78 of file EVEMarshal.h.
References Buffer::AppendSeq(), and mBuffer.
|
inlineprotected |
utility for extended size.
Definition at line 81 of file EVEMarshal.h.
Referenced by SaveRLE(), SaveVarInteger(), VisitBuffer(), VisitDict(), VisitList(), VisitString(), VisitSubStream(), VisitToken(), VisitTuple(), and VisitWString().
saves given rep to given buffer
Definition at line 69 of file EVEMarshal.cpp.
References mBuffer, and SaveStream().
Referenced by Marshal().
|
private |
Definition at line 524 of file EVEMarshal.cpp.
References Put(), PutSizeEx(), and Buffer::size().
Referenced by VisitPackedRow().
|
protected |
saves new stream with given rep.
Definition at line 78 of file EVEMarshal.cpp.
References MarshalHeaderByte, and PyRep::visit().
Referenced by Save().
|
private |
Definition at line 503 of file EVEMarshal.cpp.
References DoIntegerSizeCheck, Op_PyLongLong, Op_PyVarInteger, Put(), PutSizeEx(), and PyLong::value().
Referenced by VisitLong().
|
protectedvirtual |
Adds a boolean to the stream.
Reimplemented from PyVisitor.
Definition at line 123 of file EVEMarshal.cpp.
References Op_PyFalse, Op_PyTrue, and PyBool::value().
|
protectedvirtual |
Adds a buffer to the stream.
Reimplemented from PyVisitor.
Definition at line 151 of file EVEMarshal.cpp.
References PyBuffer::content(), Op_PyBuffer, Put(), and PutSizeEx().
|
protectedvirtual |
Adds a checksumed stream to the stream.
TODO: check the implementation of this...
Reimplemented from PyVisitor.
Definition at line 493 of file EVEMarshal.cpp.
References PyChecksumedStream::checksum(), Op_PyChecksumedStream, and PyVisitor::VisitChecksumedStream().
|
protectedvirtual |
Add a dict object to the stream
Reimplemented from PyVisitor.
Definition at line 251 of file EVEMarshal.cpp.
References PyDict::begin(), PyDict::end(), Op_PyDict, PutSizeEx(), and PyDict::size().
|
protectedvirtual |
adds a integer to the data stream
Reimplemented from PyVisitor.
Definition at line 92 of file EVEMarshal.cpp.
References Op_PyByte, Op_PyLong, Op_PyMinusOne, Op_PyOneInteger, Op_PySignedShort, Op_PyZeroInteger, and PyInt::value().
|
protectedvirtual |
Add a list object to the stream
Reimplemented from PyVisitor.
Definition at line 236 of file EVEMarshal.cpp.
References Op_PyEmptyList, Op_PyList, Op_PyOneList, PutSizeEx(), PyList::size(), and PyVisitor::VisitList().
|
protectedvirtual |
Adds a long to the stream.
Reimplemented from PyVisitor.
Definition at line 116 of file EVEMarshal.cpp.
References SaveVarInteger().
|
protectedvirtual |
Adds a None object to the stream.
Reimplemented from PyVisitor.
Definition at line 145 of file EVEMarshal.cpp.
References Op_PyNone.
|
protectedvirtual |
Adds an object to the stream.
Reimplemented from PyVisitor.
Definition at line 269 of file EVEMarshal.cpp.
References Op_PyObject, and PyVisitor::VisitObject().
|
protectedvirtual |
Adds a New object to the stream.
Reimplemented from PyVisitor.
Definition at line 275 of file EVEMarshal.cpp.
References PyList::begin(), PyDict::begin(), PyObjectEx::dict(), PyList::end(), PyDict::end(), PyObjectEx::header(), PyObjectEx::isType2(), PyObjectEx::list(), Op_PackedTerminator, Op_PyObjectEx1, Op_PyObjectEx2, and PyRep::visit().
|
protectedvirtual |
Adds a packed row to the stream.
Reimplemented from PyVisitor.
Definition at line 306 of file EVEMarshal.cpp.
References Buffer::Append(), Buffer::AppendSeq(), PyRep::AsBool(), PyRep::AsFloat(), PyRep::AsInt(), PyRep::AsLong(), Buffer::begin(), DBTYPE_BOOL, DBTYPE_CY, DBTYPE_FILETIME, DBTYPE_GetSizeBits(), DBTYPE_I1, DBTYPE_I2, DBTYPE_I4, DBTYPE_I8, DBTYPE_R4, DBTYPE_R8, DBTYPE_UI1, DBTYPE_UI2, DBTYPE_UI4, DBTYPE_UI8, Buffer::end(), PyPackedRow::GetField(), PyPackedRow::header(), PyRep::IsNone(), Op_PyPackedRow, Buffer::Reserve(), SaveRLE(), EvE::traceStack(), PyInt::value(), PyLong::value(), PyFloat::value(), PyBool::value(), PyRep::visit(), and PyObjectEx::visit().
|
protectedvirtual |
Adds a double to the stream.
Reimplemented from PyVisitor.
Definition at line 133 of file EVEMarshal.cpp.
References Op_PyReal, Op_PyZeroReal, and PyFloat::value().
|
protectedvirtual |
add a string object to the data stream
Reimplemented from PyVisitor.
Definition at line 163 of file EVEMarshal.cpp.
References PyString::content(), Op_PyCharString, Op_PyEmptyString, Op_PyLongString, Op_PyStringTableItem, Put(), PutSizeEx(), sMarshalStringTable, and STRING_TABLE_ERROR.
|
protectedvirtual |
Adds a sub stream to the stream.
Reimplemented from PyVisitor.
Definition at line 464 of file EVEMarshal.cpp.
References Buffer::begin(), PyBuffer::content(), PySubStream::data(), PySubStream::decoded(), PySubStream::EncodeData(), Buffer::end(), Op_PySubStream, Put(), PutSizeEx(), and Buffer::size().
|
protectedvirtual |
Adds a sub structure to the stream.
Reimplemented from PyVisitor.
Definition at line 458 of file EVEMarshal.cpp.
References Op_PySubStruct, and PyVisitor::VisitSubStruct().
|
protectedvirtual |
add a token object to the data stream
Reimplemented from PyVisitor.
Definition at line 207 of file EVEMarshal.cpp.
References PyToken::content(), Op_PyToken, Put(), and PutSizeEx().
|
protectedvirtual |
Add a tuple object to the stream
Reimplemented from PyVisitor.
Definition at line 219 of file EVEMarshal.cpp.
References Op_PyEmptyTuple, Op_PyOneTuple, Op_PyTuple, Op_PyTwoTuple, PutSizeEx(), PyTuple::size(), and PyVisitor::VisitTuple().
|
protectedvirtual |
add a wide string object to the data stream
Reimplemented from PyVisitor.
Definition at line 189 of file EVEMarshal.cpp.
References PyWString::content(), Op_PyEmptyWString, Op_PyWStringUTF8, Put(), and PutSizeEx().
|
private |
Definition at line 146 of file EVEMarshal.h.