AuxPort 0.2
Modules for Audio Software Development
Loading...
Searching...
No Matches
AuxPort::File Class Referenceabstract

This class provides an interface for working with files. More...

#include <AuxFile.h>

Inheritance diagram for AuxPort::File:
AuxPort::ILog AuxPort::BinaryFile AuxPort::TextFile AuxPort::AuxPascal AuxPort::AuxSeries AuxPort::CSV AuxPort::AuxSeriesEngine

Public Types

enum  Mode { Idle = 0 , Read = 1 , Write = 2 }
 Easy way to specify the Read/Write behavior of the File Stream. More...
 

Public Member Functions

 File (const File &file)=default
 
virtual bool open (const std::string &fileName, const Mode &mode=Mode::Read, bool log=false)=0
 Implement this function to specify the opening behavior of the File.
 
virtual bool close (bool log=false)=0
 Implement this function to specify the closing behavior of the File.
 
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.
 

Protected Attributes

std::unique_ptr< std::ofstream > fileWriter
 
std::unique_ptr< std::ifstream > fileReader
 
std::string fileName
 
std::string fileExtension
 
std::string errorMessage
 
Mode mode
 

Additional Inherited Members

- Protected Member Functions inherited from AuxPort::ILog
void setColour (const ColourType &colourType)
 This function allows you to set text colour for the text to be printed onto the console.
 

Detailed Description

This class provides an interface for working with files.

Definition at line 182 of file AuxFile.h.

Member Enumeration Documentation

◆ Mode

Easy way to specify the Read/Write behavior of the File Stream.

Definition at line 188 of file AuxFile.h.

Constructor & Destructor Documentation

◆ File()

AuxPort::File::File ( )

Definition at line 42 of file AuxFile.cpp.

Member Function Documentation

◆ close()

virtual bool AuxPort::File::close ( bool log = false)
pure virtual

Implement this function to specify the closing behavior of the File.

Implemented in AuxPort::BinaryFile, AuxPort::CSV, and AuxPort::TextFile.

◆ getCurrentDirectory()

std::string AuxPort::File::getCurrentDirectory ( )

Returns the current directory, the program is running in.

Definition at line 97 of file AuxFile.cpp.

◆ getListOfFiles()

std::vector< std::string > & AuxPort::File::getListOfFiles ( const std::string & extension = "")

Returns list of files present in the current directory.

Definition at line 55 of file AuxFile.cpp.

◆ Log()

void AuxPort::File::Log ( )
overridevirtual

Override this function to specify logging behavior.

Reimplemented from AuxPort::ILog.

Definition at line 78 of file AuxFile.cpp.

◆ open()

virtual bool AuxPort::File::open ( const std::string & fileName,
const Mode & mode = Mode::Read,
bool log = false )
pure virtual

Implement this function to specify the opening behavior of the File.

Implemented in AuxPort::BinaryFile, and AuxPort::TextFile.

Member Data Documentation

◆ errorMessage

std::string AuxPort::File::errorMessage
protected

Definition at line 229 of file AuxFile.h.

◆ fileExtension

std::string AuxPort::File::fileExtension
protected

Definition at line 228 of file AuxFile.h.

◆ fileName

std::string AuxPort::File::fileName
protected

Definition at line 227 of file AuxFile.h.

◆ fileReader

std::unique_ptr<std::ifstream> AuxPort::File::fileReader
protected

Definition at line 226 of file AuxFile.h.

◆ fileWriter

std::unique_ptr<std::ofstream> AuxPort::File::fileWriter
protected

Definition at line 225 of file AuxFile.h.

◆ mode

Mode AuxPort::File::mode
protected

Definition at line 230 of file AuxFile.h.


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