00001 /* Copyright (c) 2007, Gennady Bystritsky <bystr@mac.com> 00002 * 00003 * Distributed under the MIT Licence. 00004 * This is free software. See 'LICENSE' for details. 00005 * You must read and accept the license prior to use. 00006 */ 00007 00008 #ifndef _SK_UTIL_PATHNAME_ 00009 #define _SK_UTIL_PATHNAME_ 00010 00011 #include <sk/util/Object.h> 00012 #include <sk/util/String.h> 00013 00014 namespace sk { 00015 namespace util { 00016 class Pathname 00017 : public virtual sk::util::Object 00018 { 00019 public: 00020 Pathname(const sk::util::String& component); 00021 Pathname(const sk::util::String& component, const sk::util::String& defaultExtension); 00022 virtual ~Pathname(); 00023 00024 bool isAbsolute() const; 00025 const sk::util::String basename() const; 00026 const sk::util::String dirname() const; 00027 00028 Pathname& front(const sk::util::String& component); 00029 00030 // sk::util::Object re-implementation. 00031 const sk::util::Class getClass() const; 00032 const sk::util::String toString() const; 00033 00034 private: 00035 Pathname& operator = (const Pathname& other); 00036 00037 void normalizePrepended(const sk::util::String& trimmedComponent); 00038 00039 sk::util::String _pathname; 00040 }; 00041 } 00042 } 00043 00044 #endif /* _SK_UTIL_PATHNAME_ */