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
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
27 * For commercial support on build XML enabled solutions contact us:
30 * Advanced Software Production Line, S.L.
31 * C/ Dr. Michavila NÂș 14
32 * Coslada 28820 Madrid
36 * info@aspl.es - http://fact.aspl.es
38 #ifndef __AXL_STREAM_H__
39 #define __AXL_STREAM_H__
46 * \addtogroup axl_stream_module
50 axlStream
* axl_stream_new (const char * stream_source
,
52 const char * file_path
,
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
,
75 bool accept_terminator
,
78 char * axl_stream_get_until_ref (axlStream
* stream
,
81 bool accept_terminator
,
85 char * axl_stream_get_until_zero (axlStream
* stream
,
88 bool accept_terminator
,
91 char * axl_stream_get_until_ref_zero (axlStream
* stream
,
94 bool accept_terminator
,
98 void axl_stream_set_buffer_alloc (axlStream
* stream
,
99 axlStreamAlloc handler
,
103 * @brief Enum value that allows to configure which item to nullify
104 * inside the provided \ref axlStream reference.
109 * @brief Nullify the last chunk returned due to call from \ref axl_stream_get_until.
113 * @brief Nullify the last chunk returned by \ref axl_stream_get_near_to function.
117 * @brief Nullify the last chunk returned by \ref axl_stream_get_following function.
122 void axl_stream_nullify (axlStream
* stream
,
126 char * axl_stream_get_untilv (axlStream
* stream
,
129 bool accept_terminator
,
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
,
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
);
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
,
177 int axl_stream_printf_len (const char * format
,
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
);
216 * \addtogroup axl_string_module
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
228 * @brief Alias definition for \ref axl_stream_strdup_printfv.
230 #define axl_strdup_printfv axl_stream_strdup_printfv