48 (void) fclose(
file_ );
53 std::shared_ptr<SOFData>
f_;
73 explicit SOF(
const std::string & p_name,
const std::string & p_mode )
98 SOF & operator=(
const SOF & ) =
delete;
99 SOF & operator=(
SOF && ) =
delete;
112 [[nodiscard]]
SOF *
dup()
const override {
return new SOF( *
this ); }
115 std::string
opequal()
const override {
return "--nostringval--"; }
124 std::string
type()
const override {
return "filetype"; }
129 bool equal(
const SO * p_other )
const override {
130 auto o =
dynamic_cast<const SOF *
>( p_other );
131 return o ?
f_ ==
o->
f_ :
false;
140 bool isOpen()
const {
return f_->file_ !=
nullptr; }
Semantic Object File.
Definition sof.h:35
std::string opequalequal() const override
String representation for operators '==' and 'pstack'.
Definition sof.h:118
std::shared_ptr< SOFData > f_
The data.
Definition sof.h:53
std::string getFMode() const
Returns the file mode.
Definition sof.h:108
OpError writestring(const std::string &p_data)
Writes to file.
Definition sof.cpp:130
std::string type() const override
Returns a type name.
Definition sof.h:124
bool equal(const SO *p_other) const override
Checks if this SO is equal to another SO.
Definition sof.h:129
bool isOpen() const
Checks if the file is open.
Definition sof.h:140
OpError readline(std::string &p_str, bool &p_eof)
Reads a line of text from file.
Definition sof.cpp:91
std::string opequal() const override
String representation of object for operators '=', 'cvs' and 'stack'.
Definition sof.h:115
std::string getFName() const
Returns the file name.
Definition sof.h:104
OpError flush()
Flushes the file.
Definition sof.cpp:79
SOF(const std::string &p_name, const std::string &p_mode)
Ctor from a name.
Definition sof.h:73
OpError open()
Opens the file.
Definition sof.cpp:31
SOF * dup() const override
Creates a new instance as copy following the red book definition.
Definition sof.h:112
bool invariant() const noexcept override
Checks class invariants.
Definition sof.h:62
OpError readstring(std::string &p_str, bool &p_eof)
Reads text from file.
Definition sof.cpp:111
OTCode ot() const override
Returns an OTCode.
Definition sof.h:121
OpError close(int(*p_fclose)(FILE *)=fclose)
Closes the file.
Definition sof.cpp:66
bool readLeonLine(std::string &p_str)
Our std::getline( istream, string ) version.
Definition sof.cpp:153
SOF(const SOF &p_other)
Copy ctor.
Definition sof.h:85
~SOF() override
Dtor.
Definition sof.h:91
Semantic Object.
Definition so.h:60
Helpers for design by contract idioms.
#define DBC_INV_CTOR(T)
Assert for invariant checks in ctors and dtors.
Definition dbc.h:121
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:35
Semantic Object File - data member class.
Definition sof.h:40
FILE * file_
The C FILE.
Definition sof.h:41
std::string name_
The file name.
Definition sof.h:42
std::string mode_
The file open mode.
Definition sof.h:43
~SOFData()
Dtor.
Definition sof.h:46