X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a7b51bc869213608fdad75c28fba1f245d43549f..54946cc95b8493fb092b6a508bf22a1cd6fa4693:/include/wx/filename.h diff --git a/include/wx/filename.h b/include/wx/filename.h index 844c2d4916..9768a87395 100644 --- a/include/wx/filename.h +++ b/include/wx/filename.h @@ -173,20 +173,20 @@ public: // time functions - // set the file creation and last access/mod times + // set the file last access/mod and creation times // (any of the pointers may be NULL) - bool SetTimes(const wxDateTime *dtCreate, - const wxDateTime *dtAccess, - const wxDateTime *dtMod); + bool SetTimes(const wxDateTime *dtAccess, + const wxDateTime *dtMod, + const wxDateTime *dtCreate); // set the access and modification times to the current moment bool Touch(); - // return the last access, last modification and last change times + // return the last access, last modification and create times // (any of the pointers may be NULL) bool GetTimes(wxDateTime *dtAccess, wxDateTime *dtMod, - wxDateTime *dtChange) const; + wxDateTime *dtCreate) const; // convenience wrapper: get just the last mod time of the file wxDateTime GetModificationTime() const @@ -196,6 +196,16 @@ public: return dtMod; } +#ifdef __WXMAC__ + bool MacSetTypeAndCreator( wxUint32 type , wxUint32 creator ) ; + bool MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator ) ; + // gets the 'common' type and creator for a certain extension + static bool MacFindDefaultTypeAndCreator( const wxString& ext , wxUint32 *type , wxUint32 *creator ) ; + // registers application defined extensions and their default type and creator + static void MacRegisterDefaultTypeAndCreator( const wxString& ext , wxUint32 type , wxUint32 creator ) ; + // looks up the appropriate type and creator from the registration and then sets + bool MacSetDefaultTypeAndCreator() ; +#endif // various file/dir operations // retrieve the value of the current working directory @@ -232,7 +242,7 @@ public: // variables will be expanded in it // // this may be done using another (than current) value of cwd - bool Normalize(wxPathNormalize flags = wxPATH_NORM_ALL, + bool Normalize(int flags = wxPATH_NORM_ALL, const wxString& cwd = wxEmptyString, wxPathFormat format = wxPATH_NATIVE); @@ -263,33 +273,29 @@ public: static bool IsCaseSensitive( wxPathFormat format = wxPATH_NATIVE ); // is this filename absolute? - bool IsAbsolute() const - { return !m_relative; } + bool IsAbsolute(wxPathFormat format = wxPATH_NATIVE) const; // is this filename relative? - bool IsRelative() const - { return m_relative; } - - // forcibly set the flag - void SetAbsolute() - { m_relative = FALSE; } - void SetRelative() - { m_relative = TRUE; } + bool IsRelative(wxPathFormat format = wxPATH_NATIVE) const + { return !IsAbsolute(format); } // Information about path format - // get the string separating the volume from the path for this format + // get the string separating the volume from the path for this format, + // return an empty string if this format doesn't support the notion of + // volumes at all static wxString GetVolumeSeparator(wxPathFormat format = wxPATH_NATIVE); // get the string of path separators for this format static wxString GetPathSeparators(wxPathFormat format = wxPATH_NATIVE); + // get the canonical path separator for this format + static wxChar GetPathSeparator(wxPathFormat format = wxPATH_NATIVE) + { return GetPathSeparators(format)[0u]; } + // is the char a path separator for this format? static bool IsPathSeparator(wxChar ch, wxPathFormat format = wxPATH_NATIVE); - // FIXME: what exactly does this do? - bool IsWild( wxPathFormat format = wxPATH_NATIVE ); - // Dir accessors void AppendDir( const wxString &dir ); void PrependDir( const wxString &dir ); @@ -335,6 +341,9 @@ public: // Return the long form of the path (returns identity on non-Windows platforms) wxString GetLongPath() const; + // Is this a file or directory (not necessarily an existing one) + bool IsDir() const { return m_name.empty() && m_ext.empty(); } + // various helpers // get the canonical path format for this platform @@ -366,8 +375,15 @@ private: // the file name and extension (empty for directories) wxString m_name, m_ext; - - // is the path relative + + // when m_dirs is empty it may mean either that we have no path at all or + // that our path is '/', i.e. the root directory + // + // we use m_relative to distinguish between these two cases, it will be + // TRUE in the former and FALSE in the latter + // + // NB: the path is not absolute just because m_relative is FALSE, it still + // needs the drive (i.e. volume) in some formats (Windows) bool m_relative; };