File indexing completed on 2025-01-18 09:38:49
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef BOOST_IOSTREAMS_ACCESS_CONTROL_HPP_INCLUDED
0014 #define BOOST_IOSTREAMS_ACCESS_CONTROL_HPP_INCLUDED
0015
0016 #if defined(_MSC_VER)
0017 # pragma once
0018 #endif
0019
0020 #include <boost/iostreams/detail/select.hpp>
0021 #include <boost/mpl/identity.hpp>
0022 #include <boost/type_traits/is_same.hpp>
0023
0024 namespace boost { namespace iostreams {
0025
0026 struct protected_ { };
0027 struct public_ { };
0028
0029
0030 namespace detail {
0031
0032
0033 template<typename U>
0034 struct prot_ : protected U
0035 {
0036 prot_() { }
0037 template<typename V> prot_(V v) : U(v) { }
0038 };
0039
0040
0041 template<typename U> struct pub_ : public U {
0042 pub_() { }
0043 template<typename V> pub_(V v) : U(v) { }
0044 };
0045
0046
0047
0048
0049 template<typename T, typename Access>
0050 struct access_control_base {
0051 typedef int bad_access_specifier;
0052 typedef typename
0053 iostreams::select<
0054 ::boost::is_same<
0055 Access, protected_
0056 >, prot_<T>,
0057 ::boost::is_same<
0058 Access, public_
0059 >, pub_<T>,
0060 else_, bad_access_specifier
0061 >::type type;
0062 };
0063
0064 }
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075 template< typename T, typename Access,
0076 typename Base =
0077 typename detail::access_control_base<T, Access>::type >
0078 struct access_control : public Base {
0079 access_control() { }
0080 template<typename U> explicit access_control(U u) : Base(u) { }
0081 };
0082
0083
0084
0085 } }
0086
0087 #endif