#ifndef _FILEPATH_H_ #define _FILEPATH_H_ #include // use the standard namespace #if !defined (GSDL_NAMESPACE_BROKEN) #if defined(GSDL_USE_OBJECTSPACE) using namespace ospace::std; #else using namespace std; #endif #endif #include class FilePath { private: bool is_aRoot; // indicates whether this directory/file is a file root void _init(string path, string subPath); protected: string path; // full path of this item public: FilePath(); FilePath(string filePath); FilePath(string filePath, string filePath2); FilePath(int nPaths, ...); FilePath(FilePath &path, string subPath); bool isRoot(); bool isEmpty(); int compare(const FilePath &other) const; int compare(const char *other) const; FilePath *append(FilePath &path); FilePath *append(char *path); FilePath *parent(); FilePath *root(); FilePath *rootDrive(); bool isAncestorOf(string pathString); bool ensureWriteablePath(); bool exists(); const char *cString(); string pathString(); bool operator==(const FilePath &b) const { return this->compare(b) == 0; } bool operator!=(const FilePath &b) const { return this->compare(b) != 0; } bool operator<(const FilePath &b) const { return this->compare(b) < 0; } }; #endif