TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BinaryInput.cpp File Reference
#include "G3D/platform.h"
#include "G3D/BinaryInput.h"
#include "G3D/Array.h"
#include "G3D/fileutils.h"
#include "G3D/Log.h"
#include "G3D/FileSystem.h"
#include <zlib.h>
#include <cstring>
+ Include dependency graph for BinaryInput.cpp:

Namespaces

 G3D
 

Macros

#define IMPLEMENT_READER(ucase, lcase)
 
#define IMPLEMENT_READER(ucase, lcase)
 
#define IMPLEMENT_READER(ucase, lcase)
 

Functions

static uint32 G3D::readUInt32FromBuffer (const uint8 *data, bool swapBytes)
 
static bool G3D::isNewline (char c)
 

Detailed Description

Author
Morgan McGuire, graphics3d.com Copyright 2001-2013, Morgan McGuire. All rights reserved.

2001-08-09 2013-01-03

   {    
   BinaryOutput b("c:/tmp/test.b", BinaryOutput::LITTLE_ENDIAN);
   float f = 3.1415926;
   int i = 1027221;
   std::string s = "Hello World!";
   b.writeFloat32(f);
   b.writeInt32(i);
   b.writeString(s);
   b.commit();
   BinaryInput in("c:/tmp/test.b", BinaryInput::LITTLE_ENDIAN);
   debugAssert(f == in.readFloat32());
   int ii = in.readInt32();
   debugAssert(i == ii);
   debugAssert(s == in.readString());
   }
 

Macro Definition Documentation

#define IMPLEMENT_READER (   ucase,
  lcase 
)
Value:
void BinaryInput::read##ucase(std::vector<lcase>& out, int64 n) {\
out.resize(n);\
read##ucase(&out[0], n);\
}\
\
\
void BinaryInput::read##ucase(Array<lcase>& out, int64 n) {\
out.resize(n);\
read##ucase(out.begin(), n);\
}
int64_t int64
Definition: Define.h:145
#define IMPLEMENT_READER (   ucase,
  lcase 
)
Value:
void BinaryInput::read##ucase(lcase* out, int64 n) {\
if (sizeof(lcase) == 1) {\
readBytes(out, n);\
} else {\
for (int64 i = 0; i < n ; ++i) {\
out[i] = read##ucase();\
}\
}\
}
int64_t int64
Definition: Define.h:145
#define IMPLEMENT_READER (   ucase,
  lcase 
)
Value:
void BinaryInput::read##ucase(lcase* out, int64 n) {\
if (m_swapBytes) {\
for (int64 i = 0; i < n; ++i) {\
out[i] = read##ucase();\
}\
} else {\
readBytes(out, sizeof(lcase) * n);\
}\
}
int64_t int64
Definition: Define.h:145