]> git.tdb.fi Git - libs/core.git/blob - source/print.h
10fb02eedba2f11ff2ad9417c8daa1adb576012e
[libs/core.git] / source / print.h
1 /* $Id$
2
3 This file is part of libmspio
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_IO_PRINT_H_
9 #define MSP_IO_PRINT_H_
10
11 #include <msp/strings/formatter.h>
12 #include "base.h"
13 #include "console.h"
14
15 namespace Msp {
16 namespace IO {
17
18 /**
19 Writes a string to an I/O object.  Same as o.write(f).  Provided for
20 completeness with the other print functions.
21 */
22 inline unsigned print(Base &o, const std::string &f)
23 { return o.write(f); }
24
25 template<typename A1>
26 inline unsigned print(Base &o, const std::string &f, A1 a1)
27 { return print(o, format(f, a1)); }
28
29 template<typename A1, typename A2>
30 inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2)
31 { return print(o, format(f, a1, a2)); }
32
33 template<typename A1, typename A2, typename A3>
34 inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3)
35 { return print(o, format(f, a1, a2, a3)); }
36
37 template<typename A1, typename A2, typename A3, typename A4>
38 inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4)
39 { return print(o, format(f, a1, a2, a3, a4)); }
40
41 template<typename A1, typename A2, typename A3, typename A4, typename A5>
42 inline unsigned print(Base &o, const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
43 { return print(o, format(f, a1, a2, a3, a4, a5)); }
44
45 /* The following functions print to console */
46
47 inline unsigned print(const std::string &f)
48 { return print(cout, f); }
49
50 template<typename A1>
51 inline unsigned print(const std::string &f, A1 a1)
52 { return print(cout, f, a1); }
53
54 template<typename A1, typename A2>
55 inline unsigned print(const std::string &f, A1 a1, A2 a2)
56 { return print(cout, f, a1, a2); }
57
58 template<typename A1, typename A2, typename A3>
59 inline unsigned print(const std::string &f, A1 a1, A2 a2, A3 a3)
60 { return print(cout, f, a1, a2, a3); }
61
62 template<typename A1, typename A2, typename A3, typename A4>
63 inline unsigned print(const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4)
64 { return print(cout, f, a1, a2, a3, a4); }
65
66 template<typename A1, typename A2, typename A3, typename A4, typename A5>
67 inline unsigned print(const std::string &f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
68 { return print(cout, f, a1, a2, a3, a4, a5); }
69
70 } // namespace IO
71 } // namespace Msp
72
73 #endif