C++ Utilities  4.17.0
Useful C++ classes and routines such as argument parser, IO and conversion utilities
Public Member Functions | List of all members
IoUtilities::CopyHelper< bufferSize > Class Template Reference

The CopyHelper class helps to copy bytes from one stream to another. More...

#include <copy.h>

Public Member Functions

 CopyHelper ()
 Constructs a new copy helper. More...
 
void copy (std::istream &input, std::ostream &output, std::size_t count)
 Copies count bytes from input to output. More...
 
void callbackCopy (std::istream &input, std::ostream &output, std::size_t count, const std::function< bool(void)> &isAborted, const std::function< void(double)> &callback)
 Copies count bytes from input to output. More...
 
char * buffer ()
 Returns the internal buffer. More...
 

Detailed Description

template<std::size_t bufferSize>
class IoUtilities::CopyHelper< bufferSize >

The CopyHelper class helps to copy bytes from one stream to another.

Template Parameters
Specifiesthe buffer size.

Definition at line 16 of file copy.h.

Constructor & Destructor Documentation

◆ CopyHelper()

template<std::size_t bufferSize>
IoUtilities::CopyHelper< bufferSize >::CopyHelper ( )

Constructs a new copy helper.

Definition at line 31 of file copy.h.

Member Function Documentation

◆ buffer()

template<std::size_t bufferSize>
char * IoUtilities::CopyHelper< bufferSize >::buffer ( )

Returns the internal buffer.

Definition at line 83 of file copy.h.

◆ callbackCopy()

template<std::size_t bufferSize>
void IoUtilities::CopyHelper< bufferSize >::callbackCopy ( std::istream &  input,
std::ostream &  output,
std::size_t  count,
const std::function< bool(void)> &  isAborted,
const std::function< void(double)> &  callback 
)

Copies count bytes from input to output.

The procedure might be aborted and progress updates will be reported.

Copying is aborted when isAborted returns true. The current progress is reported by calling the specified callback function.

Remarks
Set an exception mask using std::ios::exceptions() to get a std::ios_base::failure exception when an IO error occurs.

Definition at line 62 of file copy.h.

◆ copy()

template<std::size_t bufferSize>
void IoUtilities::CopyHelper< bufferSize >::copy ( std::istream &  input,
std::ostream &  output,
std::size_t  count 
)

Copies count bytes from input to output.

Remarks
Set an exception mask using std::ios::exceptions() to get a std::ios_base::failure exception when an IO error occurs.

Definition at line 40 of file copy.h.


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