+ if (m_owns)
+ delete m_parent_o_stream;
+}
+
+// ----------------------------------------------------------------------------
+// wxFilterClassFactory
+// ----------------------------------------------------------------------------
+
+IMPLEMENT_ABSTRACT_CLASS(wxFilterClassFactory, wxObject)
+
+wxFilterClassFactory *wxFilterClassFactory::sm_first = NULL;
+
+bool wxFilterClassFactory::CanHandle(const wxChar *protocol,
+ wxStreamProtocolType type) const
+{
+ if (type == wxSTREAM_FILEEXTENSION)
+ {
+ size_t len = wxStrlen(protocol);
+
+ for (const wxChar * const *p = GetProtocols(type); p && *p; p++)
+ {
+ size_t l = wxStrlen(*p);
+
+ if (l <= len && wxStrcmp(*p, protocol + len - l) == 0)
+ return true;
+ }
+ }
+ else
+ {
+ for (const wxChar * const *p = GetProtocols(type); p && *p; p++)
+ if (wxStrcmp(*p, protocol) == 0)
+ return true;
+ }
+
+ return false;
+}
+
+void wxFilterClassFactory::Remove()
+{
+ if (m_next != this)
+ {
+ wxFilterClassFactory **pp = &sm_first;
+
+ while (*pp != this)
+ pp = &(*pp)->m_next;
+
+ *pp = m_next;
+
+ m_next = this;
+ }