1 // tu_file.h	-- Ignacio Casta�o, Thatcher Ulrich 2003
2 
3 // This source code has been donated to the Public Domain.  Do
4 // whatever you want with it.
5 
6 // A very generic file class that can be customized with callbacks.
7 
8 
9 #ifndef TU_FILE_H
10 #define TU_FILE_H
11 
12 #include <cstdio>
13 #include <memory>
14 #include "dsodefs.h"
15 
16 namespace gnash {
17     class IOChannel;
18 }
19 
20 namespace gnash {
21 
22 /// \brief
23 /// Creates an IOChannel wrapper around a C stream.
24 //
25 /// @param fp A C stream
26 ///
27 /// @param close Whether the C stream should be automatically closed.
28 DSOEXPORT std::unique_ptr<IOChannel> makeFileChannel(FILE* fp, bool close);
29 
30 /// \brief
31 /// Creates an IOChannel by opening the given file in the given mode.
32 //
33 /// @param filepath A path to a file in the local filesystem.
34 ///
35 /// @param mode The mode the file should be opened in, such as "rb" "w+b" (see
36 /// std::fopen)
37 ///
38 /// @return An IOChannel or NULL if the file could not be opened.
39 DSOEXPORT std::unique_ptr<IOChannel> makeFileChannel(const char* filepath, const char* mode);
40 
41 } // namespace gnash
42 #endif
43 
44 // Local Variables:
45 // mode: C++
46 // indent-tabs-mode: t
47 // End:
48