X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fprint.h;h=65744cbf69368b6da18cc37cd82dec2231ecee4c;hb=49c1f3c3ffdf318579a809f3f800442c0c76c818;hp=6fb7b4f89204b63195bce20920825033cf255790;hpb=7e85e7bed628a8db918d4f66afaf742e04d198da;p=libs%2Fcore.git diff --git a/source/print.h b/source/print.h index 6fb7b4f..65744cb 100644 --- a/source/print.h +++ b/source/print.h @@ -1,15 +1,9 @@ -/* $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" +#include "console.h" namespace Msp { namespace IO { @@ -18,28 +12,53 @@ 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) +inline 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)); } +inline unsigned print(Base &o, const std::string &f, A1 a1) +{ return print(o, format(f, a1)); } + +template +inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2) +{ return print(o, format(f, a1, a2)); } + +template +inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3) +{ return print(o, format(f, a1, a2, a3)); } + +template +inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4) +{ return print(o, format(f, a1, a2, a3, a4)); } + +template +inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ return print(o, format(f, a1, a2, a3, a4, a5)); } + +/* The following functions print to console */ + +inline unsigned print(const std::string &f) +{ return print(cout, f); } + +template +inline unsigned print(const std::string &f, A1 a1) +{ return print(cout, f, a1); } template -unsigned print(Base &o, const std::string &f, A1 a1, A2 a2) -{ return o.write(format(f, a1, a2)); } +inline unsigned print(const std::string &f, A1 a1, A2 a2) +{ return print(cout, 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)); } +inline unsigned print(const std::string &f, A1 a1, A2 a2, A3 a3) +{ return print(cout, 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)); } +inline unsigned print(const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4) +{ return print(cout, 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)); } +inline unsigned print(const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ return print(cout, f, a1, a2, a3, a4, a5); } } // namespace IO } // namespace Msp