Sync with 5.1.0
[deliverable/titan.core.git] / common / Path2.hh
1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2014 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 #ifndef PATH_HH_
9 #define PATH_HH_
10
11 #include <string>
12
13
14 class Path {
15 private:
16 Path();
17 public:
18 static const char SEPARATOR;
19
20 static std::string normalize(const std::string& original);
21
22 /* Creates a normalized absolute path from the given filename.
23 * The relative path will be resolved according to
24 * the current working directory. */
25 static std::string get_abs_path(const std::string& fname);
26
27 /* Returns the filename from the path. (The suffix after the last '/')
28 * e.g.: "abc/def" -> "def"
29 * "abc" -> "abc"
30 * "abc/" -> ""
31 */
32 static std::string get_file(const std::string& path);
33 /* Returns the directory part of the given path.
34 * e.g.: "/a/b/cde -> "/a/b/"
35 * "abc" -> ""
36 * "../abc" -> "../"
37 * "/" -> "/" */
38 static std::string get_dir(const std::string& path);
39
40 static std::string compose(const std::string& path1, const std::string& path2);
41
42 static bool is_absolute(const std::string& path);
43 };
44
45 #endif
This page took 0.060927 seconds and 5 git commands to generate.