FileName.h++
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __ccxx_FileName_hxx
00024 #define __ccxx_FileName_hxx
00025
00026 #include <commonc++/Common.h++>
00027 #include <commonc++/String.h++>
00028
00029 namespace ccxx {
00030
00054 class COMMONCPP_API FileName
00055 {
00056 public:
00057
00059 FileName();
00060
00062 FileName(const String &path);
00063
00065 FileName(const String &dir, const String &filename);
00066
00068 FileName(const FileName &other);
00069
00071 FileName(const char *path);
00072
00074 FileName& operator=(const FileName &other);
00075
00077 FileName& operator=(const String &path);
00078
00080 FileName& operator=(const char *path);
00081
00083 ~FileName() throw();
00084
00088 inline String toString() const
00089 { return(getPathName()); }
00090
00092 String getPathName() const;
00093
00095 void setPathName(const String &path);
00096
00100 inline String getVolume() const
00101 { return(_volume); }
00102
00106 void setVolume(const String &volume);
00107
00109 inline String getDirectory() const
00110 { return(_dir); }
00111
00113 void setDirectory(const String &dir);
00114
00120 FileName& pushDirectory(const String &dir);
00121
00125 FileName& popDirectory();
00126
00128 inline String getBaseName() const
00129 { return(_basename); }
00130
00132 void setBaseName(const String &name);
00133
00135 inline String getExtension() const
00136 { return(_ext); }
00137
00139 void setExtension(const String &ext);
00140
00142 String getFileName() const;
00143
00152 void setFileName(const String &name);
00153
00158 bool isAbsolute() const throw();
00159
00164 FileName& canonicalize();
00165
00166 private:
00167
00168 void _rebuildPathName() const;
00169 void _rebuildFileName() const;
00170
00171 String _volume;
00172 String _dir;
00173 String _basename;
00174 String _ext;
00175 mutable String _filename;
00176 mutable String _pathname;
00177 mutable bool _filenameDirty;
00178 mutable bool _pathnameDirty;
00179 };
00180
00181 };
00182
00183 #endif // __ccxx_FileName_hxx
00184
00185