MPD  0.20.15
UriUtil.hxx
Go to the documentation of this file.
1 /*
2  * Copyright 2003-2017 The Music Player Daemon Project
3  * http://www.musicpd.org
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef MPD_URI_UTIL_HXX
21 #define MPD_URI_UTIL_HXX
22 
23 #include "Compiler.h"
24 
25 #include <string>
26 
32 bool
33 uri_has_scheme(const char *uri) noexcept;
34 
39 std::string
40 uri_get_scheme(const char *uri) noexcept;
41 
47 const char *
48 uri_get_path(const char *uri) noexcept;
49 
51 const char *
52 uri_get_suffix(const char *uri) noexcept;
53 
55  char data[8];
56 };
57 
62 const char *
63 uri_get_suffix(const char *uri, UriSuffixBuffer &buffer) noexcept;
64 
74 bool
75 uri_safe_local(const char *uri) noexcept;
76 
84 std::string
85 uri_remove_auth(const char *uri) noexcept;
86 
93 bool
94 uri_is_child(const char *parent, const char *child) noexcept;
95 
97 bool
98 uri_is_child_or_same(const char *parent, const char *child) noexcept;
99 
104 gcc_pure
105 std::string
106 uri_apply_base(const std::string &uri, const std::string &base) noexcept;
107 
108 #endif
gcc_pure gcc_nonnull_all const char * uri_get_path(const char *uri) noexcept
Returns the URI path (including the query string) or nullptr if the given URI has no path...
char data[8]
Definition: UriUtil.hxx:55
#define gcc_nonnull_all
Definition: Compiler.h:122
gcc_pure bool uri_has_scheme(const char *uri) noexcept
Checks whether the specified URI has a scheme in the form "scheme://".
gcc_pure bool uri_safe_local(const char *uri) noexcept
Returns true if this is a safe "local" URI:
gcc_pure const char * uri_get_suffix(const char *uri) noexcept
gcc_pure std::string uri_apply_base(const std::string &uri, const std::string &base) noexcept
Translate the given URI in the context of #base.
gcc_pure gcc_nonnull_all bool uri_is_child(const char *parent, const char *child) noexcept
Check whether #child specifies a resource "inside" the directory specified by #parent.
gcc_pure gcc_nonnull_all bool uri_is_child_or_same(const char *parent, const char *child) noexcept
gcc_pure std::string uri_remove_auth(const char *uri) noexcept
Removes HTTP username and password from the URI.
#define gcc_pure
Definition: Compiler.h:116
gcc_pure std::string uri_get_scheme(const char *uri) noexcept
Returns the scheme name of the specified URI, or an empty string.
const Storage const char * uri