made SameAs() and operator==() const, added operator!=() and docs for it

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17756 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-11-07 13:16:29 +00:00
parent d480da3f17
commit f385722728
3 changed files with 29 additions and 12 deletions

View File

@@ -598,7 +598,7 @@ Deletes the specified directory from the file system.
\membersection{wxFileName::SameAs}\label{wxfilenamesameas}
\func{bool}{SameAs}{\param{const wxFileName\& }{filepath}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
\constfunc{bool}{SameAs}{\param{const wxFileName\& }{filepath}, \param{wxPathFormat }{format = wxPATH\_NATIVE}}
Compares the filename using the rules of this platform.
@@ -674,9 +674,19 @@ Assigns the new value to this filename object.
\membersection{wxFileName::operator==}\label{wxfilenameoperatorequal}
\func{bool operator}{operator==}{\param{const wxFileName\& }{filename}}
\constfunc{bool operator}{operator==}{\param{const wxFileName\& }{filename}}
\func{bool operator}{operator==}{\param{const wxString\& }{filename}}
\constfunc{bool operator}{operator==}{\param{const wxString\& }{filename}}
Returns {\tt TRUE} if the filenames are equal for the native file format.
Returns {\tt TRUE} if the filenames are equal. The string {\it filenames} is
interpreted as a path in the native filename format.
\membersection{wxFileName::operator!=}\label{wxfilenameoperatornotequal}
\constfunc{bool operator}{operator!=}{\param{const wxFileName\& }{filename}}
\constfunc{bool operator}{operator!=}{\param{const wxString\& }{filename}}
Returns {\tt TRUE} if the filenames are different. The string {\it filenames}
is interpreted as a path in the native filename format.

View File

@@ -274,14 +274,21 @@ public:
// Comparison
// compares with the rules of this platform
bool SameAs(const wxFileName &filepath,
wxPathFormat format = wxPATH_NATIVE);
// compares with the rules of the given platforms format
bool SameAs(const wxFileName& filepath,
wxPathFormat format = wxPATH_NATIVE) const;
// uses the current platform settings
bool operator==(const wxFileName& filename) { return SameAs(filename); }
bool operator==(const wxString& filename)
{ return *this == wxFileName(filename); }
// compare with another filename object
bool operator==(const wxFileName& filename) const
{ return SameAs(filename); }
bool operator!=(const wxFileName& filename) const
{ return !SameAs(filename); }
// compare with a filename string interpreted as a native file name
bool operator==(const wxString& filename) const
{ return SameAs(wxFileName(filename)); }
bool operator!=(const wxString& filename) const
{ return !SameAs(wxFileName(filename)); }
// are the file names of this type cases sensitive?
static bool IsCaseSensitive( wxPathFormat format = wxPATH_NATIVE );

View File

@@ -1022,7 +1022,7 @@ bool wxFileName::MakeRelativeTo(const wxString& pathBase, wxPathFormat format)
// filename kind tests
// ----------------------------------------------------------------------------
bool wxFileName::SameAs(const wxFileName &filepath, wxPathFormat format)
bool wxFileName::SameAs(const wxFileName& filepath, wxPathFormat format) const
{
wxFileName fn1 = *this,
fn2 = filepath;