cpp-mate  0.7
Helpful library for C++.
CppMate::FileWriter Class Referenceabstract

Represents file writer with platform-dependent implementation. More...

#include <FileWriter.hpp>

Inheritance diagram for CppMate::FileWriter:
Collaboration diagram for CppMate::FileWriter:

Public Types

enum class  Mode { New , Overwrite , Append }
 The creation mode. More...
 

Public Member Functions

virtual std::string getFilename () const =0
 Returns name of file. More...
 
- Public Member Functions inherited from CppMate::BinarySink::Closeable
virtual bool isClosed () const =0
 Indicates that sink is closed. More...
 
virtual void close ()=0
 Closes sink. More...
 
- Public Member Functions inherited from CppMate::BinarySink
virtual ~BinarySink ()=default
 
virtual void write (const void *data, uint64_t size)=0
 Writes data into the sink. More...
 

Static Public Member Functions

static std::shared_ptr< FileWritercreate (const std::string &filename, Mode mode)
 Creates new file writer for specified filename. More...
 

Detailed Description

Represents file writer with platform-dependent implementation.

Member Enumeration Documentation

◆ Mode

The creation mode.

Enumerator
New 

Creates new file and throws exception if it already exists.

Overwrite 

Overwrites file if it already exists.

Append 

Appends data to the end of the existing file.

Member Function Documentation

◆ create()

static std::shared_ptr<FileWriter> CppMate::FileWriter::create ( const std::string &  filename,
Mode  mode 
)
static

Creates new file writer for specified filename.

Parameters
filenamethe name of the target file.
modecreation mode.
Returns
instance of file writer.
Exceptions
std::ostream::failure

◆ getFilename()

virtual std::string CppMate::FileWriter::getFilename ( ) const
pure virtual

Returns name of file.

Returns
the name of file.

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