X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b13d92d1c8840feca54b00e15ad558d77bda78df..2c6f14e1a7b5062fcf77eda40824d820d9ac288e:/docs/latex/wx/mimetype.tex diff --git a/docs/latex/wx/mimetype.tex b/docs/latex/wx/mimetype.tex index 263e124619..a2c2ddf775 100644 --- a/docs/latex/wx/mimetype.tex +++ b/docs/latex/wx/mimetype.tex @@ -15,27 +15,51 @@ initialization is needed. (system-wide) and .mailcap and .mime.types in the current user's home directory: all of these files are searched for and loaded if found by default. However, additional functions -\helpref{wxMimeTypesManager::ReadMailcap}{wxmimetypesmanagerreadmailcap} and +\helpref{wxMimeTypesManager::ReadMailcap}{wxmimetypesmanagerreadmailcap} and \helpref{wxMimeTypesManager::ReadMimeTypes}{wxmimetypesmanagerreadmimetypes} are provided to load additional files. +If GNOME or KDE desktop environment is installed, then wxMimeTypesManager +gathers MIME information from respective files (e.g. .kdelnk files under KDE). + NB: Currently, wxMimeTypesManager is limited to reading MIME type information but it will support modifying it as well in the future versions. -\wxheading{Required headers} +\wxheading{Global objects} + +Global instance of wxMimeTypesManager is always available. It is defined +as follows: -#include +\begin{verbatim} +wxMimeTypesManager *wxTheMimeTypesManager; +\end{verbatim} + +It is recommended to use this instance instead of creating your own because +gathering MIME information may take quite a long on Unix systems. \wxheading{Derived from} No base class. +\wxheading{Include files} + + + \wxheading{See also} \helpref{wxFileType}{wxfiletype} \latexignore{\rtfignore{\wxheading{Function groups}}} +\membersection{Helper functions} + +All of these functions are static (i.e. don't need a wxMimeTypesManager object +to call them) and provide some useful operations for string representations of +MIME types. Their usage is recommended instead of directly working with MIME +types using wxString functions. + +\helpref{IsOfType}{wxmimetypesmanagerisoftype} + \membersection{Constructor and destructor} NB: You won't normally need to use more than one wxMimeTypesManager object in a @@ -46,22 +70,23 @@ program. \membersection{Query database} -These functions are the heart of this class: they allow to find a -\helpref{file type}{wxfiletype} object from either file extension or MIME type. +These functions are the heart of this class: they allow to find a \helpref{file type}{wxfiletype} object +from either file extension or MIME type. If the function is successful, it returns a pointer to the wxFileType object -which {\bf must be deleted by the caller}, otherwise NULL will be returned. +which {\bf must} be deleted by the caller, otherwise NULL will be returned. \helpref{GetFileTypeFromMimeType}{wxmimetypesmanagergetfiletypefrommimetype}\\ \helpref{GetFileTypeFromExtension}{wxmimetypesmanagergetfiletypefromextension} -\membersection{Initialization functions} +\membersection{Initialization functions}\label{wxmimetypesmanagerinit} -{\bf Unix:} These functions may be used to load additional (except for the -default ones which are loaded automatically) files containing MIME +{\bf Unix:} These functions may be used to load additional files (except for the +default ones which are loaded automatically) containing MIME information in either mailcap(5) or mime.types(5) format. \helpref{ReadMailcap}{wxmimetypesmanagerreadmailcap}\\ -\helpref{ReadMimeTypes}{wxmimetypesmanagerreadmimetypes} +\helpref{ReadMimeTypes}{wxmimetypesmanagerreadmimetypes}\\ +\helpref{AddFallbacks}{wxmimetypesmanageraddfallbacks} %%%%% MEMBERS HERE %%%%% \helponly{\insertatlevel{2}{ @@ -71,6 +96,7 @@ information in either mailcap(5) or mime.types(5) format. }} \membersection{wxMimeTypesManager::wxMimeTypesManager}\label{wxmimetypesmanagerctor} + \func{}{wxMimeTypesManager}{\void} Constructor puts the object in the "working" state, no additional initialization @@ -78,34 +104,75 @@ are needed - but \helpref{ReadXXX}{wxmimetypesmanagerinit} may be used to load additional mailcap/mime.types files. \membersection{wxMimeTypesManager::\destruct{wxMimeTypesManager}}\label{wxmimetypesmanagerdtor} -\func{}{\destruct{wxMimeTypesManager}{\void} + +\func{}{\destruct{wxMimeTypesManager}}{\void} Destructor is not virtual, so this class should not be derived from. +\membersection{wxMimeTypesManager::AddFallbacks}\label{wxmimetypesmanageraddfallbacks} + +\func{void}{AddFallbacks}{\param{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. + +% TODO + +Please see the typetest sample for an example of using it. + \membersection{wxMimeTypesManager::GetFileTypeFromExtension}\label{wxmimetypesmanagergetfiletypefromextension} -\func{wxFileType *}{GetFileTypeFromExtension}{\param{const wxString \&}{extension}} + +\func{wxFileType*}{GetFileTypeFromExtension}{\param{const wxString\&}{ extension}} Gather information about the files with given extension and return the corresponding \helpref{wxFileType}{wxfiletype} object or NULL if the extension is unknown. \membersection{wxMimeTypesManager::GetFileTypeFromMimeType}\label{wxmimetypesmanagergetfiletypefrommimetype} -\func{wxFileType *}{GetFileTypeFromMimeType}{\param{const wxString \&}{mimeType}} + +\func{wxFileType*}{GetFileTypeFromMimeType}{\param{const wxString\&}{ mimeType}} Gather information about the files with given MIME type and return the corresponding \helpref{wxFileType}{wxfiletype} object or NULL if the MIME type is unknown. +\membersection{wxMimeTypesManager::IsOfType}\label{wxmimetypesmanagerisoftype} + +\func{bool}{IsOfType}{\param{const wxString\&}{ mimeType}, \param{const wxString\&}{ wildcard}} + +This function returns true if either the given {\it mimeType} is exactly the +same as {\it wildcard} or if it has the same category and the subtype of +{\it wildcard} is '*'. Note that the '*' wildcard is not allowed in +{\it 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. + \membersection{wxMimeTypesManager::ReadMailcap}\label{wxmimetypesmanagerreadmailcap} -\func{\void}{ReadMailcap}{\param{const wxString \&}{filename}} + +\func{bool}{ReadMailcap}{\param{const wxString\&}{ filename}, \param{bool}{ fallback = false}} Load additional file containing information about MIME types and associated information in mailcap format. See metamail(1) and mailcap(5) for more information. +{\it fallback} parameter may be used to load additional mailcap files without +overriding the settings found in the standard files: normally, entries from +files loaded with ReadMailcap will override the entries from files loaded +previously (and the standard ones are loaded in the very beginning), but this +will not happen if this parameter is set to true (default is false). + +The return value is true if there were no errors in the file or false +otherwise. + \membersection{wxMimeTypesManager::ReadMimeTypes}\label{wxmimetypesmanagerreadmimetypes} -\func{\void}{ReadMimeTypes}{\param{const wxString \&}{filename}} + +\func{bool}{ReadMimeTypes}{\param{const wxString\&}{ filename}} Load additional file containing information about MIME types and associated information in mime.types file format. See metamail(1) and mailcap(5) for more information. + +The return value is true if there were no errors in the file or false +otherwise. +