void wxMimeTypesManager::Initialize(int mcapStyle, const wxString& sExtraDir) { #if defined(__UNIX__) && !defined(__CYGWIN__) && !defined(__WINE__) EnsureImpl(); m_impl->Initialize(mcapStyle, sExtraDir); #else (void)mcapStyle; (void)sExtraDir; #endif // Unix }
wxFileType * wxMimeTypesManager::Associate(const wxFileTypeInfo& ftInfo) { EnsureImpl(); #if defined(__WXMSW__) || defined(__UNIX__) return m_impl->Associate(ftInfo); #else // other platforms wxUnusedVar(ftInfo); wxFAIL_MSG( _T("not implemented") ); // TODO return NULL; #endif // platforms }
size_t wxMimeTypesManager::EnumAllFileTypes(wxArrayString& mimetypes) { EnsureImpl(); size_t countAll = m_impl->EnumAllFileTypes(mimetypes); // add the fallback filetypes size_t count = m_fallbacks.GetCount(); for ( size_t n = 0; n < count; n++ ) { if ( mimetypes.Index(m_fallbacks[n].GetMimeType()) == wxNOT_FOUND ) { mimetypes.Add(m_fallbacks[n].GetMimeType()); countAll++; } } return countAll; }
wxFileType * wxMimeTypesManager::GetFileTypeFromExtension(const wxString& ext) { EnsureImpl(); wxFileType *ft = m_impl->GetFileTypeFromExtension(ext); if ( !ft ) { // check the fallbacks // // TODO linear search is potentially slow, perhaps we should use a // sorted array? size_t count = m_fallbacks.GetCount(); for ( size_t n = 0; n < count; n++ ) { if ( m_fallbacks[n].GetExtensions().Index(ext) != wxNOT_FOUND ) { ft = new wxFileType(m_fallbacks[n]); break; } } } return ft; }
wxFileType * wxMimeTypesManager::GetFileTypeFromMimeType(const wxString& mimeType) { EnsureImpl(); wxFileType *ft = m_impl->GetFileTypeFromMimeType(mimeType); if ( !ft ) { // check the fallbacks // // TODO linear search is potentially slow, perhaps we should use a // sorted array? size_t count = m_fallbacks.GetCount(); for ( size_t n = 0; n < count; n++ ) { if ( wxMimeTypesManager::IsOfType(mimeType, m_fallbacks[n].GetMimeType()) ) { ft = new wxFileType(m_fallbacks[n]); break; } } } return ft; }
bool wxMimeTypesManager::ReadMimeTypes(const wxString& filename) { EnsureImpl(); return m_impl->ReadMimeTypes(filename); }
bool wxMimeTypesManager::ReadMailcap(const wxString& filename, bool fallback) { EnsureImpl(); return m_impl->ReadMailcap(filename, fallback); }