Program Listing for File manipulator.hpp

Return to documentation for file (/tmp/ws/src/ecl_core/ecl_streams/include/ecl/streams/manipulators/manipulator.hpp)

/*****************************************************************************
** Ifdefs
*****************************************************************************/

#ifndef ECL_STREAMS_MANIPULATOR_HPP_
#define ECL_STREAMS_MANIPULATOR_HPP_

/*****************************************************************************
** Includes
*****************************************************************************/

#include <ecl/config/macros.hpp>
#include <ecl/concepts/devices.hpp>
#include "../macros.hpp"

/*****************************************************************************
** Namespaces
*****************************************************************************/

namespace ecl {

/*****************************************************************************
** Forwarding
*****************************************************************************/

namespace interfaces {
    template <typename Device, bool OutputDevice> class ECL_PUBLIC OutputTextStream;
}

/*****************************************************************************
** Interface [Manipulator]
*****************************************************************************/
template <typename Derived>
class ecl_streams_PUBLIC Manipulator {
public:
    template <typename ODevice>
    void insert (interfaces::OutputTextStream<ODevice,true>& ostream) {
        ecl_compile_time_concept_check(OutputCharDeviceConcept<ODevice>);
        static_cast<Derived*>(this)->action(ostream);
    }

    virtual ~Manipulator() {}
};

} // namespace ecl

#endif /* ECL_STREAMS_MANIPULATOR_HPP_ */