MayaFlux 0.1.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

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

Private Member Functions

bool should_rotate () const
 
bool rotate_file ()
 

Private Attributes

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

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: