50 (void) fclose(
file_ );
57 std::shared_ptr<SOFData>
f_;
61 void *
shptr()
const override {
return static_cast<void *
>(
f_.get() ); }
69 explicit SOF(
const std::string & p_name,
const std::string & p_mode )
96 SOF & operator=(
const SOF & ) =
delete;
97 SOF & operator=(
SOF && ) =
delete;
110 [[nodiscard]]
SOF *
dup()
const override {
return new SOF( *
this ); }
120 std::string_view
type()
const override {
return "filetype"; }
128 bool isOpen()
const {
return f_->file_ !=
nullptr; }
Semantic Object File.
Definition sof.h:36
std::string opequalequal() const override
String representation for operators '==' and 'pstack'.
Definition sof.h:114
std::shared_ptr< SOFData > f_
The data.
Definition sof.h:57
std::string getFMode() const
Returns the file mode.
Definition sof.h:106
OpError writestring(const std::string &p_data)
Writes to file.
Definition sof.cpp:133
std::string_view type() const override
Returns a type name.
Definition sof.h:120
bool isOpen() const
Checks if the file is open.
Definition sof.h:128
OpError readline(std::string &p_str, bool &p_eof)
Reads a line of text from file.
Definition sof.cpp:94
std::string getFName() const
Returns the file name.
Definition sof.h:102
OpError flush()
Flushes the file.
Definition sof.cpp:82
void * shptr() const override
Pointer to the shared object.
Definition sof.h:61
SOF(const std::string &p_name, const std::string &p_mode)
Ctor from a name.
Definition sof.h:69
OpError open()
Opens the file.
Definition sof.cpp:35
SOF * dup() const override
Creates a new instance as copy following the red book definition.
Definition sof.h:110
OpError readstring(std::string &p_str, bool &p_eof)
Reads text from file.
Definition sof.cpp:114
OTCode ot() const override
Returns an OTCode.
Definition sof.h:117
OpError close(int(*p_fclose)(FILE *)=fclose)
Closes the file.
Definition sof.cpp:69
bool readLeonLine(std::string &p_str)
Our std::getline( istream, string ) version.
Definition sof.cpp:168
SOF(const SOF &p_other)
Copy ctor.
Definition sof.h:81
~SOF() override
Dtor.
Definition sof.h:89
Semantic Object with shared pointer to data.
Definition so.h:210
Helpers for design by contract idioms.
#define DBC_INV_CTOR(T)
Assert for invariant checks in ctors and dtors.
Definition dbc.h:122
OpError
Operator error code enum.
Definition error.h:30
Miscellaneous definitions and functions.
The class SO - semantic object.
OTCode
OTCode - the Object Type Code.
Definition so.h:38
Semantic Object File - data member class.
Definition sof.h:41
FILE * file_
The C FILE.
Definition sof.h:43
std::string name_
The file name.
Definition sof.h:44
std::string mode_
The file open mode.
Definition sof.h:45
~SOFData()
Dtor.
Definition sof.h:48