13#include "common/lang/fstream.h"
14#include "common/lang/string.h"
15#include "common/lang/string_view.h"
16#include "common/lang/memory.h"
17#include "common/sys/rc.h"
75 RC
write(
const string_view &data);
111 static unique_ptr<ObFileWriter>
create_file_writer(
const string &filename,
bool append);
A utility class for writing data to files.
Definition: ob_file_writer.h:32
RC write(const string_view &data)
Writes data to the file.
Definition: ob_file_writer.cpp:17
ObFileWriter(const string &filename, bool append=false)
Constructs an ObFileWriter object with the specified file name and mode.
Definition: ob_file_writer.h:44
string file_name() const
Returns the name of the file being written to.
Definition: ob_file_writer.h:99
bool append_
Indicates whether the file should be opened in append mode.
Definition: ob_file_writer.h:125
RC flush()
Flushes buffered data to disk.
Definition: ob_file_writer.cpp:27
RC open_file()
Opens the file for writing.
Definition: ob_file_writer.cpp:37
string filename_
The name of the file to be written to.
Definition: ob_file_writer.h:117
void close_file()
Closes the file if it is currently open.
Definition: ob_file_writer.cpp:54
bool is_open() const
Checks if the file is currently open.
Definition: ob_file_writer.h:92
static unique_ptr< ObFileWriter > create_file_writer(const string &filename, bool append)
Creates a new ObFileWriter instance.
Definition: ob_file_writer.cpp:62
ofstream file_
The file stream used for writing data.
Definition: ob_file_writer.h:130