/* vim: ts=4 sw=4 sts=4 ff=unix fenc=utf-8 : * ===================================================================== * sc_stream.h * Copyright (c) 2003 - 2011 sys0tem * LICENSE : * LGPL (GNU Lesser General Public License - Version 3,29 June 2007) * http://www.gnu.org/copyleft/lesser.html * or * EPL (Eclipse Public License - v1.0) * http://www.eclipse.org/legal/epl-v10.html * ===================================================================== */ #ifndef __SC_STREAM_H__ #define __SC_STREAM_H__ #include <stddef.h> #include <stdio.h> #ifdef __cplusplus extern "C" { #endif typedef struct { char* buff; int buffSize; int off; int size; } SC_Stream_BufferData; /** * ストリーム。 */ typedef struct SC_Stream_ { int (*readc )(struct SC_Stream_*, char*); int (*read )(struct SC_Stream_*, void*, size_t); int (*readExact )(struct SC_Stream_*, void*, size_t); int (*readLine )(struct SC_Stream_*, char*, size_t); int (*limitedRead)(struct SC_Stream_*, char*, size_t, char*, size_t); int (*writec )(struct SC_Stream_*, char); int (*write )(struct SC_Stream_*, const void*, size_t); int (*writeExact )(struct SC_Stream_*, const void*, size_t); bool (*close )(struct SC_Stream_*); int (*_readCore )(struct SC_Stream_*, void*, size_t); int (*_writeCore )(struct SC_Stream_*, const void*, size_t); SC_Stream_BufferData _data; void* _strmInfo; } SC_Stream; /* ストリーム破棄 */ void SC_Stream_delete(SC_Stream* strm); /* 各ストリームの実装にて使用する */ int SC_Stream_readc_ (SC_Stream*, char*); int SC_Stream_read_ (SC_Stream*, void*, size_t); int SC_Stream_readExact_ (SC_Stream*, void*, size_t); int SC_Stream_readLine_ (SC_Stream*, char*, size_t); int SC_Stream_limitedRead_(SC_Stream*, char*, size_t, char*, size_t); int SC_Stream_writec_ (SC_Stream*, char); int SC_Stream_write_ (SC_Stream*, const void*, size_t); int SC_Stream_writeExact_ (SC_Stream*, const void*, size_t); #ifdef __cplusplus } #endif #endif /* __SC_STREAM_H__ */