X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce16e5d78fad60b6bbc6ef8889a663fd1c9f23d2..10eb1f1eac4f334f4acaae8199178131eeba5f74:/include/wx/filename.h diff --git a/include/wx/filename.h b/include/wx/filename.h index 367ad81cbf..58ca5ecc30 100644 --- a/include/wx/filename.h +++ b/include/wx/filename.h @@ -102,14 +102,6 @@ public: wxPathFormat format = wxPATH_NATIVE) { Assign(path, name, ext, format); } - // assorted assignment operators - - wxFileName& operator=(const wxFileName& filename) - { Assign(filename); return *this; } - - wxFileName& operator=(const wxString& filename) - { Assign(filename); return *this; } - // the same for delayed initialization // VZ: wouldn't it be better to call this Create() for consistency with @@ -128,6 +120,14 @@ public: void AssignDir(const wxString& dir, wxPathFormat format = wxPATH_NATIVE) { Assign(dir, _T(""), format); } + // assorted assignment operators + + wxFileName& operator=(const wxFileName& filename) + { Assign(filename); return *this; } + + wxFileName& operator=(const wxString& filename) + { Assign(filename); return *this; } + // reset all components to default, uninitialized state void Clear(); @@ -135,7 +135,7 @@ public: static wxFileName FileName(const wxString& file); static wxFileName DirName(const wxString& dir); - // test for existence + // file tests // is the filename valid at all? bool IsOk() const { return !m_dirs.IsEmpty() || !m_name.IsEmpty(); } @@ -148,11 +148,33 @@ public: bool DirExists(); static bool DirExists( const wxString &dir ); - // Well, get modification time with sec resolution - wxDateTime GetModificationTime(); - // VZ: also need: IsDirWritable(), IsFileExecutable() &c (TODO) + // time functions + + // set the file creation and last access/mod times + // (any of the pointers may be NULL) + bool SetTimes(const wxDateTime *dtCreate, + const wxDateTime *dtAccess, + const wxDateTime *dtMod); + + // set the access and modification times to the current moment + bool Touch(); + + // return the last access, last modification and last change times + // (any of the pointers may be NULL) + bool GetTimes(wxDateTime *dtAccess, + wxDateTime *dtMod, + wxDateTime *dtChange) const; + + // convenience wrapper: get just the last mod time of the file + wxDateTime GetModificationTime() const + { + wxDateTime dtMod; + (void)GetTimes(NULL, &dtMod, NULL); + return dtMod; + } + // various file/dir operations // retrieve the value of the current working directory @@ -191,15 +213,15 @@ public: // Comparison + // compares with the rules of this platform + bool SameAs(const wxFileName &filepath, + wxPathFormat format = wxPATH_NATIVE); + // uses the current platform settings bool operator==(const wxFileName& filename) { return SameAs(filename); } bool operator==(const wxString& filename) { return *this == wxFileName(filename); } - // compares with the rules of this platform - bool SameAs(const wxFileName &filepath, - wxPathFormat format = wxPATH_NATIVE); - // Tests static bool IsCaseSensitive( wxPathFormat format = wxPATH_NATIVE ); bool IsRelative( wxPathFormat format = wxPATH_NATIVE );