00001
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00072
00073
00074
00075
00077
00078 #if !defined(_ICCIO_H)
00079 #define _ICCIO_H
00080
00081 #include "IccDefs.h"
00082 #include "stdio.h"
00083
00084 #ifdef USESAMPLEICCNAMESPACE
00085 namespace sampleICC {
00086 #endif
00087
00089 typedef enum {
00090 icSeekSet=0,
00091 icSeekCur,
00092 icSeekEnd,
00093 } icSeekVal;
00094
00103 class ICCPROFLIB_API CIccIO
00104 {
00105 public:
00106
00107 virtual ~CIccIO() {}
00108
00109 virtual void Close() {}
00110
00111 virtual icInt32Number Read8(void *pBuf8, icInt32Number nNum=1) { return 0; }
00112 virtual icInt32Number Write8(void *pBuf8, icInt32Number nNum=1) { return 0; }
00113
00114 icInt32Number ReadLine(void *pBuf8, icInt32Number nNum=256);
00115
00116 icInt32Number Read16(void *pBuf16, icInt32Number nNum=1);
00117 icInt32Number Write16(void *pBuf16, icInt32Number nNum=1);
00118
00119 icInt32Number Read32(void *pBuf32, icInt32Number nNum=1);
00120 icInt32Number Write32(void *pBuf32, icInt32Number nNum=1);
00121
00122 icInt32Number Read64(void *pBuf64, icInt32Number nNum=1);
00123 icInt32Number Write64(void *pBuf64, icInt32Number nNum=1);
00124
00125 icInt32Number Read8Float(void *pBufFloat, icInt32Number nNum=1);
00126 icInt32Number Write8Float(void *pBuf16, icInt32Number nNum=1);
00127
00128 icInt32Number Read16Float(void *pBufFloat, icInt32Number nNum=1);
00129 icInt32Number Write16Float(void *pBuf16, icInt32Number nNum=1);
00130
00131 icInt32Number ReadFloat32Float(void *pBufFloat, icInt32Number nNum=1);
00132 icInt32Number WriteFloat32Float(void *pBuf16, icInt32Number nNum=1);
00133
00134 virtual icInt32Number GetLength() {return 0;}
00135
00136 virtual icInt32Number Seek(icInt32Number nOffset, icSeekVal pos) {return -1;}
00137 virtual icInt32Number Tell() {return 0;}
00138
00140 bool Align32();
00141
00143 bool Sync32(icUInt32Number nOffset=0);
00144 };
00145
00153 class ICCPROFLIB_API CIccFileIO : public CIccIO
00154 {
00155 public:
00156 CIccFileIO();
00157 virtual ~CIccFileIO();
00158
00159 bool Open(const icChar *szFilename, const icChar *szAttr);
00160 virtual void Close();
00161
00162 virtual icInt32Number Read8(void *pBuf, icInt32Number nNum=1);
00163 virtual icInt32Number Write8(void *pBuf, icInt32Number nNum=1);
00164
00165 virtual icInt32Number GetLength();
00166
00167 virtual icInt32Number Seek(icInt32Number nOffset, icSeekVal pos);
00168 virtual icInt32Number Tell();
00169
00170 protected:
00171 FILE *m_fFile;
00172 };
00173
00181 class ICCPROFLIB_API CIccMemIO : public CIccIO
00182 {
00183 public:
00184 CIccMemIO();
00185 virtual ~CIccMemIO();
00186
00187 bool Alloc(icUInt32Number nSize, bool bWrite = false);
00188
00189 bool Attach(icUInt8Number *pData, icUInt32Number nSize, bool bWrite=false);
00190 virtual void Close();
00191
00192 virtual icInt32Number Read8(void *pBuf, icInt32Number nNum=1);
00193 virtual icInt32Number Write8(void *pBuf, icInt32Number nNum=1);
00194
00195 virtual icInt32Number GetLength();
00196
00197 virtual icInt32Number Seek(icInt32Number nOffset, icSeekVal pos);
00198 virtual icInt32Number Tell();
00199
00200 icUInt8Number *GetData() { return m_pData; }
00201
00202 protected:
00203 icUInt8Number *m_pData;
00204 icUInt32Number m_nSize;
00205 icUInt32Number m_nAvail;
00206 icUInt32Number m_nPos;
00207
00208 bool m_bFreeData;
00209 };
00210
00211 #ifdef USESAMPLEICCNAMESPACE
00212 }
00213 #endif
00214
00215 #endif // !defined(_ICCIO_H)