00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef AXIS2_STREAM_H
00018 #define AXIS2_STREAM_H
00019
00020 #include <axis2_allocator.h>
00021
00022 #ifdef __cplusplus
00023 extern "C"
00024 {
00025 #endif
00026
00027 struct axis2_stream;
00028 struct axis2_stream_ops;
00029
00041 AXIS2_DECLARE_DATA typedef struct axis2_stream_ops
00042 {
00043
00049 axis2_status_t (AXIS2_CALL *free) (struct axis2_stream *stream);
00050
00057 axis2_status_t (AXIS2_CALL *read) (void *buffer
00058 , size_t count);
00065 axis2_status_t (AXIS2_CALL *write)
00066 (const void *buffer, size_t count);
00067
00074 void * (AXIS2_CALL *file_open)
00075 (const char *file_name, const char *options);
00076
00082 axis2_status_t (AXIS2_CALL *file_close)
00083 (void *file_ptr);
00084
00089 axis2_char_t (AXIS2_CALL *file_get_char)
00090 (void *file_ptr);
00091
00098 axis2_status_t (AXIS2_CALL *file_unget_char)
00099 (const char chr, void *file_ptr);
00100
00101 } axis2_stream_ops_t;
00102
00108 typedef struct axis2_stream
00109 {
00111 struct axis2_stream_ops *ops;
00112 int axis2_eof;
00113 } axis2_stream_t;
00114
00115 #define AXIS2_STREAM_FREE(stream) ((stream->ops)->free(stream))
00116
00117 #define AXIS2_STREAM_READ(stream, buffer, count) \
00118 ((stream)->ops->read(buffer, count))
00119 #define AXIS2_STREAM_WRITE(stream, buffer, count) \
00120 ((stream->ops)->write(buffer, count))
00121 #define AXIS2_STREAM_FILE_OPEN(stream, file_name, options) \
00122 ((stream->ops)->file_open(file_name, options))
00123 #define AXIS2_STREAM_FILE_CLOSE(stream, file_ptr) \
00124 ((stream->ops)->file_close(file_ptr))
00125 #define AXIS2_STREAM_FILE_GET_CHAR(stream, file_ptr) \
00126 ((stream->ops)->file_get_char(file_ptr))
00127 #define AXIS2_STREAM_FILE_UNGET_CHAR(stream, chr, file_ptr) \
00128 ((stream->ops)->file_unget_char(chr, file_ptr))
00129
00132 #ifdef __cplusplus
00133 }
00134 #endif
00135
00136 #endif