Initial windows support. Now we don't have the stacktrace and several unittests.
[platform/upstream/glog.git] / src / windows / glog / stl_logging.h
1 // This file is automatically generated from src/glog/stl_logging.h.in
2 // using src/windows/preprocess.sh.
3 // DO NOT EDIT!
4
5 // Copyright 2003 Google, Inc.
6 // All Rights Reserved.
7 //
8 // Stream output operators for STL containers; to be used for logging *only*.
9 // Inclusion of this file lets you do:
10 //
11 // list<string> x;
12 // LOG(INFO) << "data: " << x;
13 // vector<int> v1, v2;
14 // CHECK_EQ(v1, v2);
15 //
16 // Note that if you want to use these operators from the non-global namespace,
17 // you may get an error since they are not in namespace std (and they are not
18 // in namespace std since that would result in undefined behavior). You may
19 // need to write
20 //
21 //   using ::operator<<;
22 //
23 // to fix these errors.
24
25 #ifndef UTIL_GTL_STL_LOGGING_INL_H_
26 #define UTIL_GTL_STL_LOGGING_INL_H_
27
28 #if !1
29 # error We do not support stl_logging for this compiler
30 #endif
31
32 #include <deque>
33 #include <list>
34 #include <map>
35 #include <ostream>
36 #include <set>
37 #include <utility>
38 #include <vector>
39
40 #ifdef __GNUC__
41 # include <ext/hash_set>
42 # include <ext/hash_map>
43 # include <ext/slist>
44 #endif
45
46 template<class First, class Second>
47 inline std::ostream& operator<<(std::ostream& out,
48                                 const std::pair<First, Second>& p) {
49   out << '(' << p.first << ", " << p.second << ')';
50   return out;
51 }
52
53 namespace google {
54
55 template<class Iter>
56 inline void PrintSequence(std::ostream& out, Iter begin, Iter end) {
57   using ::operator<<;
58   // Output at most 100 elements -- appropriate if used for logging.
59   for (int i = 0; begin != end && i < 100; ++i, ++begin) {
60     if (i > 0) out << ' ';
61     out << *begin;
62   }
63   if (begin != end) {
64     out << " ...";
65   }
66 }
67
68 }
69
70 #define OUTPUT_TWO_ARG_CONTAINER(Sequence) \
71 template<class T1, class T2> \
72 inline std::ostream& operator<<(std::ostream& out, \
73                                 const Sequence<T1, T2>& seq) { \
74   google::PrintSequence(out, seq.begin(), seq.end()); \
75   return out; \
76 }
77
78 OUTPUT_TWO_ARG_CONTAINER(std::vector)
79 OUTPUT_TWO_ARG_CONTAINER(std::deque)
80 OUTPUT_TWO_ARG_CONTAINER(std::list)
81 #ifdef __GNUC__
82 OUTPUT_TWO_ARG_CONTAINER(__gnu_cxx::slist)
83 #endif
84
85 #undef OUTPUT_TWO_ARG_CONTAINER
86
87 #define OUTPUT_THREE_ARG_CONTAINER(Sequence) \
88 template<class T1, class T2, class T3> \
89 inline std::ostream& operator<<(std::ostream& out, \
90                                 const Sequence<T1, T2, T3>& seq) { \
91   google::PrintSequence(out, seq.begin(), seq.end()); \
92   return out; \
93 }
94
95 OUTPUT_THREE_ARG_CONTAINER(std::set)
96 OUTPUT_THREE_ARG_CONTAINER(std::multiset)
97
98 #undef OUTPUT_THREE_ARG_CONTAINER
99
100 #define OUTPUT_FOUR_ARG_CONTAINER(Sequence) \
101 template<class T1, class T2, class T3, class T4> \
102 inline std::ostream& operator<<(std::ostream& out, \
103                                 const Sequence<T1, T2, T3, T4>& seq) { \
104   google::PrintSequence(out, seq.begin(), seq.end()); \
105   return out; \
106 }
107
108 OUTPUT_FOUR_ARG_CONTAINER(std::map)
109 OUTPUT_FOUR_ARG_CONTAINER(std::multimap)
110 #ifdef __GNUC__
111 OUTPUT_FOUR_ARG_CONTAINER(__gnu_cxx::hash_set)
112 OUTPUT_FOUR_ARG_CONTAINER(__gnu_cxx::hash_multiset)
113 #endif
114
115 #undef OUTPUT_FOUR_ARG_CONTAINER
116
117 #define OUTPUT_FIVE_ARG_CONTAINER(Sequence) \
118 template<class T1, class T2, class T3, class T4, class T5> \
119 inline std::ostream& operator<<(std::ostream& out, \
120                                 const Sequence<T1, T2, T3, T4, T5>& seq) { \
121   google::PrintSequence(out, seq.begin(), seq.end()); \
122   return out; \
123 }
124
125 #ifdef __GNUC__
126 OUTPUT_FIVE_ARG_CONTAINER(__gnu_cxx::hash_map)
127 OUTPUT_FIVE_ARG_CONTAINER(__gnu_cxx::hash_multimap)
128 #endif
129
130 #undef OUTPUT_FIVE_ARG_CONTAINER
131
132 #endif  // UTIL_GTL_STL_LOGGING_INL_H_