- Cal3D 0.11 API Reference -

platform.h
1//****************************************************************************//
2// platform.h //
3// Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger //
4//****************************************************************************//
5// This library is free software; you can redistribute it and/or modify it //
6// under the terms of the GNU Lesser General Public License as published by //
7// the Free Software Foundation; either version 2.1 of the License, or (at //
8// your option) any later version. //
9//****************************************************************************//
10
11#ifndef CAL_PLATFORM_H
12#define CAL_PLATFORM_H
13
14//****************************************************************************//
15// Compiler configuration //
16//****************************************************************************//
17
18#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
19#pragma warning(disable : 4251)
20#pragma warning(disable : 4786)
21#define snprintf _snprintf
22#endif
23
24#if !defined(_WIN32) || defined(__MINGW32__) || defined(__CYGWIN__)
25#define stricmp strcasecmp
26#endif
27
28#if defined(_MSC_VER) && _MSC_VER <= 1200
29typedef int intptr_t;
30#endif
31
32//****************************************************************************//
33// Dynamic library export setup //
34//****************************************************************************//
35
36#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
37
38#ifndef CAL3D_API
39#ifdef CAL3D_EXPORTS
40#define CAL3D_API __declspec(dllexport)
41#else
42#define CAL3D_API __declspec(dllimport)
43#endif
44#endif
45
46#else
47
48#define CAL3D_API
49
50#endif
51
52//****************************************************************************//
53// Endianness setup //
54//****************************************************************************//
55
56#if defined(__i386__) || \
57 defined(__ia64__) || \
58 defined(WIN32) || \
59 defined(__alpha__) || defined(__alpha) || \
60 defined(__arm__) || \
61 (defined(__mips__) && defined(__MIPSEL__)) || \
62 defined(__SYMBIAN32__) || \
63 defined(__x86_64__) || \
64 defined(__LITTLE_ENDIAN__)
65
66#define CAL3D_LITTLE_ENDIAN
67
68#else
69
70#define CAL3D_BIG_ENDIAN
71
72#endif
73
74//****************************************************************************//
75// Includes //
76//****************************************************************************//
77
78// standard includes
79#include <stdlib.h>
80#include <math.h>
81#include <string.h>
82
83// debug includes
84#include <assert.h>
85
86// STL includes
87#include <iostream>
88#include <fstream>
89#include <sstream>
90#include <string>
91#include <vector>
92#include <list>
93#include <map>
94
95//****************************************************************************//
96// Class declaration //
97//****************************************************************************//
98
99 /*****************************************************************************/
102
103class CAL3D_API CalPlatform
104{
105// constructors/destructor
106protected:
107 CalPlatform();
108 virtual ~CalPlatform();
109
110// member functions
111public:
112 static bool readBytes(std::istream& input, void *pBuffer, int length);
113 static bool readFloat(std::istream& input, float& value);
114 static bool readShort(std::istream& input, short& value);
115 static bool readInteger(std::istream& input, int& value);
116 static bool readString(std::istream& input, std::string& strValue);
117
118 static bool readBytes(char* input, void *pBuffer, int length);
119 static bool readFloat(char* input, float& value);
120 static bool readShort(char* input, short& value);
121 static bool readInteger(char* input, int& value);
122 static bool readString(char* input, std::string& strValue);
123
124 static bool writeBytes(std::ostream& output, const void *pBuffer, int length);
125 static bool writeFloat(std::ostream& output, float value);
126 static bool writeShort(std::ostream& output, short value);
127 static bool writeInteger(std::ostream& output, int value);
128 static bool writeString(std::ostream& output, const std::string& strValue);
129};
130
131#endif
132
133//****************************************************************************//
CalPlatform()
Constructs the platform instance.
Definition platform.cpp:30
static bool writeBytes(std::ostream &output, const void *pBuffer, int length)
Writes a number of bytes.
Definition platform.cpp:359
static bool readShort(std::istream &input, short &value)
Reads a short.
Definition platform.cpp:106
static bool readBytes(std::istream &input, void *pBuffer, int length)
Reads a number of bytes.
Definition platform.cpp:58
static bool readFloat(std::istream &input, float &value)
Reads a float.
Definition platform.cpp:78
static bool writeShort(std::ostream &output, short value)
Writes a short.
Definition platform.cpp:406
static bool readString(std::istream &input, std::string &strValue)
Reads a string.
Definition platform.cpp:160
static bool readInteger(std::istream &input, int &value)
Reads an integer.
Definition platform.cpp:132
static bool writeInteger(std::ostream &output, int value)
Writes an integer.
Definition platform.cpp:432
static bool writeFloat(std::ostream &output, float value)
Writes a float.
Definition platform.cpp:378
static bool writeString(std::ostream &output, const std::string &strValue)
Writes a string.
Definition platform.cpp:460

Generated at by The Cal3D Team with Doxygen 1.15.0