1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: classes and functions to manage MIME types
4 // Author: David Webster
8 // Copyright: adopted from msw port -- (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows license (part of wxExtra library)
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _MIMETYPE_IMPL_H
13 #define _MIMETYPE_IMPL_H
17 #include "wx/mimetype.h"
20 class WXDLLEXPORT wxFileTypeImpl
24 wxFileTypeImpl() { m_info
= NULL
; }
26 // one of these Init() function must be called (ctor can't take any
27 // arguments because it's common)
29 // initialize us with our file type name and extension - in this case
30 // we will read all other data from the registry
31 void Init(const wxString
& strFileType
, const wxString
& ext
)
32 { m_strFileType
= strFileType
; m_ext
= ext
; }
34 // initialize us with a wxFileTypeInfo object - it contains all the
36 void Init(const wxFileTypeInfo
& info
)
39 // implement accessor functions
40 bool GetExtensions(wxArrayString
& extensions
);
41 bool GetMimeType(wxString
*mimeType
) const;
42 bool GetMimeTypes(wxArrayString
& mimeTypes
) const;
43 bool GetIcon(wxIcon
*icon
) const;
44 bool GetDescription(wxString
*desc
) const;
45 bool GetOpenCommand(wxString
*openCmd
,
46 const wxFileType::MessageParameters
& params
) const;
47 bool GetPrintCommand(wxString
*printCmd
,
48 const wxFileType::MessageParameters
& params
) const;
51 // helper function: reads the command corresponding to the specified verb
52 // from the registry (returns an empty string if not found)
53 wxString
GetCommand(const wxChar
*verb
) const;
55 // we use either m_info or read the data from the registry if m_info == NULL
56 const wxFileTypeInfo
*m_info
;
57 wxString m_strFileType
, // may be empty
63 class WXDLLEXPORT wxMimeTypesManagerImpl
66 // nothing to do here, we don't load any data but just go and fetch it from
67 // the registry when asked for
68 wxMimeTypesManagerImpl() { }
70 // implement containing class functions
71 wxFileType
*GetFileTypeFromExtension(const wxString
& ext
);
72 wxFileType
*GetFileTypeFromMimeType(const wxString
& mimeType
);
74 size_t EnumAllFileTypes(wxArrayString
& mimetypes
);
76 // this are NOPs under Windows
77 bool ReadMailcap(const wxString
& filename
, bool fallback
= TRUE
)
79 bool ReadMimeTypes(const wxString
& filename
)
82 void AddFallback(const wxFileTypeInfo
& ft
) { m_fallbacks
.Add(ft
); }
85 wxArrayFileTypeInfo m_fallbacks
;