#include <wx/mimetype.h>
After initialization the functions GetFileTypeFromMimeType() and GetFileTypeFromExtension() may be called: they will return a wxFileType object which may be further queried for file description, icon and other attributes.
Under Windows, the MIME type information is queried from registry. Under Linux and Unix, it is queried from the XDG data directories.
Currently, wxMimeTypesManager is limited to reading MIME type information.
The application should not construct its own manager: it should use the object pointer wxTheMimeTypesManger.
Public Member Functions | |
wxMimeTypesManager () | |
Constructor puts the object in the "working" state. | |
~wxMimeTypesManager () | |
Destructor is not virtual, so this class should not be derived from. | |
void | AddFallbacks (const wxFileTypeInfo *fallbacks) |
This function may be used to provide hard-wired fallbacks for the MIME types and extensions that might not be present in the system MIME database. | |
wxFileType * | GetFileTypeFromExtension (const wxString &extension) |
Gather information about the files with given extension and return the corresponding wxFileType object or NULL if the extension is unknown. | |
wxFileType * | GetFileTypeFromMimeType (const wxString &mimeType) |
Gather information about the files with given MIME type and return the corresponding wxFileType object or NULL if the MIME type is unknown. | |
Static Public Member Functions | |
static bool | IsOfType (const wxString &mimeType, const wxString &wildcard) |
This function returns true if either the given mimeType is exactly the same as wildcard or if it has the same category and the subtype of wildcard is '*'. |
wxMimeTypesManager::wxMimeTypesManager | ( | ) |
Constructor puts the object in the "working" state.
wxMimeTypesManager::~wxMimeTypesManager | ( | ) |
Destructor is not virtual, so this class should not be derived from.
void wxMimeTypesManager::AddFallbacks | ( | const wxFileTypeInfo * | fallbacks | ) |
This function may be used to provide hard-wired fallbacks for the MIME types and extensions that might not be present in the system MIME database.
Please see the typetest sample for an example of using it.
wxFileType* wxMimeTypesManager::GetFileTypeFromExtension | ( | const wxString & | extension | ) |
Gather information about the files with given extension and return the corresponding wxFileType object or NULL if the extension is unknown.
The extension parameter may have, or not, the leading dot, if it has it, it is stripped automatically. It must not however be empty.
wxFileType* wxMimeTypesManager::GetFileTypeFromMimeType | ( | const wxString & | mimeType | ) |
Gather information about the files with given MIME type and return the corresponding wxFileType object or NULL if the MIME type is unknown.
static bool wxMimeTypesManager::IsOfType | ( | const wxString & | mimeType, | |
const wxString & | wildcard | |||
) | [static] |
This function returns true if either the given mimeType is exactly the same as wildcard or if it has the same category and the subtype of wildcard is '*'.
Note that the '*' wildcard is not allowed in mimeType itself.
The comparison don by this function is case insensitive so it is not necessary to convert the strings to the same case before calling it.
![]() |
[ top ] |