- 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
82// debug includes
83#include <assert.h>
84
85// STL includes
86#include <iostream>
87#include <fstream>
88#include <sstream>
89#include <string>
90#include <vector>
91#include <list>
92#include <map>
93
94//****************************************************************************//
95// Class declaration //
96//****************************************************************************//
97
98 /*****************************************************************************/
102class CAL3D_API CalPlatform
103{
104// constructors/destructor
105protected:
106 CalPlatform();
107 virtual ~CalPlatform();
108
109// member functions
110public:
111 static bool readBytes(std::istream& input, void *pBuffer, int length);
112 static bool readFloat(std::istream& input, float& value);
113 static bool readShort(std::istream& input, short& value);
114 static bool readInteger(std::istream& input, int& value);
115 static bool readString(std::istream& input, std::string& strValue);
116
117 static bool readBytes(char* input, void *pBuffer, int length);
118 static bool readFloat(char* input, float& value);
119 static bool readShort(char* input, short& value);
120 static bool readInteger(char* input, int& value);
121 static bool readString(char* input, std::string& strValue);
122
123 static bool writeBytes(std::ostream& output, const void *pBuffer, int length);
124 static bool writeFloat(std::ostream& output, float value);
125 static bool writeShort(std::ostream& output, short value);
126 static bool writeInteger(std::ostream& output, int value);
127 static bool writeString(std::ostream& output, const std::string& strValue);
128};
129
130#endif
131
132//****************************************************************************//
The platform class.
Definition platform.h:103

Generated by The Cal3D Team with Doxygen 1.10.0