2 * GPAC - Multimedia Framework C SDK
\r
4 * Copyright (c) Jean Le Feuvre 2000-2005
\r
5 * All rights reserved
\r
7 * This file is part of GPAC / common tools sub-project
\r
9 * GPAC is free software; you can redistribute it and/or modify
\r
10 * it under the terms of the GNU Lesser General Public License as published by
\r
11 * the Free Software Foundation; either version 2, or (at your option)
\r
12 * any later version.
\r
14 * GPAC is distributed in the hope that it will be useful,
\r
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 * GNU Lesser General Public License for more details.
\r
19 * You should have received a copy of the GNU Lesser General Public
\r
20 * License along with this library; see the file COPYING. If not, write to
\r
21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
\r
25 #ifndef _GF_TOKEN_H_
\r
26 #define _GF_TOKEN_H_
\r
33 * \file <gpac/token.h>
\r
34 * \brief tokenizer functions.
\r
38 * \addtogroup tok_grp tokenizer
\r
39 * \ingroup utils_grp
\r
40 * \brief String Tokenizer Functions
\r
42 *This section documents the basic string tokenizer of the GPAC framework.
\r
46 #include <gpac/tools.h>
\r
49 *\brief get string component
\r
51 *Gets the next string component comprised in a given set of characters
\r
52 *\param buffer source string to scan
\r
53 *\param start char offset from begining of buffer where tokenization shall start
\r
54 *\param separators separator characters to use
\r
55 *\param token output buffer location
\r
56 *\param token_size output buffer allocated size
\r
57 *\return position of the first char in the buffer after the last terminating separator, or -1 if token could not be found
\r
59 s32 gf_token_get(char *buffer, s32 start, char *separators, char *token, s32 token_size);
\r
61 *\brief get string component without delimitting characters
\r
63 *Gets the next string component comprised in a given set of characters, removing surrounding characters
\r
64 *\param buffer source string to scan
\r
65 *\param start char offset from begining of buffer where tokenization shall start
\r
66 *\param separators separator characters to use
\r
67 *\param strip_set surrounding characters to remove
\r
68 *\param token output buffer location
\r
69 *\param token_size output buffer allocated size
\r
70 *\return position of the first char in the buffer after the last terminating separator, or -1 if token could not be found
\r
72 s32 gf_token_get_strip(char *buffer, s32 start, char *separators, char *strip_set, char *token, s32 token_size);
\r
74 *\brief line removal
\r
76 *Gets one line from buffer and remove delimiters CR, LF and CRLF
\r
77 *\param buffer source string to scan
\r
78 *\param start char offset from begining of buffer where tokenization shall start
\r
79 *\param size size of the input buffer to analyze
\r
80 *\param line_buffer output buffer location
\r
81 *\param line_buffer_size output buffer allocated size
\r
82 *\return position of the first char in the buffer after the last line delimiter, or -1 if no line could be found
\r
84 s32 gf_token_get_line(char *buffer, u32 start, u32 size, char *line_buffer, u32 line_buffer_size);
\r
86 *\brief pattern location
\r
88 *Locates a pattern in the buffer
\r
89 *\param buffer source string to scan
\r
90 *\param start char offset from begining of buffer where tokenization shall start
\r
91 *\param size size of the input buffer to analyze
\r
92 *\param pattern pattern to locate
\r
93 *\return position of the first char in the buffer after the pattern, or -1 if pattern could not be found
\r
95 s32 gf_token_find(char *buffer, u32 start, u32 size, char *pattern);
\r
105 #endif /*_GF_TOKEN_H_*/
\r