synfig-core
1.0.3
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
synfig
filecontainer.h
Go to the documentation of this file.
1
/* === S Y N F I G ========================================================= */
21
/* ========================================================================= */
22
23
/* === S T A R T =========================================================== */
24
25
#ifndef __SYNFIG_FILECONTAINER_H
26
#define __SYNFIG_FILECONTAINER_H
27
28
/* === H E A D E R S ======================================================= */
29
30
#include <list>
31
#include "
filesystem.h
"
32
33
/* === M A C R O S ========================================================= */
34
35
/* === T Y P E D E F S ===================================================== */
36
37
/* === C L A S S E S & S T R U C T S ======================================= */
38
39
namespace
synfig
40
{
41
42
class
FileContainer
:
public
FileSystem
43
{
44
public
:
45
class
ReadStream
:
public
FileSystem::ReadStream
46
{
47
protected
:
48
friend
class
FileContainer
;
49
ReadStream
(
Handle
file_system
);
50
virtual
size_t
internal_read
(
void
*buffer,
size_t
size);
51
public
:
52
virtual
~ReadStream
();
53
};
54
55
class
WriteStream
:
public
FileSystem::WriteStream
56
{
57
protected
:
58
friend
class
FileContainer
;
59
WriteStream
(
Handle
file_system
);
60
virtual
size_t
internal_write
(
const
void
*buffer,
size_t
size);
61
public
:
62
virtual
~WriteStream
();
63
};
64
65
protected
:
66
bool
stream_opened_
;
67
bool
stream_valid_
;
68
69
public
:
70
FileContainer
();
71
virtual
~FileContainer
();
72
73
virtual
bool
create
(
const
std::string
&container_filename) = 0;
74
virtual
bool
open
(
const
std::string
&container_filename) = 0;
75
virtual
void
close
() = 0;
76
virtual
bool
is_opened
() = 0;
77
78
virtual
bool
directory_scan
(
const
std::string
&dirname, std::list< std::string > &out_files) = 0;
79
80
virtual
bool
file_open_read_whole_container
();
81
virtual
bool
file_open_read
(
const
std::string
&filename) = 0;
82
virtual
bool
file_open_write
(
const
std::string
&filename) = 0;
83
virtual
void
file_close
();
84
85
virtual
bool
file_is_opened_for_read
() = 0;
86
virtual
bool
file_is_opened_for_write
() = 0;
87
88
virtual
size_t
file_read
(
void
*buffer,
size_t
size) = 0;
89
virtual
size_t
file_write
(
const
void
*buffer,
size_t
size) = 0;
90
91
inline
bool
file_is_opened
()
92
{
93
return
file_is_opened_for_read
() ||
file_is_opened_for_write
();
94
}
95
96
ReadStreamHandle
get_read_stream_whole_container
();
97
virtual
ReadStreamHandle
get_read_stream
(
const
std::string
&filename);
98
virtual
WriteStreamHandle
get_write_stream
(
const
std::string
&filename);
99
};
100
101
}
102
103
/* === E N D =============================================================== */
104
105
#endif
Generated on Mon Nov 16 2015 15:33:39 for synfig-core by
1.8.1.2