26 #ifndef SECU_MEMORY_FILE_HPP
27 #define SECU_MEMORY_FILE_HPP
39 class secu_memory_file :
public generic_file
45 secu_memory_file(
const secu_memory_file & ref) =
default;
46 secu_memory_file(secu_memory_file && ref) noexcept =
default;
47 secu_memory_file & operator = (
const secu_memory_file & ref) =
default;
48 secu_memory_file & operator = (secu_memory_file && ref) noexcept =
default;
49 ~secu_memory_file() =
default;
54 void reset(U_I size) {
if(
is_terminated())
throw SRC_BUG; position = 0; data.resize(size); };
57 infinint get_size()
const {
return data.get_size(); };
60 infinint get_allocated_size()
const {
return data.get_allocated_size(); };
63 void randomize(U_I size) {
if(size > data.get_allocated_size()) reset(size); data.randomize(size); };
67 virtual bool skippable(skippability direction,
const infinint & amount)
override {
return true; };
68 virtual bool skip(
const infinint & pos)
override;
69 virtual bool skip_to_eof()
override;
70 virtual bool skip_relative(S_I x)
override;
71 virtual bool truncatable(
const infinint & pos)
const override {
return false; };
72 virtual infinint get_position()
const override {
if(
is_terminated())
throw SRC_BUG;
return position; };
74 const secu_string & get_contents()
const {
return data; };
79 virtual void inherited_read_ahead(
const infinint & amount)
override {};
80 virtual U_I inherited_read(
char *a, U_I size)
override;
81 virtual void inherited_write(
const char *a, U_I size)
override;
82 virtual void inherited_truncate(
const infinint & pos)
override {
throw Efeature(
"truncate a secu_memory_file object"); };
83 virtual void inherited_sync_write()
override {};
84 virtual void inherited_flush_read()
override {};
85 virtual void inherited_terminate()
override {};
generic_file(gf_mode m)
main constructor
bool is_terminated() const
class generic_file is defined here as well as class fichier
@ gf_read_write
read and write access
libdar namespace encapsulate all libdar symbols
this file contains the definition of secu_string class, a std::string like class but allocated in sec...
contains a class that permits arbitrary large data storage