- 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#endif
22
23#if !defined(_WIN32) || defined(__MINGW32__) || defined(__CYGWIN__)
24#define stricmp strcasecmp
25#endif
26
27#if defined(_MSC_VER) && _MSC_VER <= 1200
28 typedef int intptr_t;
29#endif
30
31//****************************************************************************//
32// Dynamic library export setup //
33//****************************************************************************//
34
35#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
36
37#ifndef CAL3D_API
38#ifdef CAL3D_EXPORTS
39#define CAL3D_API __declspec(dllexport)
40#else
41#define CAL3D_API __declspec(dllimport)
42#endif
43#endif
44
45#else
46
47#define CAL3D_API
48
49#endif
50
51//****************************************************************************//
52// Endianness setup //
53//****************************************************************************//
54
55#if defined(__i386__) || \
56 defined(__ia64__) || \
57 defined(WIN32) || \
58 defined(__alpha__) || defined(__alpha) || \
59 defined(__arm__) || \
60 (defined(__mips__) && defined(__MIPSEL__)) || \
61 defined(__SYMBIAN32__) || \
62 defined(__x86_64__) || \
63 defined(__LITTLE_ENDIAN__)
64
65#define CAL3D_LITTLE_ENDIAN
66
67#else
68
69#define CAL3D_BIG_ENDIAN
70
71#endif
72
73//****************************************************************************//
74// Includes //
75//****************************************************************************//
76
77// standard includes
78#include <stdlib.h>
79#include <math.h>
80
81// debug includes
82#include <assert.h>
83
84// STL includes
85#include <iostream>
86#include <fstream>
87#include <sstream>
88#include <string>
89#include <vector>
90#include <list>
91#include <map>
92
93//****************************************************************************//
94// Class declaration //
95//****************************************************************************//
96
97 /*****************************************************************************/
100
101 class CAL3D_API CalPlatform
102{
103// constructors/destructor
104 protected:
105 CalPlatform();
106 virtual ~CalPlatform();
107
108// member functions
109 public:
110 static bool readBytes(std::istream& input, void *pBuffer, int length);
111 static bool readFloat(std::istream& input, float& value);
112 static bool readInteger(std::istream& input, int& value);
113 static bool readString(std::istream& input, std::string& strValue);
114
115 static bool readBytes(char* input, void *pBuffer, int length);
116 static bool readFloat(char* input, float& value);
117 static bool readInteger(char* input, int& value);
118 static bool readString(char* input, std::string& strValue);
119
120 static bool writeBytes(std::ostream& output, const void *pBuffer, int length);
121 static bool writeFloat(std::ostream& output, float value);
122 static bool writeInteger(std::ostream& output, int value);
123 static bool writeString(std::ostream& output, const std::string& strValue);
124};
125
126#endif
127
128//****************************************************************************//
CalPlatform::CalPlatform
CalPlatform()
Constructs the platform instance.
Definition platform.cpp:29
CalPlatform::writeBytes
static bool writeBytes(std::ostream &output, const void *pBuffer, int length)
Writes a number of bytes.
Definition platform.cpp:304
CalPlatform::readBytes
static bool readBytes(std::istream &input, void *pBuffer, int length)
Reads a number of bytes.
Definition platform.cpp:57
CalPlatform::readFloat
static bool readFloat(std::istream &input, float &value)
Reads a float.
Definition platform.cpp:77
CalPlatform::readString
static bool readString(std::istream &input, std::string &strValue)
Reads a string.
Definition platform.cpp:133
CalPlatform::readInteger
static bool readInteger(std::istream &input, int &value)
Reads an integer.
Definition platform.cpp:105
CalPlatform::writeInteger
static bool writeInteger(std::ostream &output, int value)
Writes an integer.
Definition platform.cpp:351
CalPlatform::writeFloat
static bool writeFloat(std::ostream &output, float value)
Writes a float.
Definition platform.cpp:323
CalPlatform::writeString
static bool writeString(std::ostream &output, const std::string &strValue)
Writes a string.
Definition platform.cpp:379

Generated by The Cal3D Team with Doxygen 1.15.0