acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
translatable.h
1#pragma once
2
3
4#include "acme/constant/filesystem.h"
5
6
7namespace file
8{
9
10
11
12 class CLASS_DECL_ACME streamable_base :
13 virtual public ::particle
14 {
15 public:
16
17 streamable_base();
18 ~streamable_base() override;
19
20 virtual void close();
21
22 };
23
24 class CLASS_DECL_ACME translatable :
25 virtual public streamable_base
26 {
27 public:
28
29
30 // derived class must implement these
31 virtual void translate(filesize offset, enum_seek eseek);
32 virtual ::filesize get_position() const;
33
34
35 void operator ++()
36 {
37
38 return translate(1, ::e_seek_current);
39
40 }
41
42
43 void operator--()
44 {
45
46 return translate(-1, ::e_seek_current);
47
48 }
49
50
51 void operator +=(filesize offset)
52 {
53
54 return translate(offset, ::e_seek_current);
55
56 }
57
58
59 void operator-=(filesize offset)
60 {
61
62 return translate(-offset, ::e_seek_current);
63
64 }
65
66
67 explicit operator filesize() const
68 {
69
70 return this->get_position();
71
72 }
73
74
75 virtual bool is_seekable();
76
77 inline translatable & position() { return *this; }
78 //virtual filesize get_position() const override;
79 virtual void set_position(filesize position);
80 virtual void increment_position(filesize offset = 1);
81 virtual void decrement_position(filesize offset = 1);
82 virtual void seek_to_begin();
83 virtual void seek_to_end();
84 virtual void seek_from_end(filesize offset);
85
86
87
88 };
89
90
91} // namespace file
92
93
94
Definition translatable.h:26
Definition filesystem.h:16