From: Mikko Rasa Date: Tue, 5 Feb 2008 12:33:31 +0000 (+0000) Subject: Add print functions X-Git-Tag: io-1.0~9 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=7e85e7bed628a8db918d4f66afaf742e04d198da;p=libs%2Fcore.git Add print functions --- diff --git a/source/print.h b/source/print.h new file mode 100644 index 0000000..6fb7b4f --- /dev/null +++ b/source/print.h @@ -0,0 +1,47 @@ +/* $Id$ + +This file is part of libmspio +Copyright © 2007 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ + +#ifndef MSP_IO_PRINT_H_ +#define MSP_IO_PRINT_H_ + +#include +#include "base.h" + +namespace Msp { +namespace IO { + +/** +Writes a string to an I/O object. Same as o.write(f). Provided for +completeness with the other print functions. +*/ +unsigned print(Base &o, const std::string &f) +{ return o.write(f); } + +template +unsigned print(Base &o, const std::string &f, A1 a1) +{ return o.write(format(f, a1)); } + +template +unsigned print(Base &o, const std::string &f, A1 a1, A2 a2) +{ return o.write(format(f, a1, a2)); } + +template +unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3) +{ return o.write(format(f, a1, a2, a3)); } + +template +unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4) +{ return o.write(format(f, a1, a2, a3, a4)); } + +template +unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ return o.write(format(f, a1, a2, a3, a4, a5)); } + +} // namespace IO +} // namespace Msp + +#endif