OpenBlox
A game engine which provides a simple and easy to learn Lua API.
OB::BitStream Class Reference

#include <BitStream.h>

Public Member Functions

 BitStream ()
 
 BitStream (int bytesToAlloc)
 
 BitStream (unsigned char *dat, unsigned int lenBytes, bool _copyData)
 
 BitStream (const BitStream &bs)
 
virtual ~BitStream ()
 
void reset ()
 
void _addBits (uint32_t numBits)
 
uint32_t getNumBitsAlloc ()
 
uint32_t getNumBitsUsed ()
 
uint32_t getReadOffset ()
 
void padToByteLength (unsigned int bytes)
 
void ignoreBits (uint32_t numBits)
 
void ignoreBytes (unsigned int numBytes)
 
void setWriteOffset (uint32_t offset)
 
bool isNetOrderInternal ()
 
void write0 ()
 
void write1 ()
 
bool readBit ()
 
unsigned char * getData ()
 
unsigned char * copyData ()
 
void writeBits (unsigned char *inByteArray, uint32_t numToWrite, bool rightAligned=true)
 
void write (char *inByteArray, unsigned int numToWrite)
 
bool read (char *outBytearray, unsigned int numToRead)
 
void writeAlignedBytes (unsigned char *inByteArray, unsigned int numToWrite)
 
bool readAlignedBytes (unsigned char *outByteArray, unsigned int numToRead)
 
bool readBits (unsigned char *outByteArray, uint32_t numToRead, bool rightAligned=true)
 
void reverseBytes (unsigned char *inByteArray, unsigned char *outByteArray, unsigned int len)
 
void reverseBytesInPlace (unsigned char *inByteArray, unsigned int len)
 
void writeCString (char *str)
 
void writeString (std::string str)
 
char * readCString ()
 
std::string readString ()
 
void writeVar (shared_ptr< Type::VarWrapper > var)
 
shared_ptr< Type::VarWrapperreadVar (OBEngine *eng)
 
void writeUDim2 (shared_ptr< Type::UDim2 > var)
 
shared_ptr< Type::UDim2readUDim2 ()
 
void writeUDim (shared_ptr< Type::UDim > var)
 
shared_ptr< Type::UDimreadUDim ()
 
void writeColor3 (shared_ptr< Type::Color3 > var)
 
shared_ptr< Type::Color3readColor3 ()
 
void writeVector3 (shared_ptr< Type::Vector3 > var)
 
shared_ptr< Type::Vector3readVector3 ()
 
void writeVector2 (shared_ptr< Type::Vector2 > var)
 
shared_ptr< Type::Vector2readVector2 ()
 
void writeLuaEnum (shared_ptr< Type::LuaEnum > var)
 
shared_ptr< Type::LuaEnumreadLuaEnum ()
 
void writeLuaEnumItem (shared_ptr< Type::LuaEnumItem > var)
 
shared_ptr< Type::LuaEnumItemreadLuaEnumItem ()
 
size_t readSizeT ()
 
int readInt ()
 
double readDouble ()
 
float readFloat ()
 
long readLong ()
 
unsigned long readULong ()
 
ob_uint64 readUInt64 ()
 
ob_int64 readInt64 ()
 
bool readBool ()
 
void writeSizeT (size_t val)
 
void writeInt (int val)
 
void writeDouble (double val)
 
void writeFloat (float val)
 
void writeLong (long val)
 
void writeULong (unsigned long val)
 
void writeUInt64 (ob_uint64 val)
 
void writeInt64 (ob_int64 val)
 
void writeBool (bool val)
 
bool doEndianSwap ()
 
void alignWriteToByteBoundary ()
 
void alignReadToByteBoundary ()
 
uint32_t getNumBytesUsed () const
 

Detailed Description

This is a convenience class used to make crafting packets easy.

Author
John M. Harris, Jr.
Date
March 2017

Constructor & Destructor Documentation

◆ BitStream() [1/4]

OB::BitStream::BitStream ( )

◆ BitStream() [2/4]

OB::BitStream::BitStream ( int  bytesToAlloc)

◆ BitStream() [3/4]

OB::BitStream::BitStream ( unsigned char *  dat,
unsigned int  lenBytes,
bool  _copyData 
)

◆ BitStream() [4/4]

OB::BitStream::BitStream ( const BitStream bs)

◆ ~BitStream()

virtual OB::BitStream::~BitStream ( )
virtual

Member Function Documentation

◆ _addBits()

void OB::BitStream::_addBits ( uint32_t  numBits)

◆ alignReadToByteBoundary()

void OB::BitStream::alignReadToByteBoundary ( )
inline

◆ alignWriteToByteBoundary()

void OB::BitStream::alignWriteToByteBoundary ( )
inline

◆ copyData()

unsigned char* OB::BitStream::copyData ( )

◆ doEndianSwap()

bool OB::BitStream::doEndianSwap ( )
inline

◆ getData()

unsigned char* OB::BitStream::getData ( )

◆ getNumBitsAlloc()

uint32_t OB::BitStream::getNumBitsAlloc ( )

◆ getNumBitsUsed()

uint32_t OB::BitStream::getNumBitsUsed ( )

◆ getNumBytesUsed()

uint32_t OB::BitStream::getNumBytesUsed ( ) const
inline

◆ getReadOffset()

uint32_t OB::BitStream::getReadOffset ( )

◆ ignoreBits()

void OB::BitStream::ignoreBits ( uint32_t  numBits)

◆ ignoreBytes()

void OB::BitStream::ignoreBytes ( unsigned int  numBytes)

◆ isNetOrderInternal()

bool OB::BitStream::isNetOrderInternal ( )

◆ padToByteLength()

void OB::BitStream::padToByteLength ( unsigned int  bytes)

◆ read()

bool OB::BitStream::read ( char *  outBytearray,
unsigned int  numToRead 
)

◆ readAlignedBytes()

bool OB::BitStream::readAlignedBytes ( unsigned char *  outByteArray,
unsigned int  numToRead 
)

◆ readBit()

bool OB::BitStream::readBit ( )

◆ readBits()

bool OB::BitStream::readBits ( unsigned char *  outByteArray,
uint32_t  numToRead,
bool  rightAligned = true 
)

◆ readBool()

bool OB::BitStream::readBool ( )

◆ readColor3()

shared_ptr<Type::Color3> OB::BitStream::readColor3 ( )

◆ readCString()

char* OB::BitStream::readCString ( )

◆ readDouble()

double OB::BitStream::readDouble ( )

◆ readFloat()

float OB::BitStream::readFloat ( )

◆ readInt()

int OB::BitStream::readInt ( )

◆ readInt64()

ob_int64 OB::BitStream::readInt64 ( )

◆ readLong()

long OB::BitStream::readLong ( )

◆ readLuaEnum()

shared_ptr<Type::LuaEnum> OB::BitStream::readLuaEnum ( )

◆ readLuaEnumItem()

shared_ptr<Type::LuaEnumItem> OB::BitStream::readLuaEnumItem ( )

◆ readSizeT()

size_t OB::BitStream::readSizeT ( )

◆ readString()

std::string OB::BitStream::readString ( )

◆ readUDim()

shared_ptr<Type::UDim> OB::BitStream::readUDim ( )

◆ readUDim2()

shared_ptr<Type::UDim2> OB::BitStream::readUDim2 ( )

◆ readUInt64()

ob_uint64 OB::BitStream::readUInt64 ( )

◆ readULong()

unsigned long OB::BitStream::readULong ( )

◆ readVar()

shared_ptr<Type::VarWrapper> OB::BitStream::readVar ( OBEngine eng)

◆ readVector2()

shared_ptr<Type::Vector2> OB::BitStream::readVector2 ( )

◆ readVector3()

shared_ptr<Type::Vector3> OB::BitStream::readVector3 ( )

◆ reset()

void OB::BitStream::reset ( )

◆ reverseBytes()

void OB::BitStream::reverseBytes ( unsigned char *  inByteArray,
unsigned char *  outByteArray,
unsigned int  len 
)

◆ reverseBytesInPlace()

void OB::BitStream::reverseBytesInPlace ( unsigned char *  inByteArray,
unsigned int  len 
)

◆ setWriteOffset()

void OB::BitStream::setWriteOffset ( uint32_t  offset)

◆ write()

void OB::BitStream::write ( char *  inByteArray,
unsigned int  numToWrite 
)

◆ write0()

void OB::BitStream::write0 ( )

◆ write1()

void OB::BitStream::write1 ( )

◆ writeAlignedBytes()

void OB::BitStream::writeAlignedBytes ( unsigned char *  inByteArray,
unsigned int  numToWrite 
)

◆ writeBits()

void OB::BitStream::writeBits ( unsigned char *  inByteArray,
uint32_t  numToWrite,
bool  rightAligned = true 
)

◆ writeBool()

void OB::BitStream::writeBool ( bool  val)

◆ writeColor3()

void OB::BitStream::writeColor3 ( shared_ptr< Type::Color3 var)

◆ writeCString()

void OB::BitStream::writeCString ( char *  str)

◆ writeDouble()

void OB::BitStream::writeDouble ( double  val)

◆ writeFloat()

void OB::BitStream::writeFloat ( float  val)

◆ writeInt()

void OB::BitStream::writeInt ( int  val)

◆ writeInt64()

void OB::BitStream::writeInt64 ( ob_int64  val)

◆ writeLong()

void OB::BitStream::writeLong ( long  val)

◆ writeLuaEnum()

void OB::BitStream::writeLuaEnum ( shared_ptr< Type::LuaEnum var)

◆ writeLuaEnumItem()

void OB::BitStream::writeLuaEnumItem ( shared_ptr< Type::LuaEnumItem var)

◆ writeSizeT()

void OB::BitStream::writeSizeT ( size_t  val)

◆ writeString()

void OB::BitStream::writeString ( std::string  str)

◆ writeUDim()

void OB::BitStream::writeUDim ( shared_ptr< Type::UDim var)

◆ writeUDim2()

void OB::BitStream::writeUDim2 ( shared_ptr< Type::UDim2 var)

◆ writeUInt64()

void OB::BitStream::writeUInt64 ( ob_uint64  val)

◆ writeULong()

void OB::BitStream::writeULong ( unsigned long  val)

◆ writeVar()

void OB::BitStream::writeVar ( shared_ptr< Type::VarWrapper var)

◆ writeVector2()

void OB::BitStream::writeVector2 ( shared_ptr< Type::Vector2 var)

◆ writeVector3()

void OB::BitStream::writeVector3 ( shared_ptr< Type::Vector3 var)

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