X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fmisc%2Fsg_path.hxx;h=0684d5701927b5f7b0bb320218a1b6dd06280ec3;hb=e4e31be7d43569a92a5d9fa7e784381b66cbd95a;hp=41b7d744b49552c2f89bacfb04c5c2482184a2d6;hpb=c4b4c0ce59602a0b749e22b29d6ce5db6f654eae;p=simgear.git diff --git a/simgear/misc/sg_path.hxx b/simgear/misc/sg_path.hxx index 41b7d744..0684d570 100644 --- a/simgear/misc/sg_path.hxx +++ b/simgear/misc/sg_path.hxx @@ -58,6 +58,7 @@ public: /** Default constructor */ SGPath(); + /** Copy contructor */ SGPath(const SGPath& p); SGPath& operator=(const SGPath& p); @@ -68,6 +69,13 @@ public: */ SGPath( const std::string& p ); + /** + * Construct a path based on the starting path provided and a relative subpath + * @param p initial path + * @param r relative subpath + */ + SGPath( const SGPath& p, const std::string& r ); + /** Destructor */ ~SGPath(); @@ -131,7 +139,12 @@ public: * Get the path string * @return path in "C" string (ptr to char array) form. */ - const char* c_str() { return path.c_str(); } + const char* c_str() const { return path.c_str(); } + + /** + * Get the path string in OS native form + */ + std::string str_native() const; /** * Determine if file exists by attempting to fopen it. @@ -147,6 +160,22 @@ public: bool isFile() const; bool isDir() const; + + /** + * Opposite sense to isAbsolute + */ + bool isRelative() const { return !isAbsolute(); } + + /** + * Is this an absolute path? + * I.e starts with a directory seperator, or a single character + colon + */ + bool isAbsolute() const; + + /** + * check for default constructed path + */ + bool isNull() const; private: void fix();