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