MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::IO::TextFileWriter Class Reference

Simple text file writer for logs and text data. More...

#include <TextFileWriter.hpp>

+ Inheritance diagram for MayaFlux::IO::TextFileWriter:
+ Collaboration diagram for MayaFlux::IO::TextFileWriter:

Public Member Functions

bool can_write (const std::string &filepath) const override
 Check if this writer can handle the given file path.
 
void close () override
 Close the currently open file.
 
bool flush () override
 Flush buffered writes to disk.
 
size_t get_file_size () const
 Get current file size.
 
std::string get_last_error () const override
 Get last error message.
 
size_t get_write_position () const override
 Get current write position (bytes written)
 
bool is_open () const override
 Check if a file is currently open for writing.
 
bool open (const std::string &filepath, FileWriteOptions options) override
 Open a file for writing.
 
void set_max_file_size (size_t max_bytes)
 Set maximum file size before rotation.
 
 TextFileWriter ()
 
bool write_bytes (const void *data, size_t size) override
 Write raw bytes.
 
bool write_line (std::string_view line) override
 Write a line (appends newline)
 
bool write_string (std::string_view str) override
 Write a string.
 
 ~TextFileWriter () override
 
- Public Member Functions inherited from MayaFlux::IO::FileWriter
virtual ~FileWriter ()=default
 

Private Member Functions

bool rotate_file ()
 
bool should_rotate () const
 

Private Attributes

size_t m_bytes_written { 0 }
 
std::ofstream m_file
 
std::string m_filepath
 
bool m_is_open {}
 
std::string m_last_error
 
size_t m_max_file_size { 0 }
 
std::mutex m_mutex
 
FileWriteOptions m_options {}
 

Detailed Description

Simple text file writer for logs and text data.

Thread-safe text file writing with optional buffering. Designed for log files, configuration files, etc.

Definition at line 15 of file TextFileWriter.hpp.


The documentation for this class was generated from the following files: