PageRenderTime 19ms CodeModel.GetById 6ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/thirdparty/breakpad/third_party/glog/src/windows/glog/stl_logging.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 158 lines | 87 code | 22 blank | 49 comment | 7 complexity | 484bfa217203c7a61af0394723d54dc7 MD5 | raw file
  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 (c) 2003, Google Inc.
  6// All rights reserved.
  7//
  8// Redistribution and use in source and binary forms, with or without
  9// modification, are permitted provided that the following conditions are
 10// met:
 11//
 12//     * Redistributions of source code must retain the above copyright
 13// notice, this list of conditions and the following disclaimer.
 14//     * Redistributions in binary form must reproduce the above
 15// copyright notice, this list of conditions and the following disclaimer
 16// in the documentation and/or other materials provided with the
 17// distribution.
 18//     * Neither the name of Google Inc. nor the names of its
 19// contributors may be used to endorse or promote products derived from
 20// this software without specific prior written permission.
 21//
 22// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 23// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 24// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 25// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 26// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 27// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 28// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 29// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 30// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 31// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 32// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 33//
 34// Stream output operators for STL containers; to be used for logging *only*.
 35// Inclusion of this file lets you do:
 36//
 37// list<string> x;
 38// LOG(INFO) << "data: " << x;
 39// vector<int> v1, v2;
 40// CHECK_EQ(v1, v2);
 41//
 42// Note that if you want to use these operators from the non-global namespace,
 43// you may get an error since they are not in namespace std (and they are not
 44// in namespace std since that would result in undefined behavior). You may
 45// need to write
 46//
 47//   using ::operator<<;
 48//
 49// to fix these errors.
 50
 51#ifndef UTIL_GTL_STL_LOGGING_INL_H_
 52#define UTIL_GTL_STL_LOGGING_INL_H_
 53
 54#if !1
 55# error We do not support stl_logging for this compiler
 56#endif
 57
 58#include <deque>
 59#include <list>
 60#include <map>
 61#include <ostream>
 62#include <set>
 63#include <utility>
 64#include <vector>
 65
 66#ifdef __GNUC__
 67# include <ext/hash_set>
 68# include <ext/hash_map>
 69# include <ext/slist>
 70#endif
 71
 72template<class First, class Second>
 73inline std::ostream& operator<<(std::ostream& out,
 74                                const std::pair<First, Second>& p) {
 75  out << '(' << p.first << ", " << p.second << ')';
 76  return out;
 77}
 78
 79namespace google {
 80
 81template<class Iter>
 82inline void PrintSequence(std::ostream& out, Iter begin, Iter end) {
 83  using ::operator<<;
 84  // Output at most 100 elements -- appropriate if used for logging.
 85  for (int i = 0; begin != end && i < 100; ++i, ++begin) {
 86    if (i > 0) out << ' ';
 87    out << *begin;
 88  }
 89  if (begin != end) {
 90    out << " ...";
 91  }
 92}
 93
 94}
 95
 96#define OUTPUT_TWO_ARG_CONTAINER(Sequence) \
 97template<class T1, class T2> \
 98inline std::ostream& operator<<(std::ostream& out, \
 99                                const Sequence<T1, T2>& seq) { \
100  google::PrintSequence(out, seq.begin(), seq.end()); \
101  return out; \
102}
103
104OUTPUT_TWO_ARG_CONTAINER(std::vector)
105OUTPUT_TWO_ARG_CONTAINER(std::deque)
106OUTPUT_TWO_ARG_CONTAINER(std::list)
107#ifdef __GNUC__
108OUTPUT_TWO_ARG_CONTAINER(__gnu_cxx::slist)
109#endif
110
111#undef OUTPUT_TWO_ARG_CONTAINER
112
113#define OUTPUT_THREE_ARG_CONTAINER(Sequence) \
114template<class T1, class T2, class T3> \
115inline std::ostream& operator<<(std::ostream& out, \
116                                const Sequence<T1, T2, T3>& seq) { \
117  google::PrintSequence(out, seq.begin(), seq.end()); \
118  return out; \
119}
120
121OUTPUT_THREE_ARG_CONTAINER(std::set)
122OUTPUT_THREE_ARG_CONTAINER(std::multiset)
123
124#undef OUTPUT_THREE_ARG_CONTAINER
125
126#define OUTPUT_FOUR_ARG_CONTAINER(Sequence) \
127template<class T1, class T2, class T3, class T4> \
128inline std::ostream& operator<<(std::ostream& out, \
129                                const Sequence<T1, T2, T3, T4>& seq) { \
130  google::PrintSequence(out, seq.begin(), seq.end()); \
131  return out; \
132}
133
134OUTPUT_FOUR_ARG_CONTAINER(std::map)
135OUTPUT_FOUR_ARG_CONTAINER(std::multimap)
136#ifdef __GNUC__
137OUTPUT_FOUR_ARG_CONTAINER(__gnu_cxx::hash_set)
138OUTPUT_FOUR_ARG_CONTAINER(__gnu_cxx::hash_multiset)
139#endif
140
141#undef OUTPUT_FOUR_ARG_CONTAINER
142
143#define OUTPUT_FIVE_ARG_CONTAINER(Sequence) \
144template<class T1, class T2, class T3, class T4, class T5> \
145inline std::ostream& operator<<(std::ostream& out, \
146                                const Sequence<T1, T2, T3, T4, T5>& seq) { \
147  google::PrintSequence(out, seq.begin(), seq.end()); \
148  return out; \
149}
150
151#ifdef __GNUC__
152OUTPUT_FIVE_ARG_CONTAINER(__gnu_cxx::hash_map)
153OUTPUT_FIVE_ARG_CONTAINER(__gnu_cxx::hash_multimap)
154#endif
155
156#undef OUTPUT_FIVE_ARG_CONTAINER
157
158#endif  // UTIL_GTL_STL_LOGGING_INL_H_