]> git.saurik.com Git - wxWidgets.git/commitdiff
Factory some of wxFilterClassFactory into a base class.
authorMichael Wetherell <mike.wetherell@ntlworld.com>
Fri, 27 Oct 2006 07:52:28 +0000 (07:52 +0000)
committerMichael Wetherell <mike.wetherell@ntlworld.com>
Fri, 27 Oct 2006 07:52:28 +0000 (07:52 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42492 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/stream.h
src/common/stream.cpp

index cad5148ab906bb41eede60c7aa4d15697be0919d..505bb3462581544c8466178cd4c946ac4a416487 100644 (file)
@@ -335,15 +335,10 @@ enum wxStreamProtocolType
 
 void WXDLLIMPEXP_BASE wxUseFilterClasses();
 
-class WXDLLIMPEXP_BASE wxFilterClassFactory : public wxObject
+class WXDLLIMPEXP_BASE wxFilterClassFactoryBase : public wxObject
 {
 public:
-    virtual ~wxFilterClassFactory() { }
-
-    virtual wxFilterInputStream  *NewStream(wxInputStream& stream)  const = 0;
-    virtual wxFilterOutputStream *NewStream(wxOutputStream& stream) const = 0;
-    virtual wxFilterInputStream  *NewStream(wxInputStream *stream)  const = 0;
-    virtual wxFilterOutputStream *NewStream(wxOutputStream *stream) const = 0;
+    virtual ~wxFilterClassFactoryBase() { }
 
     wxString GetProtocol() const { return wxString(*GetProtocols()); }
     wxString PopExtension(const wxString& location) const;
@@ -355,6 +350,22 @@ public:
                    wxStreamProtocolType type
                    = wxSTREAM_PROTOCOL) const;
 
+protected:
+    wxString::size_type FindExtension(const wxChar *location) const;
+
+    DECLARE_ABSTRACT_CLASS(wxFilterClassFactoryBase)
+};
+
+class WXDLLIMPEXP_BASE wxFilterClassFactory : public wxFilterClassFactoryBase
+{
+public:
+    virtual ~wxFilterClassFactory() { }
+
+    virtual wxFilterInputStream  *NewStream(wxInputStream& stream)  const = 0;
+    virtual wxFilterOutputStream *NewStream(wxOutputStream& stream) const = 0;
+    virtual wxFilterInputStream  *NewStream(wxInputStream *stream)  const = 0;
+    virtual wxFilterOutputStream *NewStream(wxOutputStream *stream) const = 0;
+
     static const wxFilterClassFactory *Find(const wxChar *protocol,
                                             wxStreamProtocolType type
                                             = wxSTREAM_PROTOCOL);
@@ -371,8 +382,6 @@ protected:
     wxFilterClassFactory& operator=(const wxFilterClassFactory&)
         { return *this; }
 
-    wxString::size_type FindExtension(const wxChar *location) const;
-
 private:
     static wxFilterClassFactory *sm_first;
     wxFilterClassFactory *m_next;
index 8aa12b5e24609c88a5dbbfadc2a5fa6e9a80fb8f..5407bd206237d9f115f73893a28a9551c37b123d 100644 (file)
@@ -1106,19 +1106,18 @@ wxFilterOutputStream::~wxFilterOutputStream()
 }
 
 // ----------------------------------------------------------------------------
-// wxFilterClassFactory
+// wxFilterClassFactoryBase
 // ----------------------------------------------------------------------------
 
-IMPLEMENT_ABSTRACT_CLASS(wxFilterClassFactory, wxObject)
-
-wxFilterClassFactory *wxFilterClassFactory::sm_first = NULL;
+IMPLEMENT_ABSTRACT_CLASS(wxFilterClassFactoryBase, wxObject)
 
-wxString wxFilterClassFactory::PopExtension(const wxString& location) const
+wxString wxFilterClassFactoryBase::PopExtension(const wxString& location) const
 {
     return location.substr(0, FindExtension(location));
 }
 
-wxString::size_type wxFilterClassFactory::FindExtension(const wxChar *location) const
+wxString::size_type wxFilterClassFactoryBase::FindExtension(
+        const wxChar *location) const
 {
     size_t len = wxStrlen(location);
 
@@ -1135,8 +1134,8 @@ wxString::size_type wxFilterClassFactory::FindExtension(const wxChar *location)
     return wxString::npos;
 }
 
-bool wxFilterClassFactory::CanHandle(const wxChar *protocol,
-                                     wxStreamProtocolType type) const
+bool wxFilterClassFactoryBase::CanHandle(const wxChar *protocol,
+                                         wxStreamProtocolType type) const
 {
     if (type == wxSTREAM_FILEEXTENSION)
         return FindExtension(protocol) != wxString::npos;
@@ -1148,6 +1147,14 @@ bool wxFilterClassFactory::CanHandle(const wxChar *protocol,
     return false;
 }
 
+// ----------------------------------------------------------------------------
+// wxFilterClassFactory
+// ----------------------------------------------------------------------------
+
+IMPLEMENT_ABSTRACT_CLASS(wxFilterClassFactory, wxFilterClassFactoryBase)
+
+wxFilterClassFactory *wxFilterClassFactory::sm_first = NULL;
+
 void wxFilterClassFactory::Remove()
 {
     if (m_next != this)