#ifndef SETFMT_H #define SETFMT_H /**************************************************************************** ** COPYRIGHT (C): 1997 Cay S. Horstmann. All Rights Reserved. ** PROJECT: Practical OO Development with C++ and Java ** FILE: setfmt.h ** PURPOSE: setformat manipulator ** VERSION 1.0 ** PROGRAMMERS: Cay Horstmann (CSH) ** RELEASE DATE: 3-15-97 (CSH) ** UPDATE HISTORY: ****************************************************************************/ #line 16 "setfmt.cpp" extern ostream& do_setformat(ostream& os, const char* fmt); #line 119 "setfmt.cpp" template class Manipulator { public: typedef S& (*Action)(S&, T); Manipulator(Action a, T v) { _action = a; _value = v; } friend S& operator<<(S&, const Manipulator&); private: Action _action; T _value; }; #line 131 "setfmt.cpp" template inline S& operator<<(S& s, const Manipulator& m) { (*m._action)(s, m._value); return s; } #line 137 "setfmt.cpp" inline Manipulator setformat(const char* s) { return Manipulator(do_setformat, s); } #endif