Debian Codegraph @

src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/devdoc/string_tokenizer_requirements.md

raw
1 STRING TOKENIZER Requirements
2 ================
3
4 ## Overview
5 The STRING TOKENIZER provides the functionality of splitting a STRING into multiples tokens
6
7 ## Exposed API
8 ```C
9 typedef struct STRING_TOKEN_TAG* STRING_TOKENIZER_HANDLE;
10
11 extern STRING_TOKENIZER_HANDLE STRING_TOKENIZER_create(STRING_HANDLE handle);
12 extern STRING_TOKENIZER_HANDLE STRING_TOKENIZER_create_from_char(const char* input);
13 extern int STRING_TOKENIZER_get_next_token(STRING_TOKENIZER_HANDLE t, STRING_HANDLE output, const char* delimiters);
14 extern void STRING_TOKENIZER_destroy(STRING_TOKENIZER_HANDLE t);
15 ```
16 ### STRING_TOKENIZER_create
17 extern STRING_TOKENIZER_HANDLE STRING_TOKENIZER_create(STRING_HANDLE handle);
18 **SRS_STRING_TOKENIZER_04_001: [** STRING_TOKENIZER_create shall return an NULL STRING_TOKENIZER_HANDLE if parameter handle is NULL **]**
19
20 **SRS_STRING_TOKENIZER_04_002: [** STRING_TOKENIZER_create shall allocate a new STRING_TOKENIZER _HANDLE having the content of the STRING_HANDLE copied and current position pointing at the beginning of the string **]**
21
22 **SRS_STRING_TOKENIZER_04_003: [** STRING_TOKENIZER_create shall return an NULL STRING_TOKENIZER _HANDLE on any error that is encountered **]**
23
24 ### STRING_TOKENIZER_create_from_char
25 extern STRING_TOKENIZER_HANDLE STRING_TOKENIZER_create_from_char(const char* input);
26 **SRS_STRING_TOKENIZER_07_001: [** STRING_TOKENIZER_create_from_char shall return an NULL STRING_TOKENIZER_HANDLE if parameter input is NULL **]**
27
28 **SRS_STRING_TOKENIZER_07_002: [** STRING_TOKENIZER_create_from_char shall allocate a new STRING_TOKENIZER _HANDLE having the content of the STRING_HANDLE copied and current position pointing at the beginning of the string **]**
29
30 **SRS_STRING_TOKENIZER_07_003: [** STRING_TOKENIZER_create_from_char shall return an NULL STRING_TOKENIZER _HANDLE on any error that is encountered **]**
31
32 ### STRING_TOKENIZER_get_next_token
33 extern int STRING_TOKENIZER_get_next_token(STRING_TOKENIZER_HANDLE t, STRING_HANDLE output,const char* delimiters);
34
35 **SRS_STRING_TOKENIZER_04_004: [** STRING_TOKENIZER_get_next_token shall return a nonzero value if any of the 3 parameters is NULL **]**
36
37 **SRS_STRING_TOKENIZER_04_005: [** STRING_TOKENIZER_get_next_token searches the string inside STRING_TOKENIZER_HANDLE for the first character that is NOT contained in the current delimiter **]**
38
39 **SRS_STRING_TOKENIZER_04_006: [** If no such character is found, then STRING_TOKENIZER_get_next_token shall return a nonzero Value (You've reach the end of the string or the string consists with only delimiterstokens). **]**
40
41 **SRS_STRING_TOKENIZER_04_007: [** If such a character is found, STRING_TOKENIZER_get_next_token shall consider it as the start of a token. **]**
42
43 **SRS_STRING_TOKENIZER_04_008: [** STRING_TOKENIZER_get_next_token than searches from the start of a token for a character that is contained in the delimiters string. **]**
44
45 **SRS_STRING_TOKENIZER_04_009: [** If no such character is found, STRING_TOKENIZER_get_next_token extends the current token to the end of the string inside t, copies the token to output and returns 0. **]**
46
47 **SRS_STRING_TOKENIZER_04_010: [** If such a character is found, STRING_TOKENIZER_get_next_token shall consider it the end of the token and copy its content to output, updates the current position inside t to the next character and returns 0. **]**
48
49 **SRS_STRING_TOKENIZER_04_011: [** Each subsequent call to STRING_TOKENIZER_get_next_token starts searching from the saved position on t and behaves as described above. **]**
50
51 **SRS_STRING_TOKENIZER_TOKENIZER_04_014: [** STRING_TOKENIZER_get_next_token shall return nonzero value if t contains an empty string. **]**
52
53 ### STRING_TOKENIZER_destroy
54 extern void STRING_TOKENIZER_destroy(STRING_TOKENIZER_HANDLE t);
55 **SRS_STRING_TOKENIZER_TOKENIZER_04_012: [** STRING_TOKENIZER_destroy shall free the memory allocated by the STRING_TOKENIZER_create **]**
56
57 **SRS_STRING_TOKENIZER_TOKENIZER_04_013: [** When the t argument is NULL, then STRING_TOKENIZER_destroy shall not attempt to free **]**