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