メインページ | アルファベット順一覧 | 構成 | ファイル一覧 | 構成メンバ | ファイルメンバ | 関連ページ

# dkcStream.h

説明を見る。

    00001
    00014 #ifndef DKUTIL_C_STREAM_H
    00015 #define DKUTIL_C_STREAM_H
    00016
    00017
    00018 #include "dkcOSIndependent.h"
    00019 #include "dkcMemoryStream.h"
    00020
    00021
    00023 typedef struct dkc_Stream{
    00024     UINT mMode;
    00026     BYTE mChangeEndian;
    00028     BYTE mProcessMode;
    00029     /*union{
    00030         DKC_MEMORYSTREAM *mmem;
    00031         FILE *mfp;
    00032     }uni;*/
    00033     void *mSig;
    00034 }DKC_STREAM;
    00035
    00036 //#error streamのSEEKにRead用とWrite用をつける。
    00037
    00038
    00039 enum edkcStream{
    00041     edkcStreamSeekCurrent = SEEK_CUR,
    00043     edkcStreamSeekEnd = SEEK_END,
    00045     edkcStreamSeekSet = SEEK_SET,
    00047     edkcStreamInitMemory = 1,
    00049     edkcStreamInitFile = 2,
    00051     edkcStreamDefaultEndian = 4,
    00053     edkcStreamBigEndian = 8,
    00055     edkcStreamLittleEndian = 16,
    00057     edkcStreamProcessDefault = 32,
    00059     edkcStreamProcessAsOrdered = 64,
    00063     edkcStreamWriteErrorWhenEndianChange = 128,
    00064
    00067     edkcStreamInitMemoryAdapter = 256,
    00068
    00069     edkcStreamWin32PromoteFlag = edkcStreamLittleEndian | edkcStreamProcessAsOrdered,
    00070     edkcStreamMacPromoteFlag = edkcStreamBigEndian | edkcStreamProcessAsOrdered,
    00071
    00072 };
    00073
    00074 //**********************************************************
    00075
    00076
    00087
    00088 DKC_EXTERN DKC_STREAM * WINAPI dkcAllocStream(UINT flag,const void *default_data,size_t size,const char *filename,const char *mode);
    00089
    00090 DKC_EXTERN DKC_STREAM *WINAPI dkcAllocStreamMemoryType(UINT flag,const void *default_data,size_t size);
    00091
    00092 DKC_EXTERN DKC_STREAM *WINAPI dkcAllocStreamFileType(UINT flag,const char *filename,const char *mode);
    00098 DKC_EXTERN DKC_STREAM *WINAPI dkcAllocStreamMemoryAdapterType(UINT flag,void *adapt_buffer,size_t size);
    00104
    00105 DKC_EXTERN DKC_STREAM *WINAPI dkcAllocStreamEncouragementFileType(const char *filename,const char *mode,BOOL OrderFlag);
    00106
    00112
    00113 DKC_EXTERN int WINAPI dkcFreeStream(DKC_STREAM **ptr);
    00114
    00115 //**********************************************************
    00117 DKC_EXTERN int WINAPI dkcStreamSeek(DKC_STREAM *ptr,int offset,int origin);
    00118
    00120 DKC_EXTERN long WINAPI dkcStreamTell(DKC_STREAM *ptr);
    00121
    00123 DKC_EXTERN int WINAPI dkcStreamClear(DKC_STREAM *ptr);
    00124
    00125
    00128 DKC_EXTERN int WINAPI dkcStreamFlush(DKC_STREAM *ptr);
    00129
    00131 DKC_EXTERN BOOL WINAPI dkcStreamEOF(DKC_STREAM *ptr);
    00133 DKC_EXTERN BOOL WINAPI dkcStreamError(DKC_STREAM *ptr);
    00134
    00135 //**********************************************************
    00151
    00152 DKC_EXTERN int WINAPI dkcStreamRead(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00153
    00154
    00160 DKC_EXTERN int WINAPI dkcStreamRead8(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00161
    00162
    00170 DKC_EXTERN int WINAPI dkcStreamRead16(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00176 DKC_EXTERN int WINAPI dkcStreamRead32(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00181 DKC_EXTERN int WINAPI dkcStreamRead64(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00182
    00183
    00184 //**********************************************************
    00185
    00187 DKC_EXTERN int WINAPI dkcStreamRef(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00188
    00192 DKC_EXTERN int WINAPI dkcStreamRef8(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00193
    00194 DKC_EXTERN int WINAPI dkcStreamRef16(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00200 DKC_EXTERN int WINAPI dkcStreamRef32(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00205 DKC_EXTERN int WINAPI dkcStreamRef64(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00206
    00207
    00208 //**********************************************************
    00209
    00210
    00217
    00218
    00219 DKC_EXTERN int WINAPI dkcStreamWrite(DKC_STREAM *ptr,const void *buffer,size_t size);
    00220
    00221 DKC_EXTERN int WINAPI dkcStreamWrite8(DKC_STREAM *ptr,void *buffer,size_t size);
    00222
    00223 DKC_EXTERN int WINAPI dkcStreamWrite16(DKC_STREAM *ptr,const void *buffer,size_t size);
    00224
    00225 DKC_EXTERN int WINAPI dkcStreamWrite32(DKC_STREAM *ptr,const void *buffer,size_t size);
    00226
    00227 DKC_EXTERN int WINAPI dkcStreamWrite64(DKC_STREAM *ptr,const void *buffer,size_t size);
    00228
    00229
    00230 //**********************************************************
    00231
    00238 typedef int (WINAPI *DKC_STREAM_PROCESS_TYPE)(DKC_STREAM *p,void *buffer,size_t size,void *data);
    00239
    00240
    00241 DKC_EXTERN int WINAPI dkcStreamProcess(DKC_STREAM *ptr,void *buffer,size_t size,
    00242                                                                              DKC_STREAM_PROCESS_TYPE write_t,void *data);
    00243
    00244 DKC_EXTERN int WINAPI dkcStreamProcess16(DKC_STREAM *ptr,void *buffer,size_t size,
    00245                                                                              DKC_STREAM_PROCESS_TYPE write_t,void *data);
    00246
    00247 DKC_EXTERN int WINAPI dkcStreamProcess32(DKC_STREAM *ptr,void *buffer,size_t size,
    00248                                                                              DKC_STREAM_PROCESS_TYPE write_t,void *data);
    00249
    00250 DKC_EXTERN int WINAPI dkcStreamProcess64(DKC_STREAM *ptr,void *buffer,size_t size,
    00251                                                                              DKC_STREAM_PROCESS_TYPE write_t,void *data);
    00252
    00253
    00254
    00255
    00256
    00257
    00258 #endif