httpmessage  0.4.0
HTTP message parsing library
text.h
Go to the documentation of this file.
1 /**************************************************************************************$
2  * httpmessage
3  ***************************************************************************************
4  * Copyright © 2022 by Renaud Guillard (dev@nore.fr)
5  * Distributed under the terms of the MIT License, see LICENSE
6  ***************************************************************************************
7  */
8 
14 #if !defined (LIBHTTPMESSAGGE_TEXT_H__)
15 #define LIBHTTPMESSAGGE_TEXT_H__
16 
18 
20 
21 #include <stddef.h>
22 
27 typedef struct __httpmessage_stringview
28 {
30  const char *text;
32  size_t length;
34 
35 
36 
47 
56  httpmessage_stringview *string,
57  const char *text);
58 
68 
80 
93  const httpmessage_stringview *b);
94 
106  const char *text, size_t length);
107 
118  const httpmessage_stringview *a,
119  const httpmessage_stringview *b);
120 
132  const char *text, size_t length);
133 
135 
136 
137 #endif /* LIBHTTPMESSAGGE_TEXT_H__ */
138 
HMAPI int httpmessage_stringview_caseless_compare(const httpmessage_stringview *a, const httpmessage_stringview *b)
Compare two string view, ignoring case.
HMAPI int httpmessage_stringview_caseless_compare_text(const httpmessage_stringview *a, const char *text, size_t length)
Compare a string view to a text, ignoring case.
#define HTTPMESSAGE_C_END
End exter C block.
Definition: preprocessor.h:44
HMAPI void httpmessage_stringview_assign(httpmessage_stringview *string, const char *text)
Assign text to the string view.
HMAPI void httpmessage_stringview_clear(httpmessage_stringview *string)
Reset string view.
HMAPI void httpmessage_stringview_free(httpmessage_stringview **string)
Free a string view.
const char * text
First character of the string.
Definition: text.h:30
httpmessage_stringview * httpmessage_stringview_new(void)
Allocate and initialize a new string view.
size_t length
Text length.
Definition: text.h:32
HMAPI int httpmessage_stringview_compare_text(const httpmessage_stringview *a, const char *text, size_t length)
Compare a string view to a text.
Preprocessor macro definitions.
HMAPI int httpmessage_stringview_compare(const httpmessage_stringview *a, const httpmessage_stringview *b)
Compare two string view.
#define HTTPMESSAGE_C_BEGIN
Begin extern C block.
Definition: preprocessor.h:40
Reference to a text buffer.
Definition: text.h:27
#define HMAPI
C API exposition macro.
Definition: preprocessor.h:23