1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef API_UTIL_PATHUTIL_H
17 #define API_UTIL_PATHUTIL_H
18 
19 #include <base/containers/string.h>
20 #include <base/containers/string_view.h>
21 #include <base/containers/unordered_map.h>
22 
23 #include <util/namespace.h>
24 
25 UTIL_BEGIN_NAMESPACE()
26 namespace PathUtil {
27 
28 ::string NormalizePath(::string_view path);
29 ::string GetParentPath(::string_view path);
30 ::string ResolvePath(::string_view parent, ::string_view uri, bool allowQueryString = true);
31 ::string GetRelativePath(::string_view path, ::string_view relativeTo);
32 ::string GetFilename(::string_view path);
33 ::string GetExtension(::string_view path);
34 ::string GetBaseName(::string_view path);
35 ::unordered_map<::string, ::string> GetUriParameters(::string_view uri);
36 ::string ResolveUri(::string_view contextUri, ::string_view uri, bool allowQueryString = true);
37 
38 } // namespace PathUtil
39 UTIL_END_NAMESPACE()
40 
41 #endif // API_UTIL_IPATHUTIL_H
42