C++ Utilities  5.10.5
Useful C++ classes and routines such as argument parser, IO and conversion utilities
path.h
Go to the documentation of this file.
1 #ifndef IOUTILITIES_PATHHELPER_H
2 #define IOUTILITIES_PATHHELPER_H
3 
4 #include "../global.h"
5 
6 #include <list>
7 #include <string>
8 
9 #ifdef PLATFORM_WINDOWS
10 #define PATH_SEP_CHAR '\\'
11 #define SEARCH_PATH_SEP_CHAR ';'
12 #define PATH_SEP_STR "\\"
13 #define SEARCH_PATH_SEP_STR ";"
14 #else
15 #define PATH_SEP_CHAR '/'
16 #define SEARCH_PATH_SEP_CHAR ':'
17 #define PATH_SEP_STR "/"
18 #define SEARCH_PATH_SEP_STR ":"
19 #endif
20 
21 namespace CppUtilities {
22 
23 CPP_UTILITIES_EXPORT std::string fileName(const std::string &path);
24 CPP_UTILITIES_EXPORT std::string directory(const std::string &path);
26 } // namespace CppUtilities
27 
28 #endif // IOUTILITIES_PATHHELPER_H
#define CPP_UTILITIES_EXPORT
Marks the symbol to be exported by the c++utilities library.
Contains all utilities provides by the c++utilities library.
CPP_UTILITIES_EXPORT std::string directory(const std::string &path)
Returns the directory of the specified path string (including trailing slash).
Definition: path.cpp:35
CPP_UTILITIES_EXPORT std::string fileName(const std::string &path)
Returns the file name and extension of the specified path string.
Definition: path.cpp:15
CPP_UTILITIES_EXPORT void removeInvalidChars(std::string &fileName)
Removes invalid characters from the specified fileName.
Definition: path.cpp:57