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