include "wx/filefn.h" instead of just "filefn.h".
[wxWidgets.git] / include / wx / filename.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: filename.h
3 // Purpose: wxFileName - encapsulates ice cream
4 // Author: Robert Roebling
5 // Modified by:
6 // Created: 28.12.00
7 // RCS-ID: $Id$
8 // Copyright: (c) 2000 Robert Roebling
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FILENAME_H_
13 #define _WX_FILENAME_H_
14
15 #ifdef __GNUG__
16 #pragma interface "filename.h"
17 #endif
18
19 #ifndef WX_PRECOMP
20 #include "wx/string.h"
21 #endif
22
23 // ridiculously enough, this will replace DirExists with wxDirExists etc
24 #include "wx/filefn.h"
25
26 enum wxPathFormat
27 {
28 wxPATH_NATIVE = 0,
29 wxPATH_UNIX,
30 wxPATH_MAC,
31 wxPATH_DOS,
32
33 wxPATH_BEOS = wxPATH_UNIX,
34 wxPATH_WIN = wxPATH_DOS,
35 wxPATH_OS2 = wxPATH_DOS
36
37 };
38
39 class WXDLLEXPORT wxFileName
40 {
41 public:
42 // constructors and assignment
43 wxFileName()
44 { }
45 wxFileName( const wxFileName &filename );
46 wxFileName( const wxString &path, bool dir_only = FALSE, wxPathFormat format = wxPATH_NATIVE )
47 { Assign( path, dir_only, format ); }
48 void Assign( const wxString &path, bool dir_only = FALSE, wxPathFormat format = wxPATH_NATIVE );
49
50 // Only native form
51 bool FileExists();
52 bool DirExists();
53
54 void AssignCwd();
55 void SetCwd();
56
57 void AssignTempFileName( const wxString &prefix );
58
59 void Mkdir( int perm = 0777 );
60 void Rmdir();
61
62 // Remove . and .. (under Unix ~ as well)
63 void MakeAbsolute();
64
65 // Comparison
66 bool SameAs( const wxFileName &filename, bool upper_on_dos = TRUE );
67
68 // Tests
69 bool IsCaseSensitive( wxPathFormat format = wxPATH_NATIVE );
70 bool IsRelative( wxPathFormat format = wxPATH_NATIVE );
71 bool IsAbsolute( wxPathFormat format = wxPATH_NATIVE );
72 bool IsWild( wxPathFormat format = wxPATH_NATIVE );
73
74 // Dir accessors
75 void AppendDir( const wxString &dir );
76 void PrependDir( const wxString &dir );
77 void InsertDir( int before, const wxString &dir );
78 void RemoveDir( int pos );
79 size_t GetDirCount() { return m_dirs.GetCount(); }
80
81 // Other accessors
82 void SetExt( const wxString &ext ) { m_ext = ext; }
83 wxString GetExt() const { return m_ext; }
84 bool HasExt() const { return !m_ext.IsEmpty(); }
85
86 void SetName( const wxString &name ) { m_name = name; }
87 wxString GetName() const { return m_name; }
88 bool HasName() const { return !m_name.IsEmpty(); }
89
90 const wxArrayString &GetDirs() const { return m_dirs; }
91
92 // Construct path only
93 wxString GetPath( wxPathFormat format = wxPATH_NATIVE ) const;
94
95 // Construct full path with name and ext
96 wxString GetFullPath( wxPathFormat format = wxPATH_NATIVE ) const;
97
98
99 static wxPathFormat GetFormat( wxPathFormat format = wxPATH_NATIVE );
100
101 private:
102 wxArrayString m_dirs;
103 wxString m_name;
104 wxString m_ext;
105 };
106
107
108
109 #endif // _WX_FFILENAME_H_
110