]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/fltfactory.tex
add events API to wxHtmlWindow (patch #1504493 by Francesco Montorsi)
[wxWidgets.git] / docs / latex / wx / fltfactory.tex
1 %
2 % automatically generated by HelpGen $Revision$ from
3 % include/wx/stream.h at 28/Oct/06 18:49:10
4 %
5
6 \section{\class{wxFilterClassFactory}}\label{wxfilterclassfactory}
7
8 Allows the creation of filter streams to handle compression formats such
9 as gzip and bzip2.
10
11 For example, given a filename you can search for a factory that will
12 handle it and create a stream to decompress it:
13
14 \begin{verbatim}
15 factory = wxFilterClassFactory::Find(filename, wxSTREAM_FILEEXT);
16 if (factory)
17 stream = factory->NewStream(new wxFFileInputStream(filename));
18
19 \end{verbatim}
20
21 \helpref{Find()}{wxfilterclassfactoryfind} can also search
22 for a factory by MIME type, HTTP encoding or by wxFileSystem protocol.
23 The available factories can be enumerated
24 using \helpref{GetFirst() and GetNext()}{wxfilterclassfactorygetfirst}.
25
26 \wxheading{Derived from}
27
28 \helpref{wxObject}{wxobject}
29
30 \wxheading{Include files}
31
32 <wx/stream.h>
33
34 \wxheading{Data structures}
35
36 \begin{verbatim}
37 enum wxStreamProtocolType
38 {
39 wxSTREAM_PROTOCOL, // wxFileSystem protocol (should be only one)
40 wxSTREAM_MIMETYPE, // MIME types the stream handles
41 wxSTREAM_ENCODING, // The HTTP Content-Encodings the stream handles
42 wxSTREAM_FILEEXT // File extensions the stream handles
43 };
44
45 \end{verbatim}
46
47 \wxheading{See also}
48
49 \helpref{wxFilterInputStream}{wxfilterinputstream}\\
50 \helpref{wxFilterOutputStream}{wxfilteroutputstream}\\
51 \helpref{wxArchiveClassFactory}{wxarchiveclassfactory}\\
52 \helpref{Archive formats such as zip}{wxarc}
53
54 \latexignore{\rtfignore{\wxheading{Members}}}
55
56
57 \membersection{wxFilterClassFactory::CanHandle}\label{wxfilterclassfactorycanhandle}
58
59 \constfunc{bool}{CanHandle}{\param{const wxChar* }{protocol}, \param{wxStreamProtocolType }{type = wxSTREAM\_PROTOCOL}}
60
61 Returns true if this factory can handle the given protocol, MIME type, HTTP
62 encoding or file extension.
63
64 When using wxSTREAM\_FILEEXT for the second parameter, the first parameter
65 can be a complete filename rather than just an extension.
66
67
68 \membersection{wxFilterClassFactory::Find}\label{wxfilterclassfactoryfind}
69
70 \func{static const wxFilterClassFactory*}{Find}{\param{const wxChar* }{protocol}, \param{wxStreamProtocolType }{type = wxSTREAM\_PROTOCOL}}
71
72 A static member that finds a factory that can handle a given protocol, MIME
73 type, HTTP encoding or file extension. Returns a pointer to the class
74 factory if found, or NULL otherwise. It does not give away ownership of the
75 factory.
76
77 When using wxSTREAM\_FILEEXT for the second parameter, the first parameter
78 can be a complete filename rather than just an extension.
79
80
81 \membersection{wxFilterClassFactory::GetFirst/GetNext}\label{wxfilterclassfactorygetfirst}
82
83 \func{static const wxFilterClassFactory*}{GetFirst}{\void}
84
85 \constfunc{const wxFilterClassFactory*}{GetNext}{\void}
86
87 GetFirst and GetNext can be used to enumerate the available factories.
88
89 For example, to list them:
90
91 \begin{verbatim}
92 wxString list;
93 const wxFilterClassFactory *factory = wxFilterClassFactory::GetFirst();
94
95 while (factory) {
96 list << factory->GetProtocol() << _T("\n");
97 factory = factory->GetNext();
98 }
99
100 \end{verbatim}
101
102 GetFirst()/GetNext() return a pointer to a factory or NULL if no more
103 are available. They do not give away ownership of the factory.
104
105
106 \membersection{wxFilterClassFactory::GetProtocol}\label{wxfilterclassfactorygetprotocol}
107
108 \constfunc{wxString}{GetProtocol}{\void}
109
110 Returns the wxFileSystem protocol supported by this factory. Equivalent
111 to wxString(*GetProtcols()).
112
113
114 \membersection{wxFilterClassFactory::GetProtocols}\label{wxfilterclassfactorygetprotocols}
115
116 \constfunc{const wxChar * const*}{GetProtocols}{\param{wxStreamProtocolType }{type = wxSTREAM\_PROTOCOL}}
117
118 Returns the protocols, MIME types, HTTP encodings or file extensions
119 supported by this factory, as an array of null terminated strings. It does
120 not give away ownership of the array or strings.
121
122 For example, to list the file extensions a factory supports:
123
124 \begin{verbatim}
125 wxString list;
126 const wxChar *const *p;
127
128 for (p = factory->GetProtocols(wxSTREAM_FILEEXT); *p; p++)
129 list << *p << _T("\n");
130
131 \end{verbatim}
132
133
134 \membersection{wxFilterClassFactory::NewStream}\label{wxfilterclassfactorynewstream}
135
136 \constfunc{wxFilterInputStream*}{NewStream}{\param{wxInputStream\& }{stream}}
137
138 \constfunc{wxFilterOutputStream*}{NewStream}{\param{wxOutputStream\& }{stream}}
139
140 \constfunc{wxFilterInputStream*}{NewStream}{\param{wxInputStream* }{stream}}
141
142 \constfunc{wxFilterOutputStream*}{NewStream}{\param{wxOutputStream* }{stream}}
143
144 Create a new input or output stream to decompress or compress a given stream.
145
146 If the parent stream is passed as a pointer then the new filter stream
147 takes ownership of it. If it is passed by reference then it does not.
148
149
150 \membersection{wxFilterClassFactory::PopExtension}\label{wxfilterclassfactorypopextension}
151
152 \constfunc{wxString}{PopExtension}{\param{const wxString\& }{location}}
153
154 Remove the file extension of {\it location} if it is one of the file
155 extensions handled by this factory.
156
157
158 \membersection{wxFilterClassFactory::PushFront}\label{wxfilterclassfactorypushfront}
159
160 \func{void}{PushFront}{\void}
161
162 Adds this class factory to the list returned
163 by \helpref{GetFirst()/GetNext()}{wxfilterclassfactorygetfirst}.
164
165 It is not necessary to do this to use the filter streams. It is usually
166 used when implementing streams, typically the implementation will
167 add a static instance of its factory class.
168
169 It can also be used to change the order of a factory already in the list,
170 bringing it to the front. This isn't a thread safe operation
171 so can't be done when other threads are running that will be using the list.
172
173 The list does not take ownership of the factory.
174
175
176 \membersection{wxFilterClassFactory::Remove}\label{wxfilterclassfactoryremove}
177
178 \func{void}{Remove}{\void}
179
180 Removes this class factory from the list returned
181 by \helpref{GetFirst()/GetNext()}{wxfilterclassfactorygetfirst}.
182
183 Removing from the list isn't a thread safe operation
184 so can't be done when other threads are running that will be using the list.
185
186 The list does not own the factories, so removing a factory does not delete it.