acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
stdio_file.h
1#pragma once
2
3
4#include "acme/filesystem/file/text_file.h"
5
6
7#include <stdio.h>
8
9
10class CLASS_DECL_ACME stdio_file:
11 virtual public ::file::text_file
12{
13public:
14
15
16// enum enum_flag
17// {
18//
19// e_flag_none = 0,
20// e_flag_no_exception_if_not_found = 1,
21// e_flag_file_not_found = 2,
22//
23// };
24
25 //using e_flag = enumeration < enum_flag >;
26
27
28 FILE * m_pfile;
29 //e_flag m_eflag;
30
31
32 stdio_file();
33 explicit stdio_file(FILE * pfile);
34 ~stdio_file() override;
35
36
37 filesize get_position() const override;
38 ::file::file_status get_status() const override;
39 ::file::path get_file_path() const override;
40
41
42 void open(const ::file::path & path, ::file::e_open eopen, ::pointer < ::file::exception > * pfileexception = nullptr) override;
43 virtual void open(const ::file::path & path, const ::scoped_string & scopedstrAttributes, ::i32 iShare);
44
45
46 void translate(filesize offset, ::enum_seek eseek) override;
47 void set_size(filesize dwNewLen) override;
48 filesize size() const override;
49
50
51 void lock(filesize dwPos,filesize dwCount) override;
52 void unlock(filesize dwPos,filesize dwCount) override;
53
54 void flush() override;
55 void close() override;
56
57
58 using ::file::text_file::read;
59 memsize read(void * p, ::memsize s) override;
60
61
62 ::i32 get_unsigned_char() override;
63 ::i32 peek_byte() override;
64 void put_byte_back(::u8 b) override;
65
66 using ::file::file::write;
67 void write(const void * p, ::memsize s) override;
68
69 string get_location() const override;
70
71 bool is_opened() const override;
72
73 class c_errno c_errno() const;
74
75 [[noreturn]] void throw_exception(const ::scoped_string & scopedstr);
76
77};
78
79
80
81CLASS_DECL_ACME ::pointer<stdio_file> stdio_open(::particle * pparticle, const ::file::path & path, const scoped_string & attrs, ::i32 iShare);
82
83
84::e_status fgets_string(string & str, FILE * pfile, memsize iBufferSize = 1024);
85
86
87CLASS_DECL_ACME void __cdecl __clearerr_s(FILE * stream);
88
89
90#include "acme/prototype/prototype/holder.h"
91
92
93CLASS_DECL_ACME void destroy_pointer(FILE * p);
94
95
96using FILE_holder = holder < FILE >;
Definition e_status.h:30
void flush() override
Definition file.cpp:192
virtual void open(const ::file::path &path, ::file::e_open eopen, ::pointer< ::file::exception > *pfileexception=nullptr)
Definition file.cpp:109
Definition path.h:52
Definition text_file.h:13
Definition particle.h:95
Definition ___serialization_draft.h:42
Definition status.h:12