BVB Source Codes

mars Show concepts.hpp Source code

Return Download mars: download concepts.hpp Source code - Download mars Source code - Type:.hpp
  1. // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
  2. // (C) Copyright 2003-2007 Jonathan Turkanis
  3. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
  5.  
  6. // See http://www.boost.org/libs/iostreams for documentation.
  7.  
  8. #ifndef BOOST_IOSTREAMS_CONCEPTS_HPP_INCLUDED
  9. #define BOOST_IOSTREAMS_CONCEPTS_HPP_INCLUDED
  10.  
  11. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  12. # pragma once
  13. #endif
  14.  
  15. #include <boost/config.hpp>  // BOOST_MSVC
  16. #include <boost/detail/workaround.hpp>
  17. #include <boost/iostreams/categories.hpp>
  18. #include <boost/iostreams/detail/default_arg.hpp>
  19. #include <boost/iostreams/detail/ios.hpp>  // openmode.
  20. #include <boost/iostreams/positioning.hpp>
  21. #include <boost/static_assert.hpp>
  22. #include <boost/type_traits/is_convertible.hpp>
  23.  
  24. namespace mars_boost {} namespace boost = mars_boost; namespace mars_boost { namespace iostreams {
  25.  
  26. //--------------Definitions of helper templates for device concepts-----------//
  27.  
  28. template<typename Mode, typename Ch = BOOST_IOSTREAMS_DEFAULT_ARG(char)>
  29. struct device {
  30.     typedef Ch char_type;
  31.     struct category
  32.         : Mode,
  33.           device_tag,
  34.           closable_tag,
  35.           localizable_tag
  36.         { };
  37.  
  38.     void close()
  39.     {
  40.         using namespace detail;
  41.         BOOST_STATIC_ASSERT((!is_convertible<Mode, two_sequence>::value));
  42.     }
  43.  
  44.     void close(BOOST_IOS::openmode)
  45.     {
  46.         using namespace detail;
  47.         BOOST_STATIC_ASSERT((is_convertible<Mode, two_sequence>::value));
  48.     }
  49.  
  50.     template<typename Locale>
  51.     void imbue(const Locale&) { }
  52. };
  53.  
  54. template<typename Mode, typename Ch = BOOST_IOSTREAMS_DEFAULT_ARG(wchar_t)>
  55. struct wdevice : device<Mode, Ch> { };
  56.  
  57. typedef device<input>    source;
  58. typedef wdevice<input>   wsource;
  59. typedef device<output>   sink;
  60. typedef wdevice<output>  wsink;
  61.  
  62. //--------------Definitions of helper templates for simple filter concepts----//
  63.  
  64. template<typename Mode, typename Ch = BOOST_IOSTREAMS_DEFAULT_ARG(char)>
  65. struct filter {
  66.     typedef Ch char_type;
  67.     struct category
  68.         : Mode,
  69.           filter_tag,
  70.           closable_tag,
  71.           localizable_tag
  72.         { };
  73.  
  74.     template<typename Device>
  75.     void close(Device&)
  76.     {
  77.         using namespace detail;
  78.         BOOST_STATIC_ASSERT((!is_convertible<Mode, two_sequence>::value));
  79.         BOOST_STATIC_ASSERT((!is_convertible<Mode, dual_use>::value));
  80.     }
  81.  
  82.     template<typename Device>
  83.     void close(Device&, BOOST_IOS::openmode)
  84.     {
  85.         using namespace detail;
  86.         BOOST_STATIC_ASSERT(
  87.             (is_convertible<Mode, two_sequence>::value) ||
  88.             (is_convertible<Mode, dual_use>::value)
  89.         );
  90.     }
  91.  
  92.     template<typename Locale>
  93.     void imbue(const Locale&) { }
  94. };
  95.  
  96. template<typename Mode, typename Ch = BOOST_IOSTREAMS_DEFAULT_ARG(wchar_t)>
  97. struct wfilter : filter<Mode, Ch> { };
  98.  
  99. typedef filter<input>      input_filter;
  100. typedef wfilter<input>     input_wfilter;
  101. typedef filter<output>     output_filter;
  102. typedef wfilter<output>    output_wfilter;
  103. typedef filter<seekable>   seekable_filter;
  104. typedef wfilter<seekable>  seekable_wfilter;
  105. typedef filter<dual_use>   dual_use_filter;
  106. typedef wfilter<dual_use>  dual_use_wfilter;
  107.        
  108. //------Definitions of helper templates for multi-character filter cncepts----//
  109.  
  110. template<typename Mode, typename Ch = char>
  111. struct multichar_filter : filter<Mode, Ch> {
  112.     struct category : filter<Mode, Ch>::category, multichar_tag { };
  113. };
  114.  
  115. template<typename Mode, typename Ch = wchar_t>
  116. struct multichar_wfilter : multichar_filter<Mode, Ch> { };
  117.  
  118. typedef multichar_filter<input>      multichar_input_filter;
  119. typedef multichar_wfilter<input>     multichar_input_wfilter;
  120. typedef multichar_filter<output>     multichar_output_filter;
  121. typedef multichar_wfilter<output>    multichar_output_wfilter;
  122. typedef multichar_filter<dual_use>   multichar_dual_use_filter;
  123. typedef multichar_wfilter<dual_use>  multichar_dual_use_wfilter;
  124.  
  125. //----------------------------------------------------------------------------//
  126.  
  127. } } // End namespaces iostreams, boost.
  128.  
  129. #endif // #ifndef BOOST_IOSTREAMS_CONCEPTS_HPP_INCLUDED
  130.  
downloadconcepts.hpp Source code - Download mars Source code
Related Source Codes/Software:
Hero - Elegant transition library for iOS & tvOS 2017-06-09
deep-photo-styletransfer - Code and data for paper "Deep Photo Style Transfer... 2017-06-09
mastodon - A GNU Social-compatible microblogging server ... 2017-06-09
plyr - A simple HTML5, YouTube and Vimeo player ... 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
Public-APIs - 2017-06-09
lottie-ios - An iOS library to natively render After Effects ve... 2017-06-09
Awesome-Hacking - A collection of various awesome lists for hackers,... 2017-06-09
algorithms - Minimal examples of data structures and algorithms... 2017-06-10
lectures - Oxford Deep NLP 2017 course 2017-06-10
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top