Commit | Line | Data |
---|---|---|
d44e3c4f | 1 | /****************************************************************************** |
2 | * Copyright (c) 2000-2016 Ericsson Telecom AB | |
3 | * All rights reserved. This program and the accompanying materials | |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
7 | * | |
8 | * Contributors: | |
9 | * Balasko, Jeno | |
10 | * Beres, Szabolcs | |
11 | * | |
12 | ******************************************************************************/ | |
970ed795 EL |
13 | #ifndef PATH_HH_ |
14 | #define PATH_HH_ | |
15 | ||
16 | #include <string> | |
17 | ||
18 | ||
19 | class Path { | |
20 | private: | |
21 | Path(); | |
22 | public: | |
23 | static const char SEPARATOR; | |
24 | ||
25 | static std::string normalize(const std::string& original); | |
26 | ||
27 | /* Creates a normalized absolute path from the given filename. | |
28 | * The relative path will be resolved according to | |
29 | * the current working directory. */ | |
30 | static std::string get_abs_path(const std::string& fname); | |
31 | ||
32 | /* Returns the filename from the path. (The suffix after the last '/') | |
33 | * e.g.: "abc/def" -> "def" | |
34 | * "abc" -> "abc" | |
35 | * "abc/" -> "" | |
36 | */ | |
37 | static std::string get_file(const std::string& path); | |
38 | /* Returns the directory part of the given path. | |
39 | * e.g.: "/a/b/cde -> "/a/b/" | |
40 | * "abc" -> "" | |
41 | * "../abc" -> "../" | |
42 | * "/" -> "/" */ | |
43 | static std::string get_dir(const std::string& path); | |
44 | ||
45 | static std::string compose(const std::string& path1, const std::string& path2); | |
46 | ||
47 | static bool is_absolute(const std::string& path); | |
48 | }; | |
49 | ||
50 | #endif |