Add missing files
[gmpc-magnatune.git] / src / axl / axl_stream.h
blob58d52bb329ae5f4edef9864e66ddb99acc1b3843
1 /*
2 * LibAxl: Another XML library
3 * Copyright (C) 2006 Advanced Software Production Line, S.L.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation; either version 2.1 of
8 * the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the Free
17 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 * 02111-1307 USA
20 * You may find a copy of the license under this software is released
21 * at COPYING file. This is LGPL software: you are welcome to
22 * develop proprietary applications using this library without any
23 * royalty or fee but returning back any change, improvement or
24 * addition in the form of source code, project image, documentation
25 * patches, etc.
27 * For commercial support on build XML enabled solutions contact us:
29 * Postal address:
30 * Advanced Software Production Line, S.L.
31 * C/ Dr. Michavila NÂș 14
32 * Coslada 28820 Madrid
33 * Spain
35 * Email address:
36 * info@aspl.es - http://fact.aspl.es
38 #ifndef __AXL_STREAM_H__
39 #define __AXL_STREAM_H__
41 #include <axl_decl.h>
43 BEGIN_C_DECLS
45 /**
46 * \addtogroup axl_stream_module
47 * @{
50 axlStream * axl_stream_new (const char * stream_source,
51 int stream_size,
52 const char * file_path,
53 int fd_handler,
54 axlError ** error);
56 int axl_stream_inspect (axlStream * stream, const char * chunk, int inspected_size);
58 int axl_stream_peek (axlStream * stream, const char * chunk, int inspected_size);
60 int axl_stream_inspect_several (axlStream * stream, int chunk_num, ...);
62 void axl_stream_accept (axlStream * stream);
64 void axl_stream_move (axlStream * stream, int index);
66 void axl_stream_push (axlStream * stream, const char * content, int size);
68 bool axl_stream_fall_outside (axlStream * stream, int inspected_size);
70 bool axl_stream_check (axlStream * stream, char * chunk, int inspected_size);
72 char * axl_stream_get_until (axlStream * stream,
73 char * valid_chars,
74 int * chunk_matched,
75 bool accept_terminator,
76 int chunk_num, ...);
78 char * axl_stream_get_until_ref (axlStream * stream,
79 char * valid_chars,
80 int * chunk_matched,
81 bool accept_terminator,
82 int * result_size,
83 int chunk_num, ...);
85 char * axl_stream_get_until_zero (axlStream * stream,
86 char * valid_chars,
87 int * chunk_matched,
88 bool accept_terminator,
89 int chunk_num, ...);
91 char * axl_stream_get_until_ref_zero (axlStream * stream,
92 char * valid_chars,
93 int * chunk_matched,
94 bool accept_terminator,
95 int * result_size,
96 int chunk_num, ...);
98 void axl_stream_set_buffer_alloc (axlStream * stream,
99 axlStreamAlloc handler,
100 axlPointer data);
102 /**
103 * @brief Enum value that allows to configure which item to nullify
104 * inside the provided \ref axlStream reference.
107 typedef enum {
108 /**
109 * @brief Nullify the last chunk returned due to call from \ref axl_stream_get_until.
111 LAST_CHUNK,
112 /**
113 * @brief Nullify the last chunk returned by \ref axl_stream_get_near_to function.
115 LAST_NEAR_TO,
116 /**
117 * @brief Nullify the last chunk returned by \ref axl_stream_get_following function.
119 LAST_GET_FOLLOWING
120 } NullifyItem;
122 void axl_stream_nullify (axlStream * stream,
123 NullifyItem item);
126 char * axl_stream_get_untilv (axlStream * stream,
127 char * valid_chars,
128 int * chunk_matched,
129 bool accept_terminator,
130 int * result_size,
131 int chunk_num,
132 va_list args);
134 int axl_stream_get_index (axlStream * stream);
136 int axl_stream_get_global_index (axlStream * stream);
138 int axl_stream_get_size (axlStream * stream);
140 char * axl_stream_get_near_to (axlStream * stream, int count);
142 char * axl_stream_get_following (axlStream * stream, int count);
144 void axl_stream_link (axlStream * stream,
145 axlPointer element,
146 axlDestroyFunc func);
148 void axl_stream_unlink (axlStream * stream);
150 void axl_stream_free (axlStream * stream);
152 bool axl_stream_is_white_space (char * chunk);
154 void axl_stream_consume_white_spaces (axlStream * stream);
156 bool axl_stream_remains (axlStream * stream);
158 /* @} */
160 /* string handling interface */
162 void axl_stream_trim (char * chunk);
164 void axl_stream_trim_with_size (char * chunk, int * trimmed);
166 bool axl_stream_cmp (const char * chunk1, const char * chunk2, int size);
168 bool axl_stream_casecmp (const char * chunk1, const char * chunk2, int size);
170 char * axl_stream_strdup (const char * chunk);
172 char * axl_stream_strdup_n (const char * chunk, int n);
174 int axl_stream_vprintf_len (const char * format,
175 va_list args);
177 int axl_stream_printf_len (const char * format,
178 ...);
180 char * axl_stream_strdup_printf (const char * chunk, ...);
182 char * axl_stream_strdup_printfv (const char * chunk, va_list args);
184 char * axl_stream_strdup_printf_len (const char * chunk,
185 int * chunk_size, ...);
187 char ** axl_stream_split (const char * chunk, int separator_num, ...);
189 void axl_stream_clean_split (char ** split);
191 char * axl_stream_join (char ** strings, const char * separator);
193 char * axl_stream_concat (const char * chunk1, const char * chunk2);
195 int axl_stream_strv_num (char ** chunks);
197 void axl_stream_freev (char ** chunks);
199 char * axl_stream_to_upper (char * chunk);
201 char * axl_stream_to_lower (char * chunk);
203 char * axl_stream_to_upper_copy (const char * chunk);
205 char * axl_stream_to_lower_copy (const char * chunk);
207 bool axl_cmp (const char * string, const char * string2);
209 bool axl_casecmp (const char * string, const char * string2);
211 bool axl_memcmp (const char * string, const char * string2, int size);
213 char * axl_strdup (const char * string);
215 /**
216 * \addtogroup axl_string_module
217 * @{
220 /**
221 * @brief Alias definition for \ref axl_stream_strdup_printf.
223 * See \ref axl_stream_strdup_printf information for more details.
225 #define axl_strdup_printf axl_stream_strdup_printf
227 /**
228 * @brief Alias definition for \ref axl_stream_strdup_printfv.
230 #define axl_strdup_printfv axl_stream_strdup_printfv
232 /* @} */
234 END_C_DECLS
236 #endif