mirror of
https://github.com/SWG-Source/src.git
synced 2026-08-04 04:16:02 -04:00
Removed namespace to allow for dependent name lookups
This commit is contained in:
+6
-4
@@ -569,7 +569,7 @@ const unsigned MAX_ARRAY_SIZE = 1024;
|
||||
template<class ValueType>
|
||||
void AutoVariable<ValueType>::pack(ByteStream & target) const
|
||||
{
|
||||
Base::put(target, value);
|
||||
put(target, value);
|
||||
}
|
||||
|
||||
template<class ValueType>
|
||||
@@ -581,7 +581,8 @@ const unsigned MAX_ARRAY_SIZE = 1024;
|
||||
template<class ValueType>
|
||||
void AutoVariable<ValueType>::unpack(ByteStream::ReadIterator & source)
|
||||
{
|
||||
Base::get(source, value);
|
||||
using Base::get;
|
||||
get(source, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -644,7 +645,7 @@ const unsigned MAX_ARRAY_SIZE = 1024;
|
||||
for(i = array.begin(); i != array.end(); ++i)
|
||||
{
|
||||
ValueType v = (*i);
|
||||
Base::put(target, v);
|
||||
put(target, v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -658,9 +659,10 @@ const unsigned MAX_ARRAY_SIZE = 1024;
|
||||
if (arraySize > MAX_ARRAY_SIZE)
|
||||
arraySize = 0;
|
||||
|
||||
using Base::get;
|
||||
for(unsigned int i = 0; i < arraySize; ++i)
|
||||
{
|
||||
Base::get(source, v);
|
||||
get(source, v);
|
||||
array.push_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
+165
-165
@@ -321,6 +321,171 @@ const unsigned MAX_ARRAY_SIZE = 1024;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, ByteStream & target)
|
||||
{
|
||||
target.put(source.getBuffer(), source.getSize());
|
||||
source.advance(source.getSize());
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, double & target)
|
||||
{
|
||||
source.get(&target, 8);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, float & target)
|
||||
{
|
||||
source.get(&target, 4);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, uint64 & target)
|
||||
{
|
||||
source.get(&target, 8);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, int64 & target)
|
||||
{
|
||||
source.get(&target, 8);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, uint32 & target)
|
||||
{
|
||||
source.get(&target, 4);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, int32 & target)
|
||||
{
|
||||
source.get(&target, 4);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, uint16 & target)
|
||||
{
|
||||
source.get(&target, 2);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, int16 & target)
|
||||
{
|
||||
source.get(&target, 2);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, uint8 & target)
|
||||
{
|
||||
source.get(&target, 1);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, int8 & target)
|
||||
{
|
||||
source.get(&target, 1);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, unsigned char * const target, const unsigned int targetSize)
|
||||
{
|
||||
source.get(target, targetSize);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, bool & target)
|
||||
{
|
||||
source.get(&target, 1);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
inline void put(ByteStream & target, ByteStream::ReadIterator & source)
|
||||
{
|
||||
target.put(source.getBuffer(), source.getSize());
|
||||
source.advance(source.getSize());
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const double value)
|
||||
{
|
||||
double temp = byteSwap(value);
|
||||
target.put(&temp, 8);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const float value)
|
||||
{
|
||||
float temp = byteSwap(value);
|
||||
target.put(&temp, 4);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const uint64 value)
|
||||
{
|
||||
uint64 temp = byteSwap(value);
|
||||
target.put(&temp, 8);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const int64 value)
|
||||
{
|
||||
int64 temp = byteSwap(value);
|
||||
target.put(&temp, 8);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const uint32 value)
|
||||
{
|
||||
uint32 temp = byteSwap(value);
|
||||
target.put(&temp, 4);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const int32 value)
|
||||
{
|
||||
int32 temp = byteSwap(value);
|
||||
target.put(&temp, 4);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const uint16 value)
|
||||
{
|
||||
uint16 temp = byteSwap(value);
|
||||
target.put(&temp, 2);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const int16 value)
|
||||
{
|
||||
int16 temp = byteSwap(value);
|
||||
target.put(&temp, 2);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const uint8 value)
|
||||
{
|
||||
target.put(&value, 1);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const int8 value)
|
||||
{
|
||||
target.put(&value, 1);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const bool & source)
|
||||
{
|
||||
target.put(&source, 1);
|
||||
}
|
||||
|
||||
|
||||
inline void put(ByteStream & target, const unsigned char * const source, const unsigned int sourceSize)
|
||||
{
|
||||
target.put(source, sourceSize);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const ByteStream & source)
|
||||
{
|
||||
target.put(source.begin().getBuffer(), source.begin().getSize());
|
||||
}
|
||||
|
||||
void get(ByteStream::ReadIterator & source, std::string & target);
|
||||
void put(ByteStream & target, const std::string & source);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -499,171 +664,6 @@ const unsigned MAX_ARRAY_SIZE = 1024;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, ByteStream & target)
|
||||
{
|
||||
target.put(source.getBuffer(), source.getSize());
|
||||
source.advance(source.getSize());
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, double & target)
|
||||
{
|
||||
source.get(&target, 8);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, float & target)
|
||||
{
|
||||
source.get(&target, 4);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, uint64 & target)
|
||||
{
|
||||
source.get(&target, 8);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, int64 & target)
|
||||
{
|
||||
source.get(&target, 8);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, uint32 & target)
|
||||
{
|
||||
source.get(&target, 4);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, int32 & target)
|
||||
{
|
||||
source.get(&target, 4);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, uint16 & target)
|
||||
{
|
||||
source.get(&target, 2);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, int16 & target)
|
||||
{
|
||||
source.get(&target, 2);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, uint8 & target)
|
||||
{
|
||||
source.get(&target, 1);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, int8 & target)
|
||||
{
|
||||
source.get(&target, 1);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, unsigned char * const target, const unsigned int targetSize)
|
||||
{
|
||||
source.get(target, targetSize);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, bool & target)
|
||||
{
|
||||
source.get(&target, 1);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
inline void put(ByteStream & target, ByteStream::ReadIterator & source)
|
||||
{
|
||||
target.put(source.getBuffer(), source.getSize());
|
||||
source.advance(source.getSize());
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const double value)
|
||||
{
|
||||
double temp = byteSwap(value);
|
||||
target.put(&temp, 8);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const float value)
|
||||
{
|
||||
float temp = byteSwap(value);
|
||||
target.put(&temp, 4);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const uint64 value)
|
||||
{
|
||||
uint64 temp = byteSwap(value);
|
||||
target.put(&temp, 8);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const int64 value)
|
||||
{
|
||||
int64 temp = byteSwap(value);
|
||||
target.put(&temp, 8);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const uint32 value)
|
||||
{
|
||||
uint32 temp = byteSwap(value);
|
||||
target.put(&temp, 4);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const int32 value)
|
||||
{
|
||||
int32 temp = byteSwap(value);
|
||||
target.put(&temp, 4);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const uint16 value)
|
||||
{
|
||||
uint16 temp = byteSwap(value);
|
||||
target.put(&temp, 2);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const int16 value)
|
||||
{
|
||||
int16 temp = byteSwap(value);
|
||||
target.put(&temp, 2);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const uint8 value)
|
||||
{
|
||||
target.put(&value, 1);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const int8 value)
|
||||
{
|
||||
target.put(&value, 1);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const bool & source)
|
||||
{
|
||||
target.put(&source, 1);
|
||||
}
|
||||
|
||||
|
||||
inline void put(ByteStream & target, const unsigned char * const source, const unsigned int sourceSize)
|
||||
{
|
||||
target.put(source, sourceSize);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const ByteStream & source)
|
||||
{
|
||||
target.put(source.begin().getBuffer(), source.begin().getSize());
|
||||
}
|
||||
|
||||
void get(ByteStream::ReadIterator & source, std::string & target);
|
||||
void put(ByteStream & target, const std::string & source);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
+169
-168
@@ -331,6 +331,171 @@ const unsigned MAX_ARRAY_SIZE = 1024;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, ByteStream & target)
|
||||
{
|
||||
target.put(source.getBuffer(), source.getSize());
|
||||
source.advance(source.getSize());
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, double & target)
|
||||
{
|
||||
source.get(&target, 8);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, float & target)
|
||||
{
|
||||
source.get(&target, 4);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, uint64 & target)
|
||||
{
|
||||
source.get(&target, 8);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, int64 & target)
|
||||
{
|
||||
source.get(&target, 8);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, uint32 & target)
|
||||
{
|
||||
source.get(&target, 4);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, int32 & target)
|
||||
{
|
||||
source.get(&target, 4);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, uint16 & target)
|
||||
{
|
||||
source.get(&target, 2);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, int16 & target)
|
||||
{
|
||||
source.get(&target, 2);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, uint8 & target)
|
||||
{
|
||||
source.get(&target, 1);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, int8 & target)
|
||||
{
|
||||
source.get(&target, 1);
|
||||
}
|
||||
|
||||
inline unsigned get(ByteStream::ReadIterator & source, unsigned char * const target, const unsigned int targetSize)
|
||||
{
|
||||
return source.get(target, targetSize);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, bool & target)
|
||||
{
|
||||
source.get(&target, 1);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
inline void put(ByteStream & target, ByteStream::ReadIterator & source)
|
||||
{
|
||||
target.put(source.getBuffer(), source.getSize());
|
||||
source.advance(source.getSize());
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const double value)
|
||||
{
|
||||
double temp = byteSwap(value);
|
||||
target.put(&temp, 8);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const float value)
|
||||
{
|
||||
float temp = byteSwap(value);
|
||||
target.put(&temp, 4);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const uint64 value)
|
||||
{
|
||||
uint64 temp = byteSwap(value);
|
||||
target.put(&temp, 8);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const int64 value)
|
||||
{
|
||||
int64 temp = byteSwap(value);
|
||||
target.put(&temp, 8);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const uint32 value)
|
||||
{
|
||||
uint32 temp = byteSwap(value);
|
||||
target.put(&temp, 4);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const int32 value)
|
||||
{
|
||||
int32 temp = byteSwap(value);
|
||||
target.put(&temp, 4);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const uint16 value)
|
||||
{
|
||||
uint16 temp = byteSwap(value);
|
||||
target.put(&temp, 2);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const int16 value)
|
||||
{
|
||||
int16 temp = byteSwap(value);
|
||||
target.put(&temp, 2);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const uint8 value)
|
||||
{
|
||||
target.put(&value, 1);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const int8 value)
|
||||
{
|
||||
target.put(&value, 1);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const bool & source)
|
||||
{
|
||||
target.put(&source, 1);
|
||||
}
|
||||
|
||||
|
||||
inline void put(ByteStream & target, const unsigned char * const source, const unsigned int sourceSize)
|
||||
{
|
||||
target.put(source, sourceSize);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const ByteStream & source)
|
||||
{
|
||||
target.put(source.begin().getBuffer(), source.begin().getSize());
|
||||
}
|
||||
|
||||
unsigned get(ByteStream::ReadIterator & source, std::string & target);
|
||||
void put(ByteStream & target, const std::string & source);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -412,7 +577,7 @@ const unsigned MAX_ARRAY_SIZE = 1024;
|
||||
template<class ValueType>
|
||||
void AutoVariable<ValueType>::pack(ByteStream & target) const
|
||||
{
|
||||
Base::put(target, value);
|
||||
put(target, value);
|
||||
}
|
||||
|
||||
template<class ValueType>
|
||||
@@ -424,7 +589,7 @@ const unsigned MAX_ARRAY_SIZE = 1024;
|
||||
template<class ValueType>
|
||||
void AutoVariable<ValueType>::unpack(ByteStream::ReadIterator & source)
|
||||
{
|
||||
Base::get(source, value);
|
||||
get(source, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -480,8 +645,9 @@ const unsigned MAX_ARRAY_SIZE = 1024;
|
||||
template<class ValueType>
|
||||
inline void AutoArray<ValueType>::pack(ByteStream & target) const
|
||||
{
|
||||
using Base::put;
|
||||
unsigned int arraySize = array.size();
|
||||
Base::put(target, arraySize);
|
||||
put(target, arraySize);
|
||||
|
||||
typename std::vector<ValueType>::const_iterator i;
|
||||
for(i = array.begin(); i != array.end(); ++i)
|
||||
@@ -509,171 +675,6 @@ const unsigned MAX_ARRAY_SIZE = 1024;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, ByteStream & target)
|
||||
{
|
||||
target.put(source.getBuffer(), source.getSize());
|
||||
source.advance(source.getSize());
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, double & target)
|
||||
{
|
||||
source.get(&target, 8);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, float & target)
|
||||
{
|
||||
source.get(&target, 4);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, uint64 & target)
|
||||
{
|
||||
source.get(&target, 8);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, int64 & target)
|
||||
{
|
||||
source.get(&target, 8);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, uint32 & target)
|
||||
{
|
||||
source.get(&target, 4);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, int32 & target)
|
||||
{
|
||||
source.get(&target, 4);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, uint16 & target)
|
||||
{
|
||||
source.get(&target, 2);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, int16 & target)
|
||||
{
|
||||
source.get(&target, 2);
|
||||
target = byteSwap(target);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, uint8 & target)
|
||||
{
|
||||
source.get(&target, 1);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, int8 & target)
|
||||
{
|
||||
source.get(&target, 1);
|
||||
}
|
||||
|
||||
inline unsigned get(ByteStream::ReadIterator & source, unsigned char * const target, const unsigned int targetSize)
|
||||
{
|
||||
return source.get(target, targetSize);
|
||||
}
|
||||
|
||||
inline void get(ByteStream::ReadIterator & source, bool & target)
|
||||
{
|
||||
source.get(&target, 1);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
inline void put(ByteStream & target, ByteStream::ReadIterator & source)
|
||||
{
|
||||
target.put(source.getBuffer(), source.getSize());
|
||||
source.advance(source.getSize());
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const double value)
|
||||
{
|
||||
double temp = byteSwap(value);
|
||||
target.put(&temp, 8);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const float value)
|
||||
{
|
||||
float temp = byteSwap(value);
|
||||
target.put(&temp, 4);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const uint64 value)
|
||||
{
|
||||
uint64 temp = byteSwap(value);
|
||||
target.put(&temp, 8);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const int64 value)
|
||||
{
|
||||
int64 temp = byteSwap(value);
|
||||
target.put(&temp, 8);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const uint32 value)
|
||||
{
|
||||
uint32 temp = byteSwap(value);
|
||||
target.put(&temp, 4);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const int32 value)
|
||||
{
|
||||
int32 temp = byteSwap(value);
|
||||
target.put(&temp, 4);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const uint16 value)
|
||||
{
|
||||
uint16 temp = byteSwap(value);
|
||||
target.put(&temp, 2);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const int16 value)
|
||||
{
|
||||
int16 temp = byteSwap(value);
|
||||
target.put(&temp, 2);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const uint8 value)
|
||||
{
|
||||
target.put(&value, 1);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const int8 value)
|
||||
{
|
||||
target.put(&value, 1);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const bool & source)
|
||||
{
|
||||
target.put(&source, 1);
|
||||
}
|
||||
|
||||
|
||||
inline void put(ByteStream & target, const unsigned char * const source, const unsigned int sourceSize)
|
||||
{
|
||||
target.put(source, sourceSize);
|
||||
}
|
||||
|
||||
inline void put(ByteStream & target, const ByteStream & source)
|
||||
{
|
||||
target.put(source.begin().getBuffer(), source.begin().getSize());
|
||||
}
|
||||
|
||||
unsigned get(ByteStream::ReadIterator & source, std::string & target);
|
||||
void put(ByteStream & target, const std::string & source);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +64,31 @@ namespace Plat_Unicode
|
||||
|
||||
String & appendStringField (String & dst, const String & src, size_t width, FieldAlignment fa = FA_LEFT, unicode_char_t pad = ' ', bool truncate = false);
|
||||
String & appendStringField (String & dst, const NarrowString & src, size_t width, FieldAlignment fa = FA_LEFT, unicode_char_t pad = ' ', bool truncate = false);
|
||||
// ======================================================================
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
/**
|
||||
* Hacky code to correctly handle Cyrillic.
|
||||
*/
|
||||
|
||||
inline unicode_char_t trueUpper(unicode_char_t letter)
|
||||
{
|
||||
if ((cyrillic_lower_first <= letter) && (letter <= cyrillic_lower_last)) {
|
||||
return letter + (cyrillic_upper_first - cyrillic_lower_first);
|
||||
} else {
|
||||
return static_cast<unicode_char_t>(toupper(letter));
|
||||
}
|
||||
}
|
||||
|
||||
inline unicode_char_t trueLower(unicode_char_t letter)
|
||||
{
|
||||
if ((cyrillic_upper_first <= letter) && (letter <= cyrillic_upper_last)) {
|
||||
return letter - (cyrillic_upper_first - cyrillic_lower_first);
|
||||
} else {
|
||||
return static_cast<unicode_char_t>(tolower(letter));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare substrings of str2 and str1, each starting with pos and containing n characters
|
||||
*/
|
||||
@@ -335,30 +359,6 @@ namespace Plat_Unicode
|
||||
{
|
||||
return appendStringField (dst, narrowToWide (src), width, fa, pad, truncate);
|
||||
}
|
||||
// ======================================================================
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
/**
|
||||
* Hacky code to correctly handle Cyrillic.
|
||||
*/
|
||||
|
||||
inline unicode_char_t trueUpper(unicode_char_t letter)
|
||||
{
|
||||
if ((cyrillic_lower_first <= letter) && (letter <= cyrillic_lower_last)) {
|
||||
return letter + (cyrillic_upper_first - cyrillic_lower_first);
|
||||
} else {
|
||||
return static_cast<unicode_char_t>(toupper(letter));
|
||||
}
|
||||
}
|
||||
|
||||
inline unicode_char_t trueLower(unicode_char_t letter)
|
||||
{
|
||||
if ((cyrillic_upper_first <= letter) && (letter <= cyrillic_upper_last)) {
|
||||
return letter - (cyrillic_upper_first - cyrillic_lower_first);
|
||||
} else {
|
||||
return static_cast<unicode_char_t>(tolower(letter));
|
||||
}
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
};
|
||||
|
||||
+5
-5
@@ -40,7 +40,7 @@ namespace VChatSystem
|
||||
typedef unsigned ResultCode;
|
||||
|
||||
|
||||
typedef enum ResultCode_t
|
||||
enum ResultCode_t
|
||||
{
|
||||
RESULT_SUCCESS = 0,
|
||||
RESULT_TIMEOUT,
|
||||
@@ -109,7 +109,7 @@ namespace VChatSystem
|
||||
RESULT_END
|
||||
};
|
||||
|
||||
typedef enum CommandType_t
|
||||
enum CommandType_t
|
||||
{
|
||||
COMMAND_MUTE = 0,
|
||||
COMMAND_UNMUTE,
|
||||
@@ -130,13 +130,13 @@ namespace VChatSystem
|
||||
COMMAND_END
|
||||
};
|
||||
|
||||
typedef enum ConnectionType
|
||||
enum ConnectionType
|
||||
{
|
||||
CONNECTION_TYPE_UNKNOWN = 0,
|
||||
CONNECTION_TYPE_VHCAT_SYSTEM
|
||||
};
|
||||
|
||||
typedef enum ChannelType
|
||||
enum ChannelType
|
||||
{
|
||||
CHAN_TYPE_UNKNOWN = 0,
|
||||
CHAN_TYPE_DIR,
|
||||
@@ -144,7 +144,7 @@ namespace VChatSystem
|
||||
CHAN_TYPE_PROXIMITY
|
||||
};
|
||||
|
||||
typedef enum BanStatus
|
||||
enum BanStatus
|
||||
{
|
||||
BAN = 0,
|
||||
UNBAN
|
||||
|
||||
+103
-81
@@ -5,7 +5,7 @@
|
||||
|
||||
#ifndef API_NAMESPACE
|
||||
#pragma message ("apiMessages.h: API_NAMESPACE undefined")
|
||||
//#else
|
||||
//#else
|
||||
//#pragma message ("apiMessages.h: API_NAMESPACE:")
|
||||
//#pragma message API_NAMESPACE
|
||||
#endif
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "Base/serializeClasses.h"
|
||||
//#include "Base/serialize.h"
|
||||
#include "apiMacros.h"
|
||||
#include "apiTypeNameValuePair.h"
|
||||
|
||||
@@ -38,7 +39,7 @@ namespace API_NAMESPACE
|
||||
MESSAGE_GET_CONFIGURATION = 0x0ff5,
|
||||
|
||||
MESSAGE_SHUTDOWN_NOTIFY = 0x0f00,
|
||||
|
||||
|
||||
// Server Messages
|
||||
MESSAGE_CONNECT_REPLY = 0x7ff3,
|
||||
MESSAGE_GET_STATUS_REPLY = 0x7ff4,
|
||||
@@ -147,6 +148,90 @@ namespace API_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace soe
|
||||
{
|
||||
inline unsigned Write(unsigned char * stream, unsigned size, const API_NAMESPACE::Message::Base & data, unsigned version = 0)
|
||||
{
|
||||
unsigned written = 0;
|
||||
unsigned writtenSize = Write(stream, size, written, version);
|
||||
|
||||
if (writtenSize <= 0) { return 0; }
|
||||
written = data.Write(stream + writtenSize, size - writtenSize, version);
|
||||
if (written <= 0) { return 0; }
|
||||
writtenSize = Write(stream, size, written, version);
|
||||
|
||||
return (writtenSize + written);
|
||||
}
|
||||
|
||||
inline unsigned Read(const unsigned char * stream, unsigned size, API_NAMESPACE::Message::Base & data, unsigned, unsigned version = 0)
|
||||
{
|
||||
unsigned messageSize = 0;
|
||||
unsigned readSize = Read(stream, size, messageSize, version);
|
||||
unsigned readIn = 0;
|
||||
|
||||
size -= readSize;
|
||||
stream += readSize;
|
||||
if (messageSize > size) { return 0; }
|
||||
readIn = data.Read(stream, messageSize, version);
|
||||
if (readIn <= 0) { return 0; }
|
||||
|
||||
return (readSize + messageSize);
|
||||
}
|
||||
|
||||
inline unsigned Write(unsigned char * stream, unsigned size, const API_NAMESPACE::Message::Base::DeepPointer & data, unsigned version = 0)
|
||||
{
|
||||
API_NAMESPACE::Message::Base *msg = (API_NAMESPACE::Message::Base *)data;
|
||||
|
||||
if (msg) {
|
||||
return Write(stream, size, *msg, version);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline unsigned Read(const unsigned char * stream, unsigned size, API_NAMESPACE::Message::Base::DeepPointer & data, unsigned, unsigned version = 0)
|
||||
{
|
||||
unsigned msgSize = 0;
|
||||
unsigned msgId = 0;
|
||||
unsigned sizeSize = Read(stream, size, msgSize, version);
|
||||
unsigned idSize = (sizeSize > 0) ? Read(stream + sizeSize, size - sizeSize, msgId, version) : 0;
|
||||
|
||||
if (idSize <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
data.SetMessageType(msgId);
|
||||
|
||||
API_NAMESPACE::Message::Base *msg = data;
|
||||
|
||||
if (msg) {
|
||||
return Read(stream, size, *msg, 0, version);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PRINTABLE_MESSAGES
|
||||
inline int Print(char * stream, unsigned size, const API_NAMESPACE::Message::Base & data, unsigned maxDepth=INT_MAX)
|
||||
{
|
||||
return data.Print(stream, size, maxDepth);
|
||||
|
||||
}
|
||||
|
||||
inline int Print(char * stream, unsigned size, const API_NAMESPACE::Message::Base::DeepPointer & data, unsigned maxDepth=INT_MAX)
|
||||
{
|
||||
API_NAMESPACE::Message::Base *msg = (API_NAMESPACE::Message::Base *)data;
|
||||
|
||||
if (msg) {
|
||||
return Print(stream, size, *msg, maxDepth);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
#include "Base/serializeTemplates.h"
|
||||
|
||||
@@ -297,7 +382,7 @@ namespace API_NAMESPACE
|
||||
DefineMessageBegin(Connect, Basic, MESSAGE_CONNECT)
|
||||
DefineMessageMember(Version, std::string)
|
||||
DefineMessageMember(Description, std::string)
|
||||
|
||||
|
||||
DefineMessageEnd
|
||||
|
||||
|
||||
@@ -362,93 +447,30 @@ namespace API_NAMESPACE
|
||||
|
||||
DECLSPEC void Read(soe::NameValuePair &dest, const Message::NameValuePair &src);
|
||||
DECLSPEC void Write(const soe::NameValuePair &src, Message::NameValuePair &dest);
|
||||
|
||||
#ifdef API_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace soe
|
||||
{
|
||||
inline unsigned Write(unsigned char * stream, unsigned size, const API_NAMESPACE::Message::Base & data, unsigned version = 0)
|
||||
{
|
||||
unsigned written = 0;
|
||||
unsigned writtenSize = Write(stream, size, written, version);
|
||||
namespace soe {
|
||||
|
||||
if (writtenSize <= 0) { return 0; }
|
||||
written = data.Write(stream + writtenSize, size - writtenSize, version);
|
||||
if (written <= 0) { return 0; }
|
||||
writtenSize = Write(stream, size, written, version);
|
||||
inline unsigned Read(const unsigned char * stream, unsigned size, API_NAMESPACE::Message::NameValuePair & data, unsigned maxLen, unsigned version = 0)
|
||||
{
|
||||
NameValuePair dest;
|
||||
unsigned returnval = Read(stream, size, dest, maxLen, version);
|
||||
API_NAMESPACE::Write(dest, data);
|
||||
|
||||
return (writtenSize + written);
|
||||
}
|
||||
return returnval;
|
||||
}
|
||||
|
||||
inline unsigned Read(const unsigned char * stream, unsigned size, API_NAMESPACE::Message::Base & data, unsigned, unsigned version = 0)
|
||||
{
|
||||
unsigned messageSize = 0;
|
||||
unsigned readSize = Read(stream, size, messageSize, version);
|
||||
unsigned readIn = 0;
|
||||
inline unsigned Write(unsigned char * stream, unsigned size, const API_NAMESPACE::Message::NameValuePair & data, unsigned version = 0)
|
||||
{
|
||||
NameValuePair dest;
|
||||
API_NAMESPACE::Read(dest, data);
|
||||
|
||||
size -= readSize;
|
||||
stream += readSize;
|
||||
if (messageSize > size) { return 0; }
|
||||
readIn = data.Read(stream, messageSize, version);
|
||||
if (readIn <= 0) { return 0; }
|
||||
|
||||
return (readSize + messageSize);
|
||||
}
|
||||
|
||||
inline unsigned Write(unsigned char * stream, unsigned size, const API_NAMESPACE::Message::Base::DeepPointer & data, unsigned version = 0)
|
||||
{
|
||||
API_NAMESPACE::Message::Base *msg = (API_NAMESPACE::Message::Base *)data;
|
||||
|
||||
if (msg) {
|
||||
return Write(stream, size, *msg, version);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline unsigned Read(const unsigned char * stream, unsigned size, API_NAMESPACE::Message::Base::DeepPointer & data, unsigned, unsigned version = 0)
|
||||
{
|
||||
unsigned msgSize = 0;
|
||||
unsigned msgId = 0;
|
||||
unsigned sizeSize = Read(stream, size, msgSize, version);
|
||||
unsigned idSize = (sizeSize > 0) ? Read(stream + sizeSize, size - sizeSize, msgId, version) : 0;
|
||||
|
||||
if (idSize <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
data.SetMessageType(msgId);
|
||||
|
||||
API_NAMESPACE::Message::Base *msg = data;
|
||||
|
||||
if (msg) {
|
||||
return Read(stream, size, *msg, 0, version);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PRINTABLE_MESSAGES
|
||||
inline int Print(char * stream, unsigned size, const API_NAMESPACE::Message::Base & data, unsigned maxDepth=INT_MAX)
|
||||
{
|
||||
return data.Print(stream, size, maxDepth);
|
||||
|
||||
}
|
||||
|
||||
inline int Print(char * stream, unsigned size, const API_NAMESPACE::Message::Base::DeepPointer & data, unsigned maxDepth=INT_MAX)
|
||||
{
|
||||
API_NAMESPACE::Message::Base *msg = (API_NAMESPACE::Message::Base *)data;
|
||||
|
||||
if (msg) {
|
||||
return Print(stream, size, *msg, maxDepth);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Write(stream, size, dest, version);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//#endif //_API_MESSAGES_H
|
||||
|
||||
Reference in New Issue
Block a user