TSDuck v3.40-4033
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::IOManipulatorProxy< OSTREAM, PARAM, TRAITS > Class Template Reference

I/O manipulator with argument for subclasses of std::basic_ostream. More...

#include <tsAlgorithm.h>

Public Member Functions

 IOManipulatorProxy (OSTREAM &(OSTREAM::*func)(PARAM), PARAM param)
 Constructor.
 
std::basic_ostream< typename OSTREAM::char_type, TRAITS > & manipulator (std::basic_ostream< typename OSTREAM::char_type, TRAITS > &strm) const
 Invoke the I/O manipulator, typically invoked by the operator "<<".
 

Detailed Description

template<class OSTREAM, class PARAM, class TRAITS = std::char_traits<typename OSTREAM::char_type>>
class ts::IOManipulatorProxy< OSTREAM, PARAM, TRAITS >

I/O manipulator with argument for subclasses of std::basic_ostream.

This class has a similar role as IOManipulator() for functions using one argument.

Sample usage:

namespace ts {
// The class:
class TextFormatter : public std::basic_ostream<char>
{
public:
TextFormatter& setMarginSize(size_t margin);
....
};
// The I/O manipulator:
{
return IOManipulatorProxy<TextFormatter,size_t>(&TextFormatter::setMarginSize, size);
}
}
// Usage:
out << ts::margin(2) << "<foo>" << std::endl;
I/O manipulator with argument for subclasses of std::basic_ostream.
Definition tsAlgorithm.h:243
Format and print a text document using various output types and indentation.
Definition tsTextFormatter.h:29
TSDuck namespace, containing all TSDuck classes and functions.
Definition tsAbstractOutputStream.h:17
std::ostream & margin(std::ostream &os)
I/O manipulator for TextFormatter: move to the current margin.
Definition tsTextFormatter.h:252
Template Parameters
OSTREAMA subclass of std::basic_ostream.
PARAMThe type of the parameter for the manipulator.

Constructor & Destructor Documentation

◆ IOManipulatorProxy()

template<class OSTREAM , class PARAM , class TRAITS = std::char_traits<typename OSTREAM::char_type>>
ts::IOManipulatorProxy< OSTREAM, PARAM, TRAITS >::IOManipulatorProxy ( OSTREAM &(OSTREAM::*)(PARAM)  func,
PARAM  param 
)
inline

Constructor.

Parameters
[in]funcA pointer to member function in OSTREAM. This method shall take one parameter or type PARAM and return a reference to the OSTREAM object.
[in]paramThe parameter value to pass to the I/O manipulator.

Member Function Documentation

◆ manipulator()

template<class OSTREAM , class PARAM , class TRAITS = std::char_traits<typename OSTREAM::char_type>>
std::basic_ostream< typename OSTREAM::char_type, TRAITS > & ts::IOManipulatorProxy< OSTREAM, PARAM, TRAITS >::manipulator ( std::basic_ostream< typename OSTREAM::char_type, TRAITS > &  strm) const
inline

Invoke the I/O manipulator, typically invoked by the operator "<<".

Parameters
[in,out]strmThe stream of class OSTREAM to manipulate.
Returns
A reference to the strm object.

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