00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef CAL_PLATFORM_H
00012 #define CAL_PLATFORM_H
00013
00014
00015
00016
00017
00018 #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
00019 #pragma warning(disable : 4251)
00020 #pragma warning(disable : 4786)
00021 #define snprintf _snprintf
00022 #endif
00023
00024 #if !defined(_WIN32) || defined(__MINGW32__) || defined(__CYGWIN__)
00025 #define stricmp strcasecmp
00026 #endif
00027
00028 #if defined(_MSC_VER) && _MSC_VER <= 1200
00029 typedef int intptr_t;
00030 #endif
00031
00032
00033
00034
00035
00036 #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
00037
00038 #ifndef CAL3D_API
00039 #ifdef CAL3D_EXPORTS
00040 #define CAL3D_API __declspec(dllexport)
00041 #else
00042 #define CAL3D_API __declspec(dllimport)
00043 #endif
00044 #endif
00045
00046 #else
00047
00048 #define CAL3D_API
00049
00050 #endif
00051
00052
00053
00054
00055
00056 #if defined(__i386__) || \
00057 defined(__ia64__) || \
00058 defined(WIN32) || \
00059 defined(__alpha__) || defined(__alpha) || \
00060 defined(__arm__) || \
00061 (defined(__mips__) && defined(__MIPSEL__)) || \
00062 defined(__SYMBIAN32__) || \
00063 defined(__x86_64__) || \
00064 defined(__LITTLE_ENDIAN__)
00065
00066 #define CAL3D_LITTLE_ENDIAN
00067
00068 #else
00069
00070 #define CAL3D_BIG_ENDIAN
00071
00072 #endif
00073
00074
00075
00076
00077
00078
00079 #include <stdlib.h>
00080 #include <math.h>
00081
00082
00083 #include <assert.h>
00084
00085
00086 #include <iostream>
00087 #include <fstream>
00088 #include <sstream>
00089 #include <string>
00090 #include <vector>
00091 #include <list>
00092 #include <map>
00093
00094
00095
00096
00097
00098
00102 class CAL3D_API CalPlatform
00103 {
00104
00105 protected:
00106 CalPlatform();
00107 virtual ~CalPlatform();
00108
00109
00110 public:
00111 static bool readBytes(std::istream& input, void *pBuffer, int length);
00112 static bool readFloat(std::istream& input, float& value);
00113 static bool readShort(std::istream& input, short& value);
00114 static bool readInteger(std::istream& input, int& value);
00115 static bool readString(std::istream& input, std::string& strValue);
00116
00117 static bool readBytes(char* input, void *pBuffer, int length);
00118 static bool readFloat(char* input, float& value);
00119 static bool readShort(char* input, short& value);
00120 static bool readInteger(char* input, int& value);
00121 static bool readString(char* input, std::string& strValue);
00122
00123 static bool writeBytes(std::ostream& output, const void *pBuffer, int length);
00124 static bool writeFloat(std::ostream& output, float value);
00125 static bool writeShort(std::ostream& output, short value);
00126 static bool writeInteger(std::ostream& output, int value);
00127 static bool writeString(std::ostream& output, const std::string& strValue);
00128 };
00129
00130 #endif
00131
00132