From: Vadim Zeitlin Date: Thu, 17 Jul 2003 23:39:28 +0000 (+0000) Subject: added format parameter to File/DirName() X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/520200fd10b80c1d759311ed345789f5fe048ca5 added format parameter to File/DirName() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22066 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/latex/wx/filename.tex b/docs/latex/wx/filename.tex index a93a18c7ef..ef77c01875 100644 --- a/docs/latex/wx/filename.tex +++ b/docs/latex/wx/filename.tex @@ -265,9 +265,11 @@ Returns true if the directory with this name exists. \membersection{wxFileName::DirName}\label{wxfilenamedirname} -\func{wxFileName}{DirName}{\param{const wxString\& }{dir}} +\func{static wxFileName}{DirName}{\param{const wxString\& }{dir}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} + +Returns the object corresponding to the directory with the given name. +The {\it dir} parameter may have trailing path separator or not. -Returns the directory name. \membersection{wxFileName::FileExists}\label{wxfilenamefileexists} @@ -281,11 +283,14 @@ Returns true if the file with this name exists. \helpref{DirExists}{wxfilenamedirexists} + \membersection{wxFileName::FileName}\label{wxfilenamefilename} -\func{wxFileName}{FileName}{\param{const wxString\& }{file}} +\func{static wxFileName}{FileName}{\param{const wxString\& }{file}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} + +Returns the file name object corresponding to the given {\it file}. This +function exists mainly for symmetry with \helpref{DirName}{wxfilenamedirname}. -Static pseudo constructors. \membersection{wxFileName::GetCwd}\label{wxfilenamegetcwd} diff --git a/include/wx/filename.h b/include/wx/filename.h index 4db46c5b38..0b864b6ab9 100644 --- a/include/wx/filename.h +++ b/include/wx/filename.h @@ -98,7 +98,7 @@ public: // the usual stuff wxFileName() { Clear(); } - wxFileName( const wxFileName &filepath ) { Assign(filepath); } + wxFileName(const wxFileName& filepath) { Assign(filepath); } // from a full filename: if it terminates with a '/', a directory path // is contructed (the name will be empty), otherwise a file name and @@ -167,8 +167,10 @@ public: void Clear(); // static pseudo constructors - static wxFileName FileName(const wxString& file); - static wxFileName DirName(const wxString& dir); + static wxFileName FileName(const wxString& file, + wxPathFormat format = wxPATH_NATIVE); + static wxFileName DirName(const wxString& dir, + wxPathFormat format = wxPATH_NATIVE); // file tests diff --git a/src/common/filename.cpp b/src/common/filename.cpp index cc10adf2b3..a5a5f853a8 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -454,16 +454,16 @@ void wxFileName::Clear() } /* static */ -wxFileName wxFileName::FileName(const wxString& file) +wxFileName wxFileName::FileName(const wxString& file, wxPathFormat format) { - return wxFileName(file); + return wxFileName(file, format); } /* static */ -wxFileName wxFileName::DirName(const wxString& dir) +wxFileName wxFileName::DirName(const wxString& dir, wxPathFormat format) { wxFileName fn; - fn.AssignDir(dir); + fn.AssignDir(dir, format); return fn; }