]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/mimetype.h
ignore warning 4535 for VC8 too as it still seems to be harmless
[wxWidgets.git] / include / wx / mimetype.h
index 9018394a122c3cbb5cb436cc06a1f962aff035e0..3c99c2c621d4d770a0993f57ad298f04dbd487ca 100644 (file)
@@ -24,6 +24,7 @@
 // the things we really need
 #include "wx/string.h"
 #include "wx/dynarray.h"
+#include "wx/arrstr.h"
 
 // fwd decls
 class WXDLLIMPEXP_BASE wxIconLocation;
@@ -66,6 +67,47 @@ public:
 
 */
 
+// wxMimeTypeCommands stores the verbs defined for the given MIME type with
+// their values
+class WXDLLIMPEXP_BASE wxMimeTypeCommands
+{
+public:
+    wxMimeTypeCommands() {}
+
+    wxMimeTypeCommands(const wxArrayString& verbs,
+                       const wxArrayString& commands)
+        : m_verbs(verbs),
+          m_commands(commands)
+    {
+    }
+
+    // add a new verb with the command or replace the old value
+    void AddOrReplaceVerb(const wxString& verb, const wxString& cmd);
+    void Add(const wxString& s)
+    {
+        m_verbs.Add(s.BeforeFirst(wxT('=')));
+        m_commands.Add(s.AfterFirst(wxT('=')));
+    }
+
+    // access the commands
+    size_t GetCount() const { return m_verbs.GetCount(); }
+    const wxString& GetVerb(size_t n) const { return m_verbs[n]; }
+    const wxString& GetCmd(size_t n) const { return m_commands[n]; }
+
+    bool HasVerb(const wxString& verb) const
+        { return m_verbs.Index(verb) != wxNOT_FOUND; }
+
+    // returns empty string and wxNOT_FOUND in idx if no such verb
+    wxString GetCommandForVerb(const wxString& verb, size_t *idx = NULL) const;
+
+    // get a "verb=command" string
+    wxString GetVerbCmd(size_t n) const;
+
+private:
+    wxArrayString m_verbs;
+    wxArrayString m_commands;
+};
+
 // ----------------------------------------------------------------------------
 // wxFileTypeInfo: static container of information accessed via wxFileType.
 //
@@ -269,6 +311,25 @@ private:
     wxFileTypeImpl *m_impl;
 };
 
+//----------------------------------------------------------------------------
+// wxMimeTypesManagerFactory
+//----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxMimeTypesManagerFactory
+{
+public:
+    wxMimeTypesManagerFactory() {}
+    virtual ~wxMimeTypesManagerFactory() {}
+
+    virtual wxMimeTypesManagerImpl *CreateMimeTypesManagerImpl();
+
+    static void Set( wxMimeTypesManagerFactory *factory );
+    static wxMimeTypesManagerFactory *Get();
+    
+private:
+    static wxMimeTypesManagerFactory *m_factory;
+};
+
 // ----------------------------------------------------------------------------
 // wxMimeTypesManager: interface to system MIME database.
 //