libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_uri.h
Go to the documentation of this file.
1/*! \file
2 * \brief GblUri: URI parsing, formatting, validation, and management
3 * \ingroup utils
4 * \todo
5 * - design URI flags
6 * - implement parsing, formatting, validating back-end
7 *
8 * \author Falco Girgis
9 */
10#ifndef GIMBAL_URI_H
11#define GIMBAL_URI_H
12
13#include "../strings/gimbal_string_ref.h"
14
15#define GBL_SELF_TYPE GblUri
16
18
19GBL_FORWARD_DECLARE_STRUCT(GblStringBuffer);
20
21GBL_DECLARE_FLAGS(GBL_URI_FLAGS) {
22 None = 0x0,
23/*
24
25 */
26};
27
28/*! \struct GblUri
29 * \ingroup utils
30 * \brief Represents a decoded URI
31 */
33
34GBL_EXPORT GblUri* GblUri_create (void) GBL_NOEXCEPT;
35
36GBL_EXPORT GblUri* GblUri_createParsed (const char* pToParse,
37 GblBool relaxed) GBL_NOEXCEPT;
38
39GBL_EXPORT GblUri* GblUri_ref (GBL_SELF) GBL_NOEXCEPT;
42
43GBL_EXPORT GblUri* GblUri_copy (GBL_CSELF, GblUri* pDest) GBL_NOEXCEPT;
44
45GBL_EXPORT GBL_RESULT GblUri_parse (GBL_SELF,
46 const char* pStr,
47 GblBool relaxed) GBL_NOEXCEPT;
48
49GBL_EXPORT const char* GblUri_format (GBL_CSELF,
50 GBL_URI_FLAGS flags,
51 GblStringBuffer* pStrBuff) GBL_NOEXCEPT;
52
55
57GBL_EXPORT void GblUri_clear (GBL_SELF) GBL_NOEXCEPT;
58
59GBL_EXPORT void GblUri_setScheme (GBL_SELF, const char* pStr) GBL_NOEXCEPT;
60GBL_EXPORT void GblUri_setSchemeRef (GBL_SELF, GblStringRef* pRef) GBL_NOEXCEPT;
62
63GBL_EXPORT void GblUri_setAuthority (GBL_SELF, const char* pStr) GBL_NOEXCEPT;
64GBL_EXPORT const char* GblUri_authority (GBL_CSELF,
65 GblStringBuffer* pStrBuff) GBL_NOEXCEPT;
66
67GBL_EXPORT void GblUri_setUserInfo (GBL_SELF, const char* pStr) GBL_NOEXCEPT;
68GBL_EXPORT void GblUri_setUserInfoRef (GBL_SELF, GblStringRef* pRef) GBL_NOEXCEPT;
70
71GBL_EXPORT void GblUri_setUserName (GBL_SELF, const char* pStr) GBL_NOEXCEPT;
72GBL_EXPORT void GblUri_setUserNameRef (GBL_SELF, GblStringRef* pRef) GBL_NOEXCEPT;
74
75GBL_EXPORT void GblUri_setPassword (GBL_SELF, const char* pStr) GBL_NOEXCEPT;
76GBL_EXPORT void GblUri_setPasswordRef (GBL_SELF, GblStringRef* pRef) GBL_NOEXCEPT;
78
79GBL_EXPORT void GblUri_setHost (GBL_SELF, const char* pStr) GBL_NOEXCEPT;
80GBL_EXPORT void GblUri_setHostRef (GBL_SELF, GblStringRef* pRef) GBL_NOEXCEPT;
82
83GBL_EXPORT void GblUri_setPort (GBL_SELF, int port) GBL_NOEXCEPT;
84GBL_EXPORT int GblUri_port (GBL_CSELF) GBL_NOEXCEPT;
85
86GBL_EXPORT void GblUri_setPath (GBL_SELF, const char* pStr) GBL_NOEXCEPT;
87GBL_EXPORT void GblUri_setPathRef (GBL_SELF, GblStringRef* pRef) GBL_NOEXCEPT;
89
90GBL_EXPORT GblStringView GblUri_directory (GBL_CSELF) GBL_NOEXCEPT;
91GBL_EXPORT GblStringView GblUri_fileName (GBL_CSELF) GBL_NOEXCEPT;
92GBL_EXPORT GblStringView GblUri_extension (GBL_CSELF) GBL_NOEXCEPT;
93
94GBL_EXPORT void GblUri_setQuery (GBL_SELF, const char* pStr) GBL_NOEXCEPT;
95GBL_EXPORT void GblUri_setQueryRef (GBL_SELF, GblStringRef* pRef) GBL_NOEXCEPT;
97
98GBL_EXPORT void GblUri_setFragment (GBL_SELF, const char* pStr) GBL_NOEXCEPT;
99GBL_EXPORT void GblUri_setFragmentRef (GBL_SELF, GblStringRef* pRef) GBL_NOEXCEPT;
101
102GBL_EXPORT GblBool GblUri_isRelative (GBL_CSELF) GBL_NOEXCEPT;
103
104GBL_EXPORT GblBool GblUri_isParentOf (GBL_CSELF,
105 const GblUri* pUri) GBL_NOEXCEPT;
106
107GBL_EXPORT int GblUri_compare (GBL_CSELF,
108 const GblUri* pUri) GBL_NOEXCEPT;
109
110GBL_EXPORT GblBool GblUri_equals (GBL_CSELF,
111 const GblUri* pOther,
112 GBL_URI_FLAGS flags) GBL_NOEXCEPT;
114
115#undef GBL_SELF_TYPE
116
117#endif // GIMBAL_URI_H
#define GBL_NOEXCEPT
#define GBL_DECLS_BEGIN
#define GBL_FORWARD_DECLARE_STRUCT(S)
#define GBL_DECLARE_FLAGS(F)
#define GBL_EXPORT
uint8_t GblBool
Basic boolean type, standardized to sizeof(char)
uint16_t GblRefCount
Type able to hold a reference counter across the codebase.
const char GblStringRef
Reference-counted, const char*-compatible string type.