- wxFileName()
- { }
- wxFileName( const wxFileName &filepath );
- wxFileName( const wxString &path, bool dir_only = FALSE, wxPathFormat format = wxPATH_NATIVE )
- { Assign( path, dir_only, format ); }
- void Assign( const wxString &path, bool dir_only = FALSE, wxPathFormat format = wxPATH_NATIVE );
- void Assign( const wxFileName &filepath );
-
- // Only native form
+
+ // the usual stuff
+ wxFileName() { }
+ 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
+ // extension are extracted from it
+ wxFileName( const wxString& fullpath, wxPathFormat format = wxPATH_NATIVE )
+ { Assign( fullpath, format ); }
+
+ // from a directory name and a file name
+ wxFileName(const wxString& path,
+ const wxString& name,
+ wxPathFormat format = wxPATH_NATIVE)
+ { Assign(path, name, format); }
+
+ // from a directory name, file base name and extension
+ wxFileName(const wxString& path,
+ const wxString& name,
+ const wxString& ext,
+ 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
+ // all GUI classes? Personally, I like Set() more than Assign() too
+
+ void Assign(const wxFileName& filepath);
+ void Assign(const wxString& fullpath,
+ wxPathFormat format = wxPATH_NATIVE);
+ void Assign(const wxString& path,
+ const wxString& name,
+ wxPathFormat format = wxPATH_NATIVE);
+ void Assign(const wxString& path,
+ const wxString& name,
+ const wxString& ext,
+ wxPathFormat format = wxPATH_NATIVE);
+ void AssignDir(const wxString& dir, wxPathFormat format = wxPATH_NATIVE)
+ { Assign(dir, _T(""), format); }
+
+ // reset all components to default, uninitialized state
+ void Clear();
+
+ // static pseudo constructors
+ static wxFileName FileName(const wxString& file);
+ static wxFileName DirName(const wxString& dir);
+
+ // test for existence
+
+ // is the filename valid at all?
+ bool IsOk() const { return !m_dirs.IsEmpty() || !m_name.IsEmpty(); }
+
+ // does the file with this name exists?