networkservice
Public Member Functions | List of all members
utils::file::IWriter Interface Referenceabstract

A helper class to write a given value to a specified output stream. This class is a high level interface added to ease testability of component that use it. More...

#include "utils/file/writer/IWriter.h"

Inheritance diagram for utils::file::IWriter:
Inheritance graph
[legend]

Public Member Functions

 IWriter ()=default
 
virtual ~IWriter ()=default
 
 IWriter (const IWriter &)=delete
 
IWriteroperator= (const IWriter &)=delete
 
 IWriter (IWriter &&)=delete
 
IWriteroperator= (IWriter &&)=delete
 
virtual void writeToStream (std::ostream &stream, const std::string &value) const =0
 Write the given value to the provided output stream and check errors. More...
 

Detailed Description

A helper class to write a given value to a specified output stream. This class is a high level interface added to ease testability of component that use it.

Note
Copy contructor, copy-assignment operator, move constructor and move-assignment operator are defined to be compliant with the "Rule of five"
See also
https://en.cppreference.com/w/cpp/language/rule_of_three
Author
Boubacar DIENE bouba.nosp@m.car..nosp@m.diene.nosp@m.@gma.nosp@m.il.co.nosp@m.m
Date
May 2020

Constructor & Destructor Documentation

◆ IWriter() [1/3]

utils::file::IWriter::IWriter ( )
default

Class constructor

◆ ~IWriter()

virtual utils::file::IWriter::~IWriter ( )
virtualdefault

Class destructor

◆ IWriter() [2/3]

utils::file::IWriter::IWriter ( const IWriter )
delete

Class copy constructor

◆ IWriter() [3/3]

utils::file::IWriter::IWriter ( IWriter &&  )
delete

Class move constructor

Member Function Documentation

◆ operator=() [1/2]

IWriter& utils::file::IWriter::operator= ( const IWriter )
delete

Class copy-assignment operator

◆ operator=() [2/2]

IWriter& utils::file::IWriter::operator= ( IWriter &&  )
delete

Class move-assignment operator

◆ writeToStream()

virtual void utils::file::IWriter::writeToStream ( std::ostream &  stream,
const std::string &  value 
) const
pure virtual

Write the given value to the provided output stream and check errors.

Note that the stream must be opened before calling this method otherwise an exception should be raised. Also, a path to a file (for example) is not used in place of stream parameter to make possible unit testing without writing to the filesystem.

Parameters
streamThe output stream where to write the value
valueThe new value that will replace the currrent content

Implemented in utils::file::Writer.


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