annotate DEPENDENCIES/generic/include/boost/iostreams/detail/access_control.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 // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
Chris@16 2 // (C) Copyright 2003-2007 Jonathan Turkanis
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 // See http://www.boost.org/libs/iostreams for documentation.
Chris@16 7
Chris@16 8 // Contains the definition of the class template access_control, which
Chris@16 9 // allows the type of inheritance from a provided base class to be specified
Chris@16 10 // using a template parameter.
Chris@16 11
Chris@16 12
Chris@16 13 #ifndef BOOST_IOSTREAMS_ACCESS_CONTROL_HPP_INCLUDED
Chris@16 14 #define BOOST_IOSTREAMS_ACCESS_CONTROL_HPP_INCLUDED
Chris@16 15
Chris@16 16 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
Chris@16 17 # pragma once
Chris@16 18 #endif
Chris@16 19
Chris@16 20 #include <boost/iostreams/detail/select.hpp>
Chris@16 21 #include <boost/mpl/identity.hpp>
Chris@16 22 #include <boost/type_traits/is_same.hpp>
Chris@16 23
Chris@16 24 namespace boost { namespace iostreams {
Chris@16 25
Chris@16 26 struct protected_ { }; // Represents protected inheritance.
Chris@16 27 struct public_ { }; // Represents public inheritance.
Chris@16 28
Chris@16 29
Chris@16 30 namespace detail {
Chris@16 31
Chris@16 32 // Implements protected inheritance.
Chris@16 33 template<typename U>
Chris@16 34 struct prot_ : protected U
Chris@16 35 {
Chris@16 36 prot_() { }
Chris@16 37 template<typename V> prot_(V v) : U(v) { }
Chris@16 38 };
Chris@16 39
Chris@16 40 // Implements public inheritance.
Chris@16 41 template<typename U> struct pub_ : public U {
Chris@16 42 pub_() { }
Chris@16 43 template<typename V> pub_(V v) : U(v) { }
Chris@16 44 };
Chris@16 45
Chris@16 46 //
Chris@16 47 // Used to deduce the base type for the template access_control.
Chris@16 48 //
Chris@16 49 template<typename T, typename Access>
Chris@16 50 struct access_control_base {
Chris@16 51 typedef int bad_access_specifier;
Chris@16 52 typedef typename
Chris@16 53 iostreams::select< // Disambiguation for Tru64
Chris@16 54 ::boost::is_same<
Chris@16 55 Access, protected_
Chris@16 56 >, prot_<T>,
Chris@16 57 ::boost::is_same<
Chris@16 58 Access, public_
Chris@16 59 >, pub_<T>,
Chris@16 60 else_, bad_access_specifier
Chris@16 61 >::type type;
Chris@16 62 };
Chris@16 63
Chris@16 64 } // End namespace detail.
Chris@16 65
Chris@16 66 //
Chris@16 67 // Template name: access_control.
Chris@16 68 // Description: Allows the type of inheritance from a provided base class
Chris@16 69 // to be specified using an int template parameter.
Chris@16 70 // Template parameters:
Chris@16 71 // Base - The class from which to inherit (indirectly.)
Chris@16 72 // Access - The type of access desired. Must be one of the
Chris@16 73 // values access_base::prot or access_base::pub.
Chris@16 74 //
Chris@16 75 template< typename T, typename Access,
Chris@16 76 typename Base = // VC6 workaraound (Compiler Error C2516)
Chris@16 77 typename detail::access_control_base<T, Access>::type >
Chris@16 78 struct access_control : public Base {
Chris@16 79 access_control() { }
Chris@16 80 template<typename U> explicit access_control(U u) : Base(u) { }
Chris@16 81 };
Chris@16 82
Chris@16 83 //----------------------------------------------------------------------------//
Chris@16 84
Chris@16 85 } } // End namespaces iostreams, boost.
Chris@16 86
Chris@16 87 #endif // #ifndef BOOST_IOSTREAMS_ACCESS_CONTROL_HPP_INCLUDED