comparison uriparser/src/UriCommon.h @ 60:a2be1eba7adb

uriparser: import 0.8.5, close #878 @10m
author David Demelier <markand@malikania.fr>
date Fri, 13 Jul 2018 10:50:43 +0200
parents
children
comparison
equal deleted inserted replaced
59:e5880f2798a1 60:a2be1eba7adb
1 /*
2 * uriparser - RFC 3986 URI parsing library
3 *
4 * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
5 * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above
13 * copyright notice, this list of conditions and the following
14 * disclaimer.
15 *
16 * * Redistributions in binary form must reproduce the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer in the documentation and/or other materials
19 * provided with the distribution.
20 *
21 * * Neither the name of the <ORGANIZATION> nor the names of its
22 * contributors may be used to endorse or promote products
23 * derived from this software without specific prior written
24 * permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
29 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
30 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
31 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
32 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
33 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
35 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
37 * OF THE POSSIBILITY OF SUCH DAMAGE.
38 */
39
40 #if (defined(URI_PASS_ANSI) && !defined(URI_COMMON_H_ANSI)) \
41 || (defined(URI_PASS_UNICODE) && !defined(URI_COMMON_H_UNICODE)) \
42 || (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
43 /* What encodings are enabled? */
44 #include <uriparser/UriDefsConfig.h>
45 #if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE))
46 /* Include SELF twice */
47 # ifdef URI_ENABLE_ANSI
48 # define URI_PASS_ANSI 1
49 # include "UriCommon.h"
50 # undef URI_PASS_ANSI
51 # endif
52 # ifdef URI_ENABLE_UNICODE
53 # define URI_PASS_UNICODE 1
54 # include "UriCommon.h"
55 # undef URI_PASS_UNICODE
56 # endif
57 /* Only one pass for each encoding */
58 #elif (defined(URI_PASS_ANSI) && !defined(URI_COMMON_H_ANSI) \
59 && defined(URI_ENABLE_ANSI)) || (defined(URI_PASS_UNICODE) \
60 && !defined(URI_COMMON_H_UNICODE) && defined(URI_ENABLE_UNICODE))
61 # ifdef URI_PASS_ANSI
62 # define URI_COMMON_H_ANSI 1
63 # include <uriparser/UriDefsAnsi.h>
64 # else
65 # define URI_COMMON_H_UNICODE 1
66 # include <uriparser/UriDefsUnicode.h>
67 # endif
68
69
70
71 /* Used to point to from empty path segments.
72 * X.first and X.afterLast must be the same non-NULL value then. */
73 extern const URI_CHAR * const URI_FUNC(SafeToPointTo);
74 extern const URI_CHAR * const URI_FUNC(ConstPwd);
75 extern const URI_CHAR * const URI_FUNC(ConstParent);
76
77
78
79 void URI_FUNC(ResetUri)(URI_TYPE(Uri) * uri);
80
81 int URI_FUNC(CompareRange)(
82 const URI_TYPE(TextRange) * a,
83 const URI_TYPE(TextRange) * b);
84
85 UriBool URI_FUNC(RemoveDotSegmentsAbsolute)(URI_TYPE(Uri) * uri);
86 UriBool URI_FUNC(RemoveDotSegments)(URI_TYPE(Uri) * uri, UriBool relative);
87 UriBool URI_FUNC(RemoveDotSegmentsEx)(URI_TYPE(Uri) * uri,
88 UriBool relative, UriBool pathOwned);
89
90 unsigned char URI_FUNC(HexdigToInt)(URI_CHAR hexdig);
91 URI_CHAR URI_FUNC(HexToLetter)(unsigned int value);
92 URI_CHAR URI_FUNC(HexToLetterEx)(unsigned int value, UriBool uppercase);
93
94 UriBool URI_FUNC(IsHostSet)(const URI_TYPE(Uri) * uri);
95
96 UriBool URI_FUNC(CopyPath)(URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source);
97 UriBool URI_FUNC(CopyAuthority)(URI_TYPE(Uri) * dest, const URI_TYPE(Uri) * source);
98
99 UriBool URI_FUNC(FixAmbiguity)(URI_TYPE(Uri) * uri);
100 void URI_FUNC(FixEmptyTrailSegment)(URI_TYPE(Uri) * uri);
101
102
103 #endif
104 #endif