X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/83d8eb470b87ee0f19a203d2af3b70b153a87554..22886fb3c34356d015591846f343344733a03149:/src/common/mimecmn.cpp?ds=sidebyside diff --git a/src/common/mimecmn.cpp b/src/common/mimecmn.cpp index e6ca2e5f63..104285eac5 100644 --- a/src/common/mimecmn.cpp +++ b/src/common/mimecmn.cpp @@ -18,10 +18,6 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ - #pragma implementation "mimetypebase.h" -#endif - // for compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -85,7 +81,17 @@ wxFileTypeInfo::wxFileTypeInfo(const wxChar *mimeType, for ( ;; ) { + // icc gives this warning in its own va_arg() macro, argh +#ifdef __INTELC__ + #pragma warning(push) + #pragma warning(disable: 1684) +#endif + const wxChar *ext = va_arg(argptr, const wxChar *); + +#ifdef __INTELC__ + #pragma warning(pop) +#endif if ( !ext ) { // NULL terminates the list @@ -114,7 +120,7 @@ wxFileTypeInfo::wxFileTypeInfo(const wxArrayString& sArray) } #include "wx/arrimpl.cpp" -WX_DEFINE_OBJARRAY(wxArrayFileTypeInfo); +WX_DEFINE_OBJARRAY(wxArrayFileTypeInfo) // ============================================================================ // implementation of the wrapper classes @@ -412,12 +418,16 @@ bool wxFileType::Unassociate() #endif } -bool wxFileType::SetCommand(const wxString& cmd, const wxString& verb, -bool overwriteprompt) +bool wxFileType::SetCommand(const wxString& cmd, + const wxString& verb, + bool overwriteprompt) { #if defined (__WXMSW__) || defined(__UNIX__) return m_impl->SetCommand(cmd, verb, overwriteprompt); #else + wxUnusedVar(cmd); + wxUnusedVar(verb); + wxUnusedVar(overwriteprompt); wxFAIL_MSG(_T("not implemented")); return false; #endif @@ -437,12 +447,40 @@ bool wxFileType::SetDefaultIcon(const wxString& cmd, int index) #if defined (__WXMSW__) || defined(__UNIX__) return m_impl->SetDefaultIcon (cmd, index); #else + wxUnusedVar(index); wxFAIL_MSG(_T("not implemented")); - return false; #endif } +//---------------------------------------------------------------------------- +// wxMimeTypesManagerFactory +//---------------------------------------------------------------------------- + +wxMimeTypesManagerFactory *wxMimeTypesManagerFactory::m_factory = NULL; + +/* static */ +void wxMimeTypesManagerFactory::SetFactory( wxMimeTypesManagerFactory *factory ) +{ + if (wxMimeTypesManagerFactory::m_factory) + delete wxMimeTypesManagerFactory::m_factory; + + wxMimeTypesManagerFactory::m_factory = factory; +} + +/* static */ +wxMimeTypesManagerFactory *wxMimeTypesManagerFactory::GetFactory() +{ + if (!wxMimeTypesManagerFactory::m_factory) + wxMimeTypesManagerFactory::m_factory = new wxMimeTypesManagerFactory; + + return wxMimeTypesManagerFactory::m_factory; +} + +wxMimeTypesManagerImpl *wxMimeTypesManagerFactory::CreateMimeTypesManagerImpl() +{ + return new wxMimeTypesManagerImpl; +} // ---------------------------------------------------------------------------- // wxMimeTypesManager @@ -451,7 +489,7 @@ bool wxFileType::SetDefaultIcon(const wxString& cmd, int index) void wxMimeTypesManager::EnsureImpl() { if ( !m_impl ) - m_impl = new wxMimeTypesManagerImpl; + m_impl = wxMimeTypesManagerFactory::GetFactory()->CreateMimeTypesManagerImpl(); } bool wxMimeTypesManager::IsOfType(const wxString& mimeType, @@ -506,6 +544,7 @@ wxMimeTypesManager::Associate(const wxFileTypeInfo& ftInfo) #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