X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fio%2Fprint.h;fp=source%2Fio%2Fprint.h;h=65744cbf69368b6da18cc37cd82dec2231ecee4c;hp=0000000000000000000000000000000000000000;hb=6e0fd758970bcb5bad5e3f2454b694cc4d7b4b66;hpb=b97d4e9f86e90254ab9edef7ee62a910f6333c78 diff --git a/source/io/print.h b/source/io/print.h new file mode 100644 index 0000000..65744cb --- /dev/null +++ b/source/io/print.h @@ -0,0 +1,66 @@ +#ifndef MSP_IO_PRINT_H_ +#define MSP_IO_PRINT_H_ + +#include +#include "base.h" +#include "console.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. +*/ +inline unsigned print(Base &o, const std::string &f) +{ return o.write(f); } + +template +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 +inline unsigned print(const std::string &f, A1 a1, A2 a2) +{ return print(cout, f, a1, a2); } + +template +inline unsigned print(const std::string &f, A1 a1, A2 a2, A3 a3) +{ return print(cout, f, a1, a2, a3); } + +template +inline unsigned print(const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4) +{ return print(cout, f, a1, a2, a3, a4); } + +template +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 + +#endif