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
UTIL_BEGIN_NAMESPACE()25 UTIL_BEGIN_NAMESPACE()
26 namespace PathUtil {
27
28 BASE_NS::string NormalizePath(BASE_NS::string_view path);
29 BASE_NS::string GetParentPath(BASE_NS::string_view path);
30 BASE_NS::string ResolvePath(BASE_NS::string_view parent, BASE_NS::string_view uri, bool allowQueryString = true);
31 BASE_NS::string GetRelativePath(BASE_NS::string_view path, BASE_NS::string_view relativeTo);
32 BASE_NS::string GetFilename(BASE_NS::string_view path);
33 BASE_NS::string GetExtension(BASE_NS::string_view path);
34 BASE_NS::string GetBaseName(BASE_NS::string_view path);
35 BASE_NS::unordered_map<BASE_NS::string, BASE_NS::string> GetUriParameters(BASE_NS::string_view uri);
36 BASE_NS::string ResolveUri(BASE_NS::string_view contextUri, BASE_NS::string_view uri, bool allowQueryString = true);
37
38 } // namespace PathUtil
39 UTIL_END_NAMESPACE()
40
41 #endif // API_UTIL_IPATHUTIL_H
42