/
iarchive.h
59 lines (49 loc) · 1.49 KB
/
iarchive.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
/**
* \file iarchive.h
* Types relating to the use of ZIP archives (PK4 files) and their contents.
* \ingroup vfs
*/
#include "ModResource.h"
#include "imodule.h"
#include <cstddef>
#include "itextstream.h"
#include <string>
class InputStream;
/**
* A file opened in binary mode.
* \ingroup vfs
*/
class ArchiveFile
{
public:
/// \brief destructor
virtual ~ArchiveFile() {}
/// \brief Returns the size of the file data in bytes.
virtual std::size_t size() const = 0;
/// \brief Returns the path to this file (relative to the filesystem root)
virtual const std::string& getName() const = 0;
/// \brief Returns the stream associated with this file.
/// Subsequent calls return the same stream.
/// The stream may be read forwards until it is exhausted.
/// The stream remains valid for the lifetime of the file.
virtual InputStream& getInputStream() = 0;
};
typedef std::shared_ptr<ArchiveFile> ArchiveFilePtr;
/**
* A file opened in text mode.
* \ingroup vfs
*/
class ArchiveTextFile :
public ModResource
{
public:
/// \brief Returns the path to this file (relative to the filesystem root)
virtual const std::string& getName() const = 0;
/// \brief Returns the stream associated with this file.
/// Subsequent calls return the same stream.
/// The stream may be read forwards until it is exhausted.
/// The stream remains valid for the lifetime of the file.
virtual TextInputStream& getInputStream() = 0;
};
typedef std::shared_ptr<ArchiveTextFile> ArchiveTextFilePtr;