]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/mimetype.tex
More asserts and stuff
[wxWidgets.git] / docs / latex / wx / mimetype.tex
1 \section{\class{wxMimeTypesManager}}\label{wxmimetypesmanager}
2
3 This class allows the application to retrieve the information about all known
4 MIME types from a system-specific location and the filename extensions to the
5 MIME types and vice versa. After initialization the functions
6 \helpref{wxMimeTypesManager::GetFileTypeFromMimeType}{wxmimetypesmanagergetfiletypefrommimetype}
7 and \helpref{wxMimeTypesManager::GetFileTypeFromExtension}{wxmimetypesmanagergetfiletypefromextension}
8 may be called: they will return a \helpref{wxFileType}{wxfiletype} object which
9 may be further queried for file description, icon and other attributes.
10
11 {\bf Windows:} MIME type information is stored in the registry and no additional
12 initialization is needed.
13
14 {\bf Unix:} MIME type information is stored in the files mailcap and mime.types
15 (system-wide) and .mailcap and .mime.types in the current user's home directory:
16 all of these files are searched for and loaded if found by default. However,
17 additional functions
18 \helpref{wxMimeTypesManager::ReadMailcap}{wxmimetypesmanagerreadmailcap} and
19 \helpref{wxMimeTypesManager::ReadMimeTypes}{wxmimetypesmanagerreadmimetypes} are
20 provided to load additional files.
21
22 NB: Currently, wxMimeTypesManager is limited to reading MIME type information
23 but it will support modifying it as well in the future versions.
24
25 \wxheading{Derived from}
26
27 No base class.
28
29 \wxheading{Include files}
30
31 <wx/mimetype.h>
32
33 \wxheading{See also}
34
35 \helpref{wxFileType}{wxfiletype}
36
37 \latexignore{\rtfignore{\wxheading{Function groups}}}
38
39 \membersection{Helper functions}
40
41 All of these functions are static (i.e. don't need a wxMimeTypesManager object
42 to call them) and provide some useful operations for string representations of
43 MIME types. Their usage is recommended instead of directly working with MIME
44 types using wxString functions.
45
46 \helpref{IsOfType}{wxmimetypesmanagerisoftype}
47
48 \membersection{Constructor and destructor}
49
50 NB: You won't normally need to use more than one wxMimeTypesManager object in a
51 program.
52
53 \helpref{wxMimeTypesManager}{wxmimetypesmanagerctor}\\
54 \helpref{\destruct{wxMimeTypesManager}}{wxmimetypesmanagerdtor}
55
56 \membersection{Query database}
57
58 These functions are the heart of this class: they allow to find a \helpref{file type}{wxfiletype} object
59 from either file extension or MIME type.
60 If the function is successful, it returns a pointer to the wxFileType object
61 which {\bf must} be deleted by the caller, otherwise NULL will be returned.
62
63 \helpref{GetFileTypeFromMimeType}{wxmimetypesmanagergetfiletypefrommimetype}\\
64 \helpref{GetFileTypeFromExtension}{wxmimetypesmanagergetfiletypefromextension}
65
66 \membersection{Initialization functions}\label{wxmimetypesmanagerinit}
67
68 {\bf Unix:} These functions may be used to load additional files (except for the
69 default ones which are loaded automatically) containing MIME
70 information in either mailcap(5) or mime.types(5) format.
71
72 \helpref{ReadMailcap}{wxmimetypesmanagerreadmailcap}\\
73 \helpref{ReadMimeTypes}{wxmimetypesmanagerreadmimetypes}
74
75 %%%%% MEMBERS HERE %%%%%
76 \helponly{\insertatlevel{2}{
77
78 \wxheading{Members}
79
80 }}
81
82 \membersection{wxMimeTypesManager::wxMimeTypesManager}\label{wxmimetypesmanagerctor}
83
84 \func{}{wxMimeTypesManager}{\void}
85
86 Constructor puts the object in the "working" state, no additional initialization
87 are needed - but \helpref{ReadXXX}{wxmimetypesmanagerinit} may be used to load
88 additional mailcap/mime.types files.
89
90 \membersection{wxMimeTypesManager::\destruct{wxMimeTypesManager}}\label{wxmimetypesmanagerdtor}
91
92 \func{}{\destruct{wxMimeTypesManager}}{\void}
93
94 Destructor is not virtual, so this class should not be derived from.
95
96 \membersection{wxMimeTypesManager::GetFileTypeFromExtension}\label{wxmimetypesmanagergetfiletypefromextension}
97
98 \func{wxFileType*}{GetFileTypeFromExtension}{\param{const wxString\&}{ extension}}
99
100 Gather information about the files with given extension and return the
101 corresponding \helpref{wxFileType}{wxfiletype} object or NULL if the extension
102 is unknown.
103
104 \membersection{wxMimeTypesManager::GetFileTypeFromMimeType}\label{wxmimetypesmanagergetfiletypefrommimetype}
105
106 \func{wxFileType*}{GetFileTypeFromMimeType}{\param{const wxString\&}{ mimeType}}
107
108 Gather information about the files with given MIME type and return the
109 corresponding \helpref{wxFileType}{wxfiletype} object or NULL if the MIME type
110 is unknown.
111
112 \membersection{wxMimeTypesManager::IsOfType}\label{wxmimetypesmanagerisoftype}
113
114 \func{bool}{IsOfType}{\param{const wxString\&}{ mimeType}, \param{const wxString\&}{ wildcard}}
115
116 This function returns TRUE if either the given {\it mimeType} is exactly the
117 same as {\it wildcard} or if it has the same category and the subtype of
118 {\it wildcard} is '*'. Note that the '*' wildcard is not allowed in
119 {\it mimeType} itself.
120
121 The comparaison don by this function is case insensitive so it is not
122 necessary to convert the strings to the same case before calling it.
123
124 \membersection{wxMimeTypesManager::ReadMailcap}\label{wxmimetypesmanagerreadmailcap}
125
126 \func{bool}{ReadMailcap}{\param{const wxString\&}{ filename}, \param{bool}{ fallback = FALSE}}
127
128 Load additional file containing information about MIME types and associated
129 information in mailcap format. See metamail(1) and mailcap(5) for more
130 information.
131
132 {\it fallback} parameter may be used to load additional mailcap files without
133 overriding the settings found in the standard files: normally, entries from
134 files loaded with ReadMailcap will override the entries from files loaded
135 previously (and the standard ones are loaded in the very beginning), but this
136 will not happen if this parameter is set to TRUE (default is FALSE).
137
138 The return value is TRUE if there were no errors in the file or FALSE
139 otherwise.
140
141 \membersection{wxMimeTypesManager::ReadMimeTypes}\label{wxmimetypesmanagerreadmimetypes}
142
143 \func{bool}{ReadMimeTypes}{\param{const wxString\&}{ filename}}
144
145 Load additional file containing information about MIME types and associated
146 information in mime.types file format. See metamail(1) and mailcap(5) for more
147 information.
148
149 The return value is TRUE if there were no errors in the file or FALSE
150 otherwise.
151