Mercurial > hg > vamp-build-and-test
annotate DEPENDENCIES/generic/include/boost/exception/detail/object_hex_dump.hpp @ 125:34e428693f5d vext
Vext -> Repoint
author | Chris Cannam |
---|---|
date | Thu, 14 Jun 2018 11:15:39 +0100 |
parents | 2665513ce2d3 |
children |
rev | line source |
---|---|
Chris@16 | 1 //Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. |
Chris@16 | 2 |
Chris@16 | 3 //Distributed under the Boost Software License, Version 1.0. (See accompanying |
Chris@16 | 4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
Chris@16 | 5 |
Chris@16 | 6 #ifndef UUID_6F463AC838DF11DDA3E6909F56D89593 |
Chris@16 | 7 #define UUID_6F463AC838DF11DDA3E6909F56D89593 |
Chris@16 | 8 #if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) |
Chris@16 | 9 #pragma GCC system_header |
Chris@16 | 10 #endif |
Chris@16 | 11 #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) |
Chris@16 | 12 #pragma warning(push,1) |
Chris@16 | 13 #endif |
Chris@16 | 14 |
Chris@16 | 15 #include <boost/exception/detail/type_info.hpp> |
Chris@16 | 16 #include <iomanip> |
Chris@16 | 17 #include <ios> |
Chris@16 | 18 #include <string> |
Chris@16 | 19 #include <sstream> |
Chris@16 | 20 #include <cstdlib> |
Chris@16 | 21 |
Chris@16 | 22 namespace |
Chris@16 | 23 boost |
Chris@16 | 24 { |
Chris@16 | 25 namespace |
Chris@16 | 26 exception_detail |
Chris@16 | 27 { |
Chris@16 | 28 template <class T> |
Chris@16 | 29 inline |
Chris@16 | 30 std::string |
Chris@16 | 31 object_hex_dump( T const & x, std::size_t max_size=16 ) |
Chris@16 | 32 { |
Chris@16 | 33 std::ostringstream s; |
Chris@16 | 34 s << "type: " << type_name<T>() << ", size: " << sizeof(T) << ", dump: "; |
Chris@16 | 35 std::size_t n=sizeof(T)>max_size?max_size:sizeof(T); |
Chris@16 | 36 s.fill('0'); |
Chris@16 | 37 s.width(2); |
Chris@16 | 38 unsigned char const * b=reinterpret_cast<unsigned char const *>(&x); |
Chris@16 | 39 s << std::setw(2) << std::hex << (unsigned int)*b; |
Chris@16 | 40 for( unsigned char const * e=b+n; ++b!=e; ) |
Chris@16 | 41 s << " " << std::setw(2) << std::hex << (unsigned int)*b; |
Chris@16 | 42 return s.str(); |
Chris@16 | 43 } |
Chris@16 | 44 } |
Chris@16 | 45 } |
Chris@16 | 46 |
Chris@16 | 47 #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) |
Chris@16 | 48 #pragma warning(pop) |
Chris@16 | 49 #endif |
Chris@16 | 50 #endif |