guththila_reader.h

00001 
00002 /*
00003  * Licensed to the Apache Software Foundation (ASF) under one or more
00004  * contributor license agreements.  See the NOTICE file distributed with
00005  * this work for additional information regarding copyright ownership.
00006  * The ASF licenses this file to You under the Apache License, Version 2.0
00007  * (the "License"); you may not use this file except in compliance with
00008  * the License.  You may obtain a copy of the License at
00009  *
00010  *      http://www.apache.org/licenses/LICENSE-2.0
00011  *
00012  * Unless required by applicable law or agreed to in writing, software
00013  * distributed under the License is distributed on an "AS IS" BASIS,
00014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015  * See the License for the specific language governing permissions and
00016  * limitations under the License.
00017  */
00018 #ifndef GUTHTHILA_READER_H
00019 #define GUTHTHILA_READER_H
00020 
00021 #include <stdio.h>
00022 #include <guththila_defines.h>
00023 #include <axutil_utils.h>
00024 EXTERN_C_START()  typedef int(
00025     GUTHTHILA_CALL * GUTHTHILA_READ_INPUT_CALLBACK)(
00026         guththila_char_t *buffer,
00027         int size,
00028         void *ctx);
00029 enum guththila_reader_type
00030 {
00031     GUTHTHILA_FILE_READER =
00032         1, GUTHTHILA_IO_READER, GUTHTHILA_MEMORY_READER
00033 };
00034 typedef struct guththila_reader_s
00035 {
00036     int
00037     type;
00038 
00039     FILE *
00040     fp;
00041     guththila_char_t *
00042     buff;
00043     int
00044     buff_size;
00045 
00046     GUTHTHILA_READ_INPUT_CALLBACK
00047     input_read_callback;
00048     void *
00049     context;
00050     
00051 }
00052 guththila_reader_t;
00053 
00054 #ifndef GUTHTHILA_READER_SET_LAST_START
00055 #define GUTHTHILA_READER_SET_LAST_START(_reader, _start) ((_reader)->start = _start)
00056 #endif  /*  */
00057 
00058 #ifndef GUTHTHILA_READER_STEP_BACK
00059 #define GUTHTHILA_READER_STEP_BACK(_reader) ((_reader->next--))
00060 #endif  /*  */
00061 GUTHTHILA_EXPORT guththila_reader_t * GUTHTHILA_CALL
00062 guththila_reader_create_for_file(guththila_char_t *filename,
00063         const axutil_env_t * env);
00064 GUTHTHILA_EXPORT guththila_reader_t * GUTHTHILA_CALL
00065 guththila_reader_create_for_io(GUTHTHILA_READ_INPUT_CALLBACK
00066         input_read_callback, void *ctx,
00067         const axutil_env_t * env);
00068 GUTHTHILA_EXPORT guththila_reader_t * GUTHTHILA_CALL
00069 guththila_reader_create_for_memory(void *buffer,
00070         int size,
00071         const axutil_env_t * env);
00072 GUTHTHILA_EXPORT int GUTHTHILA_CALL  guththila_reader_read(
00073     guththila_reader_t * r,
00074     guththila_char_t * buffer,
00075     int offset,
00076     int length,
00077     const axutil_env_t * env);
00078 GUTHTHILA_EXPORT void GUTHTHILA_CALL  guththila_reader_free(
00079     guththila_reader_t * r,
00080     const axutil_env_t * env);
00081 EXTERN_C_END() 
00082 #endif  /*  */
00083 

Generated on Sat May 3 10:44:35 2008 for Axis2/C by  doxygen 1.5.5