Debian Codegraph @

core/libs/dngwriter/extra/dng_sdk/dng_file_stream.h

raw
1 /*****************************************************************************/
2 // Copyright 2006-2019 Adobe Systems Incorporated
3 // All Rights Reserved.
4 //
5 // NOTICE: Adobe permits you to use, modify, and distribute this file in
6 // accordance with the terms of the Adobe license agreement accompanying it.
7 /*****************************************************************************/
8
9 /** \file
10 * Simple, portable, file read/write support.
11 */
12
13 /*****************************************************************************/
14
15 #ifndef __dng_file_stream__
16 #define __dng_file_stream__
17
18 /*****************************************************************************/
19
20 #include "dng_stream.h"
21
22 /*****************************************************************************/
23
24 /// @brief A stream to/from a disk file. See dng_stream for read/write interface
25 ///
26 /// Also see comment in dng_stream.h regarding the caller's responsibility for
27 /// calling the Flush method.
28
29 class dng_file_stream: public dng_stream
30 {
31
32 private:
33
34 FILE *fFile;
35
36 public:
37
38 /// Open a stream on a filename by path.
39 /// \param filename Pathname in platform syntax.
40 /// \param output Set to true if writing, false otherwise.
41 /// \param bufferSize size of internal buffer to use. Defaults to
42 /// kDefaultBufferSize.
43
44 dng_file_stream (const char *filename,
45 bool output = false,
46 uint32 bufferSize = kDefaultBufferSize);
47
48 /// Open a stream on a FILE*.
49 /// \param file FILE pointer. It should be opened in binary mode.
50 /// I.e., use "rb" for reading and "wb" for writing.
51 /// \param bufferSize size of internal buffer to use. Defaults to
52 /// kDefaultBufferSize.
53
54 dng_file_stream (FILE *file,
55 uint32 bufferSize = kDefaultBufferSize);
56
57 #if qAndroid
58
59 dng_file_stream (int fileDescriptor,
60 bool output = false,
61 uint32 bufferSize = kDefaultBufferSize);
62
63 dng_file_stream (int fileDescriptor,
64 const char *mode,
65 uint32 bufferSize = kDefaultBufferSize);
66
67 #endif // qAndroid
68
69 #if qWinOS
70
71 dng_file_stream (const wchar_t *filename,
72 bool output = false,
73 uint32 bufferSize = kDefaultBufferSize);
74
75 #endif // qWinOS
76
77 virtual ~dng_file_stream ();
78
79 protected:
80
81 virtual uint64 DoGetLength ();
82
83 virtual void DoRead (void *data,
84 uint32 count,
85 uint64 offset);
86
87 virtual void DoWrite (const void *data,
88 uint32 count,
89 uint64 offset);
90
91 };
92
93 /*****************************************************************************/
94
95 #endif
96
97 /*****************************************************************************/