AuxPort 0.2
Modules for Audio Software Development
|
Abstraction over C++ Standard File Handling for ASCII based Text Files. More...
#include <AuxFile.h>
Public Member Functions | |
TextFile ()=default | |
Default Constructor, Initializes the TextFile API. | |
~TextFile ()=default | |
Default Destructor. | |
std::string & | readFileAsString () |
Reads the entire text file and saves it in a String. | |
void | writeLineToFile (const std::string &data, bool log=false) |
Writes a line to the Text File. | |
bool | readLineFromFile (std::string &line, bool log=false) |
Reads a line to the Text File. | |
bool | open (const std::string &fileName, const Mode &mode=Mode::Read, bool log=false) override |
Opens the given file as a text file. | |
bool | close (bool log=false) override |
Closes current text file stream. | |
![]() | |
File (const File &file)=default | |
std::string | getCurrentDirectory () |
Returns the current directory, the program is running in. | |
std::vector< std::string > & | getListOfFiles (const std::string &extension="") |
Returns list of files present in the current directory. | |
void | Log () override |
Override this function to specify logging behavior. | |
Additional Inherited Members | |
![]() | |
enum | Mode { Idle = 0 , Read = 1 , Write = 2 } |
Easy way to specify the Read/Write behavior of the File Stream. More... | |
![]() | |
void | setColour (const ColourType &colourType) |
This function allows you to set text colour for the text to be printed onto the console. | |
![]() | |
std::unique_ptr< std::ofstream > | fileWriter |
std::unique_ptr< std::ifstream > | fileReader |
std::string | fileName |
std::string | fileExtension |
std::string | errorMessage |
Mode | mode |
Abstraction over C++ Standard File Handling for ASCII based Text Files.
For Example :
|
overridevirtual |
Closes current text file stream.
Implements AuxPort::File.
Definition at line 158 of file AuxFile.cpp.
|
overridevirtual |
Opens the given file as a text file.
Implements AuxPort::File.
Definition at line 102 of file AuxFile.cpp.
std::string & AuxPort::TextFile::readFileAsString | ( | ) |
Reads the entire text file and saves it in a String.
Definition at line 191 of file AuxFile.cpp.
bool AuxPort::TextFile::readLineFromFile | ( | std::string & | line, |
bool | log = false ) |
Reads a line to the Text File.
Definition at line 212 of file AuxFile.cpp.
void AuxPort::TextFile::writeLineToFile | ( | const std::string & | data, |
bool | log = false ) |
Writes a line to the Text File.
Definition at line 203 of file AuxFile.cpp.