Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
c3948095f5f13578ae31f522f4c54d2985aec4a5
[simgrid.git] / include / xbt / file.hpp
1 /* Copyright (c) 2017-2018. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef XBT_FILE_HPP
8 #define XBT_FILE_HPP
9
10 #include <string>
11 #include <xbt/base.h>
12
13 namespace simgrid {
14 namespace xbt {
15
16 class Path {
17 public:
18   explicit Path(const char* path): path_(path) {}
19   explicit Path(std::string path): path_(std::move(path)) {}
20
21   /** @brief Returns the full path name */
22   std::string getName() { return path_; }
23   /** @brief Returns the directory component of a path (reimplementation of POSIX dirname) */
24   std::string getDirname();
25   /** @brief Returns the file component of a path (reimplementation of POSIX basename) */
26   std::string getBasename();
27
28 private:
29   std::string path_;
30 };
31 }}
32
33 #endif                          /* XBT_FILE_HPP */