00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef SALT_PATH_H
00031 #define SALT_PATH_H
00032
00033 #ifdef HAVE_CONFIG_H
00034 # ifdef PACKAGE_BUGREPORT
00035 # undef PACKAGE_BUGREPORT
00036 # endif
00037 # ifdef PACKAGE_NAME
00038 # undef PACKAGE_NAME
00039 # endif
00040 # ifdef PACKAGE_STRING
00041 # undef PACKAGE_STRING
00042 # endif
00043 # ifdef PACKAGE_TARNAME
00044 # undef PACKAGE_TARNAME
00045 # endif
00046 # ifdef PACKAGE_VERSION
00047 # undef PACKAGE_VERSION
00048 # endif
00049 #include "config.h"
00050 #endif
00051
00052 #include <string>
00053 #include <list>
00054
00055 namespace salt
00056 {
00057
00062 class Path
00063 {
00064
00065
00066
00067 public:
00068 typedef std::list<std::string> TStringList;
00069
00070
00071
00072
00073 public:
00074
00078 Path(const std::string &path = "");
00079
00084 void Set(const std::string &path);
00085
00089 bool IsAbsolute() const;
00090
00092 const std::string& Front() const;
00093
00095 void PopFront();
00096
00098 const std::string& Back() const;
00099
00101 void PopBack();
00102
00106 bool IsEmpty() const;
00107
00111 std::string GetCleanPath(const std::string &sep = "/") const;
00112
00113 private:
00114 Path(const Path &obj);
00115 Path& operator=(const Path &obj);
00116
00118 void Tokenize(const std::string &path);
00119
00120
00121
00122
00123 public:
00124 protected:
00126 TStringList mPathComponents;
00127
00129 bool mIsAbsolute;
00130 private:
00131 };
00132
00133 }
00134
00135 #endif //SALT_PATH_H