From 6629433203dc188a3269b27ee801da5100229ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Thu, 6 May 2010 20:11:16 +0200 Subject: Added missing uuid_io.hpp header. diff --git a/3rdParty/Boost/src/boost/uuid/uuid_io.hpp b/3rdParty/Boost/src/boost/uuid/uuid_io.hpp new file mode 100644 index 0000000..c2b050f --- /dev/null +++ b/3rdParty/Boost/src/boost/uuid/uuid_io.hpp @@ -0,0 +1,119 @@ +// Boost uuid_io.hpp header file ----------------------------------------------// + +// Copyright 2009 Andy Tompkins. +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Revision History +// 20 Mar 2009 - Initial Revision +// 28 Nov 2009 - disabled deprecated warnings for MSVC + +#ifndef BOOST_UUID_IO_HPP +#define BOOST_UUID_IO_HPP + +#include +#include +#include +#include +#include +#include +#include + +#if defined(_MSC_VER) +#pragma warning(push) // Save warning settings. +#pragma warning(disable : 4996) // Disable deprecated std::ctype::widen, std::copy +#endif + +namespace boost { +namespace uuids { + +template + std::basic_ostream& operator<<(std::basic_ostream &os, uuid const& u) +{ + io::ios_flags_saver flags_saver(os); + io::ios_width_saver width_saver(os); + io::basic_ios_fill_saver fill_saver(os); + + const typename std::basic_ostream::sentry ok(os); + if (ok) { + os << std::hex; + os.fill(os.widen('0')); + + std::size_t i=0; + for (uuid::const_iterator i_data = u.begin(); i_data!=u.end(); ++i_data, ++i) { + os.width(2); + os << static_cast(*i_data); + if (i == 3 || i == 5 || i == 7 || i == 9) { + os << os.widen('-'); + } + } + } + return os; +} + +template + std::basic_istream& operator>>(std::basic_istream &is, uuid &u) +{ + const typename std::basic_istream::sentry ok(is); + if (ok) { + unsigned char data[16]; + + typedef std::ctype ctype_t; + ctype_t const& ctype = std::use_facet(is.getloc()); + + ch xdigits[16]; + { + char szdigits[] = "0123456789ABCDEF"; + ctype.widen(szdigits, szdigits+16, xdigits); + } + ch*const xdigits_end = xdigits+16; + + ch c; + for (std::size_t i=0; i> c; + c = ctype.toupper(c); + + ch* f = std::find(xdigits, xdigits_end, c); + if (f == xdigits_end) { + is.setstate(std::ios_base::failbit); + break; + } + + unsigned char byte = static_cast(std::distance(&xdigits[0], f)); + + is >> c; + c = ctype.toupper(c); + f = std::find(xdigits, xdigits_end, c); + if (f == xdigits_end) { + is.setstate(std::ios_base::failbit); + break; + } + + byte <<= 4; + byte |= static_cast(std::distance(&xdigits[0], f)); + + data[i] = byte; + + if (is) { + if (i == 3 || i == 5 || i == 7 || i == 9) { + is >> c; + if (c != is.widen('-')) is.setstate(std::ios_base::failbit); + } + } + } + + if (is) { + std::copy(data, data+16, u.begin()); + } + } + return is; +} + +}} //namespace boost::uuids + +#if defined(_MSC_VER) +#pragma warning(pop) // Restore warnings to previous state. +#endif + +#endif // BOOST_UUID_IO_HPP diff --git a/3rdParty/Boost/update.sh b/3rdParty/Boost/update.sh index c51bf1f..d08c971 100755 --- a/3rdParty/Boost/update.sh +++ b/3rdParty/Boost/update.sh @@ -25,6 +25,7 @@ fi thread.hpp \ asio.hpp \ uuid/uuid.hpp \ + uuid/uuid_io.hpp \ uuid/uuid_generators.hpp \ regex.hpp \ $TARGET_DIR -- cgit v0.10.2-6-g49f6