id
int64
0
755k
file_name
stringlengths
3
109
file_path
stringlengths
13
185
content
stringlengths
31
9.38M
size
int64
31
9.38M
language
stringclasses
1 value
extension
stringclasses
11 values
total_lines
int64
1
340k
avg_line_length
float64
2.18
149k
max_line_length
int64
7
2.22M
alphanum_fraction
float64
0
1
repo_name
stringlengths
6
65
repo_stars
int64
100
47.3k
repo_forks
int64
0
12k
repo_open_issues
int64
0
3.4k
repo_license
stringclasses
9 values
repo_extraction_date
stringclasses
92 values
exact_duplicates_redpajama
bool
2 classes
near_duplicates_redpajama
bool
2 classes
exact_duplicates_githubcode
bool
2 classes
exact_duplicates_stackv2
bool
1 class
exact_duplicates_stackv1
bool
2 classes
near_duplicates_githubcode
bool
2 classes
near_duplicates_stackv1
bool
2 classes
near_duplicates_stackv2
bool
1 class
31,968
try_lexical_convert.hpp
supercollider_supercollider/external_libraries/boost/boost/lexical_cast/try_lexical_convert.hpp
// Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. // Copyright Antony Polukhin, 2011-2024. // // 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) // // what: lexical_cast custom keyword cast // who: contributed by Kevlin Henney, // enhanced with contributions from Terje Slettebo, // with additional fixes and suggestions from Gennaro Prota, // Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov, // Alexander Nasonov, Antony Polukhin, Justin Viiret, Michael Hofmann, // Cheng Yang, Matthew Bradbury, David W. Birdsall, Pavel Korzh and other Boosters // when: November 2000, March 2003, June 2005, June 2006, March 2011 - 2014 #ifndef BOOST_LEXICAL_CAST_TRY_LEXICAL_CONVERT_HPP #define BOOST_LEXICAL_CAST_TRY_LEXICAL_CONVERT_HPP #include <boost/config.hpp> #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif #include <boost/type_traits/conditional.hpp> #include <boost/type_traits/is_arithmetic.hpp> #include <boost/lexical_cast/detail/buffer_view.hpp> #include <boost/lexical_cast/detail/is_character.hpp> #include <boost/lexical_cast/detail/converter_numeric.hpp> #include <boost/lexical_cast/detail/converter_lexical.hpp> namespace boost { namespace detail { template<typename Target, typename Source> using is_arithmetic_and_not_xchars = boost::integral_constant< bool, !(boost::detail::is_character<Target>::value) && !(boost::detail::is_character<Source>::value) && boost::is_arithmetic<Source>::value && boost::is_arithmetic<Target>::value >; } namespace conversion { namespace detail { template <typename Target, typename Source> inline bool try_lexical_convert(const Source& arg, Target& result) { static_assert( !boost::is_volatile<Source>::value, "Boost.LexicalCast does not support volatile input"); typedef typename boost::detail::array_to_pointer_decay<Source>::type src; typedef boost::detail::is_arithmetic_and_not_xchars<Target, src > shall_we_copy_with_dynamic_check_t; typedef typename boost::conditional< shall_we_copy_with_dynamic_check_t::value, boost::detail::dynamic_num_converter_impl<Target, src >, boost::detail::lexical_converter_impl<Target, src > >::type caster_type; return caster_type::try_convert(arg, result); } template <typename Target, typename CharacterT> inline bool try_lexical_convert(const CharacterT* chars, std::size_t count, Target& result) { static_assert( boost::detail::is_character<CharacterT>::value, "This overload of try_lexical_convert is meant to be used only with arrays of characters." ); return ::boost::conversion::detail::try_lexical_convert( ::boost::conversion::detail::make_buffer_view(chars, chars + count), result ); } }} // namespace conversion::detail namespace conversion { // ADL barrier using ::boost::conversion::detail::try_lexical_convert; } } // namespace boost #endif // BOOST_LEXICAL_CAST_TRY_LEXICAL_CONVERT_HPP
3,472
C++
.h
76
38.052632
106
0.661734
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
31,969
converter_lexical.hpp
supercollider_supercollider/external_libraries/boost/boost/lexical_cast/detail/converter_lexical.hpp
// Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. // Copyright Antony Polukhin, 2011-2024. // // 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) // // what: lexical_cast custom keyword cast // who: contributed by Kevlin Henney, // enhanced with contributions from Terje Slettebo, // with additional fixes and suggestions from Gennaro Prota, // Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov, // Alexander Nasonov, Antony Polukhin, Justin Viiret, Michael Hofmann, // Cheng Yang, Matthew Bradbury, David W. Birdsall, Pavel Korzh and other Boosters // when: November 2000, March 2003, June 2005, June 2006, March 2011 - 2014 #ifndef BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_HPP #define BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_HPP #include <boost/config.hpp> #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif #if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING) #define BOOST_LCAST_NO_WCHAR_T #endif #include <cstddef> #include <string> #include <boost/limits.hpp> #include <boost/type_traits/integral_constant.hpp> #include <boost/type_traits/type_identity.hpp> #include <boost/type_traits/conditional.hpp> #include <boost/type_traits/is_integral.hpp> #include <boost/type_traits/is_float.hpp> #include <boost/detail/lcast_precision.hpp> #include <boost/lexical_cast/detail/widest_char.hpp> #include <boost/lexical_cast/detail/is_character.hpp> #include <array> #ifndef BOOST_NO_CXX17_HDR_STRING_VIEW #include <string_view> #endif #include <boost/lexical_cast/detail/buffer_view.hpp> #include <boost/container/container_fwd.hpp> #include <boost/lexical_cast/detail/converter_lexical_streams.hpp> namespace boost { // Forward declaration template<class T, std::size_t N> class array; template<class IteratorT> class iterator_range; // Forward declaration of boost::basic_string_view from Utility template<class Ch, class Tr> class basic_string_view; namespace detail // normalize_single_byte_char<Char> { // Converts signed/unsigned char to char template < class Char > struct normalize_single_byte_char { typedef Char type; }; template <> struct normalize_single_byte_char< signed char > { typedef char type; }; template <> struct normalize_single_byte_char< unsigned char > { typedef char type; }; } namespace detail // deduce_character_type_later<T> { // Helper type, meaning that stram character for T must be deduced // at Stage 2 (See deduce_source_char<T> and deduce_target_char<T>) template < class T > struct deduce_character_type_later {}; } namespace detail // stream_char_common<T> { // Selectors to choose stream character type (common for Source and Target) // Returns one of char, wchar_t, char16_t, char32_t or deduce_character_type_later<T> types // Executed on Stage 1 (See deduce_source_char<T> and deduce_target_char<T>) template < typename Type > struct stream_char_common: public boost::conditional< boost::detail::is_character< Type >::value, Type, boost::detail::deduce_character_type_later< Type > > {}; template < typename Char > struct stream_char_common< Char* >: public boost::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< Char* > > {}; template < typename Char > struct stream_char_common< const Char* >: public boost::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< const Char* > > {}; template < typename Char > struct stream_char_common< boost::conversion::detail::buffer_view< Char > > { typedef Char type; }; template < typename Char > struct stream_char_common< boost::iterator_range< Char* > >: public boost::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< boost::iterator_range< Char* > > > {}; template < typename Char > struct stream_char_common< boost::iterator_range< const Char* > >: public boost::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< boost::iterator_range< const Char* > > > {}; template < class Char, class Traits, class Alloc > struct stream_char_common< std::basic_string< Char, Traits, Alloc > > { typedef Char type; }; template < class Char, class Traits, class Alloc > struct stream_char_common< boost::container::basic_string< Char, Traits, Alloc > > { typedef Char type; }; template < typename Char, std::size_t N > struct stream_char_common< boost::array< Char, N > >: public boost::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< boost::array< Char, N > > > {}; template < typename Char, std::size_t N > struct stream_char_common< boost::array< const Char, N > >: public boost::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< boost::array< const Char, N > > > {}; #ifndef BOOST_NO_CXX11_HDR_ARRAY template < typename Char, std::size_t N > struct stream_char_common< std::array<Char, N > >: public boost::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< std::array< Char, N > > > {}; template < typename Char, std::size_t N > struct stream_char_common< std::array< const Char, N > >: public boost::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< std::array< const Char, N > > > {}; #endif #ifndef BOOST_NO_CXX17_HDR_STRING_VIEW template < class Char, class Traits > struct stream_char_common< std::basic_string_view< Char, Traits > > { typedef Char type; }; #endif template < class Char, class Traits > struct stream_char_common< boost::basic_string_view< Char, Traits > > { typedef Char type; }; #ifdef BOOST_HAS_INT128 template <> struct stream_char_common< boost::int128_type >: public boost::type_identity< char > {}; template <> struct stream_char_common< boost::uint128_type >: public boost::type_identity< char > {}; #endif #if !defined(BOOST_LCAST_NO_WCHAR_T) && defined(BOOST_NO_INTRINSIC_WCHAR_T) template <> struct stream_char_common< wchar_t > { typedef char type; }; #endif } namespace detail // deduce_source_char_impl<T> { // If type T is `deduce_character_type_later` type, then tries to deduce // character type using streaming metafunctions. // Otherwise supplied type T is a character type, that must be normalized // using normalize_single_byte_char<Char>. // Executed at Stage 2 (See deduce_source_char<T> and deduce_target_char<T>) template < class Char > struct deduce_source_char_impl { typedef typename boost::detail::normalize_single_byte_char< Char >::type type; }; template < class T > struct deduce_source_char_impl< deduce_character_type_later< T > > { template <class U> static auto left_shift_type(long) -> decltype( std::declval<std::basic_ostream< char >&>() << std::declval<const U&>(), char{}); #if !defined(BOOST_LCAST_NO_WCHAR_T) template <class U> static auto left_shift_type(int) -> decltype( std::declval<std::basic_ostream< wchar_t >&>() << std::declval<const U&>(), wchar_t{}); #endif template <class U> static void left_shift_type(...); using type = decltype(left_shift_type<T>(1L)); static_assert(!std::is_same<type, void>::value, #if defined(BOOST_LCAST_NO_WCHAR_T) "Source type is not std::ostream`able and std::wostream`s are " "not supported by your STL implementation" #else "Source type is neither std::ostream`able nor std::wostream`able" #endif ); }; } namespace detail // deduce_target_char_impl<T> { // If type T is `deduce_character_type_later` type, then tries to deduce // character type using boost::has_right_shift<T> metafunction. // Otherwise supplied type T is a character type, that must be normalized // using normalize_single_byte_char<Char>. // Executed at Stage 2 (See deduce_source_char<T> and deduce_target_char<T>) template < class Char > struct deduce_target_char_impl { typedef typename normalize_single_byte_char< Char >::type type; }; template < class T > struct deduce_target_char_impl< deduce_character_type_later<T> > { template <class U> static auto right_shift_type(long) -> decltype( std::declval<std::basic_istream< char >&>() >> std::declval<U&>(), char{}); #if !defined(BOOST_LCAST_NO_WCHAR_T) template <class U> static auto right_shift_type(int) -> decltype( std::declval<std::basic_istream< wchar_t >&>() >> std::declval<U&>(), wchar_t{}); #endif template <class U> static void right_shift_type(...); using type = decltype(right_shift_type<T>(1L)); static_assert(!std::is_same<type, void>::value, #if defined(BOOST_LCAST_NO_WCHAR_T) "Target type is not std::istream`able and std::wistream`s are " "not supported by your STL implementation" #else "Target type is neither std::istream`able nor std::wistream`able" #endif ); }; } namespace detail // deduce_target_char<T> and deduce_source_char<T> { // We deduce stream character types in two stages. // // Stage 1 is common for Target and Source. At Stage 1 we get // non normalized character type (may contain unsigned/signed char) // or deduce_character_type_later<T> where T is the original type. // Stage 1 is executed by stream_char_common<T> // // At Stage 2 we normalize character types or try to deduce character // type using metafunctions. // Stage 2 is executed by deduce_target_char_impl<T> and // deduce_source_char_impl<T> // // deduce_target_char<T> and deduce_source_char<T> functions combine // both stages template < class T > struct deduce_target_char { typedef typename stream_char_common< T >::type stage1_type; typedef typename deduce_target_char_impl< stage1_type >::type type; }; template < class T > struct deduce_source_char { typedef typename stream_char_common< T >::type stage1_type; typedef typename deduce_source_char_impl< stage1_type >::type type; }; } namespace detail // array_to_pointer_decay<T> { template<class T> struct array_to_pointer_decay { typedef T type; }; template<class T, std::size_t N> struct array_to_pointer_decay<T[N]> { typedef const T * type; }; } namespace detail // lcast_src_length { // Return max. length of string representation of Source; template< class Source, // Source type of lexical_cast. class Enable = void // helper type > struct lcast_src_length { BOOST_STATIC_CONSTANT(std::size_t, value = 1); }; // Helper for integral types. // Notes on length calculation: // Max length for 32bit int with grouping "\1" and thousands_sep ',': // "-2,1,4,7,4,8,3,6,4,7" // ^ - is_signed // ^ - 1 digit not counted by digits10 // ^^^^^^^^^^^^^^^^^^ - digits10 * 2 // // Constant is_specialized is used instead of constant 1 // to prevent buffer overflow in a rare case when // <boost/limits.hpp> doesn't add missing specialization for // numeric_limits<T> for some integral type T. // When is_specialized is false, the whole expression is 0. template <class Source> struct lcast_src_length< Source, typename boost::enable_if<boost::is_integral<Source> >::type > { BOOST_STATIC_CONSTANT(std::size_t, value = std::numeric_limits<Source>::is_signed + std::numeric_limits<Source>::is_specialized + /* == 1 */ std::numeric_limits<Source>::digits10 * 2 ); }; // Helper for floating point types. // -1.23456789e-123456 // ^ sign // ^ leading digit // ^ decimal point // ^^^^^^^^ lcast_precision<Source>::value // ^ "e" // ^ exponent sign // ^^^^^^ exponent (assumed 6 or less digits) // sign + leading digit + decimal point + "e" + exponent sign == 5 template<class Source> struct lcast_src_length< Source, typename boost::enable_if<boost::is_float<Source> >::type > { static_assert( std::numeric_limits<Source>::max_exponent10 <= 999999L && std::numeric_limits<Source>::min_exponent10 >= -999999L , ""); BOOST_STATIC_CONSTANT(std::size_t, value = 5 + lcast_precision<Source>::value + 6 ); }; } namespace detail // lexical_cast_stream_traits<Source, Target> { template <class Source, class Target> struct lexical_cast_stream_traits { typedef typename boost::detail::array_to_pointer_decay<Source>::type src; typedef typename boost::remove_cv<src>::type no_cv_src; typedef boost::detail::deduce_source_char<no_cv_src> deduce_src_char_metafunc; typedef typename deduce_src_char_metafunc::type src_char_t; typedef typename boost::detail::deduce_target_char<Target>::type target_char_t; typedef typename boost::detail::widest_char< target_char_t, src_char_t >::type char_type; #if !defined(BOOST_NO_CXX11_CHAR16_T) && defined(BOOST_NO_CXX11_UNICODE_LITERALS) static_assert(!boost::is_same<char16_t, src_char_t>::value && !boost::is_same<char16_t, target_char_t>::value, "Your compiler does not have full support for char16_t" ); #endif #if !defined(BOOST_NO_CXX11_CHAR32_T) && defined(BOOST_NO_CXX11_UNICODE_LITERALS) static_assert(!boost::is_same<char32_t, src_char_t>::value && !boost::is_same<char32_t, target_char_t>::value, "Your compiler does not have full support for char32_t" ); #endif typedef std::char_traits<char_type> traits; typedef boost::detail::lcast_src_length<no_cv_src> len_t; }; } namespace detail { template<typename Target, typename Source> struct lexical_converter_impl { typedef lexical_cast_stream_traits<Source, Target> stream_trait; typedef detail::lcast::optimized_src_stream< typename stream_trait::char_type, typename stream_trait::traits, stream_trait::len_t::value + 1 > optimized_src_stream; template <class T> static auto detect_type(int) -> decltype(std::declval<optimized_src_stream&>().stream_in(std::declval<lcast::exact<T>>()), optimized_src_stream{}); template <class T> static lcast::ios_src_stream<typename stream_trait::char_type, typename stream_trait::traits> detect_type(...); using from_src_stream = decltype(detect_type<Source>(1)); typedef detail::lcast::to_target_stream< typename stream_trait::char_type, typename stream_trait::traits > to_target_stream; static inline bool try_convert(const Source& arg, Target& result) { from_src_stream src_stream; if (!src_stream.stream_in(lcast::exact<Source>{arg})) return false; to_target_stream out(src_stream.cbegin(), src_stream.cend()); if (!out.stream_out(result)) return false; return true; } }; } } // namespace boost #undef BOOST_LCAST_NO_WCHAR_T #endif // BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_HPP
17,871
C++
.h
409
34.317848
134
0.596064
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
31,974
converter_numeric.hpp
supercollider_supercollider/external_libraries/boost/boost/lexical_cast/detail/converter_numeric.hpp
// Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. // Copyright Antony Polukhin, 2011-2024. // // 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) // // what: lexical_cast custom keyword cast // who: contributed by Kevlin Henney, // enhanced with contributions from Terje Slettebo, // with additional fixes and suggestions from Gennaro Prota, // Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov, // Alexander Nasonov, Antony Polukhin, Justin Viiret, Michael Hofmann, // Cheng Yang, Matthew Bradbury, David W. Birdsall, Pavel Korzh and other Boosters // when: November 2000, March 2003, June 2005, June 2006, March 2011 - 2016 #ifndef BOOST_LEXICAL_CAST_DETAIL_CONVERTER_NUMERIC_HPP #define BOOST_LEXICAL_CAST_DETAIL_CONVERTER_NUMERIC_HPP #include <boost/config.hpp> #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif #include <boost/core/cmath.hpp> #include <boost/core/enable_if.hpp> #include <boost/limits.hpp> #include <boost/type_traits/type_identity.hpp> #include <boost/type_traits/conditional.hpp> #include <boost/type_traits/make_unsigned.hpp> #include <boost/type_traits/is_signed.hpp> #include <boost/type_traits/is_arithmetic.hpp> #include <boost/type_traits/is_float.hpp> namespace boost { namespace detail { template <class Source, class Target> bool ios_numeric_comparer_float(Source x, Source y) noexcept { return x == y || (boost::core::isnan(x) && boost::core::isnan(y)) || (x < (std::numeric_limits<Target>::min)()) ; } template <class RangeType, class T> constexpr bool is_out_of_range_for(T value) noexcept { return value > static_cast<T>((std::numeric_limits<RangeType>::max)()) || value < static_cast<T>((std::numeric_limits<RangeType>::min)()); } // integral -> integral template <typename Target, typename Source> typename boost::enable_if_c< !boost::is_floating_point<Source>::value && !boost::is_floating_point<Target>::value, bool >::type noexcept_numeric_convert(Source arg, Target& result) noexcept { const Target target_tmp = static_cast<Target>(arg); const Source arg_restored = static_cast<Source>(target_tmp); if (arg == arg_restored) { result = target_tmp; return true; } return false; } // integral -> floating point template <typename Target, typename Source> typename boost::enable_if_c< !boost::is_floating_point<Source>::value && boost::is_floating_point<Target>::value, bool >::type noexcept_numeric_convert(Source arg, Target& result) noexcept { const Target target_tmp = static_cast<Target>(arg); result = target_tmp; return true; } // floating point -> floating point template <typename Target, typename Source> typename boost::enable_if_c< boost::is_floating_point<Source>::value && boost::is_floating_point<Target>::value, bool >::type noexcept_numeric_convert(Source arg, Target& result) noexcept { const Target target_tmp = static_cast<Target>(arg); const Source arg_restored = static_cast<Source>(target_tmp); if (detail::ios_numeric_comparer_float<Source, Target>(arg, arg_restored)) { result = target_tmp; return true; } return false; } // floating point -> integral template <typename Target, typename Source> typename boost::enable_if_c< boost::is_floating_point<Source>::value && !boost::is_floating_point<Target>::value, bool >::type noexcept_numeric_convert(Source arg, Target& result) noexcept { if (detail::is_out_of_range_for<Target>(arg)) { return false; } const Target target_tmp = static_cast<Target>(arg); const Source arg_restored = static_cast<Source>(target_tmp); if (detail::ios_numeric_comparer_float<Source, Target>(arg, arg_restored)) { result = target_tmp; return true; } return false; } struct lexical_cast_dynamic_num_not_ignoring_minus { template <typename Target, typename Source> static inline bool try_convert(Source arg, Target& result) noexcept { return boost::detail::noexcept_numeric_convert<Target, Source >(arg, result); } }; struct lexical_cast_dynamic_num_ignoring_minus { template <typename Target, typename Source> #if defined(__clang__) && (__clang_major__ > 3 || __clang_minor__ > 6) __attribute__((no_sanitize("unsigned-integer-overflow"))) #endif static inline bool try_convert(Source arg, Target& result) noexcept { typedef typename boost::conditional< boost::is_float<Source>::value, boost::type_identity<Source>, boost::make_unsigned<Source> >::type usource_lazy_t; typedef typename usource_lazy_t::type usource_t; if (arg < 0) { const bool res = boost::detail::noexcept_numeric_convert<Target, usource_t>( static_cast<usource_t>(0u - static_cast<usource_t>(arg)), result ); result = static_cast<Target>(0u - result); return res; } else { return boost::detail::noexcept_numeric_convert<Target, usource_t>(arg, result); } } }; /* * dynamic_num_converter_impl follows the rules: * 1) If Source can be converted to Target without precision loss and * without overflows, then assign Source to Target and return * * 2) If Source is less than 0 and Target is an unsigned integer, * then negate Source, check the requirements of rule 1) and if * successful, assign static_casted Source to Target and return * * 3) Otherwise throw a bad_lexical_cast exception * * * Rule 2) required because boost::lexical_cast has the behavior of * stringstream, which uses the rules of scanf for conversions. And * in the C99 standard for unsigned input value minus sign is * optional, so if a negative number is read, no errors will arise * and the result will be the two's complement. */ template <typename Target, typename Source> struct dynamic_num_converter_impl { static inline bool try_convert(Source arg, Target& result) noexcept { typedef typename boost::conditional< boost::is_unsigned<Target>::value && (boost::is_signed<Source>::value || boost::is_float<Source>::value) && !(boost::is_same<Source, bool>::value) && !(boost::is_same<Target, bool>::value), lexical_cast_dynamic_num_ignoring_minus, lexical_cast_dynamic_num_not_ignoring_minus >::type caster_type; return caster_type::try_convert(arg, result); } }; }} // namespace boost::detail #endif // BOOST_LEXICAL_CAST_DETAIL_CONVERTER_NUMERIC_HPP
6,703
C++
.h
161
37.279503
94
0.69934
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
31,975
buffer_view.hpp
supercollider_supercollider/external_libraries/boost/boost/lexical_cast/detail/buffer_view.hpp
// Copyright Antony Polukhin, 2011-2024. // // 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) #ifndef BOOST_LEXICAL_CAST_DETAIL_BUFFER_VIEW_HPP #define BOOST_LEXICAL_CAST_DETAIL_BUFFER_VIEW_HPP #include <boost/config.hpp> #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif #include <iosfwd> namespace boost { namespace conversion { namespace detail { template < typename CharT > struct buffer_view { const CharT* begin; const CharT* end; }; template < typename CharT > buffer_view<CharT> make_buffer_view(const CharT* begin, const CharT* end) { return buffer_view<CharT>{begin, end}; } inline buffer_view<char> make_buffer_view(const signed char* begin, const signed char* end) { return buffer_view<char>{ reinterpret_cast<const char*>(begin), reinterpret_cast<const char*>(end) }; } inline buffer_view<char> make_buffer_view(const unsigned char* begin, const unsigned char* end) { return buffer_view<char>{ reinterpret_cast<const char*>(begin), reinterpret_cast<const char*>(end) }; } template< typename CharT, typename Elem, typename Traits > std::basic_ostream<Elem,Traits>& operator<<( std::basic_ostream<Elem, Traits>& os, buffer_view<CharT> r) { while (r.begin != r.end) { os << r.begin[0]; ++r.begin; } return os; } }}} // namespace boost::conversion::detail #endif // BOOST_LEXICAL_CAST_DETAIL_BUFFER_VIEW_HPP
1,675
C++
.h
47
29.340426
101
0.649752
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
31,977
lcast_basic_unlockedbuf.hpp
supercollider_supercollider/external_libraries/boost/boost/lexical_cast/detail/lcast_basic_unlockedbuf.hpp
// Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. // Copyright Antony Polukhin, 2011-2024. // // 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) #ifndef BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_BASIC_UNLOCKEDBUF_HPP #define BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_BASIC_UNLOCKEDBUF_HPP #include <boost/config.hpp> #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif #ifdef BOOST_NO_STRINGSTREAM #include <strstream> #else #include <sstream> #endif #include <boost/detail/basic_pointerbuf.hpp> #ifndef BOOST_NO_CWCHAR # include <cwchar> #endif namespace boost { namespace detail { namespace lcast { // acts as a stream buffer which wraps around a pair of pointers // and gives acces to internals template <class BufferType, class CharT> class basic_unlockedbuf : public basic_pointerbuf<CharT, BufferType> { public: typedef basic_pointerbuf<CharT, BufferType> base_type; typedef typename base_type::streamsize streamsize; using base_type::pptr; using base_type::pbase; using base_type::setbuf; }; #if defined(BOOST_NO_STRINGSTREAM) template <class CharT, class Traits> using out_stream_t = std::ostream; template <class CharT, class Traits> using stringbuffer_t = basic_unlockedbuf<std::strstreambuf, char>; #elif defined(BOOST_NO_STD_LOCALE) template <class CharT, class Traits> using out_stream_t = std::ostream; template <class CharT, class Traits> using stringbuffer_t = basic_unlockedbuf<std::stringbuf, char>; template <class CharT, class Traits> using buffer_t = basic_unlockedbuf<std::streambuf, char>; #else template <class CharT, class Traits> using out_stream_t = std::basic_ostream<CharT, Traits>; template <class CharT, class Traits> using stringbuffer_t = basic_unlockedbuf<std::basic_stringbuf<CharT, Traits>, CharT>; template <class CharT, class Traits> using buffer_t = basic_unlockedbuf<std::basic_streambuf<CharT, Traits>, CharT>; #endif }}} // namespace boost::detail::lcast #endif // BOOST_LEXICAL_CAST_DETAIL_CONVERTER_LEXICAL_BASIC_UNLOCKEDBUF_HPP
2,261
C++
.h
56
36.785714
89
0.745887
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
31,979
buffers.hpp
supercollider_supercollider/external_libraries/boost/boost/endian/buffers.hpp
// boost/endian/buffers.hpp ----------------------------------------------------------// // (C) Copyright Darin Adler 2000 // (C) Copyright Beman Dawes 2006, 2009, 2014 // (C) Copyright Peter Dimov 2019 // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt // See library home page at http://www.boost.org/libs/endian //--------------------------------------------------------------------------------------// // Original design developed by Darin Adler based on classes developed by Mark // Borgerding. Four original class templates were combined into a single endian // class template by Beman Dawes, who also added the unrolled_byte_loops sign // partial specialization to correctly extend the sign when cover integer size // differs from endian representation size. // TODO: When a compiler supporting constexpr becomes available, try possible uses. #ifndef BOOST_ENDIAN_BUFFERS_HPP #define BOOST_ENDIAN_BUFFERS_HPP #if defined(_MSC_VER) # pragma warning(push) # pragma warning(disable: 4127) // conditional expression is constant #endif #include <boost/endian/detail/endian_store.hpp> #include <boost/endian/detail/endian_load.hpp> #include <boost/endian/detail/static_assert.hpp> #include <boost/config.hpp> #include <cstdint> #include <iosfwd> #include <climits> #include <cstring> #if defined(BOOST_BORLANDC) || defined(BOOST_CODEGEARC) # pragma pack(push, 1) #endif # if CHAR_BIT != 8 # error Platforms with CHAR_BIT != 8 are not supported # endif //---------------------------------- synopsis ----------------------------------------// namespace boost { namespace endian { enum class align {no, yes # ifdef BOOST_ENDIAN_DEPRECATED_NAMES , unaligned = no, aligned = yes # endif }; template <order Order, class T, std::size_t n_bits, align A = align::no> class endian_buffer; // aligned big endian signed integer buffers typedef endian_buffer<order::big, std::int8_t, 8, align::yes> big_int8_buf_at; typedef endian_buffer<order::big, std::int16_t, 16, align::yes> big_int16_buf_at; typedef endian_buffer<order::big, std::int32_t, 32, align::yes> big_int32_buf_at; typedef endian_buffer<order::big, std::int64_t, 64, align::yes> big_int64_buf_at; // aligned big endian unsigned integer buffers typedef endian_buffer<order::big, std::uint8_t, 8, align::yes> big_uint8_buf_at; typedef endian_buffer<order::big, std::uint16_t, 16, align::yes> big_uint16_buf_at; typedef endian_buffer<order::big, std::uint32_t, 32, align::yes> big_uint32_buf_at; typedef endian_buffer<order::big, std::uint64_t, 64, align::yes> big_uint64_buf_at; // aligned little endian signed integer buffers typedef endian_buffer<order::little, std::int8_t, 8, align::yes> little_int8_buf_at; typedef endian_buffer<order::little, std::int16_t, 16, align::yes> little_int16_buf_at; typedef endian_buffer<order::little, std::int32_t, 32, align::yes> little_int32_buf_at; typedef endian_buffer<order::little, std::int64_t, 64, align::yes> little_int64_buf_at; // aligned little endian unsigned integer buffers typedef endian_buffer<order::little, std::uint8_t, 8, align::yes> little_uint8_buf_at; typedef endian_buffer<order::little, std::uint16_t, 16, align::yes> little_uint16_buf_at; typedef endian_buffer<order::little, std::uint32_t, 32, align::yes> little_uint32_buf_at; typedef endian_buffer<order::little, std::uint64_t, 64, align::yes> little_uint64_buf_at; // aligned floating point buffers typedef endian_buffer<order::big, float, 32, align::yes> big_float32_buf_at; typedef endian_buffer<order::big, double, 64, align::yes> big_float64_buf_at; typedef endian_buffer<order::little, float, 32, align::yes> little_float32_buf_at; typedef endian_buffer<order::little, double, 64, align::yes> little_float64_buf_at; // aligned native endian typedefs are not provided because // <cstdint> types are superior for this use case // unaligned big endian signed integer buffers typedef endian_buffer<order::big, std::int_least8_t, 8> big_int8_buf_t; typedef endian_buffer<order::big, std::int_least16_t, 16> big_int16_buf_t; typedef endian_buffer<order::big, std::int_least32_t, 24> big_int24_buf_t; typedef endian_buffer<order::big, std::int_least32_t, 32> big_int32_buf_t; typedef endian_buffer<order::big, std::int_least64_t, 40> big_int40_buf_t; typedef endian_buffer<order::big, std::int_least64_t, 48> big_int48_buf_t; typedef endian_buffer<order::big, std::int_least64_t, 56> big_int56_buf_t; typedef endian_buffer<order::big, std::int_least64_t, 64> big_int64_buf_t; // unaligned big endian unsigned integer buffers typedef endian_buffer<order::big, std::uint_least8_t, 8> big_uint8_buf_t; typedef endian_buffer<order::big, std::uint_least16_t, 16> big_uint16_buf_t; typedef endian_buffer<order::big, std::uint_least32_t, 24> big_uint24_buf_t; typedef endian_buffer<order::big, std::uint_least32_t, 32> big_uint32_buf_t; typedef endian_buffer<order::big, std::uint_least64_t, 40> big_uint40_buf_t; typedef endian_buffer<order::big, std::uint_least64_t, 48> big_uint48_buf_t; typedef endian_buffer<order::big, std::uint_least64_t, 56> big_uint56_buf_t; typedef endian_buffer<order::big, std::uint_least64_t, 64> big_uint64_buf_t; // unaligned little endian signed integer buffers typedef endian_buffer<order::little, std::int_least8_t, 8> little_int8_buf_t; typedef endian_buffer<order::little, std::int_least16_t, 16> little_int16_buf_t; typedef endian_buffer<order::little, std::int_least32_t, 24> little_int24_buf_t; typedef endian_buffer<order::little, std::int_least32_t, 32> little_int32_buf_t; typedef endian_buffer<order::little, std::int_least64_t, 40> little_int40_buf_t; typedef endian_buffer<order::little, std::int_least64_t, 48> little_int48_buf_t; typedef endian_buffer<order::little, std::int_least64_t, 56> little_int56_buf_t; typedef endian_buffer<order::little, std::int_least64_t, 64> little_int64_buf_t; // unaligned little endian unsigned integer buffers typedef endian_buffer<order::little, std::uint_least8_t, 8> little_uint8_buf_t; typedef endian_buffer<order::little, std::uint_least16_t, 16> little_uint16_buf_t; typedef endian_buffer<order::little, std::uint_least32_t, 24> little_uint24_buf_t; typedef endian_buffer<order::little, std::uint_least32_t, 32> little_uint32_buf_t; typedef endian_buffer<order::little, std::uint_least64_t, 40> little_uint40_buf_t; typedef endian_buffer<order::little, std::uint_least64_t, 48> little_uint48_buf_t; typedef endian_buffer<order::little, std::uint_least64_t, 56> little_uint56_buf_t; typedef endian_buffer<order::little, std::uint_least64_t, 64> little_uint64_buf_t; // unaligned native endian signed integer buffers typedef endian_buffer<order::native, std::int_least8_t, 8> native_int8_buf_t; typedef endian_buffer<order::native, std::int_least16_t, 16> native_int16_buf_t; typedef endian_buffer<order::native, std::int_least32_t, 24> native_int24_buf_t; typedef endian_buffer<order::native, std::int_least32_t, 32> native_int32_buf_t; typedef endian_buffer<order::native, std::int_least64_t, 40> native_int40_buf_t; typedef endian_buffer<order::native, std::int_least64_t, 48> native_int48_buf_t; typedef endian_buffer<order::native, std::int_least64_t, 56> native_int56_buf_t; typedef endian_buffer<order::native, std::int_least64_t, 64> native_int64_buf_t; // unaligned native endian unsigned integer buffers typedef endian_buffer<order::native, std::uint_least8_t, 8> native_uint8_buf_t; typedef endian_buffer<order::native, std::uint_least16_t, 16> native_uint16_buf_t; typedef endian_buffer<order::native, std::uint_least32_t, 24> native_uint24_buf_t; typedef endian_buffer<order::native, std::uint_least32_t, 32> native_uint32_buf_t; typedef endian_buffer<order::native, std::uint_least64_t, 40> native_uint40_buf_t; typedef endian_buffer<order::native, std::uint_least64_t, 48> native_uint48_buf_t; typedef endian_buffer<order::native, std::uint_least64_t, 56> native_uint56_buf_t; typedef endian_buffer<order::native, std::uint_least64_t, 64> native_uint64_buf_t; // unaligned floating point buffers typedef endian_buffer<order::big, float, 32, align::no> big_float32_buf_t; typedef endian_buffer<order::big, double, 64, align::no> big_float64_buf_t; typedef endian_buffer<order::little, float, 32, align::no> little_float32_buf_t; typedef endian_buffer<order::little, double, 64, align::no> little_float64_buf_t; typedef endian_buffer<order::native, float, 32, align::no> native_float32_buf_t; typedef endian_buffer<order::native, double, 64, align::no> native_float64_buf_t; // Stream inserter template <class charT, class traits, order Order, class T, std::size_t n_bits, align A> std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& os, const endian_buffer<Order, T, n_bits, A>& x) { return os << x.value(); } // Stream extractor template <class charT, class traits, order Order, class T, std::size_t n_bits, align A> std::basic_istream<charT, traits>& operator>>(std::basic_istream<charT, traits>& is, endian_buffer<Order, T, n_bits, A>& x) { T i; if (is >> i) x = i; return is; } //---------------------------------- end synopsis ------------------------------------// // endian_buffer class template specializations --------------------------------------// // Specializations that represent unaligned bytes. // Taking an integer type as a parameter provides a nice way to pass both // the size and signedness of the desired integer and get the appropriate // corresponding integer type for the interface. // Q: Should endian_buffer supply "value_type operator value_type() const noexcept"? // A: No. The rationale for endian_buffers is to prevent high-cost hidden // conversions. If an implicit conversion operator is supplied, hidden conversions // can occur. // unaligned endian_buffer specialization template< order Order, class T, std::size_t n_bits > class endian_buffer<Order, T, n_bits, align::no> { #ifdef BOOST_ENDIAN_NO_CTORS public: #endif BOOST_ENDIAN_STATIC_ASSERT( (n_bits/8)*8 == n_bits ); unsigned char value_[ n_bits / 8 ]; public: typedef T value_type; #ifndef BOOST_ENDIAN_NO_CTORS endian_buffer() = default; explicit endian_buffer( T val ) BOOST_NOEXCEPT { boost::endian::endian_store<T, n_bits / 8, Order>( value_, val ); } #endif endian_buffer& operator=( T val ) BOOST_NOEXCEPT { boost::endian::endian_store<T, n_bits / 8, Order>( value_, val ); return *this; } value_type value() const BOOST_NOEXCEPT { return boost::endian::endian_load<T, n_bits / 8, Order>( value_ ); } unsigned char const * data() const BOOST_NOEXCEPT { return value_; } unsigned char * data() BOOST_NOEXCEPT { return value_; } }; // aligned specializations; only n_bits == 16/32/64 supported // aligned endian_buffer specialization template< order Order, class T, std::size_t n_bits > class endian_buffer<Order, T, n_bits, align::yes> { private: BOOST_ENDIAN_STATIC_ASSERT( (n_bits/8)*8 == n_bits ); BOOST_ENDIAN_STATIC_ASSERT( sizeof(T) == n_bits/8 ); union { unsigned char value_[ n_bits / 8 ]; T align_; }; public: typedef T value_type; #ifndef BOOST_ENDIAN_NO_CTORS endian_buffer() = default; explicit endian_buffer( T val ) BOOST_NOEXCEPT { boost::endian::endian_store<T, n_bits / 8, Order>( value_, val ); } #endif endian_buffer& operator=( T val ) BOOST_NOEXCEPT { boost::endian::endian_store<T, n_bits / 8, Order>( value_, val ); return *this; } value_type value() const BOOST_NOEXCEPT { return boost::endian::endian_load<T, n_bits / 8, Order>( value_ ); } unsigned char const * data() const BOOST_NOEXCEPT { return value_; } unsigned char * data() BOOST_NOEXCEPT { return value_; } }; // aligned native endian_buffer specialization template< class T, std::size_t n_bits > class endian_buffer<order::native, T, n_bits, align::yes> { private: BOOST_ENDIAN_STATIC_ASSERT( (n_bits/8)*8 == n_bits ); BOOST_ENDIAN_STATIC_ASSERT( sizeof(T) == n_bits/8 ); T value_; public: typedef T value_type; #ifndef BOOST_ENDIAN_NO_CTORS endian_buffer() = default; explicit endian_buffer( T val ) BOOST_NOEXCEPT: value_( val ) { } #endif endian_buffer& operator=( T val ) BOOST_NOEXCEPT { value_ = val; return *this; } value_type value() const BOOST_NOEXCEPT { return value_; } unsigned char const * data() const BOOST_NOEXCEPT { return reinterpret_cast< unsigned char const* >( &value_ ); } unsigned char * data() BOOST_NOEXCEPT { return reinterpret_cast< unsigned char* >( &value_ ); } }; } // namespace endian } // namespace boost #if defined(BOOST_BORLANDC) || defined(BOOST_CODEGEARC) # pragma pack(pop) #endif #if defined(_MSC_VER) # pragma warning(pop) #endif #endif // BOOST_ENDIAN_BUFFERS_HPP
13,526
C++
.h
286
43.681818
91
0.684323
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
true
false
31,982
static_assert.hpp
supercollider_supercollider/external_libraries/boost/boost/endian/detail/static_assert.hpp
#ifndef BOOST_ENDIAN_DETAIL_STATIC_ASSERT_HPP_INCLUDED #define BOOST_ENDIAN_DETAIL_STATIC_ASSERT_HPP_INCLUDED // Copyright 2023 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #define BOOST_ENDIAN_STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif // BOOST_ENDIAN_DETAIL_STATIC_ASSERT_HPP_INCLUDED
385
C++
.h
7
53.571429
80
0.770667
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
31,984
is_trivially_copyable.hpp
supercollider_supercollider/external_libraries/boost/boost/endian/detail/is_trivially_copyable.hpp
#ifndef BOOST_ENDIAN_DETAIL_IS_TRIVIALLY_COPYABLE_HPP_INCLUDED #define BOOST_ENDIAN_DETAIL_IS_TRIVIALLY_COPYABLE_HPP_INCLUDED // Copyright 2019, 2023 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // http://www.boost.org/LICENSE_1_0.txt #include <boost/config.hpp> #include <type_traits> namespace boost { namespace endian { namespace detail { #if defined( BOOST_LIBSTDCXX_VERSION ) && BOOST_LIBSTDCXX_VERSION < 50000 template<class T> struct is_trivially_copyable: std::integral_constant<bool, __has_trivial_copy(T) && __has_trivial_assign(T) && __has_trivial_destructor(T)> {}; #else using std::is_trivially_copyable; #endif } // namespace detail } // namespace endian } // namespace boost #endif // BOOST_ENDIAN_DETAIL_IS_TRIVIALLY_COPYABLE_HPP_INCLUDED
799
C++
.h
23
33.130435
88
0.774151
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
31,989
is_integral.hpp
supercollider_supercollider/external_libraries/boost/boost/endian/detail/is_integral.hpp
#ifndef BOOST_ENDIAN_DETAIL_IS_INTEGRAL_HPP_INCLUDED #define BOOST_ENDIAN_DETAIL_IS_INTEGRAL_HPP_INCLUDED // Copyright 2023 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // http://www.boost.org/LICENSE_1_0.txt #include <type_traits> namespace boost { namespace endian { namespace detail { template<class T> struct is_integral: std::is_integral<T> { }; #if defined(__SIZEOF_INT128__) template<> struct is_integral<__int128_t>: std::true_type { }; template<> struct is_integral<__uint128_t>: std::true_type { }; #endif } // namespace detail } // namespace endian } // namespace boost #endif // BOOST_ENDIAN_DETAIL_IS_INTEGRAL_HPP_INCLUDED
676
C++
.h
27
23.666667
61
0.765258
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,117
sinhc.hpp
supercollider_supercollider/external_libraries/boost/boost/math/special_functions/sinhc.hpp
// boost sinhc.hpp header file // (C) Copyright Hubert Holin 2001. // 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) // See http://www.boost.org for updates, documentation, and revision history. #ifndef BOOST_SINHC_HPP #define BOOST_SINHC_HPP #ifdef _MSC_VER #pragma once #endif #include <boost/math/tools/precision.hpp> #include <boost/math/policies/error_handling.hpp> #include <boost/math/special_functions/math_fwd.hpp> #include <boost/math/special_functions/fpclassify.hpp> #include <limits> #include <string> #include <stdexcept> #include <cmath> // These are the the "Hyperbolic Sinus Cardinal" functions. namespace boost { namespace math { namespace detail { // This is the "Hyperbolic Sinus Cardinal" of index Pi. template<typename T, typename Policy> inline T sinhc_pi_imp(const T x, const Policy&) { using ::std::abs; using ::std::sinh; using ::std::sqrt; static T const taylor_0_bound = tools::epsilon<T>(); static T const taylor_2_bound = sqrt(taylor_0_bound); static T const taylor_n_bound = sqrt(taylor_2_bound); if((boost::math::isinf)(x)) { return policies::raise_overflow_error<T>("sinhc(%1%)", nullptr, Policy()); } if (abs(x) >= taylor_n_bound) { return(sinh(x)/x); } else { // approximation by taylor series in x at 0 up to order 0 T result = static_cast<T>(1); if (abs(x) >= taylor_0_bound) { T x2 = x*x; // approximation by taylor series in x at 0 up to order 2 result += x2/static_cast<T>(6); if (abs(x) >= taylor_2_bound) { // approximation by taylor series in x at 0 up to order 4 result += (x2*x2)/static_cast<T>(120); } } return(result); } } } // namespace detail template <class T, class Policy> inline typename tools::promote_args<T>::type sinhc_pi(T x, const Policy& pol) { typedef typename tools::promote_args<T>::type result_type; return policies::checked_narrowing_cast<T, Policy>(detail::sinhc_pi_imp(static_cast<result_type>(x), pol), "sinhc(%1%)"); } template <class T> inline typename tools::promote_args<T>::type sinhc_pi(T x) { typedef typename tools::promote_args<T>::type result_type; return sinhc_pi(static_cast<result_type>(x), policies::policy<>()); } template<typename T, template<typename> class U> inline U<T> sinhc_pi(const U<T> x) { using std::abs; using std::sinh; using std::sqrt; using ::std::numeric_limits; static T const taylor_0_bound = tools::epsilon<T>(); static T const taylor_2_bound = sqrt(taylor_0_bound); static T const taylor_n_bound = sqrt(taylor_2_bound); if (abs(x) >= taylor_n_bound) { return(sinh(x)/x); } else { // approximation by taylor series in x at 0 up to order 0 #ifdef __MWERKS__ U<T> result = static_cast<U<T> >(1); #else U<T> result = U<T>(1); #endif if (abs(x) >= taylor_0_bound) { U<T> x2 = x*x; // approximation by taylor series in x at 0 up to order 2 result += x2/static_cast<T>(6); if (abs(x) >= taylor_2_bound) { // approximation by taylor series in x at 0 up to order 4 result += (x2*x2)/static_cast<T>(120); } } return(result); } } } } #endif /* BOOST_SINHC_HPP */
4,291
C++
.h
114
26.5
131
0.51651
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,144
bessel_derivatives_linear.hpp
supercollider_supercollider/external_libraries/boost/boost/math/special_functions/detail/bessel_derivatives_linear.hpp
// Copyright (c) 2013 Anton Bikineev // Use, modification and distribution are subject to 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) // // This is a partial header, do not include on it's own!!! // // Linear combination for bessel derivatives are defined here #ifndef BOOST_MATH_SF_DETAIL_BESSEL_DERIVATIVES_LINEAR_HPP #define BOOST_MATH_SF_DETAIL_BESSEL_DERIVATIVES_LINEAR_HPP #include <iostream> #ifdef _MSC_VER #pragma once #endif namespace boost{ namespace math{ namespace detail{ template <class T, class Tag, class Policy> inline T bessel_j_derivative_linear(T v, T x, Tag tag, Policy pol) { return (boost::math::detail::cyl_bessel_j_imp<T>(v-1, x, tag, pol) - boost::math::detail::cyl_bessel_j_imp<T>(v+1, x, tag, pol)) / 2; } template <class T, class Policy> inline T bessel_j_derivative_linear(T v, T x, const bessel_int_tag& tag, Policy pol) { return (boost::math::detail::cyl_bessel_j_imp<T>(itrunc(v-1), x, tag, pol) - boost::math::detail::cyl_bessel_j_imp<T>(itrunc(v+1), x, tag, pol)) / 2; } template <class T, class Policy> inline T sph_bessel_j_derivative_linear(unsigned v, T x, Policy pol) { return (v / x) * boost::math::detail::sph_bessel_j_imp<T>(v, x, pol) - boost::math::detail::sph_bessel_j_imp<T>(v+1, x, pol); } template <class T, class Policy> inline T bessel_i_derivative_linear(T v, T x, Policy pol) { T result = boost::math::detail::cyl_bessel_i_imp<T>(v - 1, x, pol); if(result >= tools::max_value<T>()) return result; // result is infinite // Both experimentally, and based on https://www.wolframalpha.com/input?i=BesselI%5Bv%2C+x%5D%2FBesselI%5Bv%2B2%2C+x%5D // I[v + 1, x] < I[v-1, x], so this can't overflow: T result2 = boost::math::detail::cyl_bessel_i_imp<T>(v + 1, x, pol); return result / 2 + result2 / 2; } template <class T, class Tag, class Policy> inline T bessel_k_derivative_linear(T v, T x, Tag tag, Policy pol) { T result = boost::math::detail::cyl_bessel_k_imp<T>(v - 1, x, tag, pol); if(result >= tools::max_value<T>()) return -result; // result is infinite T result2 = boost::math::detail::cyl_bessel_k_imp<T>(v + 1, x, tag, pol); if(result2 >= tools::max_value<T>() + result) return -boost::math::policies::raise_overflow_error<T>("cyl_bessel_k_prime<%1>", 0, pol); // result is infinite result /= -2; result2 /= -2; return result + result2; } template <class T, class Policy> inline T bessel_k_derivative_linear(T v, T x, const bessel_int_tag& tag, Policy pol) { T result = boost::math::detail::cyl_bessel_k_imp<T>(itrunc(v - 1), x, tag, pol); if (result >= tools::max_value<T>()) return -result; // result is infinite T result2 = boost::math::detail::cyl_bessel_k_imp<T>(itrunc(v + 1), x, tag, pol); if (result2 >= tools::max_value<T>() + result) return -boost::math::policies::raise_overflow_error<T>("cyl_bessel_k_prime<%1>", 0, pol); // result is infinite result /= -2; result2 /= -2; return result + result2; } template <class T, class Policy> inline T bessel_k_derivative_linear(T v, T x, const bessel_maybe_int_tag&, Policy pol) { using std::floor; if (floor(v) == v) return bessel_k_derivative_linear(v, x, bessel_int_tag(), pol); return bessel_k_derivative_linear(v, x, bessel_no_int_tag(), pol); } template <class T, class Tag, class Policy> inline T bessel_y_derivative_linear(T v, T x, Tag tag, Policy pol) { return (boost::math::detail::cyl_neumann_imp<T>(v-1, x, tag, pol) - boost::math::detail::cyl_neumann_imp<T>(v+1, x, tag, pol)) / 2; } template <class T, class Policy> inline T bessel_y_derivative_linear(T v, T x, const bessel_int_tag& tag, Policy pol) { return (boost::math::detail::cyl_neumann_imp<T>(itrunc(v-1), x, tag, pol) - boost::math::detail::cyl_neumann_imp<T>(itrunc(v+1), x, tag, pol)) / 2; } template <class T, class Policy> inline T sph_neumann_derivative_linear(unsigned v, T x, Policy pol) { return (v / x) * boost::math::detail::sph_neumann_imp<T>(v, x, pol) - boost::math::detail::sph_neumann_imp<T>(v+1, x, pol); } }}} // namespaces #endif // BOOST_MATH_SF_DETAIL_BESSEL_DERIVATIVES_LINEAR_HPP
4,225
C++
.h
92
43.423913
152
0.679213
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,193
throw_exception.hpp
supercollider_supercollider/external_libraries/boost/boost/math/tools/throw_exception.hpp
// (C) Copyright Matt Borland 2021. // Use, modification and distribution are subject to 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) #ifndef BOOST_MATH_TOOLS_THROW_EXCEPTION_HPP #define BOOST_MATH_TOOLS_THROW_EXCEPTION_HPP #include <boost/math/tools/is_standalone.hpp> #ifndef BOOST_MATH_STANDALONE #if defined(_MSC_VER) || defined(__GNUC__) # pragma push_macro( "I" ) # undef I #endif #include <boost/throw_exception.hpp> #define BOOST_MATH_THROW_EXCEPTION(expr) boost::throw_exception(expr); #if defined(_MSC_VER) || defined(__GNUC__) # pragma pop_macro( "I" ) #endif #else // Standalone mode - use standard library facilities #ifdef _MSC_VER # ifdef _CPPUNWIND # define BOOST_MATH_THROW_EXCEPTION(expr) throw expr; # else # define BOOST_MATH_THROW_EXCEPTION(expr) # endif #else # ifdef __EXCEPTIONS # define BOOST_MATH_THROW_EXCEPTION(expr) throw expr; # else # define BOOST_MATH_THROW_EXCEPTION(expr) # endif #endif #endif // BOOST_MATH_STANDALONE #endif // BOOST_MATH_TOOLS_THROW_EXCEPTION_HPP
1,122
C++
.h
33
32.69697
70
0.747915
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,320
config.hpp
supercollider_supercollider/external_libraries/boost/boost/math/ccmath/detail/config.hpp
// (C) Copyright John Maddock 2023. // Use, modification and distribution are subject to 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) // // Core configuration for ccmath functions, basically will they work or not? #ifndef BOOST_MATH_CCMATH_DETAIL_CONFIG #define BOOST_MATH_CCMATH_DETAIL_CONFIG #include <cmath> #include <type_traits> #include <limits> #include <boost/math/tools/is_constant_evaluated.hpp> #include <boost/math/tools/is_standalone.hpp> #ifndef BOOST_MATH_STANDALONE #include <boost/config.hpp> #ifdef BOOST_MATH_NO_CXX17_IF_CONSTEXPR # define BOOST_MATH_NO_CCMATH #endif #else // BOOST_MATH_STANDALONE #if defined(_MSC_VER) #if defined(_MSVC_LANG) && (_MSVC_LANG < 201703) # define BOOST_MATH_NO_CCMATH #endif #else // _MSC_VER #if (__cplusplus < 201703) # define BOOST_MATH_NO_CCMATH #endif #endif #endif #ifndef _MSC_VER // // Don't check here for msvc as they didn't get std lib configuration macros at the same time as C++17 <type_traits> // #if (defined(__cpp_lib_bool_constant) && __cpp_lib_bool_constant < 201505L) && !defined(BOOST_MATH_NO_CCMATH) # define BOOST_MATH_NO_CCMATH #endif #endif #endif
1,236
C++
.h
38
31.157895
116
0.755068
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,327
async_result.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/async_result.hpp
// // async_result.hpp // ~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_ASYNC_RESULT_HPP #define BOOST_ASIO_ASYNC_RESULT_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename T> struct is_completion_signature : false_type { }; template <typename R, typename... Args> struct is_completion_signature<R(Args...)> : true_type { }; template <typename R, typename... Args> struct is_completion_signature<R(Args...) &> : true_type { }; template <typename R, typename... Args> struct is_completion_signature<R(Args...) &&> : true_type { }; # if defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE) template <typename R, typename... Args> struct is_completion_signature<R(Args...) noexcept> : true_type { }; template <typename R, typename... Args> struct is_completion_signature<R(Args...) & noexcept> : true_type { }; template <typename R, typename... Args> struct is_completion_signature<R(Args...) && noexcept> : true_type { }; # endif // defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE) template <typename... T> struct are_completion_signatures : false_type { }; template <> struct are_completion_signatures<> : true_type { }; template <typename T0> struct are_completion_signatures<T0> : is_completion_signature<T0> { }; template <typename T0, typename... TN> struct are_completion_signatures<T0, TN...> : integral_constant<bool, ( is_completion_signature<T0>::value && are_completion_signatures<TN...>::value)> { }; } // namespace detail #if defined(BOOST_ASIO_HAS_CONCEPTS) namespace detail { template <typename T, typename... Args> BOOST_ASIO_CONCEPT callable_with = requires(T&& t, Args&&... args) { static_cast<T&&>(t)(static_cast<Args&&>(args)...); }; template <typename T, typename... Signatures> struct is_completion_handler_for : false_type { }; template <typename T, typename R, typename... Args> struct is_completion_handler_for<T, R(Args...)> : integral_constant<bool, (callable_with<decay_t<T>, Args...>)> { }; template <typename T, typename R, typename... Args> struct is_completion_handler_for<T, R(Args...) &> : integral_constant<bool, (callable_with<decay_t<T>&, Args...>)> { }; template <typename T, typename R, typename... Args> struct is_completion_handler_for<T, R(Args...) &&> : integral_constant<bool, (callable_with<decay_t<T>&&, Args...>)> { }; # if defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE) template <typename T, typename R, typename... Args> struct is_completion_handler_for<T, R(Args...) noexcept> : integral_constant<bool, (callable_with<decay_t<T>, Args...>)> { }; template <typename T, typename R, typename... Args> struct is_completion_handler_for<T, R(Args...) & noexcept> : integral_constant<bool, (callable_with<decay_t<T>&, Args...>)> { }; template <typename T, typename R, typename... Args> struct is_completion_handler_for<T, R(Args...) && noexcept> : integral_constant<bool, (callable_with<decay_t<T>&&, Args...>)> { }; # endif // defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE) template <typename T, typename Signature0, typename... SignatureN> struct is_completion_handler_for<T, Signature0, SignatureN...> : integral_constant<bool, ( is_completion_handler_for<T, Signature0>::value && is_completion_handler_for<T, SignatureN...>::value)> { }; } // namespace detail template <typename T> BOOST_ASIO_CONCEPT completion_signature = detail::is_completion_signature<T>::value; #define BOOST_ASIO_COMPLETION_SIGNATURE \ ::boost::asio::completion_signature template <typename T, typename... Signatures> BOOST_ASIO_CONCEPT completion_handler_for = detail::are_completion_signatures<Signatures...>::value && detail::is_completion_handler_for<T, Signatures...>::value; #define BOOST_ASIO_COMPLETION_HANDLER_FOR(sig) \ ::boost::asio::completion_handler_for<sig> #define BOOST_ASIO_COMPLETION_HANDLER_FOR2(sig0, sig1) \ ::boost::asio::completion_handler_for<sig0, sig1> #define BOOST_ASIO_COMPLETION_HANDLER_FOR3(sig0, sig1, sig2) \ ::boost::asio::completion_handler_for<sig0, sig1, sig2> #else // defined(BOOST_ASIO_HAS_CONCEPTS) #define BOOST_ASIO_COMPLETION_SIGNATURE typename #define BOOST_ASIO_COMPLETION_HANDLER_FOR(sig) typename #define BOOST_ASIO_COMPLETION_HANDLER_FOR2(sig0, sig1) typename #define BOOST_ASIO_COMPLETION_HANDLER_FOR3(sig0, sig1, sig2) typename #endif // defined(BOOST_ASIO_HAS_CONCEPTS) namespace detail { template <typename T> struct is_lvalue_completion_signature : false_type { }; template <typename R, typename... Args> struct is_lvalue_completion_signature<R(Args...) &> : true_type { }; # if defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE) template <typename R, typename... Args> struct is_lvalue_completion_signature<R(Args...) & noexcept> : true_type { }; # endif // defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE) template <typename... Signatures> struct are_any_lvalue_completion_signatures : false_type { }; template <typename Sig0> struct are_any_lvalue_completion_signatures<Sig0> : is_lvalue_completion_signature<Sig0> { }; template <typename Sig0, typename... SigN> struct are_any_lvalue_completion_signatures<Sig0, SigN...> : integral_constant<bool, ( is_lvalue_completion_signature<Sig0>::value || are_any_lvalue_completion_signatures<SigN...>::value)> { }; template <typename T> struct is_rvalue_completion_signature : false_type { }; template <typename R, typename... Args> struct is_rvalue_completion_signature<R(Args...) &&> : true_type { }; # if defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE) template <typename R, typename... Args> struct is_rvalue_completion_signature<R(Args...) && noexcept> : true_type { }; # endif // defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE) template <typename... Signatures> struct are_any_rvalue_completion_signatures : false_type { }; template <typename Sig0> struct are_any_rvalue_completion_signatures<Sig0> : is_rvalue_completion_signature<Sig0> { }; template <typename Sig0, typename... SigN> struct are_any_rvalue_completion_signatures<Sig0, SigN...> : integral_constant<bool, ( is_rvalue_completion_signature<Sig0>::value || are_any_rvalue_completion_signatures<SigN...>::value)> { }; template <typename T> struct simple_completion_signature; template <typename R, typename... Args> struct simple_completion_signature<R(Args...)> { typedef R type(Args...); }; template <typename R, typename... Args> struct simple_completion_signature<R(Args...) &> { typedef R type(Args...); }; template <typename R, typename... Args> struct simple_completion_signature<R(Args...) &&> { typedef R type(Args...); }; # if defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE) template <typename R, typename... Args> struct simple_completion_signature<R(Args...) noexcept> { typedef R type(Args...); }; template <typename R, typename... Args> struct simple_completion_signature<R(Args...) & noexcept> { typedef R type(Args...); }; template <typename R, typename... Args> struct simple_completion_signature<R(Args...) && noexcept> { typedef R type(Args...); }; # endif // defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE) template <typename CompletionToken, BOOST_ASIO_COMPLETION_SIGNATURE... Signatures> class completion_handler_async_result { public: typedef CompletionToken completion_handler_type; typedef void return_type; explicit completion_handler_async_result(completion_handler_type&) { } return_type get() { } template <typename Initiation, BOOST_ASIO_COMPLETION_HANDLER_FOR(Signatures...) RawCompletionToken, typename... Args> static return_type initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) { static_cast<Initiation&&>(initiation)( static_cast<RawCompletionToken&&>(token), static_cast<Args&&>(args)...); } private: completion_handler_async_result( const completion_handler_async_result&) = delete; completion_handler_async_result& operator=( const completion_handler_async_result&) = delete; }; } // namespace detail #if defined(GENERATING_DOCUMENTATION) /// An interface for customising the behaviour of an initiating function. /** * The async_result traits class is used for determining: * * @li the concrete completion handler type to be called at the end of the * asynchronous operation; * * @li the initiating function return type; and * * @li how the return value of the initiating function is obtained. * * The trait allows the handler and return types to be determined at the point * where the specific completion handler signature is known. * * This template may be specialised for user-defined completion token types. * The primary template assumes that the CompletionToken is the completion * handler. */ template <typename CompletionToken, BOOST_ASIO_COMPLETION_SIGNATURE... Signatures> class async_result { public: /// The concrete completion handler type for the specific signature. typedef CompletionToken completion_handler_type; /// The return type of the initiating function. typedef void return_type; /// Construct an async result from a given handler. /** * When using a specalised async_result, the constructor has an opportunity * to initialise some state associated with the completion handler, which is * then returned from the initiating function. */ explicit async_result(completion_handler_type& h); /// Obtain the value to be returned from the initiating function. return_type get(); /// Initiate the asynchronous operation that will produce the result, and /// obtain the value to be returned from the initiating function. template <typename Initiation, typename RawCompletionToken, typename... Args> static return_type initiate( Initiation&& initiation, RawCompletionToken&& token, Args&&... args); private: async_result(const async_result&) = delete; async_result& operator=(const async_result&) = delete; }; #else // defined(GENERATING_DOCUMENTATION) template <typename CompletionToken, BOOST_ASIO_COMPLETION_SIGNATURE... Signatures> class async_result : public conditional_t< detail::are_any_lvalue_completion_signatures<Signatures...>::value || !detail::are_any_rvalue_completion_signatures<Signatures...>::value, detail::completion_handler_async_result<CompletionToken, Signatures...>, async_result<CompletionToken, typename detail::simple_completion_signature<Signatures>::type...> > { public: typedef conditional_t< detail::are_any_lvalue_completion_signatures<Signatures...>::value || !detail::are_any_rvalue_completion_signatures<Signatures...>::value, detail::completion_handler_async_result<CompletionToken, Signatures...>, async_result<CompletionToken, typename detail::simple_completion_signature<Signatures>::type...> > base_type; using base_type::base_type; private: async_result(const async_result&) = delete; async_result& operator=(const async_result&) = delete; }; template <BOOST_ASIO_COMPLETION_SIGNATURE... Signatures> class async_result<void, Signatures...> { // Empty. }; #endif // defined(GENERATING_DOCUMENTATION) /// Helper template to deduce the handler type from a CompletionToken, capture /// a local copy of the handler, and then create an async_result for the /// handler. template <typename CompletionToken, BOOST_ASIO_COMPLETION_SIGNATURE... Signatures> struct async_completion { /// The real handler type to be used for the asynchronous operation. typedef typename boost::asio::async_result< decay_t<CompletionToken>, Signatures...>::completion_handler_type completion_handler_type; /// Constructor. /** * The constructor creates the concrete completion handler and makes the link * between the handler and the asynchronous result. */ explicit async_completion(CompletionToken& token) : completion_handler(static_cast<conditional_t< is_same<CompletionToken, completion_handler_type>::value, completion_handler_type&, CompletionToken&&>>(token)), result(completion_handler) { } /// A copy of, or reference to, a real handler object. conditional_t< is_same<CompletionToken, completion_handler_type>::value, completion_handler_type&, completion_handler_type> completion_handler; /// The result of the asynchronous operation's initiating function. async_result<decay_t<CompletionToken>, Signatures...> result; }; namespace detail { struct async_result_memfns_base { void initiate(); }; template <typename T> struct async_result_memfns_derived : T, async_result_memfns_base { }; template <typename T, T> struct async_result_memfns_check { }; template <typename> char (&async_result_initiate_memfn_helper(...))[2]; template <typename T> char async_result_initiate_memfn_helper( async_result_memfns_check< void (async_result_memfns_base::*)(), &async_result_memfns_derived<T>::initiate>*); template <typename CompletionToken, BOOST_ASIO_COMPLETION_SIGNATURE... Signatures> struct async_result_has_initiate_memfn : integral_constant<bool, sizeof(async_result_initiate_memfn_helper< async_result<decay_t<CompletionToken>, Signatures...> >(0)) != 1> { }; } // namespace detail #if defined(GENERATING_DOCUMENTATION) # define BOOST_ASIO_INITFN_RESULT_TYPE(ct, sig) \ void_or_deduced # define BOOST_ASIO_INITFN_RESULT_TYPE2(ct, sig0, sig1) \ void_or_deduced # define BOOST_ASIO_INITFN_RESULT_TYPE3(ct, sig0, sig1, sig2) \ void_or_deduced #else # define BOOST_ASIO_INITFN_RESULT_TYPE(ct, sig) \ typename ::boost::asio::async_result< \ typename ::boost::asio::decay<ct>::type, sig>::return_type # define BOOST_ASIO_INITFN_RESULT_TYPE2(ct, sig0, sig1) \ typename ::boost::asio::async_result< \ typename ::boost::asio::decay<ct>::type, sig0, sig1>::return_type # define BOOST_ASIO_INITFN_RESULT_TYPE3(ct, sig0, sig1, sig2) \ typename ::boost::asio::async_result< \ typename ::boost::asio::decay<ct>::type, sig0, sig1, sig2>::return_type #define BOOST_ASIO_HANDLER_TYPE(ct, sig) \ typename ::boost::asio::async_result< \ typename ::boost::asio::decay<ct>::type, sig>::completion_handler_type #define BOOST_ASIO_HANDLER_TYPE2(ct, sig0, sig1) \ typename ::boost::asio::async_result< \ typename ::boost::asio::decay<ct>::type, \ sig0, sig1>::completion_handler_type #define BOOST_ASIO_HANDLER_TYPE3(ct, sig0, sig1, sig2) \ typename ::boost::asio::async_result< \ typename ::boost::asio::decay<ct>::type, \ sig0, sig1, sig2>::completion_handler_type #endif #if defined(GENERATING_DOCUMENTATION) # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ct, sig) \ auto # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE2(ct, sig0, sig1) \ auto # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE3(ct, sig0, sig1, sig2) \ auto #elif defined(BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION) # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ct, sig) \ auto # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE2(ct, sig0, sig1) \ auto # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE3(ct, sig0, sig1, sig2) \ auto #else # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(ct, sig) \ BOOST_ASIO_INITFN_RESULT_TYPE(ct, sig) # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE2(ct, sig0, sig1) \ BOOST_ASIO_INITFN_RESULT_TYPE2(ct, sig0, sig1) # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE3(ct, sig0, sig1, sig2) \ BOOST_ASIO_INITFN_RESULT_TYPE3(ct, sig0, sig1, sig2) #endif #if defined(GENERATING_DOCUMENTATION) # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ct, sig) \ auto # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX2(ct, sig0, sig1) \ auto # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX3(ct, sig0, sig1, sig2) \ auto # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(expr) #elif defined(BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION) # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ct, sig) \ auto # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX2(ct, sig0, sig1) \ auto # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX3(ct, sig0, sig1, sig2) \ auto # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(expr) #else # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ct, sig) \ auto # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX2(ct, sig0, sig1) \ auto # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX3(ct, sig0, sig1, sig2) \ auto # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(expr) -> decltype expr #endif #if defined(GENERATING_DOCUMENTATION) # define BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(ct, sig, expr) \ void_or_deduced # define BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE2(ct, sig0, sig1, expr) \ void_or_deduced # define BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE3(ct, sig0, sig1, sig2, expr) \ void_or_deduced #else # define BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(ct, sig, expr) \ decltype expr # define BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE2(ct, sig0, sig1, expr) \ decltype expr # define BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE3(ct, sig0, sig1, sig2, expr) \ decltype expr #endif #if defined(GENERATING_DOCUMENTATION) template <typename CompletionToken, completion_signature... Signatures, typename Initiation, typename... Args> void_or_deduced async_initiate( Initiation&& initiation, type_identity_t<CompletionToken>& token, Args&&... args); #else // defined(GENERATING_DOCUMENTATION) template <typename CompletionToken, BOOST_ASIO_COMPLETION_SIGNATURE... Signatures, typename Initiation, typename... Args> inline auto async_initiate(Initiation&& initiation, type_identity_t<CompletionToken>& token, Args&&... args) -> decltype(enable_if_t< enable_if_t< detail::are_completion_signatures<Signatures...>::value, detail::async_result_has_initiate_memfn< CompletionToken, Signatures...>>::value, async_result<decay_t<CompletionToken>, Signatures...>>::initiate( static_cast<Initiation&&>(initiation), static_cast<CompletionToken&&>(token), static_cast<Args&&>(args)...)) { return async_result<decay_t<CompletionToken>, Signatures...>::initiate( static_cast<Initiation&&>(initiation), static_cast<CompletionToken&&>(token), static_cast<Args&&>(args)...); } template < BOOST_ASIO_COMPLETION_SIGNATURE... Signatures, typename CompletionToken, typename Initiation, typename... Args> inline auto async_initiate(Initiation&& initiation, CompletionToken&& token, Args&&... args) -> decltype(enable_if_t< enable_if_t< detail::are_completion_signatures<Signatures...>::value, detail::async_result_has_initiate_memfn< CompletionToken, Signatures...>>::value, async_result<decay_t<CompletionToken>, Signatures...>>::initiate( static_cast<Initiation&&>(initiation), static_cast<CompletionToken&&>(token), static_cast<Args&&>(args)...)) { return async_result<decay_t<CompletionToken>, Signatures...>::initiate( static_cast<Initiation&&>(initiation), static_cast<CompletionToken&&>(token), static_cast<Args&&>(args)...); } template <typename CompletionToken, BOOST_ASIO_COMPLETION_SIGNATURE... Signatures, typename Initiation, typename... Args> inline typename enable_if_t< !enable_if_t< detail::are_completion_signatures<Signatures...>::value, detail::async_result_has_initiate_memfn< CompletionToken, Signatures...>>::value, async_result<decay_t<CompletionToken>, Signatures...> >::return_type async_initiate(Initiation&& initiation, type_identity_t<CompletionToken>& token, Args&&... args) { async_completion<CompletionToken, Signatures...> completion(token); static_cast<Initiation&&>(initiation)( static_cast< typename async_result<decay_t<CompletionToken>, Signatures...>::completion_handler_type&&>( completion.completion_handler), static_cast<Args&&>(args)...); return completion.result.get(); } template <BOOST_ASIO_COMPLETION_SIGNATURE... Signatures, typename CompletionToken, typename Initiation, typename... Args> inline typename enable_if_t< !enable_if_t< detail::are_completion_signatures<Signatures...>::value, detail::async_result_has_initiate_memfn< CompletionToken, Signatures...>>::value, async_result<decay_t<CompletionToken>, Signatures...> >::return_type async_initiate(Initiation&& initiation, CompletionToken&& token, Args&&... args) { async_completion<CompletionToken, Signatures...> completion(token); static_cast<Initiation&&>(initiation)( static_cast< typename async_result<decay_t<CompletionToken>, Signatures...>::completion_handler_type&&>( completion.completion_handler), static_cast<Args&&>(args)...); return completion.result.get(); } #endif // defined(GENERATING_DOCUMENTATION) #if defined(BOOST_ASIO_HAS_CONCEPTS) namespace detail { template <typename... Signatures> struct initiation_archetype { template <completion_handler_for<Signatures...> CompletionHandler> void operator()(CompletionHandler&&) const { } }; } // namespace detail template <typename T, typename... Signatures> BOOST_ASIO_CONCEPT completion_token_for = detail::are_completion_signatures<Signatures...>::value && requires(T&& t) { async_initiate<T, Signatures...>( detail::initiation_archetype<Signatures...>{}, t); }; #define BOOST_ASIO_COMPLETION_TOKEN_FOR(sig) \ ::boost::asio::completion_token_for<sig> #define BOOST_ASIO_COMPLETION_TOKEN_FOR2(sig0, sig1) \ ::boost::asio::completion_token_for<sig0, sig1> #define BOOST_ASIO_COMPLETION_TOKEN_FOR3(sig0, sig1, sig2) \ ::boost::asio::completion_token_for<sig0, sig1, sig2> #else // defined(BOOST_ASIO_HAS_CONCEPTS) #define BOOST_ASIO_COMPLETION_TOKEN_FOR(sig) typename #define BOOST_ASIO_COMPLETION_TOKEN_FOR2(sig0, sig1) typename #define BOOST_ASIO_COMPLETION_TOKEN_FOR3(sig0, sig1, sig2) typename #endif // defined(BOOST_ASIO_HAS_CONCEPTS) namespace detail { struct async_operation_probe {}; struct async_operation_probe_result {}; template <typename Call, typename = void> struct is_async_operation_call : false_type { }; template <typename Call> struct is_async_operation_call<Call, void_t< enable_if_t< is_same< result_of_t<Call>, async_operation_probe_result >::value > > > : true_type { }; } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <typename... Signatures> class async_result<detail::async_operation_probe, Signatures...> { public: typedef detail::async_operation_probe_result return_type; template <typename Initiation, typename... InitArgs> static return_type initiate(Initiation&&, detail::async_operation_probe, InitArgs&&...) { return return_type(); } }; #endif // !defined(GENERATING_DOCUMENTATION) #if defined(GENERATING_DOCUMENTATION) /// The is_async_operation trait detects whether a type @c T and arguments /// @c Args... may be used to initiate an asynchronous operation. /** * Class template @c is_async_operation is a trait is derived from @c true_type * if the expression <tt>T(Args..., token)</tt> initiates an asynchronous * operation, where @c token is an unspecified completion token type. Otherwise, * @c is_async_operation is derived from @c false_type. */ template <typename T, typename... Args> struct is_async_operation : integral_constant<bool, automatically_determined> { }; #else // defined(GENERATING_DOCUMENTATION) template <typename T, typename... Args> struct is_async_operation : detail::is_async_operation_call< T(Args..., detail::async_operation_probe)> { }; #endif // defined(GENERATING_DOCUMENTATION) #if defined(BOOST_ASIO_HAS_CONCEPTS) template <typename T, typename... Args> BOOST_ASIO_CONCEPT async_operation = is_async_operation<T, Args...>::value; #define BOOST_ASIO_ASYNC_OPERATION(t) \ ::boost::asio::async_operation<t> #define BOOST_ASIO_ASYNC_OPERATION1(t, a0) \ ::boost::asio::async_operation<t, a0> #define BOOST_ASIO_ASYNC_OPERATION2(t, a0, a1) \ ::boost::asio::async_operation<t, a0, a1> #define BOOST_ASIO_ASYNC_OPERATION3(t, a0, a1, a2) \ ::boost::asio::async_operation<t, a0, a1, a2> #else // defined(BOOST_ASIO_HAS_CONCEPTS) #define BOOST_ASIO_ASYNC_OPERATION(t) typename #define BOOST_ASIO_ASYNC_OPERATION1(t, a0) typename #define BOOST_ASIO_ASYNC_OPERATION2(t, a0, a1) typename #define BOOST_ASIO_ASYNC_OPERATION3(t, a0, a1, a2) typename #endif // defined(BOOST_ASIO_HAS_CONCEPTS) namespace detail { struct completion_signature_probe {}; template <typename... T> struct completion_signature_probe_result { template <template <typename...> class Op> struct apply { typedef Op<T...> type; }; }; template <typename T> struct completion_signature_probe_result<T> { typedef T type; template <template <typename...> class Op> struct apply { typedef Op<T> type; }; }; template <> struct completion_signature_probe_result<void> { template <template <typename...> class Op> struct apply { typedef Op<> type; }; }; } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <typename... Signatures> class async_result<detail::completion_signature_probe, Signatures...> { public: typedef detail::completion_signature_probe_result<Signatures...> return_type; template <typename Initiation, typename... InitArgs> static return_type initiate(Initiation&&, detail::completion_signature_probe, InitArgs&&...) { return return_type(); } }; template <typename Signature> class async_result<detail::completion_signature_probe, Signature> { public: typedef detail::completion_signature_probe_result<Signature> return_type; template <typename Initiation, typename... InitArgs> static return_type initiate(Initiation&&, detail::completion_signature_probe, InitArgs&&...) { return return_type(); } }; #endif // !defined(GENERATING_DOCUMENTATION) #if defined(GENERATING_DOCUMENTATION) /// The completion_signature_of trait determines the completion signature /// of an asynchronous operation. /** * Class template @c completion_signature_of is a trait with a member type * alias @c type that denotes the completion signature of the asynchronous * operation initiated by the expression <tt>T(Args..., token)</tt> operation, * where @c token is an unspecified completion token type. If the asynchronous * operation does not have exactly one completion signature, the instantion of * the trait is well-formed but the member type alias @c type is omitted. If * the expression <tt>T(Args..., token)</tt> is not an asynchronous operation * then use of the trait is ill-formed. */ template <typename T, typename... Args> struct completion_signature_of { typedef automatically_determined type; }; #else // defined(GENERATING_DOCUMENTATION) template <typename T, typename... Args> struct completion_signature_of : result_of_t<T(Args..., detail::completion_signature_probe)> { }; #endif // defined(GENERATING_DOCUMENTATION) template <typename T, typename... Args> using completion_signature_of_t = typename completion_signature_of<T, Args...>::type; } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/default_completion_token.hpp> #endif // BOOST_ASIO_ASYNC_RESULT_HPP
27,759
C++
.h
785
32.670064
80
0.738185
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,329
basic_socket_iostream.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/basic_socket_iostream.hpp
// // basic_socket_iostream.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_BASIC_SOCKET_IOSTREAM_HPP #define BOOST_ASIO_BASIC_SOCKET_IOSTREAM_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #if !defined(BOOST_ASIO_NO_IOSTREAM) #include <istream> #include <ostream> #include <boost/asio/basic_socket_streambuf.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { // A separate base class is used to ensure that the streambuf is initialised // prior to the basic_socket_iostream's basic_iostream base class. template <typename Protocol, typename Clock, typename WaitTraits> class socket_iostream_base { protected: socket_iostream_base() { } socket_iostream_base(socket_iostream_base&& other) : streambuf_(std::move(other.streambuf_)) { } socket_iostream_base(basic_stream_socket<Protocol> s) : streambuf_(std::move(s)) { } socket_iostream_base& operator=(socket_iostream_base&& other) { streambuf_ = std::move(other.streambuf_); return *this; } basic_socket_streambuf<Protocol, Clock, WaitTraits> streambuf_; }; } // namespace detail #if !defined(BOOST_ASIO_BASIC_SOCKET_IOSTREAM_FWD_DECL) #define BOOST_ASIO_BASIC_SOCKET_IOSTREAM_FWD_DECL // Forward declaration with defaulted arguments. template <typename Protocol, #if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) typename Clock = boost::posix_time::ptime, typename WaitTraits = time_traits<Clock>> #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) typename Clock = chrono::steady_clock, typename WaitTraits = wait_traits<Clock>> #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) class basic_socket_iostream; #endif // !defined(BOOST_ASIO_BASIC_SOCKET_IOSTREAM_FWD_DECL) /// Iostream interface for a socket. #if defined(GENERATING_DOCUMENTATION) template <typename Protocol, typename Clock = chrono::steady_clock, typename WaitTraits = wait_traits<Clock>> #else // defined(GENERATING_DOCUMENTATION) template <typename Protocol, typename Clock, typename WaitTraits> #endif // defined(GENERATING_DOCUMENTATION) class basic_socket_iostream : private detail::socket_iostream_base<Protocol, Clock, WaitTraits>, public std::basic_iostream<char> { private: // These typedefs are intended keep this class's implementation independent // of whether it's using Boost.DateClock, Boost.Chrono or std::chrono. #if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) \ && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) typedef WaitTraits traits_helper; #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) typedef detail::chrono_time_traits<Clock, WaitTraits> traits_helper; #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) public: /// The protocol type. typedef Protocol protocol_type; /// The endpoint type. typedef typename Protocol::endpoint endpoint_type; /// The clock type. typedef Clock clock_type; #if defined(GENERATING_DOCUMENTATION) /// (Deprecated: Use time_point.) The time type. typedef typename WaitTraits::time_type time_type; /// The time type. typedef typename WaitTraits::time_point time_point; /// (Deprecated: Use duration.) The duration type. typedef typename WaitTraits::duration_type duration_type; /// The duration type. typedef typename WaitTraits::duration duration; #else # if !defined(BOOST_ASIO_NO_DEPRECATED) typedef typename traits_helper::time_type time_type; typedef typename traits_helper::duration_type duration_type; # endif // !defined(BOOST_ASIO_NO_DEPRECATED) typedef typename traits_helper::time_type time_point; typedef typename traits_helper::duration_type duration; #endif /// Construct a basic_socket_iostream without establishing a connection. basic_socket_iostream() : std::basic_iostream<char>( &this->detail::socket_iostream_base< Protocol, Clock, WaitTraits>::streambuf_) { this->setf(std::ios_base::unitbuf); } /// Construct a basic_socket_iostream from the supplied socket. explicit basic_socket_iostream(basic_stream_socket<protocol_type> s) : detail::socket_iostream_base< Protocol, Clock, WaitTraits>(std::move(s)), std::basic_iostream<char>( &this->detail::socket_iostream_base< Protocol, Clock, WaitTraits>::streambuf_) { this->setf(std::ios_base::unitbuf); } /// Move-construct a basic_socket_iostream from another. basic_socket_iostream(basic_socket_iostream&& other) : detail::socket_iostream_base< Protocol, Clock, WaitTraits>(std::move(other)), std::basic_iostream<char>(std::move(other)) { this->set_rdbuf(&this->detail::socket_iostream_base< Protocol, Clock, WaitTraits>::streambuf_); } /// Move-assign a basic_socket_iostream from another. basic_socket_iostream& operator=(basic_socket_iostream&& other) { std::basic_iostream<char>::operator=(std::move(other)); detail::socket_iostream_base< Protocol, Clock, WaitTraits>::operator=(std::move(other)); return *this; } /// Establish a connection to an endpoint corresponding to a resolver query. /** * This constructor automatically establishes a connection based on the * supplied resolver query parameters. The arguments are used to construct * a resolver query object. */ template <typename... T> explicit basic_socket_iostream(T... x) : std::basic_iostream<char>( &this->detail::socket_iostream_base< Protocol, Clock, WaitTraits>::streambuf_) { this->setf(std::ios_base::unitbuf); if (rdbuf()->connect(x...) == 0) this->setstate(std::ios_base::failbit); } /// Establish a connection to an endpoint corresponding to a resolver query. /** * This function automatically establishes a connection based on the supplied * resolver query parameters. The arguments are used to construct a resolver * query object. */ template <typename... T> void connect(T... x) { if (rdbuf()->connect(x...) == 0) this->setstate(std::ios_base::failbit); } /// Close the connection. void close() { if (rdbuf()->close() == 0) this->setstate(std::ios_base::failbit); } /// Return a pointer to the underlying streambuf. basic_socket_streambuf<Protocol, Clock, WaitTraits>* rdbuf() const { return const_cast<basic_socket_streambuf<Protocol, Clock, WaitTraits>*>( &this->detail::socket_iostream_base< Protocol, Clock, WaitTraits>::streambuf_); } /// Get a reference to the underlying socket. basic_socket<Protocol>& socket() { return rdbuf()->socket(); } /// Get the last error associated with the stream. /** * @return An \c error_code corresponding to the last error from the stream. * * @par Example * To print the error associated with a failure to establish a connection: * @code tcp::iostream s("www.boost.org", "http"); * if (!s) * { * std::cout << "Error: " << s.error().message() << std::endl; * } @endcode */ const boost::system::error_code& error() const { return rdbuf()->error(); } #if !defined(BOOST_ASIO_NO_DEPRECATED) /// (Deprecated: Use expiry().) Get the stream's expiry time as an absolute /// time. /** * @return An absolute time value representing the stream's expiry time. */ time_point expires_at() const { return rdbuf()->expires_at(); } #endif // !defined(BOOST_ASIO_NO_DEPRECATED) /// Get the stream's expiry time as an absolute time. /** * @return An absolute time value representing the stream's expiry time. */ time_point expiry() const { return rdbuf()->expiry(); } /// Set the stream's expiry time as an absolute time. /** * This function sets the expiry time associated with the stream. Stream * operations performed after this time (where the operations cannot be * completed using the internal buffers) will fail with the error * boost::asio::error::operation_aborted. * * @param expiry_time The expiry time to be used for the stream. */ void expires_at(const time_point& expiry_time) { rdbuf()->expires_at(expiry_time); } /// Set the stream's expiry time relative to now. /** * This function sets the expiry time associated with the stream. Stream * operations performed after this time (where the operations cannot be * completed using the internal buffers) will fail with the error * boost::asio::error::operation_aborted. * * @param expiry_time The expiry time to be used for the timer. */ void expires_after(const duration& expiry_time) { rdbuf()->expires_after(expiry_time); } #if !defined(BOOST_ASIO_NO_DEPRECATED) /// (Deprecated: Use expiry().) Get the stream's expiry time relative to now. /** * @return A relative time value representing the stream's expiry time. */ duration expires_from_now() const { return rdbuf()->expires_from_now(); } /// (Deprecated: Use expires_after().) Set the stream's expiry time relative /// to now. /** * This function sets the expiry time associated with the stream. Stream * operations performed after this time (where the operations cannot be * completed using the internal buffers) will fail with the error * boost::asio::error::operation_aborted. * * @param expiry_time The expiry time to be used for the timer. */ void expires_from_now(const duration& expiry_time) { rdbuf()->expires_from_now(expiry_time); } #endif // !defined(BOOST_ASIO_NO_DEPRECATED) private: // Disallow copying and assignment. basic_socket_iostream(const basic_socket_iostream&) = delete; basic_socket_iostream& operator=( const basic_socket_iostream&) = delete; }; } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // !defined(BOOST_ASIO_NO_IOSTREAM) #endif // BOOST_ASIO_BASIC_SOCKET_IOSTREAM_HPP
10,567
C++
.h
288
33.190972
79
0.715263
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,334
defer.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/defer.hpp
// // defer.hpp // ~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DEFER_HPP #define BOOST_ASIO_DEFER_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/initiate_defer.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution_context.hpp> #include <boost/asio/execution/blocking.hpp> #include <boost/asio/execution/executor.hpp> #include <boost/asio/is_executor.hpp> #include <boost/asio/require.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// Submits a completion token or function object for execution. /** * This function submits an object for execution using the object's associated * executor. The function object is queued for execution, and is never called * from the current thread prior to returning from <tt>defer()</tt>. * * The use of @c defer(), rather than @ref post(), indicates the caller's * preference that the executor defer the queueing of the function object. This * may allow the executor to optimise queueing for cases when the function * object represents a continuation of the current call context. * * @param token The @ref completion_token that will be used to produce a * completion handler. The function signature of the completion handler must be: * @code void handler(); @endcode * * @returns This function returns <tt>async_initiate<NullaryToken, * void()>(Init{}, token)</tt>, where @c Init is a function object type defined * as: * * @code class Init * { * public: * template <typename CompletionHandler> * void operator()(CompletionHandler&& completion_handler) const; * }; @endcode * * The function call operator of @c Init: * * @li Obtains the handler's associated executor object @c ex of type @c Ex by * performing @code auto ex = get_associated_executor(handler); @endcode * * @li Obtains the handler's associated allocator object @c alloc by performing * @code auto alloc = get_associated_allocator(handler); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is true, performs * @code prefer( * require(ex, execution::blocking.never), * execution::relationship.continuation, * execution::allocator(alloc) * ).execute(std::forward<CompletionHandler>(completion_handler)); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is false, performs * @code ex.defer( * std::forward<CompletionHandler>(completion_handler), * alloc); @endcode * * @par Completion Signature * @code void() @endcode */ template <BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) NullaryToken> auto defer(NullaryToken&& token) -> decltype( async_initiate<NullaryToken, void()>( declval<detail::initiate_defer>(), token)) { return async_initiate<NullaryToken, void()>( detail::initiate_defer(), token); } /// Submits a completion token or function object for execution. /** * This function submits an object for execution using the specified executor. * The function object is queued for execution, and is never called from the * current thread prior to returning from <tt>defer()</tt>. * * The use of @c defer(), rather than @ref post(), indicates the caller's * preference that the executor defer the queueing of the function object. This * may allow the executor to optimise queueing for cases when the function * object represents a continuation of the current call context. * * @param ex The target executor. * * @param token The @ref completion_token that will be used to produce a * completion handler. The function signature of the completion handler must be: * @code void handler(); @endcode * * @returns This function returns <tt>async_initiate<NullaryToken, * void()>(Init{ex}, token)</tt>, where @c Init is a function object type * defined as: * * @code class Init * { * public: * using executor_type = Executor; * explicit Init(const Executor& ex) : ex_(ex) {} * executor_type get_executor() const noexcept { return ex_; } * template <typename CompletionHandler> * void operator()(CompletionHandler&& completion_handler) const; * private: * Executor ex_; // exposition only * }; @endcode * * The function call operator of @c Init: * * @li Obtains the handler's associated executor object @c ex1 of type @c Ex1 by * performing @code auto ex1 = get_associated_executor(handler, ex); @endcode * * @li Obtains the handler's associated allocator object @c alloc by performing * @code auto alloc = get_associated_allocator(handler); @endcode * * @li If <tt>execution::is_executor<Ex1>::value</tt> is true, constructs a * function object @c f with a member @c executor_ that is initialised with * <tt>prefer(ex1, execution::outstanding_work.tracked)</tt>, a member @c * handler_ that is a decay-copy of @c completion_handler, and a function call * operator that performs: * @code auto a = get_associated_allocator(handler_); * prefer(executor_, execution::allocator(a)).execute(std::move(handler_)); * @endcode * * @li If <tt>execution::is_executor<Ex1>::value</tt> is false, constructs a * function object @c f with a member @c work_ that is initialised with * <tt>make_work_guard(ex1)</tt>, a member @c handler_ that is a decay-copy of * @c completion_handler, and a function call operator that performs: * @code auto a = get_associated_allocator(handler_); * work_.get_executor().dispatch(std::move(handler_), a); * work_.reset(); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is true, performs * @code prefer( * require(ex, execution::blocking.never), * execution::relationship.continuation, * execution::allocator(alloc) * ).execute(std::move(f)); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is false, performs * @code ex.defer(std::move(f), alloc); @endcode * * @par Completion Signature * @code void() @endcode */ template <typename Executor, BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) NullaryToken = default_completion_token_t<Executor>> auto defer(const Executor& ex, NullaryToken&& token = default_completion_token_t<Executor>(), constraint_t< (execution::is_executor<Executor>::value && can_require<Executor, execution::blocking_t::never_t>::value) || is_executor<Executor>::value > = 0) -> decltype( async_initiate<NullaryToken, void()>( declval<detail::initiate_defer_with_executor<Executor>>(), token)) { return async_initiate<NullaryToken, void()>( detail::initiate_defer_with_executor<Executor>(ex), token); } /// Submits a completion token or function object for execution. /** * @param ctx An execution context, from which the target executor is obtained. * * @param token The @ref completion_token that will be used to produce a * completion handler. The function signature of the completion handler must be: * @code void handler(); @endcode * * @returns <tt>defer(ctx.get_executor(), forward<NullaryToken>(token))</tt>. * * @par Completion Signature * @code void() @endcode */ template <typename ExecutionContext, BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) NullaryToken = default_completion_token_t<typename ExecutionContext::executor_type>> auto defer(ExecutionContext& ctx, NullaryToken&& token = default_completion_token_t<typename ExecutionContext::executor_type>(), constraint_t< is_convertible<ExecutionContext&, execution_context&>::value > = 0) -> decltype( async_initiate<NullaryToken, void()>( declval<detail::initiate_defer_with_executor< typename ExecutionContext::executor_type>>(), token)) { return async_initiate<NullaryToken, void()>( detail::initiate_defer_with_executor< typename ExecutionContext::executor_type>( ctx.get_executor()), token); } } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DEFER_HPP
8,282
C++
.h
209
37.143541
80
0.724758
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,339
dispatch.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/dispatch.hpp
// // dispatch.hpp // ~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DISPATCH_HPP #define BOOST_ASIO_DISPATCH_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/initiate_dispatch.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution_context.hpp> #include <boost/asio/execution/executor.hpp> #include <boost/asio/is_executor.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// Submits a completion token or function object for execution. /** * This function submits an object for execution using the object's associated * executor. The function object may be called from the current thread prior to * returning from <tt>dispatch()</tt>. Otherwise, it is queued for execution. * * @param token The @ref completion_token that will be used to produce a * completion handler. The function signature of the completion handler must be: * @code void handler(); @endcode * * @returns This function returns <tt>async_initiate<NullaryToken, * void()>(Init{}, token)</tt>, where @c Init is a function object type defined * as: * * @code class Init * { * public: * template <typename CompletionHandler> * void operator()(CompletionHandler&& completion_handler) const; * }; @endcode * * The function call operator of @c Init: * * @li Obtains the handler's associated executor object @c ex of type @c Ex by * performing @code auto ex = get_associated_executor(handler); @endcode * * @li Obtains the handler's associated allocator object @c alloc by performing * @code auto alloc = get_associated_allocator(handler); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is true, performs * @code prefer(ex, execution::allocator(alloc)).execute( * std::forward<CompletionHandler>(completion_handler)); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is false, performs * @code ex.dispatch( * std::forward<CompletionHandler>(completion_handler), * alloc); @endcode * * @par Completion Signature * @code void() @endcode */ template <BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) NullaryToken> inline auto dispatch(NullaryToken&& token) -> decltype( async_initiate<NullaryToken, void()>( declval<detail::initiate_dispatch>(), token)) { return async_initiate<NullaryToken, void()>( detail::initiate_dispatch(), token); } /// Submits a completion token or function object for execution. /** * This function submits an object for execution using the specified executor. * The function object may be called from the current thread prior to returning * from <tt>dispatch()</tt>. Otherwise, it is queued for execution. * * @param ex The target executor. * * @param token The @ref completion_token that will be used to produce a * completion handler. The function signature of the completion handler must be: * @code void handler(); @endcode * * @returns This function returns <tt>async_initiate<NullaryToken, * void()>(Init{ex}, token)</tt>, where @c Init is a function object type * defined as: * * @code class Init * { * public: * using executor_type = Executor; * explicit Init(const Executor& ex) : ex_(ex) {} * executor_type get_executor() const noexcept { return ex_; } * template <typename CompletionHandler> * void operator()(CompletionHandler&& completion_handler) const; * private: * Executor ex_; // exposition only * }; @endcode * * The function call operator of @c Init: * * @li Obtains the handler's associated executor object @c ex1 of type @c Ex1 by * performing @code auto ex1 = get_associated_executor(handler, ex); @endcode * * @li Obtains the handler's associated allocator object @c alloc by performing * @code auto alloc = get_associated_allocator(handler); @endcode * * @li If <tt>execution::is_executor<Ex1>::value</tt> is true, constructs a * function object @c f with a member @c executor_ that is initialised with * <tt>prefer(ex1, execution::outstanding_work.tracked)</tt>, a member @c * handler_ that is a decay-copy of @c completion_handler, and a function call * operator that performs: * @code auto a = get_associated_allocator(handler_); * prefer(executor_, execution::allocator(a)).execute(std::move(handler_)); * @endcode * * @li If <tt>execution::is_executor<Ex1>::value</tt> is false, constructs a * function object @c f with a member @c work_ that is initialised with * <tt>make_work_guard(ex1)</tt>, a member @c handler_ that is a decay-copy of * @c completion_handler, and a function call operator that performs: * @code auto a = get_associated_allocator(handler_); * work_.get_executor().dispatch(std::move(handler_), a); * work_.reset(); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is true, performs * @code prefer(ex, execution::allocator(alloc)).execute(std::move(f)); @endcode * * @li If <tt>execution::is_executor<Ex>::value</tt> is false, performs * @code ex.dispatch(std::move(f), alloc); @endcode * * @par Completion Signature * @code void() @endcode */ template <typename Executor, BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) NullaryToken = default_completion_token_t<Executor>> inline auto dispatch(const Executor& ex, NullaryToken&& token = default_completion_token_t<Executor>(), constraint_t< execution::is_executor<Executor>::value || is_executor<Executor>::value > = 0) -> decltype( async_initiate<NullaryToken, void()>( declval<detail::initiate_dispatch_with_executor<Executor>>(), token)) { return async_initiate<NullaryToken, void()>( detail::initiate_dispatch_with_executor<Executor>(ex), token); } /// Submits a completion token or function object for execution. /** * @param ctx An execution context, from which the target executor is obtained. * * @param token The @ref completion_token that will be used to produce a * completion handler. The function signature of the completion handler must be: * @code void handler(); @endcode * * @returns <tt>dispatch(ctx.get_executor(), * forward<NullaryToken>(token))</tt>. * * @par Completion Signature * @code void() @endcode */ template <typename ExecutionContext, BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) NullaryToken = default_completion_token_t<typename ExecutionContext::executor_type>> inline auto dispatch(ExecutionContext& ctx, NullaryToken&& token = default_completion_token_t< typename ExecutionContext::executor_type>(), constraint_t< is_convertible<ExecutionContext&, execution_context&>::value > = 0) -> decltype( async_initiate<NullaryToken, void()>( declval<detail::initiate_dispatch_with_executor< typename ExecutionContext::executor_type>>(), token)) { return async_initiate<NullaryToken, void()>( detail::initiate_dispatch_with_executor< typename ExecutionContext::executor_type>( ctx.get_executor()), token); } } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DISPATCH_HPP
7,424
C++
.h
188
37.053191
80
0.725952
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,342
composed.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/composed.hpp
// // composed.hpp // ~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_COMPOSED_HPP #define BOOST_ASIO_COMPOSED_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associated_executor.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/base_from_cancellation_state.hpp> #include <boost/asio/detail/composed_work.hpp> #include <boost/asio/detail/handler_cont_helpers.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename Impl, typename Work, typename Handler, typename... Signatures> class composed_op; template <typename Impl, typename Work, typename Handler> class composed_op<Impl, Work, Handler> : public base_from_cancellation_state<Handler> { public: template <typename I, typename W, typename H> composed_op(I&& impl, W&& work, H&& handler) : base_from_cancellation_state<Handler>( handler, enable_terminal_cancellation()), impl_(static_cast<I&&>(impl)), work_(static_cast<W&&>(work)), handler_(static_cast<H&&>(handler)), invocations_(0) { } composed_op(composed_op&& other) : base_from_cancellation_state<Handler>( static_cast<base_from_cancellation_state<Handler>&&>(other)), impl_(static_cast<Impl&&>(other.impl_)), work_(static_cast<Work&&>(other.work_)), handler_(static_cast<Handler&&>(other.handler_)), invocations_(other.invocations_) { } typedef typename composed_work_guard< typename Work::head_type>::executor_type io_executor_type; io_executor_type get_io_executor() const noexcept { return work_.head_.get_executor(); } typedef associated_executor_t<Handler, io_executor_type> executor_type; executor_type get_executor() const noexcept { return (get_associated_executor)(handler_, work_.head_.get_executor()); } typedef associated_allocator_t<Handler, std::allocator<void>> allocator_type; allocator_type get_allocator() const noexcept { return (get_associated_allocator)(handler_, std::allocator<void>()); } template <typename... T> void operator()(T&&... t) { if (invocations_ < ~0u) ++invocations_; this->get_cancellation_state().slot().clear(); impl_(*this, static_cast<T&&>(t)...); } template <typename... Args> auto complete(Args&&... args) -> decltype(declval<Handler>()(static_cast<Args&&>(args)...)) { return static_cast<Handler&&>(this->handler_)(static_cast<Args&&>(args)...); } void reset_cancellation_state() { base_from_cancellation_state<Handler>::reset_cancellation_state(handler_); } template <typename Filter> void reset_cancellation_state(Filter&& filter) { base_from_cancellation_state<Handler>::reset_cancellation_state(handler_, static_cast<Filter&&>(filter)); } template <typename InFilter, typename OutFilter> void reset_cancellation_state(InFilter&& in_filter, OutFilter&& out_filter) { base_from_cancellation_state<Handler>::reset_cancellation_state(handler_, static_cast<InFilter&&>(in_filter), static_cast<OutFilter&&>(out_filter)); } cancellation_type_t cancelled() const noexcept { return base_from_cancellation_state<Handler>::cancelled(); } //private: Impl impl_; Work work_; Handler handler_; unsigned invocations_; }; template <typename Impl, typename Work, typename Handler, typename R, typename... Args> class composed_op<Impl, Work, Handler, R(Args...)> : public composed_op<Impl, Work, Handler> { public: using composed_op<Impl, Work, Handler>::composed_op; template <typename... T> void operator()(T&&... t) { if (this->invocations_ < ~0u) ++this->invocations_; this->get_cancellation_state().slot().clear(); this->impl_(*this, static_cast<T&&>(t)...); } void complete(Args... args) { this->work_.reset(); static_cast<Handler&&>(this->handler_)(static_cast<Args&&>(args)...); } }; template <typename Impl, typename Work, typename Handler, typename R, typename... Args, typename... Signatures> class composed_op<Impl, Work, Handler, R(Args...), Signatures...> : public composed_op<Impl, Work, Handler, Signatures...> { public: using composed_op<Impl, Work, Handler, Signatures...>::composed_op; template <typename... T> void operator()(T&&... t) { if (this->invocations_ < ~0u) ++this->invocations_; this->get_cancellation_state().slot().clear(); this->impl_(*this, static_cast<T&&>(t)...); } using composed_op<Impl, Work, Handler, Signatures...>::complete; void complete(Args... args) { this->work_.reset(); static_cast<Handler&&>(this->handler_)(static_cast<Args&&>(args)...); } }; template <typename Impl, typename Work, typename Handler, typename Signature> inline bool asio_handler_is_continuation( composed_op<Impl, Work, Handler, Signature>* this_handler) { return this_handler->invocations_ > 1 ? true : boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename Implementation, typename Executors, typename... Signatures> class initiate_composed { public: typedef typename composed_io_executors<Executors>::head_type executor_type; template <typename I> initiate_composed(I&& impl, composed_io_executors<Executors>&& executors) : implementation_(std::forward<I>(impl)), executors_(std::move(executors)) { } executor_type get_executor() const noexcept { return executors_.head_; } template <typename Handler, typename... Args> void operator()(Handler&& handler, Args&&... args) const & { composed_op<decay_t<Implementation>, composed_work<Executors>, decay_t<Handler>, Signatures...>(implementation_, composed_work<Executors>(executors_), static_cast<Handler&&>(handler))(static_cast<Args&&>(args)...); } template <typename Handler, typename... Args> void operator()(Handler&& handler, Args&&... args) && { composed_op<decay_t<Implementation>, composed_work<Executors>, decay_t<Handler>, Signatures...>( static_cast<Implementation&&>(implementation_), composed_work<Executors>(executors_), static_cast<Handler&&>(handler))(static_cast<Args&&>(args)...); } private: Implementation implementation_; composed_io_executors<Executors> executors_; }; template <typename Implementation, typename... Signatures> class initiate_composed<Implementation, void(), Signatures...> { public: template <typename I> initiate_composed(I&& impl, composed_io_executors<void()>&&) : implementation_(std::forward<I>(impl)) { } template <typename Handler, typename... Args> void operator()(Handler&& handler, Args&&... args) const & { composed_op<decay_t<Implementation>, composed_work<void()>, decay_t<Handler>, Signatures...>(implementation_, composed_work<void()>(composed_io_executors<void()>()), static_cast<Handler&&>(handler))(static_cast<Args&&>(args)...); } template <typename Handler, typename... Args> void operator()(Handler&& handler, Args&&... args) && { composed_op<decay_t<Implementation>, composed_work<void()>, decay_t<Handler>, Signatures...>( static_cast<Implementation&&>(implementation_), composed_work<void()>(composed_io_executors<void()>()), static_cast<Handler&&>(handler))(static_cast<Args&&>(args)...); } private: Implementation implementation_; }; template <typename... Signatures, typename Implementation, typename Executors> inline initiate_composed<Implementation, Executors, Signatures...> make_initiate_composed(Implementation&& implementation, composed_io_executors<Executors>&& executors) { return initiate_composed<decay_t<Implementation>, Executors, Signatures...>( static_cast<Implementation&&>(implementation), static_cast<composed_io_executors<Executors>&&>(executors)); } } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <template <typename, typename> class Associator, typename Impl, typename Work, typename Handler, typename Signature, typename DefaultCandidate> struct associator<Associator, detail::composed_op<Impl, Work, Handler, Signature>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { static typename Associator<Handler, DefaultCandidate>::type get( const detail::composed_op<Impl, Work, Handler, Signature>& h) noexcept { return Associator<Handler, DefaultCandidate>::get(h.handler_); } static auto get(const detail::composed_op<Impl, Work, Handler, Signature>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<Handler, DefaultCandidate>::get(h.handler_, c)) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } }; #endif // !defined(GENERATING_DOCUMENTATION) /// Creates an initiation function object that may be used to launch an /// asynchronous operation with a stateful implementation. /** * The @c composed function simplifies the implementation of composed * asynchronous operations automatically by wrapping a stateful function object * for use as an initiation function object. * * @param implementation A function object that contains the implementation of * the composed asynchronous operation. The first argument to the function * object is a non-const reference to the enclosing intermediate completion * handler. The remaining arguments are any arguments that originate from the * completion handlers of any asynchronous operations performed by the * implementation. * * @param io_objects_or_executors Zero or more I/O objects or I/O executors for * which outstanding work must be maintained. * * @par Per-Operation Cancellation * By default, terminal per-operation cancellation is enabled for composed * operations that are implemented using @c composed. To disable cancellation * for the composed operation, or to alter its supported cancellation types, * call the @c self object's @c reset_cancellation_state function. * * @par Example: * * @code struct async_echo_implementation * { * tcp::socket& socket_; * boost::asio::mutable_buffer buffer_; * enum { starting, reading, writing } state_; * * template <typename Self> * void operator()(Self& self, * boost::system::error_code error, * std::size_t n) * { * switch (state_) * { * case starting: * state_ = reading; * socket_.async_read_some( * buffer_, std::move(self)); * break; * case reading: * if (error) * { * self.complete(error, 0); * } * else * { * state_ = writing; * boost::asio::async_write(socket_, buffer_, * boost::asio::transfer_exactly(n), * std::move(self)); * } * break; * case writing: * self.complete(error, n); * break; * } * } * }; * * template <typename CompletionToken> * auto async_echo(tcp::socket& socket, * boost::asio::mutable_buffer buffer, * CompletionToken&& token) * -> decltype( * boost::asio::async_initiate<CompletionToken, * void(boost::system::error_code, std::size_t)>( * boost::asio::composed( * async_echo_implementation{socket, buffer, * async_echo_implementation::starting}, socket), * token)) * { * return boost::asio::async_initiate<CompletionToken, * void(boost::system::error_code, std::size_t)>( * boost::asio::composed( * async_echo_implementation{socket, buffer, * async_echo_implementation::starting}, socket), * token, boost::system::error_code{}, 0); * } @endcode */ template <BOOST_ASIO_COMPLETION_SIGNATURE... Signatures, typename Implementation, typename... IoObjectsOrExecutors> inline auto composed(Implementation&& implementation, IoObjectsOrExecutors&&... io_objects_or_executors) -> decltype( detail::make_initiate_composed<Signatures...>( static_cast<Implementation&&>(implementation), detail::make_composed_io_executors( detail::get_composed_io_executor( static_cast<IoObjectsOrExecutors&&>( io_objects_or_executors))...))) { return detail::make_initiate_composed<Signatures...>( static_cast<Implementation&&>(implementation), detail::make_composed_io_executors( detail::get_composed_io_executor( static_cast<IoObjectsOrExecutors&&>( io_objects_or_executors))...)); } } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_COMPOSE_HPP
13,055
C++
.h
366
32.251366
80
0.693513
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,344
read.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/read.hpp
// // read.hpp // ~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_READ_HPP #define BOOST_ASIO_READ_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <cstddef> #include <boost/asio/async_result.hpp> #include <boost/asio/buffer.hpp> #include <boost/asio/completion_condition.hpp> #include <boost/asio/error.hpp> #if !defined(BOOST_ASIO_NO_EXTENSIONS) # include <boost/asio/basic_streambuf_fwd.hpp> #endif // !defined(BOOST_ASIO_NO_EXTENSIONS) #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename> class initiate_async_read; #if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) template <typename> class initiate_async_read_dynbuf_v1; #endif // !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) template <typename> class initiate_async_read_dynbuf_v2; } // namespace detail /** * @defgroup read boost::asio::read * * @brief The @c read function is a composed operation that reads a certain * amount of data from a stream before returning. */ /*@{*/ /// Attempt to read a certain amount of data from a stream before returning. /** * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's * read_some function. * * @param s The stream from which the data is to be read. The type must support * the SyncReadStream concept. * * @param buffers One or more buffers into which the data will be read. The sum * of the buffer sizes indicates the maximum number of bytes to read from the * stream. * * @returns The number of bytes transferred. * * @throws boost::system::system_error Thrown on failure. * * @par Example * To read into a single data buffer use the @ref buffer function as follows: * @code boost::asio::read(s, boost::asio::buffer(data, size)); @endcode * See the @ref buffer documentation for information on reading into multiple * buffers in one go, and how to use it with arrays, boost::array or * std::vector. * * @note This overload is equivalent to calling: * @code boost::asio::read( * s, buffers, * boost::asio::transfer_all()); @endcode */ template <typename SyncReadStream, typename MutableBufferSequence> std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, constraint_t< is_mutable_buffer_sequence<MutableBufferSequence>::value > = 0); /// Attempt to read a certain amount of data from a stream before returning. /** * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's * read_some function. * * @param s The stream from which the data is to be read. The type must support * the SyncReadStream concept. * * @param buffers One or more buffers into which the data will be read. The sum * of the buffer sizes indicates the maximum number of bytes to read from the * stream. * * @param ec Set to indicate what error occurred, if any. * * @returns The number of bytes transferred. * * @par Example * To read into a single data buffer use the @ref buffer function as follows: * @code boost::asio::read(s, boost::asio::buffer(data, size), ec); @endcode * See the @ref buffer documentation for information on reading into multiple * buffers in one go, and how to use it with arrays, boost::array or * std::vector. * * @note This overload is equivalent to calling: * @code boost::asio::read( * s, buffers, * boost::asio::transfer_all(), ec); @endcode */ template <typename SyncReadStream, typename MutableBufferSequence> std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, boost::system::error_code& ec, constraint_t< is_mutable_buffer_sequence<MutableBufferSequence>::value > = 0); /// Attempt to read a certain amount of data from a stream before returning. /** * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's * read_some function. * * @param s The stream from which the data is to be read. The type must support * the SyncReadStream concept. * * @param buffers One or more buffers into which the data will be read. The sum * of the buffer sizes indicates the maximum number of bytes to read from the * stream. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest read_some operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the stream's read_some function. * * @returns The number of bytes transferred. * * @throws boost::system::system_error Thrown on failure. * * @par Example * To read into a single data buffer use the @ref buffer function as follows: * @code boost::asio::read(s, boost::asio::buffer(data, size), * boost::asio::transfer_at_least(32)); @endcode * See the @ref buffer documentation for information on reading into multiple * buffers in one go, and how to use it with arrays, boost::array or * std::vector. */ template <typename SyncReadStream, typename MutableBufferSequence, typename CompletionCondition> std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, CompletionCondition completion_condition, constraint_t< is_mutable_buffer_sequence<MutableBufferSequence>::value > = 0, constraint_t< is_completion_condition<CompletionCondition>::value > = 0); /// Attempt to read a certain amount of data from a stream before returning. /** * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's * read_some function. * * @param s The stream from which the data is to be read. The type must support * the SyncReadStream concept. * * @param buffers One or more buffers into which the data will be read. The sum * of the buffer sizes indicates the maximum number of bytes to read from the * stream. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest read_some operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the stream's read_some function. * * @param ec Set to indicate what error occurred, if any. * * @returns The number of bytes read. If an error occurs, returns the total * number of bytes successfully transferred prior to the error. */ template <typename SyncReadStream, typename MutableBufferSequence, typename CompletionCondition> std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, CompletionCondition completion_condition, boost::system::error_code& ec, constraint_t< is_mutable_buffer_sequence<MutableBufferSequence>::value > = 0, constraint_t< is_completion_condition<CompletionCondition>::value > = 0); #if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) /// Attempt to read a certain amount of data from a stream before returning. /** * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * * @li The specified dynamic buffer sequence is full (that is, it has reached * maximum size). * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's * read_some function. * * @param s The stream from which the data is to be read. The type must support * the SyncReadStream concept. * * @param buffers The dynamic buffer sequence into which the data will be read. * * @returns The number of bytes transferred. * * @throws boost::system::system_error Thrown on failure. * * @note This overload is equivalent to calling: * @code boost::asio::read( * s, buffers, * boost::asio::transfer_all()); @endcode */ template <typename SyncReadStream, typename DynamicBuffer_v1> std::size_t read(SyncReadStream& s, DynamicBuffer_v1&& buffers, constraint_t< is_dynamic_buffer_v1<decay_t<DynamicBuffer_v1>>::value > = 0, constraint_t< !is_dynamic_buffer_v2<decay_t<DynamicBuffer_v1>>::value > = 0); /// Attempt to read a certain amount of data from a stream before returning. /** * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * * @li The supplied buffer is full (that is, it has reached maximum size). * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's * read_some function. * * @param s The stream from which the data is to be read. The type must support * the SyncReadStream concept. * * @param buffers The dynamic buffer sequence into which the data will be read. * * @param ec Set to indicate what error occurred, if any. * * @returns The number of bytes transferred. * * @note This overload is equivalent to calling: * @code boost::asio::read( * s, buffers, * boost::asio::transfer_all(), ec); @endcode */ template <typename SyncReadStream, typename DynamicBuffer_v1> std::size_t read(SyncReadStream& s, DynamicBuffer_v1&& buffers, boost::system::error_code& ec, constraint_t< is_dynamic_buffer_v1<decay_t<DynamicBuffer_v1>>::value > = 0, constraint_t< !is_dynamic_buffer_v2<decay_t<DynamicBuffer_v1>>::value > = 0); /// Attempt to read a certain amount of data from a stream before returning. /** * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * * @li The specified dynamic buffer sequence is full (that is, it has reached * maximum size). * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's * read_some function. * * @param s The stream from which the data is to be read. The type must support * the SyncReadStream concept. * * @param buffers The dynamic buffer sequence into which the data will be read. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest read_some operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the stream's read_some function. * * @returns The number of bytes transferred. * * @throws boost::system::system_error Thrown on failure. */ template <typename SyncReadStream, typename DynamicBuffer_v1, typename CompletionCondition> std::size_t read(SyncReadStream& s, DynamicBuffer_v1&& buffers, CompletionCondition completion_condition, constraint_t< is_dynamic_buffer_v1<decay_t<DynamicBuffer_v1>>::value > = 0, constraint_t< !is_dynamic_buffer_v2<decay_t<DynamicBuffer_v1>>::value > = 0, constraint_t< is_completion_condition<CompletionCondition>::value > = 0); /// Attempt to read a certain amount of data from a stream before returning. /** * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * * @li The specified dynamic buffer sequence is full (that is, it has reached * maximum size). * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's * read_some function. * * @param s The stream from which the data is to be read. The type must support * the SyncReadStream concept. * * @param buffers The dynamic buffer sequence into which the data will be read. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest read_some operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the stream's read_some function. * * @param ec Set to indicate what error occurred, if any. * * @returns The number of bytes read. If an error occurs, returns the total * number of bytes successfully transferred prior to the error. */ template <typename SyncReadStream, typename DynamicBuffer_v1, typename CompletionCondition> std::size_t read(SyncReadStream& s, DynamicBuffer_v1&& buffers, CompletionCondition completion_condition, boost::system::error_code& ec, constraint_t< is_dynamic_buffer_v1<decay_t<DynamicBuffer_v1>>::value > = 0, constraint_t< !is_dynamic_buffer_v2<decay_t<DynamicBuffer_v1>>::value > = 0, constraint_t< is_completion_condition<CompletionCondition>::value > = 0); #if !defined(BOOST_ASIO_NO_EXTENSIONS) #if !defined(BOOST_ASIO_NO_IOSTREAM) /// Attempt to read a certain amount of data from a stream before returning. /** * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * * @li The supplied buffer is full (that is, it has reached maximum size). * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's * read_some function. * * @param s The stream from which the data is to be read. The type must support * the SyncReadStream concept. * * @param b The basic_streambuf object into which the data will be read. * * @returns The number of bytes transferred. * * @throws boost::system::system_error Thrown on failure. * * @note This overload is equivalent to calling: * @code boost::asio::read( * s, b, * boost::asio::transfer_all()); @endcode */ template <typename SyncReadStream, typename Allocator> std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b); /// Attempt to read a certain amount of data from a stream before returning. /** * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * * @li The supplied buffer is full (that is, it has reached maximum size). * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's * read_some function. * * @param s The stream from which the data is to be read. The type must support * the SyncReadStream concept. * * @param b The basic_streambuf object into which the data will be read. * * @param ec Set to indicate what error occurred, if any. * * @returns The number of bytes transferred. * * @note This overload is equivalent to calling: * @code boost::asio::read( * s, b, * boost::asio::transfer_all(), ec); @endcode */ template <typename SyncReadStream, typename Allocator> std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b, boost::system::error_code& ec); /// Attempt to read a certain amount of data from a stream before returning. /** * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * * @li The supplied buffer is full (that is, it has reached maximum size). * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's * read_some function. * * @param s The stream from which the data is to be read. The type must support * the SyncReadStream concept. * * @param b The basic_streambuf object into which the data will be read. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest read_some operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the stream's read_some function. * * @returns The number of bytes transferred. * * @throws boost::system::system_error Thrown on failure. */ template <typename SyncReadStream, typename Allocator, typename CompletionCondition> std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b, CompletionCondition completion_condition, constraint_t< is_completion_condition<CompletionCondition>::value > = 0); /// Attempt to read a certain amount of data from a stream before returning. /** * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * * @li The supplied buffer is full (that is, it has reached maximum size). * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's * read_some function. * * @param s The stream from which the data is to be read. The type must support * the SyncReadStream concept. * * @param b The basic_streambuf object into which the data will be read. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest read_some operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the stream's read_some function. * * @param ec Set to indicate what error occurred, if any. * * @returns The number of bytes read. If an error occurs, returns the total * number of bytes successfully transferred prior to the error. */ template <typename SyncReadStream, typename Allocator, typename CompletionCondition> std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b, CompletionCondition completion_condition, boost::system::error_code& ec, constraint_t< is_completion_condition<CompletionCondition>::value > = 0); #endif // !defined(BOOST_ASIO_NO_IOSTREAM) #endif // !defined(BOOST_ASIO_NO_EXTENSIONS) #endif // !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) /// Attempt to read a certain amount of data from a stream before returning. /** * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * * @li The specified dynamic buffer sequence is full (that is, it has reached * maximum size). * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's * read_some function. * * @param s The stream from which the data is to be read. The type must support * the SyncReadStream concept. * * @param buffers The dynamic buffer sequence into which the data will be read. * * @returns The number of bytes transferred. * * @throws boost::system::system_error Thrown on failure. * * @note This overload is equivalent to calling: * @code boost::asio::read( * s, buffers, * boost::asio::transfer_all()); @endcode */ template <typename SyncReadStream, typename DynamicBuffer_v2> std::size_t read(SyncReadStream& s, DynamicBuffer_v2 buffers, constraint_t< is_dynamic_buffer_v2<DynamicBuffer_v2>::value > = 0); /// Attempt to read a certain amount of data from a stream before returning. /** * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * * @li The supplied buffer is full (that is, it has reached maximum size). * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's * read_some function. * * @param s The stream from which the data is to be read. The type must support * the SyncReadStream concept. * * @param buffers The dynamic buffer sequence into which the data will be read. * * @param ec Set to indicate what error occurred, if any. * * @returns The number of bytes transferred. * * @note This overload is equivalent to calling: * @code boost::asio::read( * s, buffers, * boost::asio::transfer_all(), ec); @endcode */ template <typename SyncReadStream, typename DynamicBuffer_v2> std::size_t read(SyncReadStream& s, DynamicBuffer_v2 buffers, boost::system::error_code& ec, constraint_t< is_dynamic_buffer_v2<DynamicBuffer_v2>::value > = 0); /// Attempt to read a certain amount of data from a stream before returning. /** * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * * @li The specified dynamic buffer sequence is full (that is, it has reached * maximum size). * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's * read_some function. * * @param s The stream from which the data is to be read. The type must support * the SyncReadStream concept. * * @param buffers The dynamic buffer sequence into which the data will be read. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest read_some operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the stream's read_some function. * * @returns The number of bytes transferred. * * @throws boost::system::system_error Thrown on failure. */ template <typename SyncReadStream, typename DynamicBuffer_v2, typename CompletionCondition> std::size_t read(SyncReadStream& s, DynamicBuffer_v2 buffers, CompletionCondition completion_condition, constraint_t< is_dynamic_buffer_v2<DynamicBuffer_v2>::value > = 0, constraint_t< is_completion_condition<CompletionCondition>::value > = 0); /// Attempt to read a certain amount of data from a stream before returning. /** * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * * @li The specified dynamic buffer sequence is full (that is, it has reached * maximum size). * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's * read_some function. * * @param s The stream from which the data is to be read. The type must support * the SyncReadStream concept. * * @param buffers The dynamic buffer sequence into which the data will be read. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest read_some operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the stream's read_some function. * * @param ec Set to indicate what error occurred, if any. * * @returns The number of bytes read. If an error occurs, returns the total * number of bytes successfully transferred prior to the error. */ template <typename SyncReadStream, typename DynamicBuffer_v2, typename CompletionCondition> std::size_t read(SyncReadStream& s, DynamicBuffer_v2 buffers, CompletionCondition completion_condition, boost::system::error_code& ec, constraint_t< is_dynamic_buffer_v2<DynamicBuffer_v2>::value > = 0, constraint_t< is_completion_condition<CompletionCondition>::value > = 0); /*@}*/ /** * @defgroup async_read boost::asio::async_read * * @brief The @c async_read function is a composed asynchronous operation that * reads a certain amount of data from a stream before completion. */ /*@{*/ /// Start an asynchronous operation to read a certain amount of data from a /// stream. /** * This function is used to asynchronously read a certain number of bytes of * data from a stream. It is an initiating function for an @ref * asynchronous_operation, and always returns immediately. The asynchronous * operation will continue until one of the following conditions is true: * * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's * async_read_some function, and is known as a <em>composed operation</em>. The * program must ensure that the stream performs no other read operations (such * as async_read, the stream's async_read_some function, or any other composed * operations that perform reads) until this operation completes. * * @param s The stream from which the data is to be read. The type must support * the AsyncReadStream concept. * * @param buffers One or more buffers into which the data will be read. The sum * of the buffer sizes indicates the maximum number of bytes to read from the * stream. Although the buffers object may be copied as necessary, ownership of * the underlying memory blocks is retained by the caller, which must guarantee * that they remain valid until the completion handler is called. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the read completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. * const boost::system::error_code& error, * * // Number of bytes copied into the buffers. If an error * // occurred, this will be the number of bytes successfully * // transferred prior to the error. * std::size_t bytes_transferred * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, std::size_t) @endcode * * @par Example * To read into a single data buffer use the @ref buffer function as follows: * @code * boost::asio::async_read(s, boost::asio::buffer(data, size), handler); * @endcode * See the @ref buffer documentation for information on reading into multiple * buffers in one go, and how to use it with arrays, boost::array or * std::vector. * * @note This overload is equivalent to calling: * @code boost::asio::async_read( * s, buffers, * boost::asio::transfer_all(), * handler); @endcode * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the @c AsyncReadStream type's * @c async_read_some operation. */ template <typename AsyncReadStream, typename MutableBufferSequence, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, std::size_t)) ReadToken = default_completion_token_t< typename AsyncReadStream::executor_type>> inline auto async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, ReadToken&& token = default_completion_token_t< typename AsyncReadStream::executor_type>(), constraint_t< is_mutable_buffer_sequence<MutableBufferSequence>::value > = 0, constraint_t< !is_completion_condition<ReadToken>::value > = 0) -> decltype( async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( declval<detail::initiate_async_read<AsyncReadStream>>(), token, buffers, transfer_all())) { return async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( detail::initiate_async_read<AsyncReadStream>(s), token, buffers, transfer_all()); } /// Start an asynchronous operation to read a certain amount of data from a /// stream. /** * This function is used to asynchronously read a certain number of bytes of * data from a stream. It is an initiating function for an @ref * asynchronous_operation, and always returns immediately. The asynchronous * operation will continue until one of the following conditions is true: * * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * * @li The completion_condition function object returns 0. * * @param s The stream from which the data is to be read. The type must support * the AsyncReadStream concept. * * @param buffers One or more buffers into which the data will be read. The sum * of the buffer sizes indicates the maximum number of bytes to read from the * stream. Although the buffers object may be copied as necessary, ownership of * the underlying memory blocks is retained by the caller, which must guarantee * that they remain valid until the completion handler is called. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest async_read_some operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the stream's async_read_some function. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the read completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. * const boost::system::error_code& error, * * // Number of bytes copied into the buffers. If an error * // occurred, this will be the number of bytes successfully * // transferred prior to the error. * std::size_t bytes_transferred * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, std::size_t) @endcode * * @par Example * To read into a single data buffer use the @ref buffer function as follows: * @code boost::asio::async_read(s, * boost::asio::buffer(data, size), * boost::asio::transfer_at_least(32), * handler); @endcode * See the @ref buffer documentation for information on reading into multiple * buffers in one go, and how to use it with arrays, boost::array or * std::vector. * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the @c AsyncReadStream type's * @c async_read_some operation. */ template <typename AsyncReadStream, typename MutableBufferSequence, typename CompletionCondition, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, std::size_t)) ReadToken = default_completion_token_t< typename AsyncReadStream::executor_type>> inline auto async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, CompletionCondition completion_condition, ReadToken&& token = default_completion_token_t< typename AsyncReadStream::executor_type>(), constraint_t< is_mutable_buffer_sequence<MutableBufferSequence>::value > = 0, constraint_t< is_completion_condition<CompletionCondition>::value > = 0) -> decltype( async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( declval<detail::initiate_async_read<AsyncReadStream>>(), token, buffers, static_cast<CompletionCondition&&>(completion_condition))) { return async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( detail::initiate_async_read<AsyncReadStream>(s), token, buffers, static_cast<CompletionCondition&&>(completion_condition)); } #if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) /// Start an asynchronous operation to read a certain amount of data from a /// stream. /** * This function is used to asynchronously read a certain number of bytes of * data from a stream. It is an initiating function for an @ref * asynchronous_operation, and always returns immediately. The asynchronous * operation will continue until one of the following conditions is true: * * @li The specified dynamic buffer sequence is full (that is, it has reached * maximum size). * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's * async_read_some function, and is known as a <em>composed operation</em>. The * program must ensure that the stream performs no other read operations (such * as async_read, the stream's async_read_some function, or any other composed * operations that perform reads) until this operation completes. * * @param s The stream from which the data is to be read. The type must support * the AsyncReadStream concept. * * @param buffers The dynamic buffer sequence into which the data will be read. * Although the buffers object may be copied as necessary, ownership of the * underlying memory blocks is retained by the caller, which must guarantee * that they remain valid until the completion handler is called. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the read completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. * const boost::system::error_code& error, * * // Number of bytes copied into the buffers. If an error * // occurred, this will be the number of bytes successfully * // transferred prior to the error. * std::size_t bytes_transferred * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, std::size_t) @endcode * * @note This overload is equivalent to calling: * @code boost::asio::async_read( * s, buffers, * boost::asio::transfer_all(), * handler); @endcode * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the @c AsyncReadStream type's * @c async_read_some operation. */ template <typename AsyncReadStream, typename DynamicBuffer_v1, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, std::size_t)) ReadToken = default_completion_token_t< typename AsyncReadStream::executor_type>> inline auto async_read(AsyncReadStream& s, DynamicBuffer_v1&& buffers, ReadToken&& token = default_completion_token_t< typename AsyncReadStream::executor_type>(), constraint_t< is_dynamic_buffer_v1<decay_t<DynamicBuffer_v1>>::value > = 0, constraint_t< !is_dynamic_buffer_v2<decay_t<DynamicBuffer_v1>>::value > = 0, constraint_t< !is_completion_condition<ReadToken>::value > = 0) -> decltype( async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( declval<detail::initiate_async_read_dynbuf_v1<AsyncReadStream>>(), token, static_cast<DynamicBuffer_v1&&>(buffers), transfer_all())) { return async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( detail::initiate_async_read_dynbuf_v1<AsyncReadStream>(s), token, static_cast<DynamicBuffer_v1&&>(buffers), transfer_all()); } /// Start an asynchronous operation to read a certain amount of data from a /// stream. /** * This function is used to asynchronously read a certain number of bytes of * data from a stream. It is an initiating function for an @ref * asynchronous_operation, and always returns immediately. The asynchronous * operation will continue until one of the following conditions is true: * * @li The specified dynamic buffer sequence is full (that is, it has reached * maximum size). * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's * async_read_some function, and is known as a <em>composed operation</em>. The * program must ensure that the stream performs no other read operations (such * as async_read, the stream's async_read_some function, or any other composed * operations that perform reads) until this operation completes. * * @param s The stream from which the data is to be read. The type must support * the AsyncReadStream concept. * * @param buffers The dynamic buffer sequence into which the data will be read. * Although the buffers object may be copied as necessary, ownership of the * underlying memory blocks is retained by the caller, which must guarantee * that they remain valid until the completion handler is called. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest async_read_some operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the stream's async_read_some function. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the read completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. * const boost::system::error_code& error, * * // Number of bytes copied into the buffers. If an error * // occurred, this will be the number of bytes successfully * // transferred prior to the error. * std::size_t bytes_transferred * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, std::size_t) @endcode * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the @c AsyncReadStream type's * @c async_read_some operation. */ template <typename AsyncReadStream, typename DynamicBuffer_v1, typename CompletionCondition, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, std::size_t)) ReadToken = default_completion_token_t< typename AsyncReadStream::executor_type>> inline auto async_read(AsyncReadStream& s, DynamicBuffer_v1&& buffers, CompletionCondition completion_condition, ReadToken&& token = default_completion_token_t< typename AsyncReadStream::executor_type>(), constraint_t< is_dynamic_buffer_v1<decay_t<DynamicBuffer_v1>>::value > = 0, constraint_t< !is_dynamic_buffer_v2<decay_t<DynamicBuffer_v1>>::value > = 0, constraint_t< is_completion_condition<CompletionCondition>::value > = 0) -> decltype( async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( declval<detail::initiate_async_read_dynbuf_v1<AsyncReadStream>>(), token, static_cast<DynamicBuffer_v1&&>(buffers), static_cast<CompletionCondition&&>(completion_condition))) { return async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( detail::initiate_async_read_dynbuf_v1<AsyncReadStream>(s), token, static_cast<DynamicBuffer_v1&&>(buffers), static_cast<CompletionCondition&&>(completion_condition)); } #if !defined(BOOST_ASIO_NO_EXTENSIONS) #if !defined(BOOST_ASIO_NO_IOSTREAM) /// Start an asynchronous operation to read a certain amount of data from a /// stream. /** * This function is used to asynchronously read a certain number of bytes of * data from a stream. It is an initiating function for an @ref * asynchronous_operation, and always returns immediately. The asynchronous * operation will continue until one of the following conditions is true: * * @li The supplied buffer is full (that is, it has reached maximum size). * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's * async_read_some function, and is known as a <em>composed operation</em>. The * program must ensure that the stream performs no other read operations (such * as async_read, the stream's async_read_some function, or any other composed * operations that perform reads) until this operation completes. * * @param s The stream from which the data is to be read. The type must support * the AsyncReadStream concept. * * @param b A basic_streambuf object into which the data will be read. Ownership * of the streambuf is retained by the caller, which must guarantee that it * remains valid until the completion handler is called. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the read completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. * const boost::system::error_code& error, * * // Number of bytes copied into the buffers. If an error * // occurred, this will be the number of bytes successfully * // transferred prior to the error. * std::size_t bytes_transferred * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, std::size_t) @endcode * * @note This overload is equivalent to calling: * @code boost::asio::async_read( * s, b, * boost::asio::transfer_all(), * handler); @endcode * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the @c AsyncReadStream type's * @c async_read_some operation. */ template <typename AsyncReadStream, typename Allocator, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, std::size_t)) ReadToken = default_completion_token_t< typename AsyncReadStream::executor_type>> inline auto async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, ReadToken&& token = default_completion_token_t< typename AsyncReadStream::executor_type>(), constraint_t< !is_completion_condition<ReadToken>::value > = 0) -> decltype( async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( declval<detail::initiate_async_read_dynbuf_v1<AsyncReadStream>>(), token, basic_streambuf_ref<Allocator>(b), transfer_all())) { return async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( detail::initiate_async_read_dynbuf_v1<AsyncReadStream>(s), token, basic_streambuf_ref<Allocator>(b), transfer_all()); } /// Start an asynchronous operation to read a certain amount of data from a /// stream. /** * This function is used to asynchronously read a certain number of bytes of * data from a stream. It is an initiating function for an @ref * asynchronous_operation, and always returns immediately. The asynchronous * operation will continue until one of the following conditions is true: * * @li The supplied buffer is full (that is, it has reached maximum size). * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's * async_read_some function, and is known as a <em>composed operation</em>. The * program must ensure that the stream performs no other read operations (such * as async_read, the stream's async_read_some function, or any other composed * operations that perform reads) until this operation completes. * * @param s The stream from which the data is to be read. The type must support * the AsyncReadStream concept. * * @param b A basic_streambuf object into which the data will be read. Ownership * of the streambuf is retained by the caller, which must guarantee that it * remains valid until the completion handler is called. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest async_read_some operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the stream's async_read_some function. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the read completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. * const boost::system::error_code& error, * * // Number of bytes copied into the buffers. If an error * // occurred, this will be the number of bytes successfully * // transferred prior to the error. * std::size_t bytes_transferred * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, std::size_t) @endcode * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the @c AsyncReadStream type's * @c async_read_some operation. */ template <typename AsyncReadStream, typename Allocator, typename CompletionCondition, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, std::size_t)) ReadToken = default_completion_token_t< typename AsyncReadStream::executor_type>> inline auto async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, CompletionCondition completion_condition, ReadToken&& token = default_completion_token_t< typename AsyncReadStream::executor_type>(), constraint_t< is_completion_condition<CompletionCondition>::value > = 0) -> decltype( async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( declval<detail::initiate_async_read_dynbuf_v1<AsyncReadStream>>(), token, basic_streambuf_ref<Allocator>(b), static_cast<CompletionCondition&&>(completion_condition))) { return async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( detail::initiate_async_read_dynbuf_v1<AsyncReadStream>(s), token, basic_streambuf_ref<Allocator>(b), static_cast<CompletionCondition&&>(completion_condition)); } #endif // !defined(BOOST_ASIO_NO_IOSTREAM) #endif // !defined(BOOST_ASIO_NO_EXTENSIONS) #endif // !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) /// Start an asynchronous operation to read a certain amount of data from a /// stream. /** * This function is used to asynchronously read a certain number of bytes of * data from a stream. It is an initiating function for an @ref * asynchronous_operation, and always returns immediately. The asynchronous * operation will continue until one of the following conditions is true: * * @li The specified dynamic buffer sequence is full (that is, it has reached * maximum size). * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's * async_read_some function, and is known as a <em>composed operation</em>. The * program must ensure that the stream performs no other read operations (such * as async_read, the stream's async_read_some function, or any other composed * operations that perform reads) until this operation completes. * * @param s The stream from which the data is to be read. The type must support * the AsyncReadStream concept. * * @param buffers The dynamic buffer sequence into which the data will be read. * Although the buffers object may be copied as necessary, ownership of the * underlying memory blocks is retained by the caller, which must guarantee * that they remain valid until the completion handler is called. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the read completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. * const boost::system::error_code& error, * * // Number of bytes copied into the buffers. If an error * // occurred, this will be the number of bytes successfully * // transferred prior to the error. * std::size_t bytes_transferred * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, std::size_t) @endcode * * @note This overload is equivalent to calling: * @code boost::asio::async_read( * s, buffers, * boost::asio::transfer_all(), * handler); @endcode * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the @c AsyncReadStream type's * @c async_read_some operation. */ template <typename AsyncReadStream, typename DynamicBuffer_v2, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, std::size_t)) ReadToken = default_completion_token_t< typename AsyncReadStream::executor_type>> inline auto async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers, ReadToken&& token = default_completion_token_t< typename AsyncReadStream::executor_type>(), constraint_t< is_dynamic_buffer_v2<DynamicBuffer_v2>::value > = 0, constraint_t< !is_completion_condition<ReadToken>::value > = 0) -> decltype( async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( declval<detail::initiate_async_read_dynbuf_v2<AsyncReadStream>>(), token, static_cast<DynamicBuffer_v2&&>(buffers), transfer_all())) { return async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( detail::initiate_async_read_dynbuf_v2<AsyncReadStream>(s), token, static_cast<DynamicBuffer_v2&&>(buffers), transfer_all()); } /// Start an asynchronous operation to read a certain amount of data from a /// stream. /** * This function is used to asynchronously read a certain number of bytes of * data from a stream. It is an initiating function for an @ref * asynchronous_operation, and always returns immediately. The asynchronous * operation will continue until one of the following conditions is true: * * @li The specified dynamic buffer sequence is full (that is, it has reached * maximum size). * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's * async_read_some function, and is known as a <em>composed operation</em>. The * program must ensure that the stream performs no other read operations (such * as async_read, the stream's async_read_some function, or any other composed * operations that perform reads) until this operation completes. * * @param s The stream from which the data is to be read. The type must support * the AsyncReadStream concept. * * @param buffers The dynamic buffer sequence into which the data will be read. * Although the buffers object may be copied as necessary, ownership of the * underlying memory blocks is retained by the caller, which must guarantee * that they remain valid until the completion handler is called. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest async_read_some operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the stream's async_read_some function. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the read completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. * const boost::system::error_code& error, * * // Number of bytes copied into the buffers. If an error * // occurred, this will be the number of bytes successfully * // transferred prior to the error. * std::size_t bytes_transferred * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, std::size_t) @endcode * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the @c AsyncReadStream type's * @c async_read_some operation. */ template <typename AsyncReadStream, typename DynamicBuffer_v2, typename CompletionCondition, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, std::size_t)) ReadToken = default_completion_token_t< typename AsyncReadStream::executor_type>> inline auto async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers, CompletionCondition completion_condition, ReadToken&& token = default_completion_token_t< typename AsyncReadStream::executor_type>(), constraint_t< is_dynamic_buffer_v2<DynamicBuffer_v2>::value > = 0, constraint_t< is_completion_condition<CompletionCondition>::value > = 0) -> decltype( async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( declval<detail::initiate_async_read_dynbuf_v2<AsyncReadStream>>(), token, static_cast<DynamicBuffer_v2&&>(buffers), static_cast<CompletionCondition&&>(completion_condition))) { return async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( detail::initiate_async_read_dynbuf_v2<AsyncReadStream>(s), token, static_cast<DynamicBuffer_v2&&>(buffers), static_cast<CompletionCondition&&>(completion_condition)); } /*@}*/ } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/impl/read.hpp> #endif // BOOST_ASIO_READ_HPP
62,169
C++
.h
1,504
38.72008
80
0.742461
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,352
compose.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/compose.hpp
// // compose.hpp // ~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_COMPOSE_HPP #define BOOST_ASIO_COMPOSE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/composed.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// Launch an asynchronous operation with a stateful implementation. /** * The async_compose function simplifies the implementation of composed * asynchronous operations automatically wrapping a stateful function object * with a conforming intermediate completion handler. * * @param implementation A function object that contains the implementation of * the composed asynchronous operation. The first argument to the function * object is a non-const reference to the enclosing intermediate completion * handler. The remaining arguments are any arguments that originate from the * completion handlers of any asynchronous operations performed by the * implementation. * * @param token The completion token. * * @param io_objects_or_executors Zero or more I/O objects or I/O executors for * which outstanding work must be maintained. * * @par Per-Operation Cancellation * By default, terminal per-operation cancellation is enabled for * composed operations that are implemented using @c async_compose. To * disable cancellation for the composed operation, or to alter its * supported cancellation types, call the @c self object's @c * reset_cancellation_state function. * * @par Example: * * @code struct async_echo_implementation * { * tcp::socket& socket_; * boost::asio::mutable_buffer buffer_; * enum { starting, reading, writing } state_; * * template <typename Self> * void operator()(Self& self, * boost::system::error_code error = {}, * std::size_t n = 0) * { * switch (state_) * { * case starting: * state_ = reading; * socket_.async_read_some( * buffer_, std::move(self)); * break; * case reading: * if (error) * { * self.complete(error, 0); * } * else * { * state_ = writing; * boost::asio::async_write(socket_, buffer_, * boost::asio::transfer_exactly(n), * std::move(self)); * } * break; * case writing: * self.complete(error, n); * break; * } * } * }; * * template <typename CompletionToken> * auto async_echo(tcp::socket& socket, * boost::asio::mutable_buffer buffer, * CompletionToken&& token) * -> decltype( * boost::asio::async_compose<CompletionToken, * void(boost::system::error_code, std::size_t)>( * std::declval<async_echo_implementation>(), * token, socket)) * { * return boost::asio::async_compose<CompletionToken, * void(boost::system::error_code, std::size_t)>( * async_echo_implementation{socket, buffer, * async_echo_implementation::starting}, * token, socket); * } @endcode */ template <typename CompletionToken, typename Signature, typename Implementation, typename... IoObjectsOrExecutors> inline auto async_compose(Implementation&& implementation, type_identity_t<CompletionToken>& token, IoObjectsOrExecutors&&... io_objects_or_executors) -> decltype( async_initiate<CompletionToken, Signature>( composed<Signature>(static_cast<Implementation&&>(implementation), static_cast<IoObjectsOrExecutors&&>(io_objects_or_executors)...), token)) { return async_initiate<CompletionToken, Signature>( composed<Signature>(static_cast<Implementation&&>(implementation), static_cast<IoObjectsOrExecutors&&>(io_objects_or_executors)...), token); } } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_COMPOSE_HPP
4,175
C++
.h
121
32.272727
79
0.68801
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,353
immediate.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/immediate.hpp
// // immediate.hpp // ~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_IMMEDIATE_HPP #define BOOST_ASIO_IMMEDIATE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associated_immediate_executor.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/dispatch.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename Executor> class initiate_immediate { public: typedef Executor executor_type; explicit initiate_immediate(const Executor& ex) : ex_(ex) { } executor_type get_executor() const noexcept { return ex_; } template <typename CompletionHandler> void operator()(CompletionHandler&& handler) const { typename associated_immediate_executor< CompletionHandler, executor_type>::type ex = (get_associated_immediate_executor)(handler, ex_); (dispatch)(ex, static_cast<CompletionHandler&&>(handler)); } private: Executor ex_; }; } // namespace detail /// Launch a trivial asynchronous operation that completes immediately. /** * The async_immediate function is intended for use by composed operations, * which can delegate to this operation in order to implement the correct * semantics for immediate completion. * * @param ex The asynchronous operation's I/O executor. * * @param token The completion token. * * The completion handler is immediately submitted for execution by calling * boost::asio::dispatch() on the handler's associated immediate executor. * * If the completion handler does not have a customised associated immediate * executor, then the handler is submitted as if by calling boost::asio::post() * on the supplied I/O executor. * * @par Completion Signature * @code void() @endcode */ template <typename Executor, BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) NullaryToken = default_completion_token_t<Executor>> inline auto async_immediate(const Executor& ex, NullaryToken&& token = default_completion_token_t<Executor>(), constraint_t< (execution::is_executor<Executor>::value && can_require<Executor, execution::blocking_t::never_t>::value) || is_executor<Executor>::value > = 0) -> decltype( async_initiate<NullaryToken, void()>( declval<detail::initiate_immediate<Executor>>(), token)) { return async_initiate<NullaryToken, void()>( detail::initiate_immediate<Executor>(ex), token); } /// Launch a trivial asynchronous operation that completes immediately. /** * The async_immediate function is intended for use by composed operations, * which can delegate to this operation in order to implement the correct * semantics for immediate completion. * * @param ex The execution context used to obtain the asynchronous operation's * I/O executor. * * @param token The completion token. * * The completion handler is immediately submitted for execution by calling * boost::asio::dispatch() on the handler's associated immediate executor. * * If the completion handler does not have a customised associated immediate * executor, then the handler is submitted as if by calling boost::asio::post() * on the I/O executor obtained from the supplied execution context. * * @par Completion Signature * @code void() @endcode */ template <typename ExecutionContext, BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) NullaryToken = default_completion_token_t<typename ExecutionContext::executor_type>> inline auto async_immediate(ExecutionContext& ctx, NullaryToken&& token = default_completion_token_t< typename ExecutionContext::executor_type>(), constraint_t< is_convertible<ExecutionContext&, execution_context&>::value > = 0) -> decltype( async_initiate<NullaryToken, void()>( declval<detail::initiate_immediate< typename ExecutionContext::executor_type>>(), token)) { return async_initiate<NullaryToken, void()>( detail::initiate_immediate< typename ExecutionContext::executor_type>( ctx.get_executor()), token); } } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_IMMEDIATE_HPP
4,515
C++
.h
128
32.296875
79
0.741707
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,356
consign.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/consign.hpp
// // consign.hpp // ~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_CONSIGN_HPP #define BOOST_ASIO_CONSIGN_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <tuple> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// Completion token type used to specify that the completion handler should /// carry additional values along with it. /** * This completion token adapter is typically used to keep at least one copy of * an object, such as a smart pointer, alive until the completion handler is * called. */ template <typename CompletionToken, typename... Values> class consign_t { public: /// Constructor. template <typename T, typename... V> constexpr explicit consign_t(T&& completion_token, V&&... values) : token_(static_cast<T&&>(completion_token)), values_(static_cast<V&&>(values)...) { } #if defined(GENERATING_DOCUMENTATION) private: #endif // defined(GENERATING_DOCUMENTATION) CompletionToken token_; std::tuple<Values...> values_; }; /// Completion token adapter used to specify that the completion handler should /// carry additional values along with it. /** * This completion token adapter is typically used to keep at least one copy of * an object, such as a smart pointer, alive until the completion handler is * called. */ template <typename CompletionToken, typename... Values> BOOST_ASIO_NODISCARD inline constexpr consign_t<decay_t<CompletionToken>, decay_t<Values>...> consign(CompletionToken&& completion_token, Values&&... values) { return consign_t<decay_t<CompletionToken>, decay_t<Values>...>( static_cast<CompletionToken&&>(completion_token), static_cast<Values&&>(values)...); } } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/impl/consign.hpp> #endif // BOOST_ASIO_CONSIGN_HPP
2,235
C++
.h
65
32.492308
79
0.738647
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,357
placeholders.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/placeholders.hpp
// // placeholders.hpp // ~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_PLACEHOLDERS_HPP #define BOOST_ASIO_PLACEHOLDERS_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/functional.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace placeholders { #if defined(GENERATING_DOCUMENTATION) /// An argument placeholder, for use with std::bind() or boost::bind(), that /// corresponds to the error argument of a handler for any of the asynchronous /// functions. unspecified error; /// An argument placeholder, for use with std::bind() or boost::bind(), that /// corresponds to the bytes_transferred argument of a handler for asynchronous /// functions such as boost::asio::basic_stream_socket::async_write_some or /// boost::asio::async_write. unspecified bytes_transferred; /// An argument placeholder, for use with std::bind() or boost::bind(), that /// corresponds to the iterator argument of a handler for asynchronous functions /// such as boost::asio::async_connect. unspecified iterator; /// An argument placeholder, for use with std::bind() or boost::bind(), that /// corresponds to the results argument of a handler for asynchronous functions /// such as boost::asio::basic_resolver::async_resolve. unspecified results; /// An argument placeholder, for use with std::bind() or boost::bind(), that /// corresponds to the results argument of a handler for asynchronous functions /// such as boost::asio::async_connect. unspecified endpoint; /// An argument placeholder, for use with std::bind() or boost::bind(), that /// corresponds to the signal_number argument of a handler for asynchronous /// functions such as boost::asio::signal_set::async_wait. unspecified signal_number; #else static BOOST_ASIO_INLINE_VARIABLE constexpr auto& error = std::placeholders::_1; static BOOST_ASIO_INLINE_VARIABLE constexpr auto& bytes_transferred = std::placeholders::_2; static BOOST_ASIO_INLINE_VARIABLE constexpr auto& iterator = std::placeholders::_2; static BOOST_ASIO_INLINE_VARIABLE constexpr auto& results = std::placeholders::_2; static BOOST_ASIO_INLINE_VARIABLE constexpr auto& endpoint = std::placeholders::_2; static BOOST_ASIO_INLINE_VARIABLE constexpr auto& signal_number = std::placeholders::_2; #endif } // namespace placeholders } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_PLACEHOLDERS_HPP
2,797
C++
.h
65
41.569231
80
0.760133
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,361
associated_allocator.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/associated_allocator.hpp
// // associated_allocator.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_ASSOCIATED_ALLOCATOR_HPP #define BOOST_ASIO_ASSOCIATED_ALLOCATOR_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <memory> #include <boost/asio/associator.hpp> #include <boost/asio/detail/functional.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { template <typename T, typename Allocator> struct associated_allocator; namespace detail { template <typename T, typename = void> struct has_allocator_type : false_type { }; template <typename T> struct has_allocator_type<T, void_t<typename T::allocator_type>> : true_type { }; template <typename T, typename A, typename = void, typename = void> struct associated_allocator_impl { typedef void asio_associated_allocator_is_unspecialised; typedef A type; static type get(const T&) noexcept { return type(); } static const type& get(const T&, const A& a) noexcept { return a; } }; template <typename T, typename A> struct associated_allocator_impl<T, A, void_t<typename T::allocator_type>> { typedef typename T::allocator_type type; static auto get(const T& t) noexcept -> decltype(t.get_allocator()) { return t.get_allocator(); } static auto get(const T& t, const A&) noexcept -> decltype(t.get_allocator()) { return t.get_allocator(); } }; template <typename T, typename A> struct associated_allocator_impl<T, A, enable_if_t< !has_allocator_type<T>::value >, void_t< typename associator<associated_allocator, T, A>::type >> : associator<associated_allocator, T, A> { }; } // namespace detail /// Traits type used to obtain the allocator associated with an object. /** * A program may specialise this traits type if the @c T template parameter in * the specialisation is a user-defined type. The template parameter @c * Allocator shall be a type meeting the Allocator requirements. * * Specialisations shall meet the following requirements, where @c t is a const * reference to an object of type @c T, and @c a is an object of type @c * Allocator. * * @li Provide a nested typedef @c type that identifies a type meeting the * Allocator requirements. * * @li Provide a noexcept static member function named @c get, callable as @c * get(t) and with return type @c type or a (possibly const) reference to @c * type. * * @li Provide a noexcept static member function named @c get, callable as @c * get(t,a) and with return type @c type or a (possibly const) reference to @c * type. */ template <typename T, typename Allocator = std::allocator<void>> struct associated_allocator #if !defined(GENERATING_DOCUMENTATION) : detail::associated_allocator_impl<T, Allocator> #endif // !defined(GENERATING_DOCUMENTATION) { #if defined(GENERATING_DOCUMENTATION) /// If @c T has a nested type @c allocator_type, <tt>T::allocator_type</tt>. /// Otherwise @c Allocator. typedef see_below type; /// If @c T has a nested type @c allocator_type, returns /// <tt>t.get_allocator()</tt>. Otherwise returns @c type(). static decltype(auto) get(const T& t) noexcept; /// If @c T has a nested type @c allocator_type, returns /// <tt>t.get_allocator()</tt>. Otherwise returns @c a. static decltype(auto) get(const T& t, const Allocator& a) noexcept; #endif // defined(GENERATING_DOCUMENTATION) }; /// Helper function to obtain an object's associated allocator. /** * @returns <tt>associated_allocator<T>::get(t)</tt> */ template <typename T> BOOST_ASIO_NODISCARD inline typename associated_allocator<T>::type get_associated_allocator(const T& t) noexcept { return associated_allocator<T>::get(t); } /// Helper function to obtain an object's associated allocator. /** * @returns <tt>associated_allocator<T, Allocator>::get(t, a)</tt> */ template <typename T, typename Allocator> BOOST_ASIO_NODISCARD inline auto get_associated_allocator( const T& t, const Allocator& a) noexcept -> decltype(associated_allocator<T, Allocator>::get(t, a)) { return associated_allocator<T, Allocator>::get(t, a); } template <typename T, typename Allocator = std::allocator<void>> using associated_allocator_t = typename associated_allocator<T, Allocator>::type; namespace detail { template <typename T, typename A, typename = void> struct associated_allocator_forwarding_base { }; template <typename T, typename A> struct associated_allocator_forwarding_base<T, A, enable_if_t< is_same< typename associated_allocator<T, A>::asio_associated_allocator_is_unspecialised, void >::value >> { typedef void asio_associated_allocator_is_unspecialised; }; } // namespace detail /// Specialisation of associated_allocator for @c std::reference_wrapper. template <typename T, typename Allocator> struct associated_allocator<reference_wrapper<T>, Allocator> #if !defined(GENERATING_DOCUMENTATION) : detail::associated_allocator_forwarding_base<T, Allocator> #endif // !defined(GENERATING_DOCUMENTATION) { /// Forwards @c type to the associator specialisation for the unwrapped type /// @c T. typedef typename associated_allocator<T, Allocator>::type type; /// Forwards the request to get the allocator to the associator specialisation /// for the unwrapped type @c T. static type get(reference_wrapper<T> t) noexcept { return associated_allocator<T, Allocator>::get(t.get()); } /// Forwards the request to get the allocator to the associator specialisation /// for the unwrapped type @c T. static auto get(reference_wrapper<T> t, const Allocator& a) noexcept -> decltype(associated_allocator<T, Allocator>::get(t.get(), a)) { return associated_allocator<T, Allocator>::get(t.get(), a); } }; } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_ASSOCIATED_ALLOCATOR_HPP
6,271
C++
.h
182
32.098901
80
0.735425
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,369
cancel_at.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/cancel_at.hpp
// // cancel_at.hpp // ~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_CANCEL_AT_HPP #define BOOST_ASIO_CANCEL_AT_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/basic_waitable_timer.hpp> #include <boost/asio/cancellation_type.hpp> #include <boost/asio/detail/chrono.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/wait_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// A @ref completion_token adapter that cancels an operation at a given time. /** * The cancel_at_t class is used to indicate that an asynchronous operation * should be cancelled if not complete at the specified absolute time. */ template <typename CompletionToken, typename Clock, typename WaitTraits = boost::asio::wait_traits<Clock>> class cancel_at_t { public: /// Constructor. template <typename T> cancel_at_t(T&& completion_token, const typename Clock::time_point& expiry, cancellation_type_t cancel_type = cancellation_type::terminal) : token_(static_cast<T&&>(completion_token)), expiry_(expiry), cancel_type_(cancel_type) { } //private: CompletionToken token_; typename Clock::time_point expiry_; cancellation_type_t cancel_type_; }; /// A @ref completion_token adapter that cancels an operation at a given time. /** * The cancel_at_timer class is used to indicate that an asynchronous operation * should be cancelled if not complete at the specified absolute time. */ template <typename CompletionToken, typename Clock, typename WaitTraits = boost::asio::wait_traits<Clock>, typename Executor = any_io_executor> class cancel_at_timer { public: /// Constructor. template <typename T> cancel_at_timer(T&& completion_token, basic_waitable_timer<Clock, WaitTraits, Executor>& timer, const typename Clock::time_point& expiry, cancellation_type_t cancel_type = cancellation_type::terminal) : token_(static_cast<T&&>(completion_token)), timer_(timer), expiry_(expiry), cancel_type_(cancel_type) { } //private: CompletionToken token_; basic_waitable_timer<Clock, WaitTraits, Executor>& timer_; typename Clock::time_point expiry_; cancellation_type_t cancel_type_; }; /// A function object type that adapts a @ref completion_token to cancel an /// operation at a given time. /** * May also be used directly as a completion token, in which case it adapts the * asynchronous operation's default completion token (or boost::asio::deferred * if no default is available). */ template <typename Clock, typename WaitTraits = boost::asio::wait_traits<Clock>> class partial_cancel_at { public: /// Constructor that specifies the expiry and cancellation type. explicit partial_cancel_at(const typename Clock::time_point& expiry, cancellation_type_t cancel_type = cancellation_type::terminal) : expiry_(expiry), cancel_type_(cancel_type) { } /// Adapt a @ref completion_token to specify that the completion handler /// arguments should be combined into a single tuple argument. template <typename CompletionToken> BOOST_ASIO_NODISCARD inline constexpr cancel_at_t<decay_t<CompletionToken>, Clock, WaitTraits> operator()(CompletionToken&& completion_token) const { return cancel_at_t<decay_t<CompletionToken>, Clock, WaitTraits>( static_cast<CompletionToken&&>(completion_token), expiry_, cancel_type_); } //private: typename Clock::time_point expiry_; cancellation_type_t cancel_type_; }; /// A function object type that adapts a @ref completion_token to cancel an /// operation at a given time. /** * May also be used directly as a completion token, in which case it adapts the * asynchronous operation's default completion token (or boost::asio::deferred * if no default is available). */ template <typename Clock, typename WaitTraits = boost::asio::wait_traits<Clock>, typename Executor = any_io_executor> class partial_cancel_at_timer { public: /// Constructor that specifies the expiry and cancellation type. explicit partial_cancel_at_timer( basic_waitable_timer<Clock, WaitTraits, Executor>& timer, const typename Clock::time_point& expiry, cancellation_type_t cancel_type = cancellation_type::terminal) : timer_(timer), expiry_(expiry), cancel_type_(cancel_type) { } /// Adapt a @ref completion_token to specify that the completion handler /// arguments should be combined into a single tuple argument. template <typename CompletionToken> BOOST_ASIO_NODISCARD inline cancel_at_timer<decay_t<CompletionToken>, Clock, WaitTraits, Executor> operator()(CompletionToken&& completion_token) const { return cancel_at_timer<decay_t<CompletionToken>, Clock, WaitTraits, Executor>( static_cast<CompletionToken&&>(completion_token), timer_, expiry_, cancel_type_); } //private: basic_waitable_timer<Clock, WaitTraits, Executor>& timer_; typename Clock::time_point expiry_; cancellation_type_t cancel_type_; }; /// Create a partial completion token adapter that cancels an operation if not /// complete by the specified absolute time. /** * @par Thread Safety * When an asynchronous operation is used with cancel_at, a timer async_wait * operation is performed in parallel to the main operation. If this parallel * async_wait completes first, a cancellation request is emitted to cancel the * main operation. Consequently, the application must ensure that the * asynchronous operation is performed within an implicit or explicit strand. */ template <typename Clock, typename Duration> BOOST_ASIO_NODISCARD inline partial_cancel_at<Clock> cancel_at(const chrono::time_point<Clock, Duration>& expiry, cancellation_type_t cancel_type = cancellation_type::terminal) { return partial_cancel_at<Clock>(expiry, cancel_type); } /// Create a partial completion token adapter that cancels an operation if not /// complete by the specified absolute time. /** * @par Thread Safety * When an asynchronous operation is used with cancel_at, a timer async_wait * operation is performed in parallel to the main operation. If this parallel * async_wait completes first, a cancellation request is emitted to cancel the * main operation. Consequently, the application must ensure that the * asynchronous operation is performed within an implicit or explicit strand. */ template <typename Clock, typename WaitTraits, typename Executor, typename Duration> BOOST_ASIO_NODISCARD inline partial_cancel_at_timer<Clock, WaitTraits, Executor> cancel_at(basic_waitable_timer<Clock, WaitTraits, Executor>& timer, const chrono::time_point<Clock, Duration>& expiry, cancellation_type_t cancel_type = cancellation_type::terminal) { return partial_cancel_at_timer<Clock, WaitTraits, Executor>( timer, expiry, cancel_type); } /// Adapt a @ref completion_token to cancel an operation if not complete by the /// specified absolute time. /** * @par Thread Safety * When an asynchronous operation is used with cancel_at, a timer async_wait * operation is performed in parallel to the main operation. If this parallel * async_wait completes first, a cancellation request is emitted to cancel the * main operation. Consequently, the application must ensure that the * asynchronous operation is performed within an implicit or explicit strand. */ template <typename CompletionToken, typename Clock, typename Duration> BOOST_ASIO_NODISCARD inline cancel_at_t<decay_t<CompletionToken>, Clock> cancel_at(const chrono::time_point<Clock, Duration>& expiry, CompletionToken&& completion_token) { return cancel_at_t<decay_t<CompletionToken>, Clock>( static_cast<CompletionToken&&>(completion_token), expiry, cancellation_type::terminal); } /// Adapt a @ref completion_token to cancel an operation if not complete by the /// specified absolute time. /** * @par Thread Safety * When an asynchronous operation is used with cancel_at, a timer async_wait * operation is performed in parallel to the main operation. If this parallel * async_wait completes first, a cancellation request is emitted to cancel the * main operation. Consequently, the application must ensure that the * asynchronous operation is performed within an implicit or explicit strand. */ template <typename CompletionToken, typename Clock, typename Duration> BOOST_ASIO_NODISCARD inline cancel_at_t<decay_t<CompletionToken>, Clock> cancel_at(const chrono::time_point<Clock, Duration>& expiry, cancellation_type_t cancel_type, CompletionToken&& completion_token) { return cancel_at_t<decay_t<CompletionToken>, Clock>( static_cast<CompletionToken&&>(completion_token), expiry, cancel_type); } /// Adapt a @ref completion_token to cancel an operation if not complete by the /// specified absolute time. /** * @par Thread Safety * When an asynchronous operation is used with cancel_at, a timer async_wait * operation is performed in parallel to the main operation. If this parallel * async_wait completes first, a cancellation request is emitted to cancel the * main operation. Consequently, the application must ensure that the * asynchronous operation is performed within an implicit or explicit strand. */ template <typename CompletionToken, typename Clock, typename WaitTraits, typename Executor, typename Duration> BOOST_ASIO_NODISCARD inline cancel_at_timer<decay_t<CompletionToken>, Clock, WaitTraits, Executor> cancel_at(basic_waitable_timer<Clock, WaitTraits, Executor>& timer, const chrono::time_point<Clock, Duration>& expiry, CompletionToken&& completion_token) { return cancel_at_timer<decay_t<CompletionToken>, Clock, WaitTraits, Executor>( static_cast<CompletionToken&&>(completion_token), timer, expiry, cancellation_type::terminal); } /// Adapt a @ref completion_token to cancel an operation if not complete by the /// specified absolute time. /** * @par Thread Safety * When an asynchronous operation is used with cancel_at, a timer async_wait * operation is performed in parallel to the main operation. If this parallel * async_wait completes first, a cancellation request is emitted to cancel the * main operation. Consequently, the application must ensure that the * asynchronous operation is performed within an implicit or explicit strand. */ template <typename CompletionToken, typename Clock, typename WaitTraits, typename Executor, typename Duration> BOOST_ASIO_NODISCARD inline cancel_at_timer<decay_t<CompletionToken>, Clock, WaitTraits, Executor> cancel_at(basic_waitable_timer<Clock, WaitTraits, Executor>& timer, const chrono::time_point<Clock, Duration>& expiry, cancellation_type_t cancel_type, CompletionToken&& completion_token) { return cancel_at_timer<decay_t<CompletionToken>, Clock, WaitTraits, Executor>( static_cast<CompletionToken&&>(completion_token), timer, expiry, cancel_type); } } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/impl/cancel_at.hpp> #endif // BOOST_ASIO_CANCEL_AT_HPP
11,431
C++
.h
271
39.501845
80
0.763449
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,372
strand.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/strand.hpp
// // strand.hpp // ~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_STRAND_HPP #define BOOST_ASIO_STRAND_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/strand_executor_service.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/blocking.hpp> #include <boost/asio/execution/executor.hpp> #include <boost/asio/is_executor.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// Provides serialised function invocation for any executor type. template <typename Executor> class strand { public: /// The type of the underlying executor. typedef Executor inner_executor_type; /// Default constructor. /** * This constructor is only valid if the underlying executor type is default * constructible. */ strand() : executor_(), impl_(strand::create_implementation(executor_)) { } /// Construct a strand for the specified executor. template <typename Executor1> explicit strand(const Executor1& e, constraint_t< conditional_t< !is_same<Executor1, strand>::value, is_convertible<Executor1, Executor>, false_type >::value > = 0) : executor_(e), impl_(strand::create_implementation(executor_)) { } /// Copy constructor. strand(const strand& other) noexcept : executor_(other.executor_), impl_(other.impl_) { } /// Converting constructor. /** * This constructor is only valid if the @c OtherExecutor type is convertible * to @c Executor. */ template <class OtherExecutor> strand( const strand<OtherExecutor>& other) noexcept : executor_(other.executor_), impl_(other.impl_) { } /// Assignment operator. strand& operator=(const strand& other) noexcept { executor_ = other.executor_; impl_ = other.impl_; return *this; } /// Converting assignment operator. /** * This assignment operator is only valid if the @c OtherExecutor type is * convertible to @c Executor. */ template <class OtherExecutor> strand& operator=( const strand<OtherExecutor>& other) noexcept { executor_ = other.executor_; impl_ = other.impl_; return *this; } /// Move constructor. strand(strand&& other) noexcept : executor_(static_cast<Executor&&>(other.executor_)), impl_(static_cast<implementation_type&&>(other.impl_)) { } /// Converting move constructor. /** * This constructor is only valid if the @c OtherExecutor type is convertible * to @c Executor. */ template <class OtherExecutor> strand(strand<OtherExecutor>&& other) noexcept : executor_(static_cast<OtherExecutor&&>(other.executor_)), impl_(static_cast<implementation_type&&>(other.impl_)) { } /// Move assignment operator. strand& operator=(strand&& other) noexcept { executor_ = static_cast<Executor&&>(other.executor_); impl_ = static_cast<implementation_type&&>(other.impl_); return *this; } /// Converting move assignment operator. /** * This assignment operator is only valid if the @c OtherExecutor type is * convertible to @c Executor. */ template <class OtherExecutor> strand& operator=(strand<OtherExecutor>&& other) noexcept { executor_ = static_cast<OtherExecutor&&>(other.executor_); impl_ = static_cast<implementation_type&&>(other.impl_); return *this; } /// Destructor. ~strand() noexcept { } /// Obtain the underlying executor. inner_executor_type get_inner_executor() const noexcept { return executor_; } /// Forward a query to the underlying executor. /** * Do not call this function directly. It is intended for use with the * boost::asio::query customisation point. * * For example: * @code boost::asio::strand<my_executor_type> ex = ...; * if (boost::asio::query(ex, boost::asio::execution::blocking) * == boost::asio::execution::blocking.never) * ... @endcode */ template <typename Property> constraint_t< can_query<const Executor&, Property>::value, conditional_t< is_convertible<Property, execution::blocking_t>::value, execution::blocking_t, query_result_t<const Executor&, Property> > > query(const Property& p) const noexcept(is_nothrow_query<const Executor&, Property>::value) { return this->query_helper( is_convertible<Property, execution::blocking_t>(), p); } /// Forward a requirement to the underlying executor. /** * Do not call this function directly. It is intended for use with the * boost::asio::require customisation point. * * For example: * @code boost::asio::strand<my_executor_type> ex1 = ...; * auto ex2 = boost::asio::require(ex1, * boost::asio::execution::blocking.never); @endcode */ template <typename Property> constraint_t< can_require<const Executor&, Property>::value && !is_convertible<Property, execution::blocking_t::always_t>::value, strand<decay_t<require_result_t<const Executor&, Property>>> > require(const Property& p) const noexcept(is_nothrow_require<const Executor&, Property>::value) { return strand<decay_t<require_result_t<const Executor&, Property>>>( boost::asio::require(executor_, p), impl_); } /// Forward a preference to the underlying executor. /** * Do not call this function directly. It is intended for use with the * boost::asio::prefer customisation point. * * For example: * @code boost::asio::strand<my_executor_type> ex1 = ...; * auto ex2 = boost::asio::prefer(ex1, * boost::asio::execution::blocking.never); @endcode */ template <typename Property> constraint_t< can_prefer<const Executor&, Property>::value && !is_convertible<Property, execution::blocking_t::always_t>::value, strand<decay_t<prefer_result_t<const Executor&, Property>>> > prefer(const Property& p) const noexcept(is_nothrow_prefer<const Executor&, Property>::value) { return strand<decay_t<prefer_result_t<const Executor&, Property>>>( boost::asio::prefer(executor_, p), impl_); } #if !defined(BOOST_ASIO_NO_TS_EXECUTORS) /// Obtain the underlying execution context. execution_context& context() const noexcept { return executor_.context(); } /// Inform the strand that it has some outstanding work to do. /** * The strand delegates this call to its underlying executor. */ void on_work_started() const noexcept { executor_.on_work_started(); } /// Inform the strand that some work is no longer outstanding. /** * The strand delegates this call to its underlying executor. */ void on_work_finished() const noexcept { executor_.on_work_finished(); } #endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS) /// Request the strand to invoke the given function object. /** * This function is used to ask the strand to execute the given function * object on its underlying executor. The function object will be executed * according to the properties of the underlying executor. * * @param f The function object to be called. The executor will make * a copy of the handler object as required. The function signature of the * function object must be: @code void function(); @endcode */ template <typename Function> constraint_t< traits::execute_member<const Executor&, Function>::is_valid, void > execute(Function&& f) const { detail::strand_executor_service::execute(impl_, executor_, static_cast<Function&&>(f)); } #if !defined(BOOST_ASIO_NO_TS_EXECUTORS) /// Request the strand to invoke the given function object. /** * This function is used to ask the strand to execute the given function * object on its underlying executor. The function object will be executed * inside this function if the strand is not otherwise busy and if the * underlying executor's @c dispatch() function is also able to execute the * function before returning. * * @param f The function object to be called. The executor will make * a copy of the handler object as required. The function signature of the * function object must be: @code void function(); @endcode * * @param a An allocator that may be used by the executor to allocate the * internal storage needed for function invocation. */ template <typename Function, typename Allocator> void dispatch(Function&& f, const Allocator& a) const { detail::strand_executor_service::dispatch(impl_, executor_, static_cast<Function&&>(f), a); } /// Request the strand to invoke the given function object. /** * This function is used to ask the executor to execute the given function * object. The function object will never be executed inside this function. * Instead, it will be scheduled by the underlying executor's defer function. * * @param f The function object to be called. The executor will make * a copy of the handler object as required. The function signature of the * function object must be: @code void function(); @endcode * * @param a An allocator that may be used by the executor to allocate the * internal storage needed for function invocation. */ template <typename Function, typename Allocator> void post(Function&& f, const Allocator& a) const { detail::strand_executor_service::post(impl_, executor_, static_cast<Function&&>(f), a); } /// Request the strand to invoke the given function object. /** * This function is used to ask the executor to execute the given function * object. The function object will never be executed inside this function. * Instead, it will be scheduled by the underlying executor's defer function. * * @param f The function object to be called. The executor will make * a copy of the handler object as required. The function signature of the * function object must be: @code void function(); @endcode * * @param a An allocator that may be used by the executor to allocate the * internal storage needed for function invocation. */ template <typename Function, typename Allocator> void defer(Function&& f, const Allocator& a) const { detail::strand_executor_service::defer(impl_, executor_, static_cast<Function&&>(f), a); } #endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS) /// Determine whether the strand is running in the current thread. /** * @return @c true if the current thread is executing a function that was * submitted to the strand using post(), dispatch() or defer(). Otherwise * returns @c false. */ bool running_in_this_thread() const noexcept { return detail::strand_executor_service::running_in_this_thread(impl_); } /// Compare two strands for equality. /** * Two strands are equal if they refer to the same ordered, non-concurrent * state. */ friend bool operator==(const strand& a, const strand& b) noexcept { return a.impl_ == b.impl_; } /// Compare two strands for inequality. /** * Two strands are equal if they refer to the same ordered, non-concurrent * state. */ friend bool operator!=(const strand& a, const strand& b) noexcept { return a.impl_ != b.impl_; } #if defined(GENERATING_DOCUMENTATION) private: #endif // defined(GENERATING_DOCUMENTATION) typedef detail::strand_executor_service::implementation_type implementation_type; template <typename InnerExecutor> static implementation_type create_implementation(const InnerExecutor& ex, constraint_t< can_query<InnerExecutor, execution::context_t>::value > = 0) { return use_service<detail::strand_executor_service>( boost::asio::query(ex, execution::context)).create_implementation(); } template <typename InnerExecutor> static implementation_type create_implementation(const InnerExecutor& ex, constraint_t< !can_query<InnerExecutor, execution::context_t>::value > = 0) { return use_service<detail::strand_executor_service>( ex.context()).create_implementation(); } strand(const Executor& ex, const implementation_type& impl) : executor_(ex), impl_(impl) { } template <typename Property> query_result_t<const Executor&, Property> query_helper( false_type, const Property& property) const { return boost::asio::query(executor_, property); } template <typename Property> execution::blocking_t query_helper(true_type, const Property& property) const { execution::blocking_t result = boost::asio::query(executor_, property); return result == execution::blocking.always ? execution::blocking.possibly : result; } Executor executor_; implementation_type impl_; }; /** @defgroup make_strand boost::asio::make_strand * * @brief The boost::asio::make_strand function creates a @ref strand object for * an executor or execution context. */ /*@{*/ /// Create a @ref strand object for an executor. /** * @param ex An executor. * * @returns A strand constructed with the specified executor. */ template <typename Executor> inline strand<Executor> make_strand(const Executor& ex, constraint_t< is_executor<Executor>::value || execution::is_executor<Executor>::value > = 0) { return strand<Executor>(ex); } /// Create a @ref strand object for an execution context. /** * @param ctx An execution context, from which an executor will be obtained. * * @returns A strand constructed with the execution context's executor, obtained * by performing <tt>ctx.get_executor()</tt>. */ template <typename ExecutionContext> inline strand<typename ExecutionContext::executor_type> make_strand(ExecutionContext& ctx, constraint_t< is_convertible<ExecutionContext&, execution_context&>::value > = 0) { return strand<typename ExecutionContext::executor_type>(ctx.get_executor()); } /*@}*/ #if !defined(GENERATING_DOCUMENTATION) namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) template <typename Executor> struct equality_comparable<strand<Executor>> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) template <typename Executor, typename Function> struct execute_member<strand<Executor>, Function, enable_if_t< traits::execute_member<const Executor&, Function>::is_valid >> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = false; typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) template <typename Executor, typename Property> struct query_member<strand<Executor>, Property, enable_if_t< can_query<const Executor&, Property>::value >> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = is_nothrow_query<Executor, Property>::value; typedef conditional_t< is_convertible<Property, execution::blocking_t>::value, execution::blocking_t, query_result_t<Executor, Property>> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) template <typename Executor, typename Property> struct require_member<strand<Executor>, Property, enable_if_t< can_require<const Executor&, Property>::value && !is_convertible<Property, execution::blocking_t::always_t>::value >> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = is_nothrow_require<Executor, Property>::value; typedef strand<decay_t<require_result_t<Executor, Property>>> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT) template <typename Executor, typename Property> struct prefer_member<strand<Executor>, Property, enable_if_t< can_prefer<const Executor&, Property>::value && !is_convertible<Property, execution::blocking_t::always_t>::value >> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = is_nothrow_prefer<Executor, Property>::value; typedef strand<decay_t<prefer_result_t<Executor, Property>>> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT) } // namespace traits #endif // !defined(GENERATING_DOCUMENTATION) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> // If both io_context.hpp and strand.hpp have been included, automatically // include the header file needed for the io_context::strand class. #if !defined(BOOST_ASIO_NO_EXTENSIONS) # if defined(BOOST_ASIO_IO_CONTEXT_HPP) # include <boost/asio/io_context_strand.hpp> # endif // defined(BOOST_ASIO_IO_CONTEXT_HPP) #endif // !defined(BOOST_ASIO_NO_EXTENSIONS) #endif // BOOST_ASIO_STRAND_HPP
17,365
C++
.h
494
31.506073
80
0.714864
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,373
this_coro.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/this_coro.hpp
// // this_coro.hpp // ~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_THIS_CORO_HPP #define BOOST_ASIO_THIS_CORO_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace this_coro { /// Awaitable type that returns the executor of the current coroutine. struct executor_t { constexpr executor_t() { } }; /// Awaitable object that returns the executor of the current coroutine. BOOST_ASIO_INLINE_VARIABLE constexpr executor_t executor; /// Awaitable type that returns the cancellation state of the current coroutine. struct cancellation_state_t { constexpr cancellation_state_t() { } }; /// Awaitable object that returns the cancellation state of the current /// coroutine. /** * @par Example * @code boost::asio::awaitable<void> my_coroutine() * { * boost::asio::cancellation_state cs * = co_await boost::asio::this_coro::cancellation_state; * * // ... * * if (cs.cancelled() != boost::asio::cancellation_type::none) * // ... * } @endcode */ BOOST_ASIO_INLINE_VARIABLE constexpr cancellation_state_t cancellation_state; #if defined(GENERATING_DOCUMENTATION) /// Returns an awaitable object that may be used to reset the cancellation state /// of the current coroutine. /** * Let <tt>P</tt> be the cancellation slot associated with the current * coroutine's @ref co_spawn completion handler. Assigns a new * boost::asio::cancellation_state object <tt>S</tt>, constructed as * <tt>S(P)</tt>, into the current coroutine's cancellation state object. * * @par Example * @code boost::asio::awaitable<void> my_coroutine() * { * co_await boost::asio::this_coro::reset_cancellation_state(); * * // ... * } @endcode * * @note The cancellation state is shared by all coroutines in the same "thread * of execution" that was created using boost::asio::co_spawn. */ BOOST_ASIO_NODISCARD constexpr unspecified reset_cancellation_state(); /// Returns an awaitable object that may be used to reset the cancellation state /// of the current coroutine. /** * Let <tt>P</tt> be the cancellation slot associated with the current * coroutine's @ref co_spawn completion handler. Assigns a new * boost::asio::cancellation_state object <tt>S</tt>, constructed as <tt>S(P, * std::forward<Filter>(filter))</tt>, into the current coroutine's * cancellation state object. * * @par Example * @code boost::asio::awaitable<void> my_coroutine() * { * co_await boost::asio::this_coro::reset_cancellation_state( * boost::asio::enable_partial_cancellation()); * * // ... * } @endcode * * @note The cancellation state is shared by all coroutines in the same "thread * of execution" that was created using boost::asio::co_spawn. */ template <typename Filter> BOOST_ASIO_NODISCARD constexpr unspecified reset_cancellation_state(Filter&& filter); /// Returns an awaitable object that may be used to reset the cancellation state /// of the current coroutine. /** * Let <tt>P</tt> be the cancellation slot associated with the current * coroutine's @ref co_spawn completion handler. Assigns a new * boost::asio::cancellation_state object <tt>S</tt>, constructed as <tt>S(P, * std::forward<InFilter>(in_filter), * std::forward<OutFilter>(out_filter))</tt>, into the current coroutine's * cancellation state object. * * @par Example * @code boost::asio::awaitable<void> my_coroutine() * { * co_await boost::asio::this_coro::reset_cancellation_state( * boost::asio::enable_partial_cancellation(), * boost::asio::disable_cancellation()); * * // ... * } @endcode * * @note The cancellation state is shared by all coroutines in the same "thread * of execution" that was created using boost::asio::co_spawn. */ template <typename InFilter, typename OutFilter> BOOST_ASIO_NODISCARD constexpr unspecified reset_cancellation_state( InFilter&& in_filter, OutFilter&& out_filter); /// Returns an awaitable object that may be used to determine whether the /// coroutine throws if trying to suspend when it has been cancelled. /** * @par Example * @code boost::asio::awaitable<void> my_coroutine() * { * if (co_await boost::asio::this_coro::throw_if_cancelled) * // ... * * // ... * } @endcode */ BOOST_ASIO_NODISCARD constexpr unspecified throw_if_cancelled(); /// Returns an awaitable object that may be used to specify whether the /// coroutine throws if trying to suspend when it has been cancelled. /** * @par Example * @code boost::asio::awaitable<void> my_coroutine() * { * co_await boost::asio::this_coro::throw_if_cancelled(false); * * // ... * } @endcode */ BOOST_ASIO_NODISCARD constexpr unspecified throw_if_cancelled(bool value); #else // defined(GENERATING_DOCUMENTATION) struct reset_cancellation_state_0_t { constexpr reset_cancellation_state_0_t() { } }; BOOST_ASIO_NODISCARD inline constexpr reset_cancellation_state_0_t reset_cancellation_state() { return reset_cancellation_state_0_t(); } template <typename Filter> struct reset_cancellation_state_1_t { template <typename F> explicit constexpr reset_cancellation_state_1_t( F&& filt) : filter(static_cast<F&&>(filt)) { } Filter filter; }; template <typename Filter> BOOST_ASIO_NODISCARD inline constexpr reset_cancellation_state_1_t< decay_t<Filter>> reset_cancellation_state(Filter&& filter) { return reset_cancellation_state_1_t<decay_t<Filter>>( static_cast<Filter&&>(filter)); } template <typename InFilter, typename OutFilter> struct reset_cancellation_state_2_t { template <typename F1, typename F2> constexpr reset_cancellation_state_2_t( F1&& in_filt, F2&& out_filt) : in_filter(static_cast<F1&&>(in_filt)), out_filter(static_cast<F2&&>(out_filt)) { } InFilter in_filter; OutFilter out_filter; }; template <typename InFilter, typename OutFilter> BOOST_ASIO_NODISCARD inline constexpr reset_cancellation_state_2_t<decay_t<InFilter>, decay_t<OutFilter>> reset_cancellation_state(InFilter&& in_filter, OutFilter&& out_filter) { return reset_cancellation_state_2_t<decay_t<InFilter>, decay_t<OutFilter>>( static_cast<InFilter&&>(in_filter), static_cast<OutFilter&&>(out_filter)); } struct throw_if_cancelled_0_t { constexpr throw_if_cancelled_0_t() { } }; BOOST_ASIO_NODISCARD inline constexpr throw_if_cancelled_0_t throw_if_cancelled() { return throw_if_cancelled_0_t(); } struct throw_if_cancelled_1_t { explicit constexpr throw_if_cancelled_1_t(bool val) : value(val) { } bool value; }; BOOST_ASIO_NODISCARD inline constexpr throw_if_cancelled_1_t throw_if_cancelled(bool value) { return throw_if_cancelled_1_t(value); } #endif // defined(GENERATING_DOCUMENTATION) } // namespace this_coro } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_THIS_CORO_HPP
7,286
C++
.h
236
28.855932
80
0.729514
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,378
deferred.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/deferred.hpp
// // deferred.hpp // ~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DEFERRED_HPP #define BOOST_ASIO_DEFERRED_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <tuple> #include <boost/asio/associator.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/utility.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// Trait for detecting objects that are usable as deferred operations. template <typename T> struct is_deferred : false_type { }; /// Helper type to wrap multiple completion signatures. template <typename... Signatures> struct deferred_signatures { }; namespace detail { // Helper trait for getting the completion signatures of the tail in a sequence // when invoked with the specified arguments. template <typename Tail, typename... Signatures> struct deferred_sequence_signatures; template <typename Tail, typename R, typename... Args, typename... Signatures> struct deferred_sequence_signatures<Tail, R(Args...), Signatures...> : completion_signature_of<decltype(declval<Tail>()(declval<Args>()...))> { static_assert( !is_same<decltype(declval<Tail>()(declval<Args>()...)), void>::value, "deferred functions must produce a deferred return type"); }; // Completion handler for the head component of a deferred sequence. template <typename Handler, typename Tail> class deferred_sequence_handler { public: template <typename H, typename T> explicit deferred_sequence_handler(H&& handler, T&& tail) : handler_(static_cast<H&&>(handler)), tail_(static_cast<T&&>(tail)) { } template <typename... Args> void operator()(Args&&... args) { static_cast<Tail&&>(tail_)( static_cast<Args&&>(args)...)( static_cast<Handler&&>(handler_)); } //private: Handler handler_; Tail tail_; }; template <typename Head, typename Tail, typename... Signatures> class deferred_sequence_base { private: struct initiate { template <typename Handler> void operator()(Handler&& handler, Head head, Tail&& tail) { static_cast<Head&&>(head)( deferred_sequence_handler<decay_t<Handler>, decay_t<Tail>>( static_cast<Handler&&>(handler), static_cast<Tail&&>(tail))); } }; Head head_; Tail tail_; public: template <typename H, typename T> constexpr explicit deferred_sequence_base(H&& head, T&& tail) : head_(static_cast<H&&>(head)), tail_(static_cast<T&&>(tail)) { } template <BOOST_ASIO_COMPLETION_TOKEN_FOR(Signatures...) CompletionToken> auto operator()(CompletionToken&& token) && -> decltype( async_initiate<CompletionToken, Signatures...>( initiate(), token, static_cast<Head&&>(this->head_), static_cast<Tail&&>(this->tail_))) { return async_initiate<CompletionToken, Signatures...>(initiate(), token, static_cast<Head&&>(head_), static_cast<Tail&&>(tail_)); } template <BOOST_ASIO_COMPLETION_TOKEN_FOR(Signatures...) CompletionToken> auto operator()(CompletionToken&& token) const & -> decltype( async_initiate<CompletionToken, Signatures...>( initiate(), token, this->head_, this->tail_)) { return async_initiate<CompletionToken, Signatures...>( initiate(), token, head_, tail_); } }; // Two-step application of variadic Signatures to determine correct base type. template <typename Head, typename Tail> struct deferred_sequence_types { template <typename... Signatures> struct op1 { typedef deferred_sequence_base<Head, Tail, Signatures...> type; }; template <typename... Signatures> struct op2 { typedef typename deferred_sequence_signatures<Tail, Signatures...>::template apply<op1>::type::type type; }; typedef typename completion_signature_of<Head>::template apply<op2>::type::type base; }; } // namespace detail /// Used to represent an empty deferred action. struct deferred_noop { /// No effect. template <typename... Args> void operator()(Args&&...) && { } /// No effect. template <typename... Args> void operator()(Args&&...) const & { } }; #if !defined(GENERATING_DOCUMENTATION) template <> struct is_deferred<deferred_noop> : true_type { }; #endif // !defined(GENERATING_DOCUMENTATION) /// Tag type to disambiguate deferred constructors. struct deferred_init_tag {}; /// Wraps a function object so that it may be used as an element in a deferred /// composition. template <typename Function> class deferred_function { public: /// Constructor. template <typename F> constexpr explicit deferred_function(deferred_init_tag, F&& function) : function_(static_cast<F&&>(function)) { } //private: Function function_; public: template <typename... Args> auto operator()(Args&&... args) && -> decltype( static_cast<Function&&>(this->function_)(static_cast<Args&&>(args)...)) { return static_cast<Function&&>(function_)(static_cast<Args&&>(args)...); } template <typename... Args> auto operator()(Args&&... args) const & -> decltype(Function(function_)(static_cast<Args&&>(args)...)) { return Function(function_)(static_cast<Args&&>(args)...); } }; #if !defined(GENERATING_DOCUMENTATION) template <typename Function> struct is_deferred<deferred_function<Function>> : true_type { }; #endif // !defined(GENERATING_DOCUMENTATION) /// Encapsulates deferred values. template <typename... Values> class BOOST_ASIO_NODISCARD deferred_values { private: std::tuple<Values...> values_; struct initiate { template <typename Handler, typename... V> void operator()(Handler handler, V&&... values) { static_cast<Handler&&>(handler)(static_cast<V&&>(values)...); } }; template <typename CompletionToken, std::size_t... I> auto invoke_helper(CompletionToken&& token, detail::index_sequence<I...>) -> decltype( async_initiate<CompletionToken, void(Values...)>(initiate(), token, std::get<I>(static_cast<std::tuple<Values...>&&>(this->values_))...)) { return async_initiate<CompletionToken, void(Values...)>(initiate(), token, std::get<I>(static_cast<std::tuple<Values...>&&>(values_))...); } template <typename CompletionToken, std::size_t... I> auto const_invoke_helper(CompletionToken&& token, detail::index_sequence<I...>) -> decltype( async_initiate<CompletionToken, void(Values...)>( initiate(), token, std::get<I>(values_)...)) { return async_initiate<CompletionToken, void(Values...)>( initiate(), token, std::get<I>(values_)...); } public: /// Construct a deferred asynchronous operation from the arguments to an /// initiation function object. template <typename... V> constexpr explicit deferred_values( deferred_init_tag, V&&... values) : values_(static_cast<V&&>(values)...) { } /// Initiate the deferred operation using the supplied completion token. template <BOOST_ASIO_COMPLETION_TOKEN_FOR(void(Values...)) CompletionToken> auto operator()(CompletionToken&& token) && -> decltype( this->invoke_helper( static_cast<CompletionToken&&>(token), detail::index_sequence_for<Values...>())) { return this->invoke_helper( static_cast<CompletionToken&&>(token), detail::index_sequence_for<Values...>()); } template <BOOST_ASIO_COMPLETION_TOKEN_FOR(void(Values...)) CompletionToken> auto operator()(CompletionToken&& token) const & -> decltype( this->const_invoke_helper( static_cast<CompletionToken&&>(token), detail::index_sequence_for<Values...>())) { return this->const_invoke_helper( static_cast<CompletionToken&&>(token), detail::index_sequence_for<Values...>()); } }; #if !defined(GENERATING_DOCUMENTATION) template <typename... Values> struct is_deferred<deferred_values<Values...>> : true_type { }; #endif // !defined(GENERATING_DOCUMENTATION) /// Encapsulates a deferred asynchronous operation. template <typename Signature, typename Initiation, typename... InitArgs> class BOOST_ASIO_NODISCARD deferred_async_operation { private: typedef decay_t<Initiation> initiation_t; initiation_t initiation_; typedef std::tuple<decay_t<InitArgs>...> init_args_t; init_args_t init_args_; template <typename CompletionToken, std::size_t... I> auto invoke_helper(CompletionToken&& token, detail::index_sequence<I...>) -> decltype( async_initiate<CompletionToken, Signature>( static_cast<initiation_t&&>(initiation_), token, std::get<I>(static_cast<init_args_t&&>(init_args_))...)) { return async_initiate<CompletionToken, Signature>( static_cast<initiation_t&&>(initiation_), token, std::get<I>(static_cast<init_args_t&&>(init_args_))...); } template <typename CompletionToken, std::size_t... I> auto const_invoke_helper(CompletionToken&& token, detail::index_sequence<I...>) const & -> decltype( async_initiate<CompletionToken, Signature>( conditional_t<true, initiation_t, CompletionToken>(initiation_), token, std::get<I>(init_args_)...)) { return async_initiate<CompletionToken, Signature>( initiation_t(initiation_), token, std::get<I>(init_args_)...); } public: /// Construct a deferred asynchronous operation from the arguments to an /// initiation function object. template <typename I, typename... A> constexpr explicit deferred_async_operation( deferred_init_tag, I&& initiation, A&&... init_args) : initiation_(static_cast<I&&>(initiation)), init_args_(static_cast<A&&>(init_args)...) { } /// Initiate the asynchronous operation using the supplied completion token. template <BOOST_ASIO_COMPLETION_TOKEN_FOR(Signature) CompletionToken> auto operator()(CompletionToken&& token) && -> decltype( this->invoke_helper( static_cast<CompletionToken&&>(token), detail::index_sequence_for<InitArgs...>())) { return this->invoke_helper( static_cast<CompletionToken&&>(token), detail::index_sequence_for<InitArgs...>()); } template <BOOST_ASIO_COMPLETION_TOKEN_FOR(Signature) CompletionToken> auto operator()(CompletionToken&& token) const & -> decltype( this->const_invoke_helper( static_cast<CompletionToken&&>(token), detail::index_sequence_for<InitArgs...>())) { return this->const_invoke_helper( static_cast<CompletionToken&&>(token), detail::index_sequence_for<InitArgs...>()); } }; /// Encapsulates a deferred asynchronous operation thas has multiple completion /// signatures. template <typename... Signatures, typename Initiation, typename... InitArgs> class BOOST_ASIO_NODISCARD deferred_async_operation< deferred_signatures<Signatures...>, Initiation, InitArgs...> { private: typedef decay_t<Initiation> initiation_t; initiation_t initiation_; typedef std::tuple<decay_t<InitArgs>...> init_args_t; init_args_t init_args_; template <typename CompletionToken, std::size_t... I> auto invoke_helper(CompletionToken&& token, detail::index_sequence<I...>) -> decltype( async_initiate<CompletionToken, Signatures...>( static_cast<initiation_t&&>(initiation_), token, std::get<I>(static_cast<init_args_t&&>(init_args_))...)) { return async_initiate<CompletionToken, Signatures...>( static_cast<initiation_t&&>(initiation_), token, std::get<I>(static_cast<init_args_t&&>(init_args_))...); } template <typename CompletionToken, std::size_t... I> auto const_invoke_helper(CompletionToken&& token, detail::index_sequence<I...>) const & -> decltype( async_initiate<CompletionToken, Signatures...>( initiation_t(initiation_), token, std::get<I>(init_args_)...)) { return async_initiate<CompletionToken, Signatures...>( initiation_t(initiation_), token, std::get<I>(init_args_)...); } public: /// Construct a deferred asynchronous operation from the arguments to an /// initiation function object. template <typename I, typename... A> constexpr explicit deferred_async_operation( deferred_init_tag, I&& initiation, A&&... init_args) : initiation_(static_cast<I&&>(initiation)), init_args_(static_cast<A&&>(init_args)...) { } /// Initiate the asynchronous operation using the supplied completion token. template <BOOST_ASIO_COMPLETION_TOKEN_FOR(Signatures...) CompletionToken> auto operator()(CompletionToken&& token) && -> decltype( this->invoke_helper( static_cast<CompletionToken&&>(token), detail::index_sequence_for<InitArgs...>())) { return this->invoke_helper( static_cast<CompletionToken&&>(token), detail::index_sequence_for<InitArgs...>()); } template <BOOST_ASIO_COMPLETION_TOKEN_FOR(Signatures...) CompletionToken> auto operator()(CompletionToken&& token) const & -> decltype( this->const_invoke_helper( static_cast<CompletionToken&&>(token), detail::index_sequence_for<InitArgs...>())) { return this->const_invoke_helper( static_cast<CompletionToken&&>(token), detail::index_sequence_for<InitArgs...>()); } }; #if !defined(GENERATING_DOCUMENTATION) template <typename Signature, typename Initiation, typename... InitArgs> struct is_deferred< deferred_async_operation<Signature, Initiation, InitArgs...>> : true_type { }; #endif // !defined(GENERATING_DOCUMENTATION) /// Defines a link between two consecutive operations in a sequence. template <typename Head, typename Tail> class BOOST_ASIO_NODISCARD deferred_sequence : public detail::deferred_sequence_types<Head, Tail>::base { public: template <typename H, typename T> constexpr explicit deferred_sequence(deferred_init_tag, H&& head, T&& tail) : detail::deferred_sequence_types<Head, Tail>::base( static_cast<H&&>(head), static_cast<T&&>(tail)) { } #if defined(GENERATING_DOCUMENTATION) template <typename CompletionToken> auto operator()(CompletionToken&& token) &&; template <typename CompletionToken> auto operator()(CompletionToken&& token) const &; #endif // defined(GENERATING_DOCUMENTATION) }; #if !defined(GENERATING_DOCUMENTATION) template <typename Head, typename Tail> struct is_deferred<deferred_sequence<Head, Tail>> : true_type { }; #endif // !defined(GENERATING_DOCUMENTATION) /// Used to represent a deferred conditional branch. template <typename OnTrue = deferred_noop, typename OnFalse = deferred_noop> class BOOST_ASIO_NODISCARD deferred_conditional { private: template <typename T, typename F> friend class deferred_conditional; // Helper constructor. template <typename T, typename F> explicit deferred_conditional(bool b, T&& on_true, F&& on_false) : on_true_(static_cast<T&&>(on_true)), on_false_(static_cast<F&&>(on_false)), bool_(b) { } OnTrue on_true_; OnFalse on_false_; bool bool_; public: /// Construct a deferred conditional with the value to determine which branch /// will be executed. constexpr explicit deferred_conditional(bool b) : on_true_(), on_false_(), bool_(b) { } /// Invoke the conditional branch bsaed on the stored value. template <typename... Args> auto operator()(Args&&... args) && -> decltype(static_cast<OnTrue&&>(on_true_)(static_cast<Args&&>(args)...)) { if (bool_) { return static_cast<OnTrue&&>(on_true_)(static_cast<Args&&>(args)...); } else { return static_cast<OnFalse&&>(on_false_)(static_cast<Args&&>(args)...); } } template <typename... Args> auto operator()(Args&&... args) const & -> decltype(on_true_(static_cast<Args&&>(args)...)) { if (bool_) { return on_true_(static_cast<Args&&>(args)...); } else { return on_false_(static_cast<Args&&>(args)...); } } /// Set the true branch of the conditional. template <typename T> deferred_conditional<T, OnFalse> then(T on_true, constraint_t< is_deferred<T>::value >* = 0, constraint_t< is_same< conditional_t<true, OnTrue, T>, deferred_noop >::value >* = 0) && { return deferred_conditional<T, OnFalse>( bool_, static_cast<T&&>(on_true), static_cast<OnFalse&&>(on_false_)); } /// Set the false branch of the conditional. template <typename T> deferred_conditional<OnTrue, T> otherwise(T on_false, constraint_t< is_deferred<T>::value >* = 0, constraint_t< !is_same< conditional_t<true, OnTrue, T>, deferred_noop >::value >* = 0, constraint_t< is_same< conditional_t<true, OnFalse, T>, deferred_noop >::value >* = 0) && { return deferred_conditional<OnTrue, T>( bool_, static_cast<OnTrue&&>(on_true_), static_cast<T&&>(on_false)); } }; #if !defined(GENERATING_DOCUMENTATION) template <typename OnTrue, typename OnFalse> struct is_deferred<deferred_conditional<OnTrue, OnFalse>> : true_type { }; #endif // !defined(GENERATING_DOCUMENTATION) /// Class used to specify that an asynchronous operation should return a /// function object to lazily launch the operation. /** * The deferred_t class is used to indicate that an asynchronous operation * should return a function object which is itself an initiation function. A * deferred_t object may be passed as a completion token to an asynchronous * operation, typically as the default completion token: * * @code auto my_deferred_op = my_socket.async_read_some(my_buffer); @endcode * * or by explicitly passing the special value @c boost::asio::deferred: * * @code auto my_deferred_op * = my_socket.async_read_some(my_buffer, * boost::asio::deferred); @endcode * * The initiating function (async_read_some in the above example) returns a * function object that will lazily initiate the operation. */ class deferred_t { public: /// Default constructor. constexpr deferred_t() { } /// Adapts an executor to add the @c deferred_t completion token as the /// default. template <typename InnerExecutor> struct executor_with_default : InnerExecutor { /// Specify @c deferred_t as the default completion token type. typedef deferred_t default_completion_token_type; /// Construct the adapted executor from the inner executor type. template <typename InnerExecutor1> executor_with_default(const InnerExecutor1& ex, constraint_t< conditional_t< !is_same<InnerExecutor1, executor_with_default>::value, is_convertible<InnerExecutor1, InnerExecutor>, false_type >::value > = 0) noexcept : InnerExecutor(ex) { } }; /// Type alias to adapt an I/O object to use @c deferred_t as its /// default completion token type. template <typename T> using as_default_on_t = typename T::template rebind_executor< executor_with_default<typename T::executor_type>>::other; /// Function helper to adapt an I/O object to use @c deferred_t as its /// default completion token type. template <typename T> static typename decay_t<T>::template rebind_executor< executor_with_default<typename decay_t<T>::executor_type> >::other as_default_on(T&& object) { return typename decay_t<T>::template rebind_executor< executor_with_default<typename decay_t<T>::executor_type> >::other(static_cast<T&&>(object)); } /// Creates a new deferred from a function. template <typename Function> constraint_t< !is_deferred<decay_t<Function>>::value, deferred_function<decay_t<Function>> > operator()(Function&& function) const { return deferred_function<decay_t<Function>>( deferred_init_tag{}, static_cast<Function&&>(function)); } /// Passes through anything that is already deferred. template <typename T> constraint_t< is_deferred<decay_t<T>>::value, decay_t<T> > operator()(T&& t) const { return static_cast<T&&>(t); } /// Returns a deferred operation that returns the provided values. template <typename... Args> static constexpr deferred_values<decay_t<Args>...> values(Args&&... args) { return deferred_values<decay_t<Args>...>( deferred_init_tag{}, static_cast<Args&&>(args)...); } /// Creates a conditional object for branching deferred operations. static constexpr deferred_conditional<> when(bool b) { return deferred_conditional<>(b); } }; /// Pipe operator used to chain deferred operations. template <typename Head, typename Tail> inline auto operator|(Head head, Tail&& tail) -> constraint_t< is_deferred<Head>::value, decltype(static_cast<Head&&>(head)(static_cast<Tail&&>(tail))) > { return static_cast<Head&&>(head)(static_cast<Tail&&>(tail)); } /// A @ref completion_token object used to specify that an asynchronous /// operation should return a function object to lazily launch the operation. /** * See the documentation for boost::asio::deferred_t for a usage example. */ BOOST_ASIO_INLINE_VARIABLE constexpr deferred_t deferred; } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/impl/deferred.hpp> #endif // BOOST_ASIO_DEFERRED_HPP
21,703
C++
.h
639
29.981221
80
0.689067
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,380
connect.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/connect.hpp
// // connect.hpp // ~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_CONNECT_HPP #define BOOST_ASIO_CONNECT_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/basic_socket.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/error.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { struct default_connect_condition; template <typename, typename> class initiate_async_range_connect; template <typename, typename> class initiate_async_iterator_connect; template <typename T, typename = void, typename = void> struct is_endpoint_sequence_helper : false_type { }; template <typename T> struct is_endpoint_sequence_helper<T, void_t< decltype(declval<T>().begin()) >, void_t< decltype(declval<T>().end()) > > : true_type { }; template <typename T, typename Iterator, typename = void> struct is_connect_condition_helper : false_type { }; template <typename T, typename Iterator> struct is_connect_condition_helper<T, Iterator, enable_if_t< is_same< result_of_t<T(boost::system::error_code, Iterator)>, Iterator >::value > > : true_type { }; template <typename T, typename Iterator> struct is_connect_condition_helper<T, Iterator, enable_if_t< is_same< result_of_t<T(boost::system::error_code, decltype(*declval<Iterator>()))>, bool >::value > > : true_type { }; struct default_connect_condition { template <typename Endpoint> bool operator()(const boost::system::error_code&, const Endpoint&) { return true; } }; } // namespace detail #if defined(GENERATING_DOCUMENTATION) /// Type trait used to determine whether a type is an endpoint sequence that can /// be used with with @c connect and @c async_connect. template <typename T> struct is_endpoint_sequence { /// The value member is true if the type may be used as an endpoint sequence. static const bool value = automatically_determined; }; /// Trait for determining whether a function object is a connect condition that /// can be used with @c connect and @c async_connect. template <typename T, typename Iterator> struct is_connect_condition { /// The value member is true if the type may be used as a connect condition. static constexpr bool value = automatically_determined; }; #else // defined(GENERATING_DOCUMENTATION) template <typename T> struct is_endpoint_sequence : detail::is_endpoint_sequence_helper<T> { }; template <typename T, typename Iterator> struct is_connect_condition : detail::is_connect_condition_helper<T, Iterator> { }; #endif // defined(GENERATING_DOCUMENTATION) /** * @defgroup connect boost::asio::connect * * @brief The @c connect function is a composed operation that establishes a * socket connection by trying each endpoint in a sequence. */ /*@{*/ /// Establishes a socket connection by trying each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c connect member * function, once for each endpoint in the sequence, until a connection is * successfully established. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param endpoints A sequence of endpoints. * * @returns The successfully connected endpoint. * * @throws boost::system::system_error Thrown on failure. If the sequence is * empty, the associated @c error_code is boost::asio::error::not_found. * Otherwise, contains the error from the last connection attempt. * * @par Example * @code tcp::resolver r(my_context); * tcp::resolver::query q("host", "service"); * tcp::socket s(my_context); * boost::asio::connect(s, r.resolve(q)); @endcode */ template <typename Protocol, typename Executor, typename EndpointSequence> typename Protocol::endpoint connect(basic_socket<Protocol, Executor>& s, const EndpointSequence& endpoints, constraint_t< is_endpoint_sequence<EndpointSequence>::value > = 0); /// Establishes a socket connection by trying each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c connect member * function, once for each endpoint in the sequence, until a connection is * successfully established. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param endpoints A sequence of endpoints. * * @param ec Set to indicate what error occurred, if any. If the sequence is * empty, set to boost::asio::error::not_found. Otherwise, contains the error * from the last connection attempt. * * @returns On success, the successfully connected endpoint. Otherwise, a * default-constructed endpoint. * * @par Example * @code tcp::resolver r(my_context); * tcp::resolver::query q("host", "service"); * tcp::socket s(my_context); * boost::system::error_code ec; * boost::asio::connect(s, r.resolve(q), ec); * if (ec) * { * // An error occurred. * } @endcode */ template <typename Protocol, typename Executor, typename EndpointSequence> typename Protocol::endpoint connect(basic_socket<Protocol, Executor>& s, const EndpointSequence& endpoints, boost::system::error_code& ec, constraint_t< is_endpoint_sequence<EndpointSequence>::value > = 0); #if !defined(BOOST_ASIO_NO_DEPRECATED) /// (Deprecated: Use range overload.) Establishes a socket connection by trying /// each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c connect member * function, once for each endpoint in the sequence, until a connection is * successfully established. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param begin An iterator pointing to the start of a sequence of endpoints. * * @returns On success, an iterator denoting the successfully connected * endpoint. Otherwise, the end iterator. * * @throws boost::system::system_error Thrown on failure. If the sequence is * empty, the associated @c error_code is boost::asio::error::not_found. * Otherwise, contains the error from the last connection attempt. * * @note This overload assumes that a default constructed object of type @c * Iterator represents the end of the sequence. This is a valid assumption for * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. */ template <typename Protocol, typename Executor, typename Iterator> Iterator connect(basic_socket<Protocol, Executor>& s, Iterator begin, constraint_t< !is_endpoint_sequence<Iterator>::value > = 0); /// (Deprecated: Use range overload.) Establishes a socket connection by trying /// each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c connect member * function, once for each endpoint in the sequence, until a connection is * successfully established. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param begin An iterator pointing to the start of a sequence of endpoints. * * @param ec Set to indicate what error occurred, if any. If the sequence is * empty, set to boost::asio::error::not_found. Otherwise, contains the error * from the last connection attempt. * * @returns On success, an iterator denoting the successfully connected * endpoint. Otherwise, the end iterator. * * @note This overload assumes that a default constructed object of type @c * Iterator represents the end of the sequence. This is a valid assumption for * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. */ template <typename Protocol, typename Executor, typename Iterator> Iterator connect(basic_socket<Protocol, Executor>& s, Iterator begin, boost::system::error_code& ec, constraint_t< !is_endpoint_sequence<Iterator>::value > = 0); #endif // !defined(BOOST_ASIO_NO_DEPRECATED) /// Establishes a socket connection by trying each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c connect member * function, once for each endpoint in the sequence, until a connection is * successfully established. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param begin An iterator pointing to the start of a sequence of endpoints. * * @param end An iterator pointing to the end of a sequence of endpoints. * * @returns An iterator denoting the successfully connected endpoint. * * @throws boost::system::system_error Thrown on failure. If the sequence is * empty, the associated @c error_code is boost::asio::error::not_found. * Otherwise, contains the error from the last connection attempt. * * @par Example * @code tcp::resolver r(my_context); * tcp::resolver::query q("host", "service"); * tcp::resolver::results_type e = r.resolve(q); * tcp::socket s(my_context); * boost::asio::connect(s, e.begin(), e.end()); @endcode */ template <typename Protocol, typename Executor, typename Iterator> Iterator connect(basic_socket<Protocol, Executor>& s, Iterator begin, Iterator end); /// Establishes a socket connection by trying each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c connect member * function, once for each endpoint in the sequence, until a connection is * successfully established. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param begin An iterator pointing to the start of a sequence of endpoints. * * @param end An iterator pointing to the end of a sequence of endpoints. * * @param ec Set to indicate what error occurred, if any. If the sequence is * empty, set to boost::asio::error::not_found. Otherwise, contains the error * from the last connection attempt. * * @returns On success, an iterator denoting the successfully connected * endpoint. Otherwise, the end iterator. * * @par Example * @code tcp::resolver r(my_context); * tcp::resolver::query q("host", "service"); * tcp::resolver::results_type e = r.resolve(q); * tcp::socket s(my_context); * boost::system::error_code ec; * boost::asio::connect(s, e.begin(), e.end(), ec); * if (ec) * { * // An error occurred. * } @endcode */ template <typename Protocol, typename Executor, typename Iterator> Iterator connect(basic_socket<Protocol, Executor>& s, Iterator begin, Iterator end, boost::system::error_code& ec); /// Establishes a socket connection by trying each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c connect member * function, once for each endpoint in the sequence, until a connection is * successfully established. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param endpoints A sequence of endpoints. * * @param connect_condition A function object that is called prior to each * connection attempt. The signature of the function object must be: * @code bool connect_condition( * const boost::system::error_code& ec, * const typename Protocol::endpoint& next); @endcode * The @c ec parameter contains the result from the most recent connect * operation. Before the first connection attempt, @c ec is always set to * indicate success. The @c next parameter is the next endpoint to be tried. * The function object should return true if the next endpoint should be tried, * and false if it should be skipped. * * @returns The successfully connected endpoint. * * @throws boost::system::system_error Thrown on failure. If the sequence is * empty, the associated @c error_code is boost::asio::error::not_found. * Otherwise, contains the error from the last connection attempt. * * @par Example * The following connect condition function object can be used to output * information about the individual connection attempts: * @code struct my_connect_condition * { * bool operator()( * const boost::system::error_code& ec, * const::tcp::endpoint& next) * { * if (ec) std::cout << "Error: " << ec.message() << std::endl; * std::cout << "Trying: " << next << std::endl; * return true; * } * }; @endcode * It would be used with the boost::asio::connect function as follows: * @code tcp::resolver r(my_context); * tcp::resolver::query q("host", "service"); * tcp::socket s(my_context); * tcp::endpoint e = boost::asio::connect(s, * r.resolve(q), my_connect_condition()); * std::cout << "Connected to: " << e << std::endl; @endcode */ template <typename Protocol, typename Executor, typename EndpointSequence, typename ConnectCondition> typename Protocol::endpoint connect(basic_socket<Protocol, Executor>& s, const EndpointSequence& endpoints, ConnectCondition connect_condition, constraint_t< is_endpoint_sequence<EndpointSequence>::value > = 0, constraint_t< is_connect_condition<ConnectCondition, decltype(declval<const EndpointSequence&>().begin())>::value > = 0); /// Establishes a socket connection by trying each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c connect member * function, once for each endpoint in the sequence, until a connection is * successfully established. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param endpoints A sequence of endpoints. * * @param connect_condition A function object that is called prior to each * connection attempt. The signature of the function object must be: * @code bool connect_condition( * const boost::system::error_code& ec, * const typename Protocol::endpoint& next); @endcode * The @c ec parameter contains the result from the most recent connect * operation. Before the first connection attempt, @c ec is always set to * indicate success. The @c next parameter is the next endpoint to be tried. * The function object should return true if the next endpoint should be tried, * and false if it should be skipped. * * @param ec Set to indicate what error occurred, if any. If the sequence is * empty, set to boost::asio::error::not_found. Otherwise, contains the error * from the last connection attempt. * * @returns On success, the successfully connected endpoint. Otherwise, a * default-constructed endpoint. * * @par Example * The following connect condition function object can be used to output * information about the individual connection attempts: * @code struct my_connect_condition * { * bool operator()( * const boost::system::error_code& ec, * const::tcp::endpoint& next) * { * if (ec) std::cout << "Error: " << ec.message() << std::endl; * std::cout << "Trying: " << next << std::endl; * return true; * } * }; @endcode * It would be used with the boost::asio::connect function as follows: * @code tcp::resolver r(my_context); * tcp::resolver::query q("host", "service"); * tcp::socket s(my_context); * boost::system::error_code ec; * tcp::endpoint e = boost::asio::connect(s, * r.resolve(q), my_connect_condition(), ec); * if (ec) * { * // An error occurred. * } * else * { * std::cout << "Connected to: " << e << std::endl; * } @endcode */ template <typename Protocol, typename Executor, typename EndpointSequence, typename ConnectCondition> typename Protocol::endpoint connect(basic_socket<Protocol, Executor>& s, const EndpointSequence& endpoints, ConnectCondition connect_condition, boost::system::error_code& ec, constraint_t< is_endpoint_sequence<EndpointSequence>::value > = 0, constraint_t< is_connect_condition<ConnectCondition, decltype(declval<const EndpointSequence&>().begin())>::value > = 0); #if !defined(BOOST_ASIO_NO_DEPRECATED) /// (Deprecated: Use range overload.) Establishes a socket connection by trying /// each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c connect member * function, once for each endpoint in the sequence, until a connection is * successfully established. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param begin An iterator pointing to the start of a sequence of endpoints. * * @param connect_condition A function object that is called prior to each * connection attempt. The signature of the function object must be: * @code bool connect_condition( * const boost::system::error_code& ec, * const typename Protocol::endpoint& next); @endcode * The @c ec parameter contains the result from the most recent connect * operation. Before the first connection attempt, @c ec is always set to * indicate success. The @c next parameter is the next endpoint to be tried. * The function object should return true if the next endpoint should be tried, * and false if it should be skipped. * * @returns On success, an iterator denoting the successfully connected * endpoint. Otherwise, the end iterator. * * @throws boost::system::system_error Thrown on failure. If the sequence is * empty, the associated @c error_code is boost::asio::error::not_found. * Otherwise, contains the error from the last connection attempt. * * @note This overload assumes that a default constructed object of type @c * Iterator represents the end of the sequence. This is a valid assumption for * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. */ template <typename Protocol, typename Executor, typename Iterator, typename ConnectCondition> Iterator connect(basic_socket<Protocol, Executor>& s, Iterator begin, ConnectCondition connect_condition, constraint_t< !is_endpoint_sequence<Iterator>::value > = 0, constraint_t< is_connect_condition<ConnectCondition, Iterator>::value > = 0); /// (Deprecated: Use range overload.) Establishes a socket connection by trying /// each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c connect member * function, once for each endpoint in the sequence, until a connection is * successfully established. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param begin An iterator pointing to the start of a sequence of endpoints. * * @param connect_condition A function object that is called prior to each * connection attempt. The signature of the function object must be: * @code bool connect_condition( * const boost::system::error_code& ec, * const typename Protocol::endpoint& next); @endcode * The @c ec parameter contains the result from the most recent connect * operation. Before the first connection attempt, @c ec is always set to * indicate success. The @c next parameter is the next endpoint to be tried. * The function object should return true if the next endpoint should be tried, * and false if it should be skipped. * * @param ec Set to indicate what error occurred, if any. If the sequence is * empty, set to boost::asio::error::not_found. Otherwise, contains the error * from the last connection attempt. * * @returns On success, an iterator denoting the successfully connected * endpoint. Otherwise, the end iterator. * * @note This overload assumes that a default constructed object of type @c * Iterator represents the end of the sequence. This is a valid assumption for * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. */ template <typename Protocol, typename Executor, typename Iterator, typename ConnectCondition> Iterator connect(basic_socket<Protocol, Executor>& s, Iterator begin, ConnectCondition connect_condition, boost::system::error_code& ec, constraint_t< !is_endpoint_sequence<Iterator>::value > = 0, constraint_t< is_connect_condition<ConnectCondition, Iterator>::value > = 0); #endif // !defined(BOOST_ASIO_NO_DEPRECATED) /// Establishes a socket connection by trying each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c connect member * function, once for each endpoint in the sequence, until a connection is * successfully established. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param begin An iterator pointing to the start of a sequence of endpoints. * * @param end An iterator pointing to the end of a sequence of endpoints. * * @param connect_condition A function object that is called prior to each * connection attempt. The signature of the function object must be: * @code bool connect_condition( * const boost::system::error_code& ec, * const typename Protocol::endpoint& next); @endcode * The @c ec parameter contains the result from the most recent connect * operation. Before the first connection attempt, @c ec is always set to * indicate success. The @c next parameter is the next endpoint to be tried. * The function object should return true if the next endpoint should be tried, * and false if it should be skipped. * * @returns An iterator denoting the successfully connected endpoint. * * @throws boost::system::system_error Thrown on failure. If the sequence is * empty, the associated @c error_code is boost::asio::error::not_found. * Otherwise, contains the error from the last connection attempt. * * @par Example * The following connect condition function object can be used to output * information about the individual connection attempts: * @code struct my_connect_condition * { * bool operator()( * const boost::system::error_code& ec, * const::tcp::endpoint& next) * { * if (ec) std::cout << "Error: " << ec.message() << std::endl; * std::cout << "Trying: " << next << std::endl; * return true; * } * }; @endcode * It would be used with the boost::asio::connect function as follows: * @code tcp::resolver r(my_context); * tcp::resolver::query q("host", "service"); * tcp::resolver::results_type e = r.resolve(q); * tcp::socket s(my_context); * tcp::resolver::results_type::iterator i = boost::asio::connect( * s, e.begin(), e.end(), my_connect_condition()); * std::cout << "Connected to: " << i->endpoint() << std::endl; @endcode */ template <typename Protocol, typename Executor, typename Iterator, typename ConnectCondition> Iterator connect(basic_socket<Protocol, Executor>& s, Iterator begin, Iterator end, ConnectCondition connect_condition, constraint_t< is_connect_condition<ConnectCondition, Iterator>::value > = 0); /// Establishes a socket connection by trying each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c connect member * function, once for each endpoint in the sequence, until a connection is * successfully established. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param begin An iterator pointing to the start of a sequence of endpoints. * * @param end An iterator pointing to the end of a sequence of endpoints. * * @param connect_condition A function object that is called prior to each * connection attempt. The signature of the function object must be: * @code bool connect_condition( * const boost::system::error_code& ec, * const typename Protocol::endpoint& next); @endcode * The @c ec parameter contains the result from the most recent connect * operation. Before the first connection attempt, @c ec is always set to * indicate success. The @c next parameter is the next endpoint to be tried. * The function object should return true if the next endpoint should be tried, * and false if it should be skipped. * * @param ec Set to indicate what error occurred, if any. If the sequence is * empty, set to boost::asio::error::not_found. Otherwise, contains the error * from the last connection attempt. * * @returns On success, an iterator denoting the successfully connected * endpoint. Otherwise, the end iterator. * * @par Example * The following connect condition function object can be used to output * information about the individual connection attempts: * @code struct my_connect_condition * { * bool operator()( * const boost::system::error_code& ec, * const::tcp::endpoint& next) * { * if (ec) std::cout << "Error: " << ec.message() << std::endl; * std::cout << "Trying: " << next << std::endl; * return true; * } * }; @endcode * It would be used with the boost::asio::connect function as follows: * @code tcp::resolver r(my_context); * tcp::resolver::query q("host", "service"); * tcp::resolver::results_type e = r.resolve(q); * tcp::socket s(my_context); * boost::system::error_code ec; * tcp::resolver::results_type::iterator i = boost::asio::connect( * s, e.begin(), e.end(), my_connect_condition()); * if (ec) * { * // An error occurred. * } * else * { * std::cout << "Connected to: " << i->endpoint() << std::endl; * } @endcode */ template <typename Protocol, typename Executor, typename Iterator, typename ConnectCondition> Iterator connect(basic_socket<Protocol, Executor>& s, Iterator begin, Iterator end, ConnectCondition connect_condition, boost::system::error_code& ec, constraint_t< is_connect_condition<ConnectCondition, Iterator>::value > = 0); /*@}*/ /** * @defgroup async_connect boost::asio::async_connect * * @brief The @c async_connect function is a composed asynchronous operation * that establishes a socket connection by trying each endpoint in a sequence. */ /*@{*/ /// Asynchronously establishes a socket connection by trying each endpoint in a /// sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c async_connect * member function, once for each endpoint in the sequence, until a connection * is successfully established. It is an initiating function for an @ref * asynchronous_operation, and always returns immediately. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param endpoints A sequence of endpoints. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the connect completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. if the sequence is empty, set to * // boost::asio::error::not_found. Otherwise, contains the * // error from the last connection attempt. * const boost::system::error_code& error, * * // On success, the successfully connected endpoint. * // Otherwise, a default-constructed endpoint. * const typename Protocol::endpoint& endpoint * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, typename Protocol::endpoint) @endcode * * @par Example * @code tcp::resolver r(my_context); * tcp::resolver::query q("host", "service"); * tcp::socket s(my_context); * * // ... * * r.async_resolve(q, resolve_handler); * * // ... * * void resolve_handler( * const boost::system::error_code& ec, * tcp::resolver::results_type results) * { * if (!ec) * { * boost::asio::async_connect(s, results, connect_handler); * } * } * * // ... * * void connect_handler( * const boost::system::error_code& ec, * const tcp::endpoint& endpoint) * { * // ... * } @endcode * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the socket's @c async_connect operation. */ template <typename Protocol, typename Executor, typename EndpointSequence, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, typename Protocol::endpoint)) RangeConnectToken = default_completion_token_t<Executor>> inline auto async_connect(basic_socket<Protocol, Executor>& s, const EndpointSequence& endpoints, RangeConnectToken&& token = default_completion_token_t<Executor>(), constraint_t< is_endpoint_sequence<EndpointSequence>::value > = 0, constraint_t< !is_connect_condition<RangeConnectToken, decltype(declval<const EndpointSequence&>().begin())>::value > = 0) -> decltype( async_initiate<RangeConnectToken, void (boost::system::error_code, typename Protocol::endpoint)>( declval<detail::initiate_async_range_connect<Protocol, Executor>>(), token, endpoints, declval<detail::default_connect_condition>())) { return async_initiate<RangeConnectToken, void (boost::system::error_code, typename Protocol::endpoint)>( detail::initiate_async_range_connect<Protocol, Executor>(s), token, endpoints, detail::default_connect_condition()); } #if !defined(BOOST_ASIO_NO_DEPRECATED) /// (Deprecated: Use range overload.) Asynchronously establishes a socket /// connection by trying each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c async_connect * member function, once for each endpoint in the sequence, until a connection * is successfully established. It is an initiating function for an @ref * asynchronous_operation, and always returns immediately. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param begin An iterator pointing to the start of a sequence of endpoints. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the connect completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. if the sequence is empty, set to * // boost::asio::error::not_found. Otherwise, contains the * // error from the last connection attempt. * const boost::system::error_code& error, * * // On success, an iterator denoting the successfully * // connected endpoint. Otherwise, the end iterator. * Iterator iterator * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, Iterator) @endcode * * @note This overload assumes that a default constructed object of type @c * Iterator represents the end of the sequence. This is a valid assumption for * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the socket's @c async_connect operation. */ template <typename Protocol, typename Executor, typename Iterator, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, Iterator)) IteratorConnectToken = default_completion_token_t<Executor>> inline auto async_connect(basic_socket<Protocol, Executor>& s, Iterator begin, IteratorConnectToken&& token = default_completion_token_t<Executor>(), constraint_t< !is_endpoint_sequence<Iterator>::value > = 0, constraint_t< !is_same<Iterator, decay_t<IteratorConnectToken>>::value > = 0, constraint_t< !is_connect_condition<IteratorConnectToken, Iterator>::value > = 0) -> decltype( async_initiate<IteratorConnectToken, void (boost::system::error_code, Iterator)>( declval<detail::initiate_async_iterator_connect<Protocol, Executor>>(), token, begin, Iterator(), declval<detail::default_connect_condition>())) { return async_initiate<IteratorConnectToken, void (boost::system::error_code, Iterator)>( detail::initiate_async_iterator_connect<Protocol, Executor>(s), token, begin, Iterator(), detail::default_connect_condition()); } #endif // !defined(BOOST_ASIO_NO_DEPRECATED) /// Asynchronously establishes a socket connection by trying each endpoint in a /// sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c async_connect * member function, once for each endpoint in the sequence, until a connection * is successfully established. It is an initiating function for an @ref * asynchronous_operation, and always returns immediately. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param begin An iterator pointing to the start of a sequence of endpoints. * * @param end An iterator pointing to the end of a sequence of endpoints. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the connect completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. if the sequence is empty, set to * // boost::asio::error::not_found. Otherwise, contains the * // error from the last connection attempt. * const boost::system::error_code& error, * * // On success, an iterator denoting the successfully * // connected endpoint. Otherwise, the end iterator. * Iterator iterator * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, Iterator) @endcode * * @par Example * @code std::vector<tcp::endpoint> endpoints = ...; * tcp::socket s(my_context); * boost::asio::async_connect(s, * endpoints.begin(), endpoints.end(), * connect_handler); * * // ... * * void connect_handler( * const boost::system::error_code& ec, * std::vector<tcp::endpoint>::iterator i) * { * // ... * } @endcode * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the socket's @c async_connect operation. */ template <typename Protocol, typename Executor, typename Iterator, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, Iterator)) IteratorConnectToken = default_completion_token_t<Executor>> inline auto async_connect( basic_socket<Protocol, Executor>& s, Iterator begin, Iterator end, IteratorConnectToken&& token = default_completion_token_t<Executor>(), constraint_t< !is_connect_condition<IteratorConnectToken, Iterator>::value > = 0) -> decltype( async_initiate<IteratorConnectToken, void (boost::system::error_code, Iterator)>( declval<detail::initiate_async_iterator_connect<Protocol, Executor>>(), token, begin, end, declval<detail::default_connect_condition>())) { return async_initiate<IteratorConnectToken, void (boost::system::error_code, Iterator)>( detail::initiate_async_iterator_connect<Protocol, Executor>(s), token, begin, end, detail::default_connect_condition()); } /// Asynchronously establishes a socket connection by trying each endpoint in a /// sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c async_connect * member function, once for each endpoint in the sequence, until a connection * is successfully established. It is an initiating function for an @ref * asynchronous_operation, and always returns immediately. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param endpoints A sequence of endpoints. * * @param connect_condition A function object that is called prior to each * connection attempt. The signature of the function object must be: * @code bool connect_condition( * const boost::system::error_code& ec, * const typename Protocol::endpoint& next); @endcode * The @c ec parameter contains the result from the most recent connect * operation. Before the first connection attempt, @c ec is always set to * indicate success. The @c next parameter is the next endpoint to be tried. * The function object should return true if the next endpoint should be tried, * and false if it should be skipped. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the connect completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. if the sequence is empty, set to * // boost::asio::error::not_found. Otherwise, contains the * // error from the last connection attempt. * const boost::system::error_code& error, * * // On success, an iterator denoting the successfully * // connected endpoint. Otherwise, the end iterator. * Iterator iterator * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, typename Protocol::endpoint) @endcode * * @par Example * The following connect condition function object can be used to output * information about the individual connection attempts: * @code struct my_connect_condition * { * bool operator()( * const boost::system::error_code& ec, * const::tcp::endpoint& next) * { * if (ec) std::cout << "Error: " << ec.message() << std::endl; * std::cout << "Trying: " << next << std::endl; * return true; * } * }; @endcode * It would be used with the boost::asio::connect function as follows: * @code tcp::resolver r(my_context); * tcp::resolver::query q("host", "service"); * tcp::socket s(my_context); * * // ... * * r.async_resolve(q, resolve_handler); * * // ... * * void resolve_handler( * const boost::system::error_code& ec, * tcp::resolver::results_type results) * { * if (!ec) * { * boost::asio::async_connect(s, results, * my_connect_condition(), * connect_handler); * } * } * * // ... * * void connect_handler( * const boost::system::error_code& ec, * const tcp::endpoint& endpoint) * { * if (ec) * { * // An error occurred. * } * else * { * std::cout << "Connected to: " << endpoint << std::endl; * } * } @endcode * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the socket's @c async_connect operation. */ template <typename Protocol, typename Executor, typename EndpointSequence, typename ConnectCondition, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, typename Protocol::endpoint)) RangeConnectToken = default_completion_token_t<Executor>> inline auto async_connect(basic_socket<Protocol, Executor>& s, const EndpointSequence& endpoints, ConnectCondition connect_condition, RangeConnectToken&& token = default_completion_token_t<Executor>(), constraint_t< is_endpoint_sequence<EndpointSequence>::value > = 0, constraint_t< is_connect_condition<ConnectCondition, decltype(declval<const EndpointSequence&>().begin())>::value > = 0) -> decltype( async_initiate<RangeConnectToken, void (boost::system::error_code, typename Protocol::endpoint)>( declval<detail::initiate_async_range_connect<Protocol, Executor>>(), token, endpoints, connect_condition)) { return async_initiate<RangeConnectToken, void (boost::system::error_code, typename Protocol::endpoint)>( detail::initiate_async_range_connect<Protocol, Executor>(s), token, endpoints, connect_condition); } #if !defined(BOOST_ASIO_NO_DEPRECATED) /// (Deprecated: Use range overload.) Asynchronously establishes a socket /// connection by trying each endpoint in a sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c async_connect * member function, once for each endpoint in the sequence, until a connection * is successfully established. It is an initiating function for an @ref * asynchronous_operation, and always returns immediately. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param begin An iterator pointing to the start of a sequence of endpoints. * * @param connect_condition A function object that is called prior to each * connection attempt. The signature of the function object must be: * @code bool connect_condition( * const boost::system::error_code& ec, * const typename Protocol::endpoint& next); @endcode * The @c ec parameter contains the result from the most recent connect * operation. Before the first connection attempt, @c ec is always set to * indicate success. The @c next parameter is the next endpoint to be tried. * The function object should return true if the next endpoint should be tried, * and false if it should be skipped. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the connect completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. if the sequence is empty, set to * // boost::asio::error::not_found. Otherwise, contains the * // error from the last connection attempt. * const boost::system::error_code& error, * * // On success, an iterator denoting the successfully * // connected endpoint. Otherwise, the end iterator. * Iterator iterator * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, Iterator) @endcode * * @note This overload assumes that a default constructed object of type @c * Iterator represents the end of the sequence. This is a valid assumption for * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the socket's @c async_connect operation. */ template <typename Protocol, typename Executor, typename Iterator, typename ConnectCondition, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, Iterator)) IteratorConnectToken = default_completion_token_t<Executor>> inline auto async_connect(basic_socket<Protocol, Executor>& s, Iterator begin, ConnectCondition connect_condition, IteratorConnectToken&& token = default_completion_token_t<Executor>(), constraint_t< !is_endpoint_sequence<Iterator>::value > = 0, constraint_t< is_connect_condition<ConnectCondition, Iterator>::value > = 0) -> decltype( async_initiate<IteratorConnectToken, void (boost::system::error_code, Iterator)>( declval<detail::initiate_async_iterator_connect<Protocol, Executor>>(), token, begin, Iterator(), connect_condition)) { return async_initiate<IteratorConnectToken, void (boost::system::error_code, Iterator)>( detail::initiate_async_iterator_connect<Protocol, Executor>(s), token, begin, Iterator(), connect_condition); } #endif // !defined(BOOST_ASIO_NO_DEPRECATED) /// Asynchronously establishes a socket connection by trying each endpoint in a /// sequence. /** * This function attempts to connect a socket to one of a sequence of * endpoints. It does this by repeated calls to the socket's @c async_connect * member function, once for each endpoint in the sequence, until a connection * is successfully established. It is an initiating function for an @ref * asynchronous_operation, and always returns immediately. * * @param s The socket to be connected. If the socket is already open, it will * be closed. * * @param begin An iterator pointing to the start of a sequence of endpoints. * * @param end An iterator pointing to the end of a sequence of endpoints. * * @param connect_condition A function object that is called prior to each * connection attempt. The signature of the function object must be: * @code bool connect_condition( * const boost::system::error_code& ec, * const typename Protocol::endpoint& next); @endcode * The @c ec parameter contains the result from the most recent connect * operation. Before the first connection attempt, @c ec is always set to * indicate success. The @c next parameter is the next endpoint to be tried. * The function object should return true if the next endpoint should be tried, * and false if it should be skipped. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the connect completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. if the sequence is empty, set to * // boost::asio::error::not_found. Otherwise, contains the * // error from the last connection attempt. * const boost::system::error_code& error, * * // On success, an iterator denoting the successfully * // connected endpoint. Otherwise, the end iterator. * Iterator iterator * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, Iterator) @endcode * * @par Example * The following connect condition function object can be used to output * information about the individual connection attempts: * @code struct my_connect_condition * { * bool operator()( * const boost::system::error_code& ec, * const::tcp::endpoint& next) * { * if (ec) std::cout << "Error: " << ec.message() << std::endl; * std::cout << "Trying: " << next << std::endl; * return true; * } * }; @endcode * It would be used with the boost::asio::connect function as follows: * @code tcp::resolver r(my_context); * tcp::resolver::query q("host", "service"); * tcp::socket s(my_context); * * // ... * * r.async_resolve(q, resolve_handler); * * // ... * * void resolve_handler( * const boost::system::error_code& ec, * tcp::resolver::iterator i) * { * if (!ec) * { * tcp::resolver::iterator end; * boost::asio::async_connect(s, i, end, * my_connect_condition(), * connect_handler); * } * } * * // ... * * void connect_handler( * const boost::system::error_code& ec, * tcp::resolver::iterator i) * { * if (ec) * { * // An error occurred. * } * else * { * std::cout << "Connected to: " << i->endpoint() << std::endl; * } * } @endcode * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the socket's @c async_connect operation. */ template <typename Protocol, typename Executor, typename Iterator, typename ConnectCondition, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, Iterator)) IteratorConnectToken = default_completion_token_t<Executor>> inline auto async_connect(basic_socket<Protocol, Executor>& s, Iterator begin, Iterator end, ConnectCondition connect_condition, IteratorConnectToken&& token = default_completion_token_t<Executor>(), constraint_t< is_connect_condition<ConnectCondition, Iterator>::value > = 0) -> decltype( async_initiate<IteratorConnectToken, void (boost::system::error_code, Iterator)>( declval<detail::initiate_async_iterator_connect<Protocol, Executor>>(), token, begin, end, connect_condition)) { return async_initiate<IteratorConnectToken, void (boost::system::error_code, Iterator)>( detail::initiate_async_iterator_connect<Protocol, Executor>(s), token, begin, end, connect_condition); } /*@}*/ } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/impl/connect.hpp> #endif // BOOST_ASIO_CONNECT_HPP
52,494
C++
.h
1,303
37.702226
80
0.727251
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,390
default_completion_token.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/default_completion_token.hpp
// // default_completion_token.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_HPP #define BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { class deferred_t; namespace detail { template <typename T, typename = void> struct default_completion_token_impl { typedef deferred_t type; }; template <typename T> struct default_completion_token_impl<T, void_t<typename T::default_completion_token_type> > { typedef typename T::default_completion_token_type type; }; } // namespace detail #if defined(GENERATING_DOCUMENTATION) /// Traits type used to determine the default completion token type associated /// with a type (such as an executor). /** * A program may specialise this traits type if the @c T template parameter in * the specialisation is a user-defined type. * * Specialisations of this trait may provide a nested typedef @c type, which is * a default-constructible completion token type. * * If not otherwise specialised, the default completion token type is * boost::asio::deferred_t. */ template <typename T> struct default_completion_token { /// If @c T has a nested type @c default_completion_token_type, /// <tt>T::default_completion_token_type</tt>. Otherwise the typedef @c type /// is boost::asio::deferred_t. typedef see_below type; }; #else template <typename T> struct default_completion_token : detail::default_completion_token_impl<T> { }; #endif template <typename T> using default_completion_token_t = typename default_completion_token<T>::type; #define BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(e) \ = typename ::boost::asio::default_completion_token<e>::type #define BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(e) \ = typename ::boost::asio::default_completion_token<e>::type() } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/deferred.hpp> #endif // BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_HPP
2,451
C++
.h
73
31.876712
79
0.750424
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,391
detached.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/detached.hpp
// // detached.hpp // ~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DETACHED_HPP #define BOOST_ASIO_DETACHED_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <memory> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// A @ref completion_token type used to specify that an asynchronous operation /// is detached. /** * The detached_t class is used to indicate that an asynchronous operation is * detached. That is, there is no completion handler waiting for the * operation's result. A detached_t object may be passed as a handler to an * asynchronous operation, typically using the special value * @c boost::asio::detached. For example: * * @code my_socket.async_send(my_buffer, boost::asio::detached); * @endcode */ class detached_t { public: /// Constructor. constexpr detached_t() { } /// Adapts an executor to add the @c detached_t completion token as the /// default. template <typename InnerExecutor> struct executor_with_default : InnerExecutor { /// Specify @c detached_t as the default completion token type. typedef detached_t default_completion_token_type; /// Construct the adapted executor from the inner executor type. executor_with_default(const InnerExecutor& ex) noexcept : InnerExecutor(ex) { } /// Convert the specified executor to the inner executor type, then use /// that to construct the adapted executor. template <typename OtherExecutor> executor_with_default(const OtherExecutor& ex, constraint_t< is_convertible<OtherExecutor, InnerExecutor>::value > = 0) noexcept : InnerExecutor(ex) { } }; /// Type alias to adapt an I/O object to use @c detached_t as its /// default completion token type. template <typename T> using as_default_on_t = typename T::template rebind_executor< executor_with_default<typename T::executor_type>>::other; /// Function helper to adapt an I/O object to use @c detached_t as its /// default completion token type. template <typename T> static typename decay_t<T>::template rebind_executor< executor_with_default<typename decay_t<T>::executor_type> >::other as_default_on(T&& object) { return typename decay_t<T>::template rebind_executor< executor_with_default<typename decay_t<T>::executor_type> >::other(static_cast<T&&>(object)); } }; /// A @ref completion_token object used to specify that an asynchronous /// operation is detached. /** * See the documentation for boost::asio::detached_t for a usage example. */ BOOST_ASIO_INLINE_VARIABLE constexpr detached_t detached; } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/impl/detached.hpp> #endif // BOOST_ASIO_DETACHED_HPP
3,195
C++
.h
91
32.032967
79
0.72215
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,392
bind_allocator.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/bind_allocator.hpp
// // bind_allocator.hpp // ~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_BIND_ALLOCATOR_HPP #define BOOST_ASIO_BIND_ALLOCATOR_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associated_allocator.hpp> #include <boost/asio/associated_executor.hpp> #include <boost/asio/associator.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/initiation_base.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { // Helper to automatically define nested typedef result_type. template <typename T, typename = void> struct allocator_binder_result_type { protected: typedef void result_type_or_void; }; template <typename T> struct allocator_binder_result_type<T, void_t<typename T::result_type>> { typedef typename T::result_type result_type; protected: typedef result_type result_type_or_void; }; template <typename R> struct allocator_binder_result_type<R(*)()> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R> struct allocator_binder_result_type<R(&)()> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R, typename A1> struct allocator_binder_result_type<R(*)(A1)> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R, typename A1> struct allocator_binder_result_type<R(&)(A1)> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R, typename A1, typename A2> struct allocator_binder_result_type<R(*)(A1, A2)> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R, typename A1, typename A2> struct allocator_binder_result_type<R(&)(A1, A2)> { typedef R result_type; protected: typedef result_type result_type_or_void; }; // Helper to automatically define nested typedef argument_type. template <typename T, typename = void> struct allocator_binder_argument_type {}; template <typename T> struct allocator_binder_argument_type<T, void_t<typename T::argument_type>> { typedef typename T::argument_type argument_type; }; template <typename R, typename A1> struct allocator_binder_argument_type<R(*)(A1)> { typedef A1 argument_type; }; template <typename R, typename A1> struct allocator_binder_argument_type<R(&)(A1)> { typedef A1 argument_type; }; // Helper to automatically define nested typedefs first_argument_type and // second_argument_type. template <typename T, typename = void> struct allocator_binder_argument_types {}; template <typename T> struct allocator_binder_argument_types<T, void_t<typename T::first_argument_type>> { typedef typename T::first_argument_type first_argument_type; typedef typename T::second_argument_type second_argument_type; }; template <typename R, typename A1, typename A2> struct allocator_binder_argument_type<R(*)(A1, A2)> { typedef A1 first_argument_type; typedef A2 second_argument_type; }; template <typename R, typename A1, typename A2> struct allocator_binder_argument_type<R(&)(A1, A2)> { typedef A1 first_argument_type; typedef A2 second_argument_type; }; } // namespace detail /// A call wrapper type to bind an allocator of type @c Allocator /// to an object of type @c T. template <typename T, typename Allocator> class allocator_binder #if !defined(GENERATING_DOCUMENTATION) : public detail::allocator_binder_result_type<T>, public detail::allocator_binder_argument_type<T>, public detail::allocator_binder_argument_types<T> #endif // !defined(GENERATING_DOCUMENTATION) { public: /// The type of the target object. typedef T target_type; /// The type of the associated allocator. typedef Allocator allocator_type; #if defined(GENERATING_DOCUMENTATION) /// The return type if a function. /** * The type of @c result_type is based on the type @c T of the wrapper's * target object: * * @li if @c T is a pointer to function type, @c result_type is a synonym for * the return type of @c T; * * @li if @c T is a class type with a member type @c result_type, then @c * result_type is a synonym for @c T::result_type; * * @li otherwise @c result_type is not defined. */ typedef see_below result_type; /// The type of the function's argument. /** * The type of @c argument_type is based on the type @c T of the wrapper's * target object: * * @li if @c T is a pointer to a function type accepting a single argument, * @c argument_type is a synonym for the return type of @c T; * * @li if @c T is a class type with a member type @c argument_type, then @c * argument_type is a synonym for @c T::argument_type; * * @li otherwise @c argument_type is not defined. */ typedef see_below argument_type; /// The type of the function's first argument. /** * The type of @c first_argument_type is based on the type @c T of the * wrapper's target object: * * @li if @c T is a pointer to a function type accepting two arguments, @c * first_argument_type is a synonym for the return type of @c T; * * @li if @c T is a class type with a member type @c first_argument_type, * then @c first_argument_type is a synonym for @c T::first_argument_type; * * @li otherwise @c first_argument_type is not defined. */ typedef see_below first_argument_type; /// The type of the function's second argument. /** * The type of @c second_argument_type is based on the type @c T of the * wrapper's target object: * * @li if @c T is a pointer to a function type accepting two arguments, @c * second_argument_type is a synonym for the return type of @c T; * * @li if @c T is a class type with a member type @c first_argument_type, * then @c second_argument_type is a synonym for @c T::second_argument_type; * * @li otherwise @c second_argument_type is not defined. */ typedef see_below second_argument_type; #endif // defined(GENERATING_DOCUMENTATION) /// Construct an allocator wrapper for the specified object. /** * This constructor is only valid if the type @c T is constructible from type * @c U. */ template <typename U> allocator_binder(const allocator_type& s, U&& u) : allocator_(s), target_(static_cast<U&&>(u)) { } /// Copy constructor. allocator_binder(const allocator_binder& other) : allocator_(other.get_allocator()), target_(other.get()) { } /// Construct a copy, but specify a different allocator. allocator_binder(const allocator_type& s, const allocator_binder& other) : allocator_(s), target_(other.get()) { } /// Construct a copy of a different allocator wrapper type. /** * This constructor is only valid if the @c Allocator type is * constructible from type @c OtherAllocator, and the type @c T is * constructible from type @c U. */ template <typename U, typename OtherAllocator> allocator_binder(const allocator_binder<U, OtherAllocator>& other, constraint_t<is_constructible<Allocator, OtherAllocator>::value> = 0, constraint_t<is_constructible<T, U>::value> = 0) : allocator_(other.get_allocator()), target_(other.get()) { } /// Construct a copy of a different allocator wrapper type, but /// specify a different allocator. /** * This constructor is only valid if the type @c T is constructible from type * @c U. */ template <typename U, typename OtherAllocator> allocator_binder(const allocator_type& s, const allocator_binder<U, OtherAllocator>& other, constraint_t<is_constructible<T, U>::value> = 0) : allocator_(s), target_(other.get()) { } /// Move constructor. allocator_binder(allocator_binder&& other) : allocator_(static_cast<allocator_type&&>( other.get_allocator())), target_(static_cast<T&&>(other.get())) { } /// Move construct the target object, but specify a different allocator. allocator_binder(const allocator_type& s, allocator_binder&& other) : allocator_(s), target_(static_cast<T&&>(other.get())) { } /// Move construct from a different allocator wrapper type. template <typename U, typename OtherAllocator> allocator_binder( allocator_binder<U, OtherAllocator>&& other, constraint_t<is_constructible<Allocator, OtherAllocator>::value> = 0, constraint_t<is_constructible<T, U>::value> = 0) : allocator_(static_cast<OtherAllocator&&>( other.get_allocator())), target_(static_cast<U&&>(other.get())) { } /// Move construct from a different allocator wrapper type, but /// specify a different allocator. template <typename U, typename OtherAllocator> allocator_binder(const allocator_type& s, allocator_binder<U, OtherAllocator>&& other, constraint_t<is_constructible<T, U>::value> = 0) : allocator_(s), target_(static_cast<U&&>(other.get())) { } /// Destructor. ~allocator_binder() { } /// Obtain a reference to the target object. target_type& get() noexcept { return target_; } /// Obtain a reference to the target object. const target_type& get() const noexcept { return target_; } /// Obtain the associated allocator. allocator_type get_allocator() const noexcept { return allocator_; } /// Forwarding function call operator. template <typename... Args> result_of_t<T(Args...)> operator()(Args&&... args) { return target_(static_cast<Args&&>(args)...); } /// Forwarding function call operator. template <typename... Args> result_of_t<T(Args...)> operator()(Args&&... args) const { return target_(static_cast<Args&&>(args)...); } private: Allocator allocator_; T target_; }; /// A function object type that adapts a @ref completion_token to specify that /// the completion handler should have the supplied allocator as its associated /// allocator. /** * May also be used directly as a completion token, in which case it adapts the * asynchronous operation's default completion token (or boost::asio::deferred * if no default is available). */ template <typename Allocator> struct partial_allocator_binder { /// Constructor that specifies associated allocator. explicit partial_allocator_binder(const Allocator& ex) : allocator_(ex) { } /// Adapt a @ref completion_token to specify that the completion handler /// should have the allocator as its associated allocator. template <typename CompletionToken> BOOST_ASIO_NODISCARD inline constexpr allocator_binder<decay_t<CompletionToken>, Allocator> operator()(CompletionToken&& completion_token) const { return allocator_binder<decay_t<CompletionToken>, Allocator>( allocator_, static_cast<CompletionToken&&>(completion_token)); } //private: Allocator allocator_; }; /// Create a partial completion token that associates an allocator. template <typename Allocator> BOOST_ASIO_NODISCARD inline partial_allocator_binder<Allocator> bind_allocator(const Allocator& ex) { return partial_allocator_binder<Allocator>(ex); } /// Associate an object of type @c T with an allocator of type /// @c Allocator. template <typename Allocator, typename T> BOOST_ASIO_NODISCARD inline allocator_binder<decay_t<T>, Allocator> bind_allocator(const Allocator& s, T&& t) { return allocator_binder<decay_t<T>, Allocator>(s, static_cast<T&&>(t)); } #if !defined(GENERATING_DOCUMENTATION) namespace detail { template <typename TargetAsyncResult, typename Allocator, typename = void> class allocator_binder_completion_handler_async_result { public: template <typename T> explicit allocator_binder_completion_handler_async_result(T&) { } }; template <typename TargetAsyncResult, typename Allocator> class allocator_binder_completion_handler_async_result< TargetAsyncResult, Allocator, void_t<typename TargetAsyncResult::completion_handler_type>> { private: TargetAsyncResult target_; public: typedef allocator_binder< typename TargetAsyncResult::completion_handler_type, Allocator> completion_handler_type; explicit allocator_binder_completion_handler_async_result( typename TargetAsyncResult::completion_handler_type& handler) : target_(handler) { } auto get() -> decltype(target_.get()) { return target_.get(); } }; template <typename TargetAsyncResult, typename = void> struct allocator_binder_async_result_return_type { }; template <typename TargetAsyncResult> struct allocator_binder_async_result_return_type< TargetAsyncResult, void_type<typename TargetAsyncResult::return_type>> { typedef typename TargetAsyncResult::return_type return_type; }; } // namespace detail template <typename T, typename Allocator, typename Signature> class async_result<allocator_binder<T, Allocator>, Signature> : public detail::allocator_binder_completion_handler_async_result< async_result<T, Signature>, Allocator>, public detail::allocator_binder_async_result_return_type< async_result<T, Signature>> { public: explicit async_result(allocator_binder<T, Allocator>& b) : detail::allocator_binder_completion_handler_async_result< async_result<T, Signature>, Allocator>(b.get()) { } template <typename Initiation> struct init_wrapper : detail::initiation_base<Initiation> { using detail::initiation_base<Initiation>::initiation_base; template <typename Handler, typename... Args> void operator()(Handler&& handler, const Allocator& a, Args&&... args) && { static_cast<Initiation&&>(*this)( allocator_binder<decay_t<Handler>, Allocator>( a, static_cast<Handler&&>(handler)), static_cast<Args&&>(args)...); } template <typename Handler, typename... Args> void operator()(Handler&& handler, const Allocator& a, Args&&... args) const & { static_cast<const Initiation&>(*this)( allocator_binder<decay_t<Handler>, Allocator>( a, static_cast<Handler&&>(handler)), static_cast<Args&&>(args)...); } }; template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate< conditional_t< is_const<remove_reference_t<RawCompletionToken>>::value, const T, T>, Signature>( declval<init_wrapper<decay_t<Initiation>>>(), token.get(), token.get_allocator(), static_cast<Args&&>(args)...)) { return async_initiate< conditional_t< is_const<remove_reference_t<RawCompletionToken>>::value, const T, T>, Signature>( init_wrapper<decay_t<Initiation>>( static_cast<Initiation&&>(initiation)), token.get(), token.get_allocator(), static_cast<Args&&>(args)...); } private: async_result(const async_result&) = delete; async_result& operator=(const async_result&) = delete; async_result<T, Signature> target_; }; template <typename Allocator, typename... Signatures> struct async_result<partial_allocator_binder<Allocator>, Signatures...> { template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate<Signatures...>( static_cast<Initiation&&>(initiation), allocator_binder< default_completion_token_t<associated_executor_t<Initiation>>, Allocator>(token.allocator_, default_completion_token_t<associated_executor_t<Initiation>>{}), static_cast<Args&&>(args)...)) { return async_initiate<Signatures...>( static_cast<Initiation&&>(initiation), allocator_binder< default_completion_token_t<associated_executor_t<Initiation>>, Allocator>(token.allocator_, default_completion_token_t<associated_executor_t<Initiation>>{}), static_cast<Args&&>(args)...); } }; template <template <typename, typename> class Associator, typename T, typename Allocator, typename DefaultCandidate> struct associator<Associator, allocator_binder<T, Allocator>, DefaultCandidate> : Associator<T, DefaultCandidate> { static typename Associator<T, DefaultCandidate>::type get( const allocator_binder<T, Allocator>& b) noexcept { return Associator<T, DefaultCandidate>::get(b.get()); } static auto get(const allocator_binder<T, Allocator>& b, const DefaultCandidate& c) noexcept -> decltype(Associator<T, DefaultCandidate>::get(b.get(), c)) { return Associator<T, DefaultCandidate>::get(b.get(), c); } }; template <typename T, typename Allocator, typename Allocator1> struct associated_allocator<allocator_binder<T, Allocator>, Allocator1> { typedef Allocator type; static auto get(const allocator_binder<T, Allocator>& b, const Allocator1& = Allocator1()) noexcept -> decltype(b.get_allocator()) { return b.get_allocator(); } }; #endif // !defined(GENERATING_DOCUMENTATION) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_BIND_ALLOCATOR_HPP
17,652
C++
.h
520
30.492308
79
0.717896
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,397
append.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/append.hpp
// // append.hpp // ~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_APPEND_HPP #define BOOST_ASIO_APPEND_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <tuple> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// Completion token type used to specify that the completion handler /// arguments should be passed additional values after the results of the /// operation. template <typename CompletionToken, typename... Values> class append_t { public: /// Constructor. template <typename T, typename... V> constexpr explicit append_t(T&& completion_token, V&&... values) : token_(static_cast<T&&>(completion_token)), values_(static_cast<V&&>(values)...) { } //private: CompletionToken token_; std::tuple<Values...> values_; }; /// Completion token type used to specify that the completion handler /// arguments should be passed additional values after the results of the /// operation. template <typename CompletionToken, typename... Values> BOOST_ASIO_NODISCARD inline constexpr append_t<decay_t<CompletionToken>, decay_t<Values>...> append(CompletionToken&& completion_token, Values&&... values) { return append_t<decay_t<CompletionToken>, decay_t<Values>...>( static_cast<CompletionToken&&>(completion_token), static_cast<Values&&>(values)...); } } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/impl/append.hpp> #endif // BOOST_ASIO_APPEND_HPP
1,867
C++
.h
55
32.036364
79
0.732222
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,399
read_at.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/read_at.hpp
// // read_at.hpp // ~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_READ_AT_HPP #define BOOST_ASIO_READ_AT_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <cstddef> #include <boost/asio/async_result.hpp> #include <boost/asio/completion_condition.hpp> #include <boost/asio/detail/cstdint.hpp> #include <boost/asio/error.hpp> #if !defined(BOOST_ASIO_NO_EXTENSIONS) # include <boost/asio/basic_streambuf_fwd.hpp> #endif // !defined(BOOST_ASIO_NO_EXTENSIONS) #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename> class initiate_async_read_at; #if !defined(BOOST_ASIO_NO_IOSTREAM) template <typename> class initiate_async_read_at_streambuf; #endif // !defined(BOOST_ASIO_NO_IOSTREAM) } // namespace detail /** * @defgroup read_at boost::asio::read_at * * @brief The @c read_at function is a composed operation that reads a certain * amount of data at the specified offset before returning. */ /*@{*/ /// Attempt to read a certain amount of data at the specified offset before /// returning. /** * This function is used to read a certain number of bytes of data from a * random access device at the specified offset. The call will block until one * of the following conditions is true: * * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the device's * read_some_at function. * * @param d The device from which the data is to be read. The type must support * the SyncRandomAccessReadDevice concept. * * @param offset The offset at which the data will be read. * * @param buffers One or more buffers into which the data will be read. The sum * of the buffer sizes indicates the maximum number of bytes to read from the * device. * * @returns The number of bytes transferred. * * @throws boost::system::system_error Thrown on failure. * * @par Example * To read into a single data buffer use the @ref buffer function as follows: * @code boost::asio::read_at(d, 42, boost::asio::buffer(data, size)); @endcode * See the @ref buffer documentation for information on reading into multiple * buffers in one go, and how to use it with arrays, boost::array or * std::vector. * * @note This overload is equivalent to calling: * @code boost::asio::read_at( * d, 42, buffers, * boost::asio::transfer_all()); @endcode */ template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence> std::size_t read_at(SyncRandomAccessReadDevice& d, uint64_t offset, const MutableBufferSequence& buffers); /// Attempt to read a certain amount of data at the specified offset before /// returning. /** * This function is used to read a certain number of bytes of data from a * random access device at the specified offset. The call will block until one * of the following conditions is true: * * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the device's * read_some_at function. * * @param d The device from which the data is to be read. The type must support * the SyncRandomAccessReadDevice concept. * * @param offset The offset at which the data will be read. * * @param buffers One or more buffers into which the data will be read. The sum * of the buffer sizes indicates the maximum number of bytes to read from the * device. * * @param ec Set to indicate what error occurred, if any. * * @returns The number of bytes transferred. * * @par Example * To read into a single data buffer use the @ref buffer function as follows: * @code boost::asio::read_at(d, 42, * boost::asio::buffer(data, size), ec); @endcode * See the @ref buffer documentation for information on reading into multiple * buffers in one go, and how to use it with arrays, boost::array or * std::vector. * * @note This overload is equivalent to calling: * @code boost::asio::read_at( * d, 42, buffers, * boost::asio::transfer_all(), ec); @endcode */ template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence> std::size_t read_at(SyncRandomAccessReadDevice& d, uint64_t offset, const MutableBufferSequence& buffers, boost::system::error_code& ec); /// Attempt to read a certain amount of data at the specified offset before /// returning. /** * This function is used to read a certain number of bytes of data from a * random access device at the specified offset. The call will block until one * of the following conditions is true: * * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the device's * read_some_at function. * * @param d The device from which the data is to be read. The type must support * the SyncRandomAccessReadDevice concept. * * @param offset The offset at which the data will be read. * * @param buffers One or more buffers into which the data will be read. The sum * of the buffer sizes indicates the maximum number of bytes to read from the * device. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest read_some_at operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the device's read_some_at function. * * @returns The number of bytes transferred. * * @throws boost::system::system_error Thrown on failure. * * @par Example * To read into a single data buffer use the @ref buffer function as follows: * @code boost::asio::read_at(d, 42, boost::asio::buffer(data, size), * boost::asio::transfer_at_least(32)); @endcode * See the @ref buffer documentation for information on reading into multiple * buffers in one go, and how to use it with arrays, boost::array or * std::vector. */ template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence, typename CompletionCondition> std::size_t read_at(SyncRandomAccessReadDevice& d, uint64_t offset, const MutableBufferSequence& buffers, CompletionCondition completion_condition, constraint_t< is_completion_condition<CompletionCondition>::value > = 0); /// Attempt to read a certain amount of data at the specified offset before /// returning. /** * This function is used to read a certain number of bytes of data from a * random access device at the specified offset. The call will block until one * of the following conditions is true: * * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the device's * read_some_at function. * * @param d The device from which the data is to be read. The type must support * the SyncRandomAccessReadDevice concept. * * @param offset The offset at which the data will be read. * * @param buffers One or more buffers into which the data will be read. The sum * of the buffer sizes indicates the maximum number of bytes to read from the * device. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest read_some_at operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the device's read_some_at function. * * @param ec Set to indicate what error occurred, if any. * * @returns The number of bytes read. If an error occurs, returns the total * number of bytes successfully transferred prior to the error. */ template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence, typename CompletionCondition> std::size_t read_at(SyncRandomAccessReadDevice& d, uint64_t offset, const MutableBufferSequence& buffers, CompletionCondition completion_condition, boost::system::error_code& ec, constraint_t< is_completion_condition<CompletionCondition>::value > = 0); #if !defined(BOOST_ASIO_NO_EXTENSIONS) #if !defined(BOOST_ASIO_NO_IOSTREAM) /// Attempt to read a certain amount of data at the specified offset before /// returning. /** * This function is used to read a certain number of bytes of data from a * random access device at the specified offset. The call will block until one * of the following conditions is true: * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the device's * read_some_at function. * * @param d The device from which the data is to be read. The type must support * the SyncRandomAccessReadDevice concept. * * @param offset The offset at which the data will be read. * * @param b The basic_streambuf object into which the data will be read. * * @returns The number of bytes transferred. * * @throws boost::system::system_error Thrown on failure. * * @note This overload is equivalent to calling: * @code boost::asio::read_at( * d, 42, b, * boost::asio::transfer_all()); @endcode */ template <typename SyncRandomAccessReadDevice, typename Allocator> std::size_t read_at(SyncRandomAccessReadDevice& d, uint64_t offset, basic_streambuf<Allocator>& b); /// Attempt to read a certain amount of data at the specified offset before /// returning. /** * This function is used to read a certain number of bytes of data from a * random access device at the specified offset. The call will block until one * of the following conditions is true: * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the device's * read_some_at function. * * @param d The device from which the data is to be read. The type must support * the SyncRandomAccessReadDevice concept. * * @param offset The offset at which the data will be read. * * @param b The basic_streambuf object into which the data will be read. * * @param ec Set to indicate what error occurred, if any. * * @returns The number of bytes transferred. * * @note This overload is equivalent to calling: * @code boost::asio::read_at( * d, 42, b, * boost::asio::transfer_all(), ec); @endcode */ template <typename SyncRandomAccessReadDevice, typename Allocator> std::size_t read_at(SyncRandomAccessReadDevice& d, uint64_t offset, basic_streambuf<Allocator>& b, boost::system::error_code& ec); /// Attempt to read a certain amount of data at the specified offset before /// returning. /** * This function is used to read a certain number of bytes of data from a * random access device at the specified offset. The call will block until one * of the following conditions is true: * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the device's * read_some_at function. * * @param d The device from which the data is to be read. The type must support * the SyncRandomAccessReadDevice concept. * * @param offset The offset at which the data will be read. * * @param b The basic_streambuf object into which the data will be read. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest read_some_at operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the device's read_some_at function. * * @returns The number of bytes transferred. * * @throws boost::system::system_error Thrown on failure. */ template <typename SyncRandomAccessReadDevice, typename Allocator, typename CompletionCondition> std::size_t read_at(SyncRandomAccessReadDevice& d, uint64_t offset, basic_streambuf<Allocator>& b, CompletionCondition completion_condition, constraint_t< is_completion_condition<CompletionCondition>::value > = 0); /// Attempt to read a certain amount of data at the specified offset before /// returning. /** * This function is used to read a certain number of bytes of data from a * random access device at the specified offset. The call will block until one * of the following conditions is true: * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the device's * read_some_at function. * * @param d The device from which the data is to be read. The type must support * the SyncRandomAccessReadDevice concept. * * @param offset The offset at which the data will be read. * * @param b The basic_streambuf object into which the data will be read. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest read_some_at operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the device's read_some_at function. * * @param ec Set to indicate what error occurred, if any. * * @returns The number of bytes read. If an error occurs, returns the total * number of bytes successfully transferred prior to the error. */ template <typename SyncRandomAccessReadDevice, typename Allocator, typename CompletionCondition> std::size_t read_at(SyncRandomAccessReadDevice& d, uint64_t offset, basic_streambuf<Allocator>& b, CompletionCondition completion_condition, boost::system::error_code& ec, constraint_t< is_completion_condition<CompletionCondition>::value > = 0); #endif // !defined(BOOST_ASIO_NO_IOSTREAM) #endif // !defined(BOOST_ASIO_NO_EXTENSIONS) /*@}*/ /** * @defgroup async_read_at boost::asio::async_read_at * * @brief The @c async_read_at function is a composed asynchronous operation * that reads a certain amount of data at the specified offset. */ /*@{*/ /// Start an asynchronous operation to read a certain amount of data at the /// specified offset. /** * This function is used to asynchronously read a certain number of bytes of * data from a random access device at the specified offset. It is an * initiating function for an @ref asynchronous_operation, and always returns * immediately. The asynchronous operation will continue until one of the * following conditions is true: * * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the device's * async_read_some_at function. * * @param d The device from which the data is to be read. The type must support * the AsyncRandomAccessReadDevice concept. * * @param offset The offset at which the data will be read. * * @param buffers One or more buffers into which the data will be read. The sum * of the buffer sizes indicates the maximum number of bytes to read from the * device. Although the buffers object may be copied as necessary, ownership of * the underlying memory blocks is retained by the caller, which must guarantee * that they remain valid until the completion handler is called. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the read completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. * const boost::system::error_code& error, * * // Number of bytes copied into the buffers. If an error * // occurred, this will be the number of bytes successfully * // transferred prior to the error. * std::size_t bytes_transferred * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, std::size_t) @endcode * * @par Example * To read into a single data buffer use the @ref buffer function as follows: * @code * boost::asio::async_read_at(d, 42, boost::asio::buffer(data, size), handler); * @endcode * See the @ref buffer documentation for information on reading into multiple * buffers in one go, and how to use it with arrays, boost::array or * std::vector. * * @note This overload is equivalent to calling: * @code boost::asio::async_read_at( * d, 42, buffers, * boost::asio::transfer_all(), * handler); @endcode * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the @c AsyncRandomAccessReadDevice type's * async_read_some_at operation. */ template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, std::size_t)) ReadToken = default_completion_token_t< typename AsyncRandomAccessReadDevice::executor_type>> inline auto async_read_at(AsyncRandomAccessReadDevice& d, uint64_t offset, const MutableBufferSequence& buffers, ReadToken&& token = default_completion_token_t< typename AsyncRandomAccessReadDevice::executor_type>(), constraint_t< !is_completion_condition<ReadToken>::value > = 0) -> decltype( async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( declval<detail::initiate_async_read_at<AsyncRandomAccessReadDevice>>(), token, offset, buffers, transfer_all())) { return async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( detail::initiate_async_read_at<AsyncRandomAccessReadDevice>(d), token, offset, buffers, transfer_all()); } /// Start an asynchronous operation to read a certain amount of data at the /// specified offset. /** * This function is used to asynchronously read a certain number of bytes of * data from a random access device at the specified offset. It is an * initiating function for an @ref asynchronous_operation, and always returns * immediately. The asynchronous operation will continue until one of the * following conditions is true: * * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * * @li The completion_condition function object returns 0. * * @param d The device from which the data is to be read. The type must support * the AsyncRandomAccessReadDevice concept. * * @param offset The offset at which the data will be read. * * @param buffers One or more buffers into which the data will be read. The sum * of the buffer sizes indicates the maximum number of bytes to read from the * device. Although the buffers object may be copied as necessary, ownership of * the underlying memory blocks is retained by the caller, which must guarantee * that they remain valid until the completion handler is called. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest async_read_some_at operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the device's async_read_some_at function. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the read completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. * const boost::system::error_code& error, * * // Number of bytes copied into the buffers. If an error * // occurred, this will be the number of bytes successfully * // transferred prior to the error. * std::size_t bytes_transferred * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, std::size_t) @endcode * * @par Example * To read into a single data buffer use the @ref buffer function as follows: * @code boost::asio::async_read_at(d, 42, * boost::asio::buffer(data, size), * boost::asio::transfer_at_least(32), * handler); @endcode * See the @ref buffer documentation for information on reading into multiple * buffers in one go, and how to use it with arrays, boost::array or * std::vector. * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the @c AsyncRandomAccessReadDevice type's * async_read_some_at operation. */ template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename CompletionCondition, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, std::size_t)) ReadToken = default_completion_token_t< typename AsyncRandomAccessReadDevice::executor_type>> inline auto async_read_at(AsyncRandomAccessReadDevice& d, uint64_t offset, const MutableBufferSequence& buffers, CompletionCondition completion_condition, ReadToken&& token = default_completion_token_t< typename AsyncRandomAccessReadDevice::executor_type>(), constraint_t< is_completion_condition<CompletionCondition>::value > = 0) -> decltype( async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( declval<detail::initiate_async_read_at<AsyncRandomAccessReadDevice>>(), token, offset, buffers, static_cast<CompletionCondition&&>(completion_condition))) { return async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( detail::initiate_async_read_at<AsyncRandomAccessReadDevice>(d), token, offset, buffers, static_cast<CompletionCondition&&>(completion_condition)); } #if !defined(BOOST_ASIO_NO_EXTENSIONS) #if !defined(BOOST_ASIO_NO_IOSTREAM) /// Start an asynchronous operation to read a certain amount of data at the /// specified offset. /** * This function is used to asynchronously read a certain number of bytes of * data from a random access device at the specified offset. It is an * initiating function for an @ref asynchronous_operation, and always returns * immediately. The asynchronous operation will continue until one of the * following conditions is true: * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the device's * async_read_some_at function. * * @param d The device from which the data is to be read. The type must support * the AsyncRandomAccessReadDevice concept. * * @param offset The offset at which the data will be read. * * @param b A basic_streambuf object into which the data will be read. Ownership * of the streambuf is retained by the caller, which must guarantee that it * remains valid until the completion handler is called. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the read completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. * const boost::system::error_code& error, * * // Number of bytes copied into the buffers. If an error * // occurred, this will be the number of bytes successfully * // transferred prior to the error. * std::size_t bytes_transferred * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, std::size_t) @endcode * * @note This overload is equivalent to calling: * @code boost::asio::async_read_at( * d, 42, b, * boost::asio::transfer_all(), * handler); @endcode * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the @c AsyncRandomAccessReadDevice type's * async_read_some_at operation. */ template <typename AsyncRandomAccessReadDevice, typename Allocator, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, std::size_t)) ReadToken = default_completion_token_t< typename AsyncRandomAccessReadDevice::executor_type>> inline auto async_read_at(AsyncRandomAccessReadDevice& d, uint64_t offset, basic_streambuf<Allocator>& b, ReadToken&& token = default_completion_token_t< typename AsyncRandomAccessReadDevice::executor_type>(), constraint_t< !is_completion_condition<ReadToken>::value > = 0) -> decltype( async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( declval<detail::initiate_async_read_at_streambuf< AsyncRandomAccessReadDevice>>(), token, offset, &b, transfer_all())) { return async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( detail::initiate_async_read_at_streambuf<AsyncRandomAccessReadDevice>(d), token, offset, &b, transfer_all()); } /// Start an asynchronous operation to read a certain amount of data at the /// specified offset. /** * This function is used to asynchronously read a certain number of bytes of * data from a random access device at the specified offset. It is an * initiating function for an @ref asynchronous_operation, and always returns * immediately. The asynchronous operation will continue until one of the * following conditions is true: * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the device's * async_read_some_at function. * * @param d The device from which the data is to be read. The type must support * the AsyncRandomAccessReadDevice concept. * * @param offset The offset at which the data will be read. * * @param b A basic_streambuf object into which the data will be read. Ownership * of the streambuf is retained by the caller, which must guarantee that it * remains valid until the completion handler is called. * * @param completion_condition The function object to be called to determine * whether the read operation is complete. The signature of the function object * must be: * @code std::size_t completion_condition( * // Result of latest async_read_some_at operation. * const boost::system::error_code& error, * * // Number of bytes transferred so far. * std::size_t bytes_transferred * ); @endcode * A return value of 0 indicates that the read operation is complete. A non-zero * return value indicates the maximum number of bytes to be read on the next * call to the device's async_read_some_at function. * * @param token The @ref completion_token that will be used to produce a * completion handler, which will be called when the read completes. * Potential completion tokens include @ref use_future, @ref use_awaitable, * @ref yield_context, or a function object with the correct completion * signature. The function signature of the completion handler must be: * @code void handler( * // Result of operation. * const boost::system::error_code& error, * * // Number of bytes copied into the buffers. If an error * // occurred, this will be the number of bytes successfully * // transferred prior to the error. * std::size_t bytes_transferred * ); @endcode * Regardless of whether the asynchronous operation completes immediately or * not, the completion handler will not be invoked from within this function. * On immediate completion, invocation of the handler will be performed in a * manner equivalent to using boost::asio::async_immediate(). * * @par Completion Signature * @code void(boost::system::error_code, std::size_t) @endcode * * @par Per-Operation Cancellation * This asynchronous operation supports cancellation for the following * boost::asio::cancellation_type values: * * @li @c cancellation_type::terminal * * @li @c cancellation_type::partial * * if they are also supported by the @c AsyncRandomAccessReadDevice type's * async_read_some_at operation. */ template <typename AsyncRandomAccessReadDevice, typename Allocator, typename CompletionCondition, BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, std::size_t)) ReadToken = default_completion_token_t< typename AsyncRandomAccessReadDevice::executor_type>> inline auto async_read_at(AsyncRandomAccessReadDevice& d, uint64_t offset, basic_streambuf<Allocator>& b, CompletionCondition completion_condition, ReadToken&& token = default_completion_token_t< typename AsyncRandomAccessReadDevice::executor_type>(), constraint_t< is_completion_condition<CompletionCondition>::value > = 0) -> decltype( async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( declval<detail::initiate_async_read_at_streambuf< AsyncRandomAccessReadDevice>>(), token, offset, &b, static_cast<CompletionCondition&&>(completion_condition))) { return async_initiate<ReadToken, void (boost::system::error_code, std::size_t)>( detail::initiate_async_read_at_streambuf<AsyncRandomAccessReadDevice>(d), token, offset, &b, static_cast<CompletionCondition&&>(completion_condition)); } #endif // !defined(BOOST_ASIO_NO_IOSTREAM) #endif // !defined(BOOST_ASIO_NO_EXTENSIONS) /*@}*/ } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/impl/read_at.hpp> #endif // BOOST_ASIO_READ_AT_HPP
32,942
C++
.h
799
38.782228
80
0.747602
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,402
use_awaitable.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/use_awaitable.hpp
// // use_awaitable.hpp // ~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_USE_AWAITABLE_HPP #define BOOST_ASIO_USE_AWAITABLE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #if defined(BOOST_ASIO_HAS_CO_AWAIT) || defined(GENERATING_DOCUMENTATION) #include <boost/asio/awaitable.hpp> #include <boost/asio/detail/handler_tracking.hpp> #if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) # if defined(BOOST_ASIO_HAS_SOURCE_LOCATION) # include <boost/asio/detail/source_location.hpp> # endif // defined(BOOST_ASIO_HAS_SOURCE_LOCATION) #endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// A @ref completion_token that represents the currently executing coroutine. /** * The @c use_awaitable_t class, with its value @c use_awaitable, is used to * represent the currently executing coroutine. This completion token may be * passed as a handler to an asynchronous operation. For example: * * @code awaitable<void> my_coroutine() * { * std::size_t n = co_await my_socket.async_read_some(buffer, use_awaitable); * ... * } @endcode * * When used with co_await, the initiating function (@c async_read_some in the * above example) suspends the current coroutine. The coroutine is resumed when * the asynchronous operation completes, and the result of the operation is * returned. */ template <typename Executor = any_io_executor> struct use_awaitable_t { /// Default constructor. constexpr use_awaitable_t( #if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) # if defined(BOOST_ASIO_HAS_SOURCE_LOCATION) detail::source_location location = detail::source_location::current() # endif // defined(BOOST_ASIO_HAS_SOURCE_LOCATION) #endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) ) #if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) # if defined(BOOST_ASIO_HAS_SOURCE_LOCATION) : file_name_(location.file_name()), line_(location.line()), function_name_(location.function_name()) # else // defined(BOOST_ASIO_HAS_SOURCE_LOCATION) : file_name_(0), line_(0), function_name_(0) # endif // defined(BOOST_ASIO_HAS_SOURCE_LOCATION) #endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) { } /// Constructor used to specify file name, line, and function name. constexpr use_awaitable_t(const char* file_name, int line, const char* function_name) #if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) : file_name_(file_name), line_(line), function_name_(function_name) #endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) { #if !defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) (void)file_name; (void)line; (void)function_name; #endif // !defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) } /// Adapts an executor to add the @c use_awaitable_t completion token as the /// default. template <typename InnerExecutor> struct executor_with_default : InnerExecutor { /// Specify @c use_awaitable_t as the default completion token type. typedef use_awaitable_t default_completion_token_type; /// Construct the adapted executor from the inner executor type. template <typename InnerExecutor1> executor_with_default(const InnerExecutor1& ex, constraint_t< conditional_t< !is_same<InnerExecutor1, executor_with_default>::value, is_convertible<InnerExecutor1, InnerExecutor>, false_type >::value > = 0) noexcept : InnerExecutor(ex) { } }; /// Type alias to adapt an I/O object to use @c use_awaitable_t as its /// default completion token type. template <typename T> using as_default_on_t = typename T::template rebind_executor< executor_with_default<typename T::executor_type>>::other; /// Function helper to adapt an I/O object to use @c use_awaitable_t as its /// default completion token type. template <typename T> static typename decay_t<T>::template rebind_executor< executor_with_default<typename decay_t<T>::executor_type> >::other as_default_on(T&& object) { return typename decay_t<T>::template rebind_executor< executor_with_default<typename decay_t<T>::executor_type> >::other(static_cast<T&&>(object)); } #if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) const char* file_name_; int line_; const char* function_name_; #endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) }; /// A @ref completion_token object that represents the currently executing /// coroutine. /** * See the documentation for boost::asio::use_awaitable_t for a usage example. */ #if defined(GENERATING_DOCUMENTATION) BOOST_ASIO_INLINE_VARIABLE constexpr use_awaitable_t<> use_awaitable; #else BOOST_ASIO_INLINE_VARIABLE constexpr use_awaitable_t<> use_awaitable(0, 0, 0); #endif } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/impl/use_awaitable.hpp> #endif // defined(BOOST_ASIO_HAS_CO_AWAIT) || defined(GENERATING_DOCUMENTATION) #endif // BOOST_ASIO_USE_AWAITABLE_HPP
5,387
C++
.h
142
34.753521
79
0.727412
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,403
prefer.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/prefer.hpp
// // prefer.hpp // ~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_PREFER_HPP #define BOOST_ASIO_PREFER_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/is_applicable_property.hpp> #include <boost/asio/traits/prefer_free.hpp> #include <boost/asio/traits/prefer_member.hpp> #include <boost/asio/traits/require_free.hpp> #include <boost/asio/traits/require_member.hpp> #include <boost/asio/traits/static_require.hpp> #include <boost/asio/detail/push_options.hpp> #if defined(GENERATING_DOCUMENTATION) namespace boost { namespace asio { /// A customisation point that attempts to apply a property to an object. /** * The name <tt>prefer</tt> denotes a customisation point object. The * expression <tt>boost::asio::prefer(E, P0, Pn...)</tt> for some subexpressions * <tt>E</tt> and <tt>P0</tt>, and where <tt>Pn...</tt> represents <tt>N</tt> * subexpressions (where <tt>N</tt> is 0 or more, and with types <tt>T = * decay_t<decltype(E)></tt> and <tt>Prop0 = decay_t<decltype(P0)></tt>) is * expression-equivalent to: * * @li If <tt>is_applicable_property_v<T, Prop0> && Prop0::is_preferable</tt> is * not a well-formed constant expression with value <tt>true</tt>, * <tt>boost::asio::prefer(E, P0, Pn...)</tt> is ill-formed. * * @li Otherwise, <tt>E</tt> if <tt>N == 0</tt> and the expression * <tt>Prop0::template static_query_v<T> == Prop0::value()</tt> is a * well-formed constant expression with value <tt>true</tt>. * * @li Otherwise, <tt>(E).require(P0)</tt> if <tt>N == 0</tt> and the expression * <tt>(E).require(P0)</tt> is a valid expression. * * @li Otherwise, <tt>require(E, P0)</tt> if <tt>N == 0</tt> and the expression * <tt>require(E, P0)</tt> is a valid expression with overload resolution * performed in a context that does not include the declaration of the * <tt>require</tt> customization point object. * * @li Otherwise, <tt>(E).prefer(P0)</tt> if <tt>N == 0</tt> and the expression * <tt>(E).prefer(P0)</tt> is a valid expression. * * @li Otherwise, <tt>prefer(E, P0)</tt> if <tt>N == 0</tt> and the expression * <tt>prefer(E, P0)</tt> is a valid expression with overload resolution * performed in a context that does not include the declaration of the * <tt>prefer</tt> customization point object. * * @li Otherwise, <tt>E</tt> if <tt>N == 0</tt>. * * @li Otherwise, * <tt>boost::asio::prefer(boost::asio::prefer(E, P0), Pn...)</tt> * if <tt>N > 0</tt> and the expression * <tt>boost::asio::prefer(boost::asio::prefer(E, P0), Pn...)</tt> * is a valid expression. * * @li Otherwise, <tt>boost::asio::prefer(E, P0, Pn...)</tt> is ill-formed. */ inline constexpr unspecified prefer = unspecified; /// A type trait that determines whether a @c prefer expression is well-formed. /** * Class template @c can_prefer is a trait that is derived from * @c true_type if the expression <tt>boost::asio::prefer(std::declval<T>(), * std::declval<Properties>()...)</tt> is well formed; otherwise @c false_type. */ template <typename T, typename... Properties> struct can_prefer : integral_constant<bool, automatically_determined> { }; /// A type trait that determines whether a @c prefer expression will not throw. /** * Class template @c is_nothrow_prefer is a trait that is derived from * @c true_type if the expression <tt>boost::asio::prefer(std::declval<T>(), * std::declval<Properties>()...)</tt> is @c noexcept; otherwise @c false_type. */ template <typename T, typename... Properties> struct is_nothrow_prefer : integral_constant<bool, automatically_determined> { }; /// A type trait that determines the result type of a @c prefer expression. /** * Class template @c prefer_result is a trait that determines the result * type of the expression <tt>boost::asio::prefer(std::declval<T>(), * std::declval<Properties>()...)</tt>. */ template <typename T, typename... Properties> struct prefer_result { /// The result of the @c prefer expression. typedef automatically_determined type; }; } // namespace asio } // namespace boost #else // defined(GENERATING_DOCUMENTATION) namespace boost_asio_prefer_fn { using boost::asio::conditional_t; using boost::asio::decay_t; using boost::asio::declval; using boost::asio::enable_if_t; using boost::asio::is_applicable_property; using boost::asio::traits::prefer_free; using boost::asio::traits::prefer_member; using boost::asio::traits::require_free; using boost::asio::traits::require_member; using boost::asio::traits::static_require; void prefer(); void require(); enum overload_type { identity, call_require_member, call_require_free, call_prefer_member, call_prefer_free, two_props, n_props, ill_formed }; template <typename Impl, typename T, typename Properties, typename = void, typename = void, typename = void, typename = void, typename = void, typename = void, typename = void> struct call_traits { static constexpr overload_type overload = ill_formed; static constexpr bool is_noexcept = false; typedef void result_type; }; template <typename Impl, typename T, typename Property> struct call_traits<Impl, T, void(Property), enable_if_t< is_applicable_property< decay_t<T>, decay_t<Property> >::value >, enable_if_t< decay_t<Property>::is_preferable >, enable_if_t< static_require<T, Property>::is_valid >> { static constexpr overload_type overload = identity; static constexpr bool is_noexcept = true; typedef T&& result_type; }; template <typename Impl, typename T, typename Property> struct call_traits<Impl, T, void(Property), enable_if_t< is_applicable_property< decay_t<T>, decay_t<Property> >::value >, enable_if_t< decay_t<Property>::is_preferable >, enable_if_t< !static_require<T, Property>::is_valid >, enable_if_t< require_member<typename Impl::template proxy<T>::type, Property>::is_valid >> : require_member<typename Impl::template proxy<T>::type, Property> { static constexpr overload_type overload = call_require_member; }; template <typename Impl, typename T, typename Property> struct call_traits<Impl, T, void(Property), enable_if_t< is_applicable_property< decay_t<T>, decay_t<Property> >::value >, enable_if_t< decay_t<Property>::is_preferable >, enable_if_t< !static_require<T, Property>::is_valid >, enable_if_t< !require_member<typename Impl::template proxy<T>::type, Property>::is_valid >, enable_if_t< require_free<T, Property>::is_valid >> : require_free<T, Property> { static constexpr overload_type overload = call_require_free; }; template <typename Impl, typename T, typename Property> struct call_traits<Impl, T, void(Property), enable_if_t< is_applicable_property< decay_t<T>, decay_t<Property> >::value >, enable_if_t< decay_t<Property>::is_preferable >, enable_if_t< !static_require<T, Property>::is_valid >, enable_if_t< !require_member<typename Impl::template proxy<T>::type, Property>::is_valid >, enable_if_t< !require_free<T, Property>::is_valid >, enable_if_t< prefer_member<typename Impl::template proxy<T>::type, Property>::is_valid >> : prefer_member<typename Impl::template proxy<T>::type, Property> { static constexpr overload_type overload = call_prefer_member; }; template <typename Impl, typename T, typename Property> struct call_traits<Impl, T, void(Property), enable_if_t< is_applicable_property< decay_t<T>, decay_t<Property> >::value >, enable_if_t< decay_t<Property>::is_preferable >, enable_if_t< !static_require<T, Property>::is_valid >, enable_if_t< !require_member<typename Impl::template proxy<T>::type, Property>::is_valid >, enable_if_t< !require_free<T, Property>::is_valid >, enable_if_t< !prefer_member<typename Impl::template proxy<T>::type, Property>::is_valid >, enable_if_t< prefer_free<T, Property>::is_valid >> : prefer_free<T, Property> { static constexpr overload_type overload = call_prefer_free; }; template <typename Impl, typename T, typename Property> struct call_traits<Impl, T, void(Property), enable_if_t< is_applicable_property< decay_t<T>, decay_t<Property> >::value >, enable_if_t< decay_t<Property>::is_preferable >, enable_if_t< !static_require<T, Property>::is_valid >, enable_if_t< !require_member<typename Impl::template proxy<T>::type, Property>::is_valid >, enable_if_t< !require_free<T, Property>::is_valid >, enable_if_t< !prefer_member<typename Impl::template proxy<T>::type, Property>::is_valid >, enable_if_t< !prefer_free<T, Property>::is_valid >> { static constexpr overload_type overload = identity; static constexpr bool is_noexcept = true; typedef T&& result_type; }; template <typename Impl, typename T, typename P0, typename P1> struct call_traits<Impl, T, void(P0, P1), enable_if_t< call_traits<Impl, T, void(P0)>::overload != ill_formed >, enable_if_t< call_traits< Impl, typename call_traits<Impl, T, void(P0)>::result_type, void(P1) >::overload != ill_formed >> { static constexpr overload_type overload = two_props; static constexpr bool is_noexcept = ( call_traits<Impl, T, void(P0)>::is_noexcept && call_traits< Impl, typename call_traits<Impl, T, void(P0)>::result_type, void(P1) >::is_noexcept ); typedef decay_t< typename call_traits< Impl, typename call_traits<Impl, T, void(P0)>::result_type, void(P1) >::result_type > result_type; }; template <typename Impl, typename T, typename P0, typename P1, typename... PN> struct call_traits<Impl, T, void(P0, P1, PN...), enable_if_t< call_traits<Impl, T, void(P0)>::overload != ill_formed >, enable_if_t< call_traits< Impl, typename call_traits<Impl, T, void(P0)>::result_type, void(P1, PN...) >::overload != ill_formed >> { static constexpr overload_type overload = n_props; static constexpr bool is_noexcept = ( call_traits<Impl, T, void(P0)>::is_noexcept && call_traits< Impl, typename call_traits<Impl, T, void(P0)>::result_type, void(P1, PN...) >::is_noexcept ); typedef decay_t< typename call_traits< Impl, typename call_traits<Impl, T, void(P0)>::result_type, void(P1, PN...) >::result_type > result_type; }; struct impl { template <typename T> struct proxy { #if defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) \ && defined(BOOST_ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT) struct type { template <typename P> auto require(P&& p) noexcept( noexcept( declval<conditional_t<true, T, P>>().require(static_cast<P&&>(p)) ) ) -> decltype( declval<conditional_t<true, T, P>>().require(static_cast<P&&>(p)) ); template <typename P> auto prefer(P&& p) noexcept( noexcept( declval<conditional_t<true, T, P>>().prefer(static_cast<P&&>(p)) ) ) -> decltype( declval<conditional_t<true, T, P>>().prefer(static_cast<P&&>(p)) ); }; #else // defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) // && defined(BOOST_ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT) typedef T type; #endif // defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) // && defined(BOOST_ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT) }; template <typename T, typename Property> BOOST_ASIO_NODISCARD constexpr enable_if_t< call_traits<impl, T, void(Property)>::overload == identity, typename call_traits<impl, T, void(Property)>::result_type > operator()(T&& t, Property&&) const noexcept(call_traits<impl, T, void(Property)>::is_noexcept) { return static_cast<T&&>(t); } template <typename T, typename Property> BOOST_ASIO_NODISCARD constexpr enable_if_t< call_traits<impl, T, void(Property)>::overload == call_require_member, typename call_traits<impl, T, void(Property)>::result_type > operator()(T&& t, Property&& p) const noexcept(call_traits<impl, T, void(Property)>::is_noexcept) { return static_cast<T&&>(t).require(static_cast<Property&&>(p)); } template <typename T, typename Property> BOOST_ASIO_NODISCARD constexpr enable_if_t< call_traits<impl, T, void(Property)>::overload == call_require_free, typename call_traits<impl, T, void(Property)>::result_type > operator()(T&& t, Property&& p) const noexcept(call_traits<impl, T, void(Property)>::is_noexcept) { return require(static_cast<T&&>(t), static_cast<Property&&>(p)); } template <typename T, typename Property> BOOST_ASIO_NODISCARD constexpr enable_if_t< call_traits<impl, T, void(Property)>::overload == call_prefer_member, typename call_traits<impl, T, void(Property)>::result_type > operator()(T&& t, Property&& p) const noexcept(call_traits<impl, T, void(Property)>::is_noexcept) { return static_cast<T&&>(t).prefer(static_cast<Property&&>(p)); } template <typename T, typename Property> BOOST_ASIO_NODISCARD constexpr enable_if_t< call_traits<impl, T, void(Property)>::overload == call_prefer_free, typename call_traits<impl, T, void(Property)>::result_type > operator()(T&& t, Property&& p) const noexcept(call_traits<impl, T, void(Property)>::is_noexcept) { return prefer(static_cast<T&&>(t), static_cast<Property&&>(p)); } template <typename T, typename P0, typename P1> BOOST_ASIO_NODISCARD constexpr enable_if_t< call_traits<impl, T, void(P0, P1)>::overload == two_props, typename call_traits<impl, T, void(P0, P1)>::result_type > operator()(T&& t, P0&& p0, P1&& p1) const noexcept(call_traits<impl, T, void(P0, P1)>::is_noexcept) { return (*this)( (*this)(static_cast<T&&>(t), static_cast<P0&&>(p0)), static_cast<P1&&>(p1)); } template <typename T, typename P0, typename P1, typename... PN> BOOST_ASIO_NODISCARD constexpr enable_if_t< call_traits<impl, T, void(P0, P1, PN...)>::overload == n_props, typename call_traits<impl, T, void(P0, P1, PN...)>::result_type > operator()(T&& t, P0&& p0, P1&& p1, PN&&... pn) const noexcept(call_traits<impl, T, void(P0, P1, PN...)>::is_noexcept) { return (*this)( (*this)(static_cast<T&&>(t), static_cast<P0&&>(p0)), static_cast<P1&&>(p1), static_cast<PN&&>(pn)...); } }; template <typename T = impl> struct static_instance { static const T instance; }; template <typename T> const T static_instance<T>::instance = {}; } // namespace boost_asio_prefer_fn namespace boost { namespace asio { namespace { static constexpr const boost_asio_prefer_fn::impl& prefer = boost_asio_prefer_fn::static_instance<>::instance; } // namespace typedef boost_asio_prefer_fn::impl prefer_t; template <typename T, typename... Properties> struct can_prefer : integral_constant<bool, boost_asio_prefer_fn::call_traits< prefer_t, T, void(Properties...)>::overload != boost_asio_prefer_fn::ill_formed> { }; #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) template <typename T, typename... Properties> constexpr bool can_prefer_v = can_prefer<T, Properties...>::value; #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) template <typename T, typename... Properties> struct is_nothrow_prefer : integral_constant<bool, boost_asio_prefer_fn::call_traits< prefer_t, T, void(Properties...)>::is_noexcept> { }; #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) template <typename T, typename... Properties> constexpr bool is_nothrow_prefer_v = is_nothrow_prefer<T, Properties...>::value; #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) template <typename T, typename... Properties> struct prefer_result { typedef typename boost_asio_prefer_fn::call_traits< prefer_t, T, void(Properties...)>::result_type type; }; template <typename T, typename... Properties> using prefer_result_t = typename prefer_result<T, Properties...>::type; } // namespace asio } // namespace boost #endif // defined(GENERATING_DOCUMENTATION) #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_PREFER_HPP
16,754
C++
.h
521
28.700576
80
0.681444
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,404
bind_cancellation_slot.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/bind_cancellation_slot.hpp
// // bind_cancellation_slot.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_BIND_CANCELLATION_SLOT_HPP #define BOOST_ASIO_BIND_CANCELLATION_SLOT_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associated_cancellation_slot.hpp> #include <boost/asio/associated_executor.hpp> #include <boost/asio/associator.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/initiation_base.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { // Helper to automatically define nested typedef result_type. template <typename T, typename = void> struct cancellation_slot_binder_result_type { protected: typedef void result_type_or_void; }; template <typename T> struct cancellation_slot_binder_result_type<T, void_t<typename T::result_type>> { typedef typename T::result_type result_type; protected: typedef result_type result_type_or_void; }; template <typename R> struct cancellation_slot_binder_result_type<R(*)()> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R> struct cancellation_slot_binder_result_type<R(&)()> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R, typename A1> struct cancellation_slot_binder_result_type<R(*)(A1)> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R, typename A1> struct cancellation_slot_binder_result_type<R(&)(A1)> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R, typename A1, typename A2> struct cancellation_slot_binder_result_type<R(*)(A1, A2)> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R, typename A1, typename A2> struct cancellation_slot_binder_result_type<R(&)(A1, A2)> { typedef R result_type; protected: typedef result_type result_type_or_void; }; // Helper to automatically define nested typedef argument_type. template <typename T, typename = void> struct cancellation_slot_binder_argument_type {}; template <typename T> struct cancellation_slot_binder_argument_type<T, void_t<typename T::argument_type>> { typedef typename T::argument_type argument_type; }; template <typename R, typename A1> struct cancellation_slot_binder_argument_type<R(*)(A1)> { typedef A1 argument_type; }; template <typename R, typename A1> struct cancellation_slot_binder_argument_type<R(&)(A1)> { typedef A1 argument_type; }; // Helper to automatically define nested typedefs first_argument_type and // second_argument_type. template <typename T, typename = void> struct cancellation_slot_binder_argument_types {}; template <typename T> struct cancellation_slot_binder_argument_types<T, void_t<typename T::first_argument_type>> { typedef typename T::first_argument_type first_argument_type; typedef typename T::second_argument_type second_argument_type; }; template <typename R, typename A1, typename A2> struct cancellation_slot_binder_argument_type<R(*)(A1, A2)> { typedef A1 first_argument_type; typedef A2 second_argument_type; }; template <typename R, typename A1, typename A2> struct cancellation_slot_binder_argument_type<R(&)(A1, A2)> { typedef A1 first_argument_type; typedef A2 second_argument_type; }; } // namespace detail /// A call wrapper type to bind a cancellation slot of type @c CancellationSlot /// to an object of type @c T. template <typename T, typename CancellationSlot> class cancellation_slot_binder #if !defined(GENERATING_DOCUMENTATION) : public detail::cancellation_slot_binder_result_type<T>, public detail::cancellation_slot_binder_argument_type<T>, public detail::cancellation_slot_binder_argument_types<T> #endif // !defined(GENERATING_DOCUMENTATION) { public: /// The type of the target object. typedef T target_type; /// The type of the associated cancellation slot. typedef CancellationSlot cancellation_slot_type; #if defined(GENERATING_DOCUMENTATION) /// The return type if a function. /** * The type of @c result_type is based on the type @c T of the wrapper's * target object: * * @li if @c T is a pointer to function type, @c result_type is a synonym for * the return type of @c T; * * @li if @c T is a class type with a member type @c result_type, then @c * result_type is a synonym for @c T::result_type; * * @li otherwise @c result_type is not defined. */ typedef see_below result_type; /// The type of the function's argument. /** * The type of @c argument_type is based on the type @c T of the wrapper's * target object: * * @li if @c T is a pointer to a function type accepting a single argument, * @c argument_type is a synonym for the return type of @c T; * * @li if @c T is a class type with a member type @c argument_type, then @c * argument_type is a synonym for @c T::argument_type; * * @li otherwise @c argument_type is not defined. */ typedef see_below argument_type; /// The type of the function's first argument. /** * The type of @c first_argument_type is based on the type @c T of the * wrapper's target object: * * @li if @c T is a pointer to a function type accepting two arguments, @c * first_argument_type is a synonym for the return type of @c T; * * @li if @c T is a class type with a member type @c first_argument_type, * then @c first_argument_type is a synonym for @c T::first_argument_type; * * @li otherwise @c first_argument_type is not defined. */ typedef see_below first_argument_type; /// The type of the function's second argument. /** * The type of @c second_argument_type is based on the type @c T of the * wrapper's target object: * * @li if @c T is a pointer to a function type accepting two arguments, @c * second_argument_type is a synonym for the return type of @c T; * * @li if @c T is a class type with a member type @c first_argument_type, * then @c second_argument_type is a synonym for @c T::second_argument_type; * * @li otherwise @c second_argument_type is not defined. */ typedef see_below second_argument_type; #endif // defined(GENERATING_DOCUMENTATION) /// Construct a cancellation slot wrapper for the specified object. /** * This constructor is only valid if the type @c T is constructible from type * @c U. */ template <typename U> cancellation_slot_binder(const cancellation_slot_type& s, U&& u) : slot_(s), target_(static_cast<U&&>(u)) { } /// Copy constructor. cancellation_slot_binder(const cancellation_slot_binder& other) : slot_(other.get_cancellation_slot()), target_(other.get()) { } /// Construct a copy, but specify a different cancellation slot. cancellation_slot_binder(const cancellation_slot_type& s, const cancellation_slot_binder& other) : slot_(s), target_(other.get()) { } /// Construct a copy of a different cancellation slot wrapper type. /** * This constructor is only valid if the @c CancellationSlot type is * constructible from type @c OtherCancellationSlot, and the type @c T is * constructible from type @c U. */ template <typename U, typename OtherCancellationSlot> cancellation_slot_binder( const cancellation_slot_binder<U, OtherCancellationSlot>& other, constraint_t<is_constructible<CancellationSlot, OtherCancellationSlot>::value> = 0, constraint_t<is_constructible<T, U>::value> = 0) : slot_(other.get_cancellation_slot()), target_(other.get()) { } /// Construct a copy of a different cancellation slot wrapper type, but /// specify a different cancellation slot. /** * This constructor is only valid if the type @c T is constructible from type * @c U. */ template <typename U, typename OtherCancellationSlot> cancellation_slot_binder(const cancellation_slot_type& s, const cancellation_slot_binder<U, OtherCancellationSlot>& other, constraint_t<is_constructible<T, U>::value> = 0) : slot_(s), target_(other.get()) { } /// Move constructor. cancellation_slot_binder(cancellation_slot_binder&& other) : slot_(static_cast<cancellation_slot_type&&>( other.get_cancellation_slot())), target_(static_cast<T&&>(other.get())) { } /// Move construct the target object, but specify a different cancellation /// slot. cancellation_slot_binder(const cancellation_slot_type& s, cancellation_slot_binder&& other) : slot_(s), target_(static_cast<T&&>(other.get())) { } /// Move construct from a different cancellation slot wrapper type. template <typename U, typename OtherCancellationSlot> cancellation_slot_binder( cancellation_slot_binder<U, OtherCancellationSlot>&& other, constraint_t<is_constructible<CancellationSlot, OtherCancellationSlot>::value> = 0, constraint_t<is_constructible<T, U>::value> = 0) : slot_(static_cast<OtherCancellationSlot&&>( other.get_cancellation_slot())), target_(static_cast<U&&>(other.get())) { } /// Move construct from a different cancellation slot wrapper type, but /// specify a different cancellation slot. template <typename U, typename OtherCancellationSlot> cancellation_slot_binder(const cancellation_slot_type& s, cancellation_slot_binder<U, OtherCancellationSlot>&& other, constraint_t<is_constructible<T, U>::value> = 0) : slot_(s), target_(static_cast<U&&>(other.get())) { } /// Destructor. ~cancellation_slot_binder() { } /// Obtain a reference to the target object. target_type& get() noexcept { return target_; } /// Obtain a reference to the target object. const target_type& get() const noexcept { return target_; } /// Obtain the associated cancellation slot. cancellation_slot_type get_cancellation_slot() const noexcept { return slot_; } /// Forwarding function call operator. template <typename... Args> result_of_t<T(Args...)> operator()(Args&&... args) { return target_(static_cast<Args&&>(args)...); } /// Forwarding function call operator. template <typename... Args> result_of_t<T(Args...)> operator()(Args&&... args) const { return target_(static_cast<Args&&>(args)...); } private: CancellationSlot slot_; T target_; }; /// A function object type that adapts a @ref completion_token to specify that /// the completion handler should have the supplied cancellation slot as its /// associated cancellation slot. /** * May also be used directly as a completion token, in which case it adapts the * asynchronous operation's default completion token (or boost::asio::deferred * if no default is available). */ template <typename CancellationSlot> struct partial_cancellation_slot_binder { /// Constructor that specifies associated cancellation slot. explicit partial_cancellation_slot_binder(const CancellationSlot& ex) : cancellation_slot_(ex) { } /// Adapt a @ref completion_token to specify that the completion handler /// should have the cancellation slot as its associated cancellation slot. template <typename CompletionToken> BOOST_ASIO_NODISCARD inline constexpr cancellation_slot_binder<decay_t<CompletionToken>, CancellationSlot> operator()(CompletionToken&& completion_token) const { return cancellation_slot_binder<decay_t<CompletionToken>, CancellationSlot>( static_cast<CompletionToken&&>(completion_token), cancellation_slot_); } //private: CancellationSlot cancellation_slot_; }; /// Create a partial completion token that associates a cancellation slot. template <typename CancellationSlot> BOOST_ASIO_NODISCARD inline partial_cancellation_slot_binder<CancellationSlot> bind_cancellation_slot(const CancellationSlot& ex) { return partial_cancellation_slot_binder<CancellationSlot>(ex); } /// Associate an object of type @c T with a cancellation slot of type /// @c CancellationSlot. template <typename CancellationSlot, typename T> BOOST_ASIO_NODISCARD inline cancellation_slot_binder<decay_t<T>, CancellationSlot> bind_cancellation_slot(const CancellationSlot& s, T&& t) { return cancellation_slot_binder<decay_t<T>, CancellationSlot>( s, static_cast<T&&>(t)); } #if !defined(GENERATING_DOCUMENTATION) namespace detail { template <typename TargetAsyncResult, typename CancellationSlot, typename = void> class cancellation_slot_binder_completion_handler_async_result { public: template <typename T> explicit cancellation_slot_binder_completion_handler_async_result(T&) { } }; template <typename TargetAsyncResult, typename CancellationSlot> class cancellation_slot_binder_completion_handler_async_result< TargetAsyncResult, CancellationSlot, void_t<typename TargetAsyncResult::completion_handler_type>> { private: TargetAsyncResult target_; public: typedef cancellation_slot_binder< typename TargetAsyncResult::completion_handler_type, CancellationSlot> completion_handler_type; explicit cancellation_slot_binder_completion_handler_async_result( typename TargetAsyncResult::completion_handler_type& handler) : target_(handler) { } auto get() -> decltype(target_.get()) { return target_.get(); } }; template <typename TargetAsyncResult, typename = void> struct cancellation_slot_binder_async_result_return_type { }; template <typename TargetAsyncResult> struct cancellation_slot_binder_async_result_return_type< TargetAsyncResult, void_t<typename TargetAsyncResult::return_type>> { typedef typename TargetAsyncResult::return_type return_type; }; } // namespace detail template <typename T, typename CancellationSlot, typename Signature> class async_result<cancellation_slot_binder<T, CancellationSlot>, Signature> : public detail::cancellation_slot_binder_completion_handler_async_result< async_result<T, Signature>, CancellationSlot>, public detail::cancellation_slot_binder_async_result_return_type< async_result<T, Signature>> { public: explicit async_result(cancellation_slot_binder<T, CancellationSlot>& b) : detail::cancellation_slot_binder_completion_handler_async_result< async_result<T, Signature>, CancellationSlot>(b.get()) { } template <typename Initiation> struct init_wrapper : detail::initiation_base<Initiation> { using detail::initiation_base<Initiation>::initiation_base; template <typename Handler, typename... Args> void operator()(Handler&& handler, const CancellationSlot& slot, Args&&... args) && { static_cast<Initiation&&>(*this)( cancellation_slot_binder<decay_t<Handler>, CancellationSlot>( slot, static_cast<Handler&&>(handler)), static_cast<Args&&>(args)...); } template <typename Handler, typename... Args> void operator()(Handler&& handler, const CancellationSlot& slot, Args&&... args) const & { static_cast<const Initiation&>(*this)( cancellation_slot_binder<decay_t<Handler>, CancellationSlot>( slot, static_cast<Handler&&>(handler)), static_cast<Args&&>(args)...); } }; template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate< conditional_t< is_const<remove_reference_t<RawCompletionToken>>::value, const T, T>, Signature>( declval<init_wrapper<decay_t<Initiation>>>(), token.get(), token.get_cancellation_slot(), static_cast<Args&&>(args)...)) { return async_initiate< conditional_t< is_const<remove_reference_t<RawCompletionToken>>::value, const T, T>, Signature>( init_wrapper<decay_t<Initiation>>( static_cast<Initiation&&>(initiation)), token.get(), token.get_cancellation_slot(), static_cast<Args&&>(args)...); } private: async_result(const async_result&) = delete; async_result& operator=(const async_result&) = delete; async_result<T, Signature> target_; }; template <typename CancellationSlot, typename... Signatures> struct async_result<partial_cancellation_slot_binder<CancellationSlot>, Signatures...> { template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate<Signatures...>( static_cast<Initiation&&>(initiation), cancellation_slot_binder< default_completion_token_t<associated_executor_t<Initiation>>, CancellationSlot>(token.cancellation_slot_, default_completion_token_t<associated_executor_t<Initiation>>{}), static_cast<Args&&>(args)...)) { return async_initiate<Signatures...>( static_cast<Initiation&&>(initiation), cancellation_slot_binder< default_completion_token_t<associated_executor_t<Initiation>>, CancellationSlot>(token.cancellation_slot_, default_completion_token_t<associated_executor_t<Initiation>>{}), static_cast<Args&&>(args)...); } }; template <template <typename, typename> class Associator, typename T, typename CancellationSlot, typename DefaultCandidate> struct associator<Associator, cancellation_slot_binder<T, CancellationSlot>, DefaultCandidate> : Associator<T, DefaultCandidate> { static typename Associator<T, DefaultCandidate>::type get( const cancellation_slot_binder<T, CancellationSlot>& b) noexcept { return Associator<T, DefaultCandidate>::get(b.get()); } static auto get(const cancellation_slot_binder<T, CancellationSlot>& b, const DefaultCandidate& c) noexcept -> decltype(Associator<T, DefaultCandidate>::get(b.get(), c)) { return Associator<T, DefaultCandidate>::get(b.get(), c); } }; template <typename T, typename CancellationSlot, typename CancellationSlot1> struct associated_cancellation_slot< cancellation_slot_binder<T, CancellationSlot>, CancellationSlot1> { typedef CancellationSlot type; static auto get(const cancellation_slot_binder<T, CancellationSlot>& b, const CancellationSlot1& = CancellationSlot1()) noexcept -> decltype(b.get_cancellation_slot()) { return b.get_cancellation_slot(); } }; #endif // !defined(GENERATING_DOCUMENTATION) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_BIND_CANCELLATION_SLOT_HPP
19,075
C++
.h
537
31.981378
80
0.728386
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,409
bind_executor.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/bind_executor.hpp
// // bind_executor.hpp // ~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_BIND_EXECUTOR_HPP #define BOOST_ASIO_BIND_EXECUTOR_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associated_executor.hpp> #include <boost/asio/associator.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/initiation_base.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/executor.hpp> #include <boost/asio/execution_context.hpp> #include <boost/asio/is_executor.hpp> #include <boost/asio/uses_executor.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { // Helper to automatically define nested typedef result_type. template <typename T, typename = void> struct executor_binder_result_type { protected: typedef void result_type_or_void; }; template <typename T> struct executor_binder_result_type<T, void_t<typename T::result_type>> { typedef typename T::result_type result_type; protected: typedef result_type result_type_or_void; }; template <typename R> struct executor_binder_result_type<R(*)()> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R> struct executor_binder_result_type<R(&)()> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R, typename A1> struct executor_binder_result_type<R(*)(A1)> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R, typename A1> struct executor_binder_result_type<R(&)(A1)> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R, typename A1, typename A2> struct executor_binder_result_type<R(*)(A1, A2)> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R, typename A1, typename A2> struct executor_binder_result_type<R(&)(A1, A2)> { typedef R result_type; protected: typedef result_type result_type_or_void; }; // Helper to automatically define nested typedef argument_type. template <typename T, typename = void> struct executor_binder_argument_type {}; template <typename T> struct executor_binder_argument_type<T, void_t<typename T::argument_type>> { typedef typename T::argument_type argument_type; }; template <typename R, typename A1> struct executor_binder_argument_type<R(*)(A1)> { typedef A1 argument_type; }; template <typename R, typename A1> struct executor_binder_argument_type<R(&)(A1)> { typedef A1 argument_type; }; // Helper to automatically define nested typedefs first_argument_type and // second_argument_type. template <typename T, typename = void> struct executor_binder_argument_types {}; template <typename T> struct executor_binder_argument_types<T, void_t<typename T::first_argument_type>> { typedef typename T::first_argument_type first_argument_type; typedef typename T::second_argument_type second_argument_type; }; template <typename R, typename A1, typename A2> struct executor_binder_argument_type<R(*)(A1, A2)> { typedef A1 first_argument_type; typedef A2 second_argument_type; }; template <typename R, typename A1, typename A2> struct executor_binder_argument_type<R(&)(A1, A2)> { typedef A1 first_argument_type; typedef A2 second_argument_type; }; // Helper to perform uses_executor construction of the target type, if // required. template <typename T, typename Executor, bool UsesExecutor> class executor_binder_base; template <typename T, typename Executor> class executor_binder_base<T, Executor, true> { protected: template <typename E, typename U> executor_binder_base(E&& e, U&& u) : executor_(static_cast<E&&>(e)), target_(executor_arg_t(), executor_, static_cast<U&&>(u)) { } Executor executor_; T target_; }; template <typename T, typename Executor> class executor_binder_base<T, Executor, false> { protected: template <typename E, typename U> executor_binder_base(E&& e, U&& u) : executor_(static_cast<E&&>(e)), target_(static_cast<U&&>(u)) { } Executor executor_; T target_; }; } // namespace detail /// A call wrapper type to bind an executor of type @c Executor to an object of /// type @c T. template <typename T, typename Executor> class executor_binder #if !defined(GENERATING_DOCUMENTATION) : public detail::executor_binder_result_type<T>, public detail::executor_binder_argument_type<T>, public detail::executor_binder_argument_types<T>, private detail::executor_binder_base< T, Executor, uses_executor<T, Executor>::value> #endif // !defined(GENERATING_DOCUMENTATION) { public: /// The type of the target object. typedef T target_type; /// The type of the associated executor. typedef Executor executor_type; #if defined(GENERATING_DOCUMENTATION) /// The return type if a function. /** * The type of @c result_type is based on the type @c T of the wrapper's * target object: * * @li if @c T is a pointer to function type, @c result_type is a synonym for * the return type of @c T; * * @li if @c T is a class type with a member type @c result_type, then @c * result_type is a synonym for @c T::result_type; * * @li otherwise @c result_type is not defined. */ typedef see_below result_type; /// The type of the function's argument. /** * The type of @c argument_type is based on the type @c T of the wrapper's * target object: * * @li if @c T is a pointer to a function type accepting a single argument, * @c argument_type is a synonym for the return type of @c T; * * @li if @c T is a class type with a member type @c argument_type, then @c * argument_type is a synonym for @c T::argument_type; * * @li otherwise @c argument_type is not defined. */ typedef see_below argument_type; /// The type of the function's first argument. /** * The type of @c first_argument_type is based on the type @c T of the * wrapper's target object: * * @li if @c T is a pointer to a function type accepting two arguments, @c * first_argument_type is a synonym for the return type of @c T; * * @li if @c T is a class type with a member type @c first_argument_type, * then @c first_argument_type is a synonym for @c T::first_argument_type; * * @li otherwise @c first_argument_type is not defined. */ typedef see_below first_argument_type; /// The type of the function's second argument. /** * The type of @c second_argument_type is based on the type @c T of the * wrapper's target object: * * @li if @c T is a pointer to a function type accepting two arguments, @c * second_argument_type is a synonym for the return type of @c T; * * @li if @c T is a class type with a member type @c first_argument_type, * then @c second_argument_type is a synonym for @c T::second_argument_type; * * @li otherwise @c second_argument_type is not defined. */ typedef see_below second_argument_type; #endif // defined(GENERATING_DOCUMENTATION) /// Construct an executor wrapper for the specified object. /** * This constructor is only valid if the type @c T is constructible from type * @c U. */ template <typename U> executor_binder(executor_arg_t, const executor_type& e, U&& u) : base_type(e, static_cast<U&&>(u)) { } /// Copy constructor. executor_binder(const executor_binder& other) : base_type(other.get_executor(), other.get()) { } /// Construct a copy, but specify a different executor. executor_binder(executor_arg_t, const executor_type& e, const executor_binder& other) : base_type(e, other.get()) { } /// Construct a copy of a different executor wrapper type. /** * This constructor is only valid if the @c Executor type is constructible * from type @c OtherExecutor, and the type @c T is constructible from type * @c U. */ template <typename U, typename OtherExecutor> executor_binder(const executor_binder<U, OtherExecutor>& other, constraint_t<is_constructible<Executor, OtherExecutor>::value> = 0, constraint_t<is_constructible<T, U>::value> = 0) : base_type(other.get_executor(), other.get()) { } /// Construct a copy of a different executor wrapper type, but specify a /// different executor. /** * This constructor is only valid if the type @c T is constructible from type * @c U. */ template <typename U, typename OtherExecutor> executor_binder(executor_arg_t, const executor_type& e, const executor_binder<U, OtherExecutor>& other, constraint_t<is_constructible<T, U>::value> = 0) : base_type(e, other.get()) { } /// Move constructor. executor_binder(executor_binder&& other) : base_type(static_cast<executor_type&&>(other.get_executor()), static_cast<T&&>(other.get())) { } /// Move construct the target object, but specify a different executor. executor_binder(executor_arg_t, const executor_type& e, executor_binder&& other) : base_type(e, static_cast<T&&>(other.get())) { } /// Move construct from a different executor wrapper type. template <typename U, typename OtherExecutor> executor_binder(executor_binder<U, OtherExecutor>&& other, constraint_t<is_constructible<Executor, OtherExecutor>::value> = 0, constraint_t<is_constructible<T, U>::value> = 0) : base_type(static_cast<OtherExecutor&&>(other.get_executor()), static_cast<U&&>(other.get())) { } /// Move construct from a different executor wrapper type, but specify a /// different executor. template <typename U, typename OtherExecutor> executor_binder(executor_arg_t, const executor_type& e, executor_binder<U, OtherExecutor>&& other, constraint_t<is_constructible<T, U>::value> = 0) : base_type(e, static_cast<U&&>(other.get())) { } /// Destructor. ~executor_binder() { } /// Obtain a reference to the target object. target_type& get() noexcept { return this->target_; } /// Obtain a reference to the target object. const target_type& get() const noexcept { return this->target_; } /// Obtain the associated executor. executor_type get_executor() const noexcept { return this->executor_; } /// Forwarding function call operator. template <typename... Args> result_of_t<T(Args...)> operator()(Args&&... args) { return this->target_(static_cast<Args&&>(args)...); } /// Forwarding function call operator. template <typename... Args> result_of_t<T(Args...)> operator()(Args&&... args) const { return this->target_(static_cast<Args&&>(args)...); } private: typedef detail::executor_binder_base<T, Executor, uses_executor<T, Executor>::value> base_type; }; /// A function object type that adapts a @ref completion_token to specify that /// the completion handler should have the supplied executor as its associated /// executor. /** * May also be used directly as a completion token, in which case it adapts the * asynchronous operation's default completion token (or boost::asio::deferred * if no default is available). */ template <typename Executor> struct partial_executor_binder { /// Constructor that specifies associated executor. explicit partial_executor_binder(const Executor& ex) : executor_(ex) { } /// Adapt a @ref completion_token to specify that the completion handler /// should have the executor as its associated executor. template <typename CompletionToken> BOOST_ASIO_NODISCARD inline constexpr executor_binder<decay_t<CompletionToken>, Executor> operator()(CompletionToken&& completion_token) const { return executor_binder<decay_t<CompletionToken>, Executor>(executor_arg_t(), static_cast<CompletionToken&&>(completion_token), executor_); } //private: Executor executor_; }; /// Create a partial completion token that associates an executor. template <typename Executor> BOOST_ASIO_NODISCARD inline partial_executor_binder<Executor> bind_executor(const Executor& ex, constraint_t< is_executor<Executor>::value || execution::is_executor<Executor>::value > = 0) { return partial_executor_binder<Executor>(ex); } /// Associate an object of type @c T with an executor of type @c Executor. template <typename Executor, typename T> BOOST_ASIO_NODISCARD inline executor_binder<decay_t<T>, Executor> bind_executor(const Executor& ex, T&& t, constraint_t< is_executor<Executor>::value || execution::is_executor<Executor>::value > = 0) { return executor_binder<decay_t<T>, Executor>( executor_arg_t(), ex, static_cast<T&&>(t)); } /// Create a partial completion token that associates an execution context's /// executor. template <typename ExecutionContext> BOOST_ASIO_NODISCARD inline partial_executor_binder< typename ExecutionContext::executor_type> bind_executor(ExecutionContext& ctx, constraint_t< is_convertible<ExecutionContext&, execution_context&>::value > = 0) { return partial_executor_binder<typename ExecutionContext::executor_type>( ctx.get_executor()); } /// Associate an object of type @c T with an execution context's executor. template <typename ExecutionContext, typename T> BOOST_ASIO_NODISCARD inline executor_binder<decay_t<T>, typename ExecutionContext::executor_type> bind_executor(ExecutionContext& ctx, T&& t, constraint_t< is_convertible<ExecutionContext&, execution_context&>::value > = 0) { return executor_binder<decay_t<T>, typename ExecutionContext::executor_type>( executor_arg_t(), ctx.get_executor(), static_cast<T&&>(t)); } #if !defined(GENERATING_DOCUMENTATION) template <typename T, typename Executor> struct uses_executor<executor_binder<T, Executor>, Executor> : true_type {}; namespace detail { template <typename TargetAsyncResult, typename Executor, typename = void> class executor_binder_completion_handler_async_result { public: template <typename T> explicit executor_binder_completion_handler_async_result(T&) { } }; template <typename TargetAsyncResult, typename Executor> class executor_binder_completion_handler_async_result< TargetAsyncResult, Executor, void_t<typename TargetAsyncResult::completion_handler_type >> { private: TargetAsyncResult target_; public: typedef executor_binder< typename TargetAsyncResult::completion_handler_type, Executor> completion_handler_type; explicit executor_binder_completion_handler_async_result( typename TargetAsyncResult::completion_handler_type& handler) : target_(handler) { } auto get() -> decltype(target_.get()) { return target_.get(); } }; template <typename TargetAsyncResult, typename = void> struct executor_binder_async_result_return_type { }; template <typename TargetAsyncResult> struct executor_binder_async_result_return_type<TargetAsyncResult, void_t<typename TargetAsyncResult::return_type>> { typedef typename TargetAsyncResult::return_type return_type; }; } // namespace detail template <typename T, typename Executor, typename Signature> class async_result<executor_binder<T, Executor>, Signature> : public detail::executor_binder_completion_handler_async_result< async_result<T, Signature>, Executor>, public detail::executor_binder_async_result_return_type< async_result<T, Signature>> { public: explicit async_result(executor_binder<T, Executor>& b) : detail::executor_binder_completion_handler_async_result< async_result<T, Signature>, Executor>(b.get()) { } template <typename Initiation> struct init_wrapper : detail::initiation_base<Initiation> { using detail::initiation_base<Initiation>::initiation_base; template <typename Handler, typename... Args> void operator()(Handler&& handler, const Executor& e, Args&&... args) && { static_cast<Initiation&&>(*this)( executor_binder<decay_t<Handler>, Executor>( executor_arg_t(), e, static_cast<Handler&&>(handler)), static_cast<Args&&>(args)...); } template <typename Handler, typename... Args> void operator()(Handler&& handler, const Executor& e, Args&&... args) const & { static_cast<const Initiation&>(*this)( executor_binder<decay_t<Handler>, Executor>( executor_arg_t(), e, static_cast<Handler&&>(handler)), static_cast<Args&&>(args)...); } }; template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate< conditional_t< is_const<remove_reference_t<RawCompletionToken>>::value, const T, T>, Signature>( declval<init_wrapper<decay_t<Initiation>>>(), token.get(), token.get_executor(), static_cast<Args&&>(args)...)) { return async_initiate< conditional_t< is_const<remove_reference_t<RawCompletionToken>>::value, const T, T>, Signature>( init_wrapper<decay_t<Initiation>>( static_cast<Initiation&&>(initiation)), token.get(), token.get_executor(), static_cast<Args&&>(args)...); } private: async_result(const async_result&) = delete; async_result& operator=(const async_result&) = delete; }; template <typename Executor, typename... Signatures> struct async_result<partial_executor_binder<Executor>, Signatures...> { template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate<Signatures...>( static_cast<Initiation&&>(initiation), executor_binder< default_completion_token_t<associated_executor_t<Initiation>>, Executor>(executor_arg_t(), token.executor_, default_completion_token_t<associated_executor_t<Initiation>>{}), static_cast<Args&&>(args)...)) { return async_initiate<Signatures...>( static_cast<Initiation&&>(initiation), executor_binder< default_completion_token_t<associated_executor_t<Initiation>>, Executor>(executor_arg_t(), token.executor_, default_completion_token_t<associated_executor_t<Initiation>>{}), static_cast<Args&&>(args)...); } }; template <template <typename, typename> class Associator, typename T, typename Executor, typename DefaultCandidate> struct associator<Associator, executor_binder<T, Executor>, DefaultCandidate> : Associator<T, DefaultCandidate> { static typename Associator<T, DefaultCandidate>::type get( const executor_binder<T, Executor>& b) noexcept { return Associator<T, DefaultCandidate>::get(b.get()); } static auto get(const executor_binder<T, Executor>& b, const DefaultCandidate& c) noexcept -> decltype(Associator<T, DefaultCandidate>::get(b.get(), c)) { return Associator<T, DefaultCandidate>::get(b.get(), c); } }; template <typename T, typename Executor, typename Executor1> struct associated_executor<executor_binder<T, Executor>, Executor1> { typedef Executor type; static auto get(const executor_binder<T, Executor>& b, const Executor1& = Executor1()) noexcept -> decltype(b.get_executor()) { return b.get_executor(); } }; #endif // !defined(GENERATING_DOCUMENTATION) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_BIND_EXECUTOR_HPP
19,902
C++
.h
580
30.944828
80
0.718237
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,410
prepend.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/prepend.hpp
// // prepend.hpp // ~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_PREPEND_HPP #define BOOST_ASIO_PREPEND_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <tuple> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// Completion token type used to specify that the completion handler /// arguments should be passed additional values before the results of the /// operation. template <typename CompletionToken, typename... Values> class prepend_t { public: /// Constructor. template <typename T, typename... V> constexpr explicit prepend_t(T&& completion_token, V&&... values) : token_(static_cast<T&&>(completion_token)), values_(static_cast<V&&>(values)...) { } //private: CompletionToken token_; std::tuple<Values...> values_; }; /// Completion token type used to specify that the completion handler /// arguments should be passed additional values before the results of the /// operation. template <typename CompletionToken, typename... Values> BOOST_ASIO_NODISCARD inline constexpr prepend_t<decay_t<CompletionToken>, decay_t<Values>...> prepend(CompletionToken&& completion_token, Values&&... values) { return prepend_t<decay_t<CompletionToken>, decay_t<Values>...>( static_cast<CompletionToken&&>(completion_token), static_cast<Values&&>(values)...); } } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/impl/prepend.hpp> #endif // BOOST_ASIO_PREPEND_HPP
1,884
C++
.h
56
31.678571
79
0.732379
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,411
cancel_after.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/cancel_after.hpp
// // cancel_after.hpp // ~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_CANCEL_AFTER_HPP #define BOOST_ASIO_CANCEL_AFTER_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/basic_waitable_timer.hpp> #include <boost/asio/cancellation_type.hpp> #include <boost/asio/detail/chrono.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/wait_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// A @ref completion_token adapter that cancels an operation after a timeout. /** * The cancel_after_t class is used to indicate that an asynchronous operation * should be cancelled if not complete before the specified duration has * elapsed. */ template <typename CompletionToken, typename Clock, typename WaitTraits = boost::asio::wait_traits<Clock>> class cancel_after_t { public: /// Constructor. template <typename T> cancel_after_t(T&& completion_token, const typename Clock::duration& timeout, cancellation_type_t cancel_type = cancellation_type::terminal) : token_(static_cast<T&&>(completion_token)), timeout_(timeout), cancel_type_(cancel_type) { } //private: CompletionToken token_; typename Clock::duration timeout_; cancellation_type_t cancel_type_; }; /// A @ref completion_token adapter that cancels an operation after a timeout. /** * The cancel_after_timer class is used to indicate that an asynchronous * operation should be cancelled if not complete before the specified duration * has elapsed. */ template <typename CompletionToken, typename Clock, typename WaitTraits = boost::asio::wait_traits<Clock>, typename Executor = any_io_executor> class cancel_after_timer { public: /// Constructor. template <typename T> cancel_after_timer(T&& completion_token, basic_waitable_timer<Clock, WaitTraits, Executor>& timer, const typename Clock::duration& timeout, cancellation_type_t cancel_type = cancellation_type::terminal) : token_(static_cast<T&&>(completion_token)), timer_(timer), timeout_(timeout), cancel_type_(cancel_type) { } //private: CompletionToken token_; basic_waitable_timer<Clock, WaitTraits, Executor>& timer_; typename Clock::duration timeout_; cancellation_type_t cancel_type_; }; /// A function object type that adapts a @ref completion_token to cancel an /// operation after a timeout. /** * May also be used directly as a completion token, in which case it adapts the * asynchronous operation's default completion token (or boost::asio::deferred * if no default is available). */ template <typename Clock, typename WaitTraits = boost::asio::wait_traits<Clock>> class partial_cancel_after { public: /// Constructor that specifies the timeout duration and cancellation type. explicit partial_cancel_after(const typename Clock::duration& timeout, cancellation_type_t cancel_type = cancellation_type::terminal) : timeout_(timeout), cancel_type_(cancel_type) { } /// Adapt a @ref completion_token to specify that the completion handler /// arguments should be combined into a single tuple argument. template <typename CompletionToken> BOOST_ASIO_NODISCARD inline cancel_after_t<decay_t<CompletionToken>, Clock, WaitTraits> operator()(CompletionToken&& completion_token) const { return cancel_after_t<decay_t<CompletionToken>, Clock, WaitTraits>( static_cast<CompletionToken&&>(completion_token), timeout_, cancel_type_); } //private: typename Clock::duration timeout_; cancellation_type_t cancel_type_; }; /// A function object type that adapts a @ref completion_token to cancel an /// operation after a timeout. /** * May also be used directly as a completion token, in which case it adapts the * asynchronous operation's default completion token (or boost::asio::deferred * if no default is available). */ template <typename Clock, typename WaitTraits = boost::asio::wait_traits<Clock>, typename Executor = any_io_executor> class partial_cancel_after_timer { public: /// Constructor that specifies the timeout duration and cancellation type. explicit partial_cancel_after_timer( basic_waitable_timer<Clock, WaitTraits, Executor>& timer, const typename Clock::duration& timeout, cancellation_type_t cancel_type = cancellation_type::terminal) : timer_(timer), timeout_(timeout), cancel_type_(cancel_type) { } /// Adapt a @ref completion_token to specify that the completion handler /// arguments should be combined into a single tuple argument. template <typename CompletionToken> BOOST_ASIO_NODISCARD inline cancel_after_timer<decay_t<CompletionToken>, Clock, WaitTraits, Executor> operator()(CompletionToken&& completion_token) const { return cancel_after_timer<decay_t<CompletionToken>, Clock, WaitTraits, Executor>( static_cast<CompletionToken&&>(completion_token), timeout_, cancel_type_); } //private: basic_waitable_timer<Clock, WaitTraits, Executor>& timer_; typename Clock::duration timeout_; cancellation_type_t cancel_type_; }; /// Create a partial completion token adapter that cancels an operation if not /// complete before the specified relative timeout has elapsed. /** * @par Thread Safety * When an asynchronous operation is used with cancel_after, a timer async_wait * operation is performed in parallel to the main operation. If this parallel * async_wait completes first, a cancellation request is emitted to cancel the * main operation. Consequently, the application must ensure that the * asynchronous operation is performed within an implicit or explicit strand. */ template <typename Rep, typename Period> BOOST_ASIO_NODISCARD inline partial_cancel_after<chrono::steady_clock> cancel_after(const chrono::duration<Rep, Period>& timeout, cancellation_type_t cancel_type = cancellation_type::terminal) { return partial_cancel_after<chrono::steady_clock>(timeout, cancel_type); } /// Create a partial completion token adapter that cancels an operation if not /// complete before the specified relative timeout has elapsed. /** * @par Thread Safety * When an asynchronous operation is used with cancel_after, a timer async_wait * operation is performed in parallel to the main operation. If this parallel * async_wait completes first, a cancellation request is emitted to cancel the * main operation. Consequently, the application must ensure that the * asynchronous operation is performed within an implicit or explicit strand. */ template <typename Clock, typename WaitTraits, typename Executor, typename Rep, typename Period> BOOST_ASIO_NODISCARD inline partial_cancel_after_timer<Clock, WaitTraits, Executor> cancel_after(basic_waitable_timer<Clock, WaitTraits, Executor>& timer, const chrono::duration<Rep, Period>& timeout, cancellation_type_t cancel_type = cancellation_type::terminal) { return partial_cancel_after_timer<Clock, WaitTraits, Executor>( timer, timeout, cancel_type); } /// Adapt a @ref completion_token to cancel an operation if not complete before /// the specified relative timeout has elapsed. /** * @par Thread Safety * When an asynchronous operation is used with cancel_after, a timer async_wait * operation is performed in parallel to the main operation. If this parallel * async_wait completes first, a cancellation request is emitted to cancel the * main operation. Consequently, the application must ensure that the * asynchronous operation is performed within an implicit or explicit strand. */ template <typename Rep, typename Period, typename CompletionToken> BOOST_ASIO_NODISCARD inline cancel_after_t<decay_t<CompletionToken>, chrono::steady_clock> cancel_after(const chrono::duration<Rep, Period>& timeout, CompletionToken&& completion_token) { return cancel_after_t<decay_t<CompletionToken>, chrono::steady_clock>( static_cast<CompletionToken&&>(completion_token), timeout, cancellation_type::terminal); } /// Adapt a @ref completion_token to cancel an operation if not complete before /// the specified relative timeout has elapsed. /** * @par Thread Safety * When an asynchronous operation is used with cancel_after, a timer async_wait * operation is performed in parallel to the main operation. If this parallel * async_wait completes first, a cancellation request is emitted to cancel the * main operation. Consequently, the application must ensure that the * asynchronous operation is performed within an implicit or explicit strand. */ template <typename Rep, typename Period, typename CompletionToken> BOOST_ASIO_NODISCARD inline cancel_after_t<decay_t<CompletionToken>, chrono::steady_clock> cancel_after(const chrono::duration<Rep, Period>& timeout, cancellation_type_t cancel_type, CompletionToken&& completion_token) { return cancel_after_t<decay_t<CompletionToken>, chrono::steady_clock>( static_cast<CompletionToken&&>(completion_token), timeout, cancel_type); } /// Adapt a @ref completion_token to cancel an operation if not complete before /// the specified relative timeout has elapsed. /** * @par Thread Safety * When an asynchronous operation is used with cancel_after, a timer async_wait * operation is performed in parallel to the main operation. If this parallel * async_wait completes first, a cancellation request is emitted to cancel the * main operation. Consequently, the application must ensure that the * asynchronous operation is performed within an implicit or explicit strand. */ template <typename Clock, typename WaitTraits, typename Executor, typename Rep, typename Period, typename CompletionToken> BOOST_ASIO_NODISCARD inline cancel_after_timer<decay_t<CompletionToken>, Clock, WaitTraits, Executor> cancel_after(basic_waitable_timer<Clock, WaitTraits, Executor>& timer, const chrono::duration<Rep, Period>& timeout, CompletionToken&& completion_token) { return cancel_after_timer<decay_t<CompletionToken>, Clock, WaitTraits, Executor>( static_cast<CompletionToken&&>(completion_token), timer, timeout, cancellation_type::terminal); } /// Adapt a @ref completion_token to cancel an operation if not complete before /// the specified relative timeout has elapsed. /** * @par Thread Safety * When an asynchronous operation is used with cancel_after, a timer async_wait * operation is performed in parallel to the main operation. If this parallel * async_wait completes first, a cancellation request is emitted to cancel the * main operation. Consequently, the application must ensure that the * asynchronous operation is performed within an implicit or explicit strand. */ template <typename Clock, typename WaitTraits, typename Executor, typename Rep, typename Period, typename CompletionToken> BOOST_ASIO_NODISCARD inline cancel_after_timer<decay_t<CompletionToken>, chrono::steady_clock> cancel_after(basic_waitable_timer<Clock, WaitTraits, Executor>& timer, const chrono::duration<Rep, Period>& timeout, cancellation_type_t cancel_type, CompletionToken&& completion_token) { return cancel_after_timer<decay_t<CompletionToken>, Clock, WaitTraits, Executor>( static_cast<CompletionToken&&>(completion_token), timer, timeout, cancel_type); } } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/impl/cancel_after.hpp> #endif // BOOST_ASIO_CANCEL_AFTER_HPP
11,800
C++
.h
278
39.773381
80
0.768287
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,413
associated_cancellation_slot.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/associated_cancellation_slot.hpp
// // associated_cancellation_slot.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_ASSOCIATED_CANCELLATION_SLOT_HPP #define BOOST_ASIO_ASSOCIATED_CANCELLATION_SLOT_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associator.hpp> #include <boost/asio/cancellation_signal.hpp> #include <boost/asio/detail/functional.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { template <typename T, typename CancellationSlot> struct associated_cancellation_slot; namespace detail { template <typename T, typename = void> struct has_cancellation_slot_type : false_type { }; template <typename T> struct has_cancellation_slot_type<T, void_t<typename T::cancellation_slot_type>> : true_type { }; template <typename T, typename S, typename = void, typename = void> struct associated_cancellation_slot_impl { typedef void asio_associated_cancellation_slot_is_unspecialised; typedef S type; static type get(const T&) noexcept { return type(); } static const type& get(const T&, const S& s) noexcept { return s; } }; template <typename T, typename S> struct associated_cancellation_slot_impl<T, S, void_t<typename T::cancellation_slot_type>> { typedef typename T::cancellation_slot_type type; static auto get(const T& t) noexcept -> decltype(t.get_cancellation_slot()) { return t.get_cancellation_slot(); } static auto get(const T& t, const S&) noexcept -> decltype(t.get_cancellation_slot()) { return t.get_cancellation_slot(); } }; template <typename T, typename S> struct associated_cancellation_slot_impl<T, S, enable_if_t< !has_cancellation_slot_type<T>::value >, void_t< typename associator<associated_cancellation_slot, T, S>::type >> : associator<associated_cancellation_slot, T, S> { }; } // namespace detail /// Traits type used to obtain the cancellation_slot associated with an object. /** * A program may specialise this traits type if the @c T template parameter in * the specialisation is a user-defined type. The template parameter @c * CancellationSlot shall be a type meeting the CancellationSlot requirements. * * Specialisations shall meet the following requirements, where @c t is a const * reference to an object of type @c T, and @c s is an object of type @c * CancellationSlot. * * @li Provide a nested typedef @c type that identifies a type meeting the * CancellationSlot requirements. * * @li Provide a noexcept static member function named @c get, callable as @c * get(t) and with return type @c type or a (possibly const) reference to @c * type. * * @li Provide a noexcept static member function named @c get, callable as @c * get(t,s) and with return type @c type or a (possibly const) reference to @c * type. */ template <typename T, typename CancellationSlot = cancellation_slot> struct associated_cancellation_slot #if !defined(GENERATING_DOCUMENTATION) : detail::associated_cancellation_slot_impl<T, CancellationSlot> #endif // !defined(GENERATING_DOCUMENTATION) { #if defined(GENERATING_DOCUMENTATION) /// If @c T has a nested type @c cancellation_slot_type, /// <tt>T::cancellation_slot_type</tt>. Otherwise /// @c CancellationSlot. typedef see_below type; /// If @c T has a nested type @c cancellation_slot_type, returns /// <tt>t.get_cancellation_slot()</tt>. Otherwise returns @c type(). static decltype(auto) get(const T& t) noexcept; /// If @c T has a nested type @c cancellation_slot_type, returns /// <tt>t.get_cancellation_slot()</tt>. Otherwise returns @c s. static decltype(auto) get(const T& t, const CancellationSlot& s) noexcept; #endif // defined(GENERATING_DOCUMENTATION) }; /// Helper function to obtain an object's associated cancellation_slot. /** * @returns <tt>associated_cancellation_slot<T>::get(t)</tt> */ template <typename T> BOOST_ASIO_NODISCARD inline typename associated_cancellation_slot<T>::type get_associated_cancellation_slot(const T& t) noexcept { return associated_cancellation_slot<T>::get(t); } /// Helper function to obtain an object's associated cancellation_slot. /** * @returns <tt>associated_cancellation_slot<T, * CancellationSlot>::get(t, st)</tt> */ template <typename T, typename CancellationSlot> BOOST_ASIO_NODISCARD inline auto get_associated_cancellation_slot( const T& t, const CancellationSlot& st) noexcept -> decltype(associated_cancellation_slot<T, CancellationSlot>::get(t, st)) { return associated_cancellation_slot<T, CancellationSlot>::get(t, st); } template <typename T, typename CancellationSlot = cancellation_slot> using associated_cancellation_slot_t = typename associated_cancellation_slot<T, CancellationSlot>::type; namespace detail { template <typename T, typename S, typename = void> struct associated_cancellation_slot_forwarding_base { }; template <typename T, typename S> struct associated_cancellation_slot_forwarding_base<T, S, enable_if_t< is_same< typename associated_cancellation_slot<T, S>::asio_associated_cancellation_slot_is_unspecialised, void >::value >> { typedef void asio_associated_cancellation_slot_is_unspecialised; }; } // namespace detail /// Specialisation of associated_cancellation_slot for @c /// std::reference_wrapper. template <typename T, typename CancellationSlot> struct associated_cancellation_slot<reference_wrapper<T>, CancellationSlot> #if !defined(GENERATING_DOCUMENTATION) : detail::associated_cancellation_slot_forwarding_base<T, CancellationSlot> #endif // !defined(GENERATING_DOCUMENTATION) { /// Forwards @c type to the associator specialisation for the unwrapped type /// @c T. typedef typename associated_cancellation_slot<T, CancellationSlot>::type type; /// Forwards the request to get the cancellation slot to the associator /// specialisation for the unwrapped type @c T. static type get(reference_wrapper<T> t) noexcept { return associated_cancellation_slot<T, CancellationSlot>::get(t.get()); } /// Forwards the request to get the cancellation slot to the associator /// specialisation for the unwrapped type @c T. static auto get(reference_wrapper<T> t, const CancellationSlot& s) noexcept -> decltype( associated_cancellation_slot<T, CancellationSlot>::get(t.get(), s)) { return associated_cancellation_slot<T, CancellationSlot>::get(t.get(), s); } }; } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_ASSOCIATED_CANCELLATION_SLOT_HPP
6,951
C++
.h
189
34.37037
80
0.749257
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,418
redirect_error.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/redirect_error.hpp
// // redirect_error.hpp // ~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_REDIRECT_ERROR_HPP #define BOOST_ASIO_REDIRECT_ERROR_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/system/error_code.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// A @ref completion_token adapter used to specify that an error produced by an /// asynchronous operation is captured to an error_code variable. /** * The redirect_error_t class is used to indicate that any error_code produced * by an asynchronous operation is captured to a specified variable. */ template <typename CompletionToken> class redirect_error_t { public: /// Constructor. template <typename T> redirect_error_t(T&& completion_token, boost::system::error_code& ec) : token_(static_cast<T&&>(completion_token)), ec_(ec) { } //private: CompletionToken token_; boost::system::error_code& ec_; }; /// A function object type that adapts a @ref completion_token to capture /// error_code values to a variable. /** * May also be used directly as a completion token, in which case it adapts the * asynchronous operation's default completion token (or boost::asio::deferred * if no default is available). */ class partial_redirect_error { public: /// Constructor that specifies the variable used to capture error_code values. explicit partial_redirect_error(boost::system::error_code& ec) : ec_(ec) { } /// Adapt a @ref completion_token to specify that the completion handler /// should capture error_code values to a variable. template <typename CompletionToken> BOOST_ASIO_NODISCARD inline constexpr redirect_error_t<decay_t<CompletionToken>> operator()(CompletionToken&& completion_token) const { return redirect_error_t<decay_t<CompletionToken>>( static_cast<CompletionToken&&>(completion_token), ec_); } //private: boost::system::error_code& ec_; }; /// Create a partial completion token adapter that captures error_code values /// to a variable. BOOST_ASIO_NODISCARD inline partial_redirect_error redirect_error(boost::system::error_code& ec) { return partial_redirect_error(ec); } /// Adapt a @ref completion_token to capture error_code values to a variable. template <typename CompletionToken> BOOST_ASIO_NODISCARD inline redirect_error_t<decay_t<CompletionToken>> redirect_error(CompletionToken&& completion_token, boost::system::error_code& ec) { return redirect_error_t<decay_t<CompletionToken>>( static_cast<CompletionToken&&>(completion_token), ec); } } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/impl/redirect_error.hpp> #endif // BOOST_ASIO_REDIRECT_ERROR_HPP
3,121
C++
.h
90
32.533333
80
0.74859
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,420
as_tuple.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/as_tuple.hpp
// // as_tuple.hpp // ~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_AS_TUPLE_HPP #define BOOST_ASIO_AS_TUPLE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// A @ref completion_token adapter used to specify that the completion handler /// arguments should be combined into a single tuple argument. /** * The as_tuple_t class is used to indicate that any arguments to the * completion handler should be combined and passed as a single tuple argument. * The arguments are first moved into a @c std::tuple and that tuple is then * passed to the completion handler. */ template <typename CompletionToken> class as_tuple_t { public: /// Tag type used to prevent the "default" constructor from being used for /// conversions. struct default_constructor_tag {}; /// Default constructor. /** * This constructor is only valid if the underlying completion token is * default constructible and move constructible. The underlying completion * token is itself defaulted as an argument to allow it to capture a source * location. */ constexpr as_tuple_t( default_constructor_tag = default_constructor_tag(), CompletionToken token = CompletionToken()) : token_(static_cast<CompletionToken&&>(token)) { } /// Constructor. template <typename T> constexpr explicit as_tuple_t( T&& completion_token) : token_(static_cast<T&&>(completion_token)) { } /// Adapts an executor to add the @c as_tuple_t completion token as the /// default. template <typename InnerExecutor> struct executor_with_default : InnerExecutor { /// Specify @c as_tuple_t as the default completion token type. typedef as_tuple_t default_completion_token_type; /// Construct the adapted executor from the inner executor type. template <typename InnerExecutor1> executor_with_default(const InnerExecutor1& ex, constraint_t< conditional_t< !is_same<InnerExecutor1, executor_with_default>::value, is_convertible<InnerExecutor1, InnerExecutor>, false_type >::value > = 0) noexcept : InnerExecutor(ex) { } }; /// Type alias to adapt an I/O object to use @c as_tuple_t as its /// default completion token type. template <typename T> using as_default_on_t = typename T::template rebind_executor< executor_with_default<typename T::executor_type>>::other; /// Function helper to adapt an I/O object to use @c as_tuple_t as its /// default completion token type. template <typename T> static typename decay_t<T>::template rebind_executor< executor_with_default<typename decay_t<T>::executor_type> >::other as_default_on(T&& object) { return typename decay_t<T>::template rebind_executor< executor_with_default<typename decay_t<T>::executor_type> >::other(static_cast<T&&>(object)); } //private: CompletionToken token_; }; /// A function object type that adapts a @ref completion_token to specify that /// the completion handler arguments should be combined into a single tuple /// argument. /** * May also be used directly as a completion token, in which case it adapts the * asynchronous operation's default completion token (or boost::asio::deferred * if no default is available). */ struct partial_as_tuple { /// Default constructor. constexpr partial_as_tuple() { } /// Adapt a @ref completion_token to specify that the completion handler /// arguments should be combined into a single tuple argument. template <typename CompletionToken> BOOST_ASIO_NODISCARD inline constexpr as_tuple_t<decay_t<CompletionToken>> operator()(CompletionToken&& completion_token) const { return as_tuple_t<decay_t<CompletionToken>>( static_cast<CompletionToken&&>(completion_token)); } }; /// A function object that adapts a @ref completion_token to specify that the /// completion handler arguments should be combined into a single tuple /// argument. /** * May also be used directly as a completion token, in which case it adapts the * asynchronous operation's default completion token (or boost::asio::deferred * if no default is available). */ BOOST_ASIO_INLINE_VARIABLE constexpr partial_as_tuple as_tuple; } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #include <boost/asio/impl/as_tuple.hpp> #endif // BOOST_ASIO_AS_TUPLE_HPP
4,866
C++
.h
134
32.985075
79
0.725594
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,422
bind_immediate_executor.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/bind_immediate_executor.hpp
// // bind_immediate_executor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_BIND_IMMEDIATE_EXECUTOR_HPP #define BOOST_ASIO_BIND_IMMEDIATE_EXECUTOR_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associated_executor.hpp> #include <boost/asio/associated_immediate_executor.hpp> #include <boost/asio/associator.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/initiation_base.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { // Helper to automatically define nested typedef result_type. template <typename T, typename = void> struct immediate_executor_binder_result_type { protected: typedef void result_type_or_void; }; template <typename T> struct immediate_executor_binder_result_type<T, void_t<typename T::result_type>> { typedef typename T::result_type result_type; protected: typedef result_type result_type_or_void; }; template <typename R> struct immediate_executor_binder_result_type<R(*)()> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R> struct immediate_executor_binder_result_type<R(&)()> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R, typename A1> struct immediate_executor_binder_result_type<R(*)(A1)> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R, typename A1> struct immediate_executor_binder_result_type<R(&)(A1)> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R, typename A1, typename A2> struct immediate_executor_binder_result_type<R(*)(A1, A2)> { typedef R result_type; protected: typedef result_type result_type_or_void; }; template <typename R, typename A1, typename A2> struct immediate_executor_binder_result_type<R(&)(A1, A2)> { typedef R result_type; protected: typedef result_type result_type_or_void; }; // Helper to automatically define nested typedef argument_type. template <typename T, typename = void> struct immediate_executor_binder_argument_type {}; template <typename T> struct immediate_executor_binder_argument_type<T, void_t<typename T::argument_type>> { typedef typename T::argument_type argument_type; }; template <typename R, typename A1> struct immediate_executor_binder_argument_type<R(*)(A1)> { typedef A1 argument_type; }; template <typename R, typename A1> struct immediate_executor_binder_argument_type<R(&)(A1)> { typedef A1 argument_type; }; // Helper to automatically define nested typedefs first_argument_type and // second_argument_type. template <typename T, typename = void> struct immediate_executor_binder_argument_types {}; template <typename T> struct immediate_executor_binder_argument_types<T, void_t<typename T::first_argument_type>> { typedef typename T::first_argument_type first_argument_type; typedef typename T::second_argument_type second_argument_type; }; template <typename R, typename A1, typename A2> struct immediate_executor_binder_argument_type<R(*)(A1, A2)> { typedef A1 first_argument_type; typedef A2 second_argument_type; }; template <typename R, typename A1, typename A2> struct immediate_executor_binder_argument_type<R(&)(A1, A2)> { typedef A1 first_argument_type; typedef A2 second_argument_type; }; } // namespace detail /// A call wrapper type to bind a immediate executor of type @c Executor /// to an object of type @c T. template <typename T, typename Executor> class immediate_executor_binder #if !defined(GENERATING_DOCUMENTATION) : public detail::immediate_executor_binder_result_type<T>, public detail::immediate_executor_binder_argument_type<T>, public detail::immediate_executor_binder_argument_types<T> #endif // !defined(GENERATING_DOCUMENTATION) { public: /// The type of the target object. typedef T target_type; /// The type of the associated immediate executor. typedef Executor immediate_executor_type; #if defined(GENERATING_DOCUMENTATION) /// The return type if a function. /** * The type of @c result_type is based on the type @c T of the wrapper's * target object: * * @li if @c T is a pointer to function type, @c result_type is a synonym for * the return type of @c T; * * @li if @c T is a class type with a member type @c result_type, then @c * result_type is a synonym for @c T::result_type; * * @li otherwise @c result_type is not defined. */ typedef see_below result_type; /// The type of the function's argument. /** * The type of @c argument_type is based on the type @c T of the wrapper's * target object: * * @li if @c T is a pointer to a function type accepting a single argument, * @c argument_type is a synonym for the return type of @c T; * * @li if @c T is a class type with a member type @c argument_type, then @c * argument_type is a synonym for @c T::argument_type; * * @li otherwise @c argument_type is not defined. */ typedef see_below argument_type; /// The type of the function's first argument. /** * The type of @c first_argument_type is based on the type @c T of the * wrapper's target object: * * @li if @c T is a pointer to a function type accepting two arguments, @c * first_argument_type is a synonym for the return type of @c T; * * @li if @c T is a class type with a member type @c first_argument_type, * then @c first_argument_type is a synonym for @c T::first_argument_type; * * @li otherwise @c first_argument_type is not defined. */ typedef see_below first_argument_type; /// The type of the function's second argument. /** * The type of @c second_argument_type is based on the type @c T of the * wrapper's target object: * * @li if @c T is a pointer to a function type accepting two arguments, @c * second_argument_type is a synonym for the return type of @c T; * * @li if @c T is a class type with a member type @c first_argument_type, * then @c second_argument_type is a synonym for @c T::second_argument_type; * * @li otherwise @c second_argument_type is not defined. */ typedef see_below second_argument_type; #endif // defined(GENERATING_DOCUMENTATION) /// Construct a immediate executor wrapper for the specified object. /** * This constructor is only valid if the type @c T is constructible from type * @c U. */ template <typename U> immediate_executor_binder(const immediate_executor_type& e, U&& u) : executor_(e), target_(static_cast<U&&>(u)) { } /// Copy constructor. immediate_executor_binder(const immediate_executor_binder& other) : executor_(other.get_immediate_executor()), target_(other.get()) { } /// Construct a copy, but specify a different immediate executor. immediate_executor_binder(const immediate_executor_type& e, const immediate_executor_binder& other) : executor_(e), target_(other.get()) { } /// Construct a copy of a different immediate executor wrapper type. /** * This constructor is only valid if the @c Executor type is * constructible from type @c OtherExecutor, and the type @c T is * constructible from type @c U. */ template <typename U, typename OtherExecutor> immediate_executor_binder( const immediate_executor_binder<U, OtherExecutor>& other, constraint_t<is_constructible<Executor, OtherExecutor>::value> = 0, constraint_t<is_constructible<T, U>::value> = 0) : executor_(other.get_immediate_executor()), target_(other.get()) { } /// Construct a copy of a different immediate executor wrapper type, but /// specify a different immediate executor. /** * This constructor is only valid if the type @c T is constructible from type * @c U. */ template <typename U, typename OtherExecutor> immediate_executor_binder(const immediate_executor_type& e, const immediate_executor_binder<U, OtherExecutor>& other, constraint_t<is_constructible<T, U>::value> = 0) : executor_(e), target_(other.get()) { } /// Move constructor. immediate_executor_binder(immediate_executor_binder&& other) : executor_(static_cast<immediate_executor_type&&>( other.get_immediate_executor())), target_(static_cast<T&&>(other.get())) { } /// Move construct the target object, but specify a different immediate /// executor. immediate_executor_binder(const immediate_executor_type& e, immediate_executor_binder&& other) : executor_(e), target_(static_cast<T&&>(other.get())) { } /// Move construct from a different immediate executor wrapper type. template <typename U, typename OtherExecutor> immediate_executor_binder( immediate_executor_binder<U, OtherExecutor>&& other, constraint_t<is_constructible<Executor, OtherExecutor>::value> = 0, constraint_t<is_constructible<T, U>::value> = 0) : executor_(static_cast<OtherExecutor&&>( other.get_immediate_executor())), target_(static_cast<U&&>(other.get())) { } /// Move construct from a different immediate executor wrapper type, but /// specify a different immediate executor. template <typename U, typename OtherExecutor> immediate_executor_binder(const immediate_executor_type& e, immediate_executor_binder<U, OtherExecutor>&& other, constraint_t<is_constructible<T, U>::value> = 0) : executor_(e), target_(static_cast<U&&>(other.get())) { } /// Destructor. ~immediate_executor_binder() { } /// Obtain a reference to the target object. target_type& get() noexcept { return target_; } /// Obtain a reference to the target object. const target_type& get() const noexcept { return target_; } /// Obtain the associated immediate executor. immediate_executor_type get_immediate_executor() const noexcept { return executor_; } /// Forwarding function call operator. template <typename... Args> result_of_t<T(Args...)> operator()(Args&&... args) { return target_(static_cast<Args&&>(args)...); } /// Forwarding function call operator. template <typename... Args> result_of_t<T(Args...)> operator()(Args&&... args) const { return target_(static_cast<Args&&>(args)...); } private: Executor executor_; T target_; }; /// A function object type that adapts a @ref completion_token to specify that /// the completion handler should have the supplied executor as its associated /// immediate executor. /** * May also be used directly as a completion token, in which case it adapts the * asynchronous operation's default completion token (or boost::asio::deferred * if no default is available). */ template <typename Executor> struct partial_immediate_executor_binder { /// Constructor that specifies associated executor. explicit partial_immediate_executor_binder(const Executor& ex) : executor_(ex) { } /// Adapt a @ref completion_token to specify that the completion handler /// should have the executor as its associated immediate executor. template <typename CompletionToken> BOOST_ASIO_NODISCARD inline constexpr immediate_executor_binder<decay_t<CompletionToken>, Executor> operator()(CompletionToken&& completion_token) const { return immediate_executor_binder<decay_t<CompletionToken>, Executor>( static_cast<CompletionToken&&>(completion_token), executor_); } //private: Executor executor_; }; /// Create a partial completion token that associates an executor. template <typename Executor> BOOST_ASIO_NODISCARD inline partial_immediate_executor_binder<Executor> bind_immediate_executor(const Executor& ex) { return partial_immediate_executor_binder<Executor>(ex); } /// Associate an object of type @c T with a immediate executor of type /// @c Executor. template <typename Executor, typename T> BOOST_ASIO_NODISCARD inline immediate_executor_binder<decay_t<T>, Executor> bind_immediate_executor(const Executor& e, T&& t) { return immediate_executor_binder< decay_t<T>, Executor>( e, static_cast<T&&>(t)); } #if !defined(GENERATING_DOCUMENTATION) namespace detail { template <typename TargetAsyncResult, typename Executor, typename = void> class immediate_executor_binder_completion_handler_async_result { public: template <typename T> explicit immediate_executor_binder_completion_handler_async_result(T&) { } }; template <typename TargetAsyncResult, typename Executor> class immediate_executor_binder_completion_handler_async_result< TargetAsyncResult, Executor, void_t< typename TargetAsyncResult::completion_handler_type >> { private: TargetAsyncResult target_; public: typedef immediate_executor_binder< typename TargetAsyncResult::completion_handler_type, Executor> completion_handler_type; explicit immediate_executor_binder_completion_handler_async_result( typename TargetAsyncResult::completion_handler_type& handler) : target_(handler) { } auto get() -> decltype(target_.get()) { return target_.get(); } }; template <typename TargetAsyncResult, typename = void> struct immediate_executor_binder_async_result_return_type { }; template <typename TargetAsyncResult> struct immediate_executor_binder_async_result_return_type< TargetAsyncResult, void_t< typename TargetAsyncResult::return_type >> { typedef typename TargetAsyncResult::return_type return_type; }; } // namespace detail template <typename T, typename Executor, typename Signature> class async_result<immediate_executor_binder<T, Executor>, Signature> : public detail::immediate_executor_binder_completion_handler_async_result< async_result<T, Signature>, Executor>, public detail::immediate_executor_binder_async_result_return_type< async_result<T, Signature>> { public: explicit async_result(immediate_executor_binder<T, Executor>& b) : detail::immediate_executor_binder_completion_handler_async_result< async_result<T, Signature>, Executor>(b.get()) { } template <typename Initiation> struct init_wrapper : detail::initiation_base<Initiation> { using detail::initiation_base<Initiation>::initiation_base; template <typename Handler, typename... Args> void operator()(Handler&& handler, const Executor& e, Args&&... args) && { static_cast<Initiation&&>(*this)( immediate_executor_binder< decay_t<Handler>, Executor>( e, static_cast<Handler&&>(handler)), static_cast<Args&&>(args)...); } template <typename Handler, typename... Args> void operator()(Handler&& handler, const Executor& e, Args&&... args) const & { static_cast<const Initiation&>(*this)( immediate_executor_binder< decay_t<Handler>, Executor>( e, static_cast<Handler&&>(handler)), static_cast<Args&&>(args)...); } }; template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate< conditional_t< is_const<remove_reference_t<RawCompletionToken>>::value, const T, T>, Signature>( declval<init_wrapper<decay_t<Initiation>>>(), token.get(), token.get_immediate_executor(), static_cast<Args&&>(args)...)) { return async_initiate< conditional_t< is_const<remove_reference_t<RawCompletionToken>>::value, const T, T>, Signature>( init_wrapper<decay_t<Initiation>>( static_cast<Initiation&&>(initiation)), token.get(), token.get_immediate_executor(), static_cast<Args&&>(args)...); } private: async_result(const async_result&) = delete; async_result& operator=(const async_result&) = delete; async_result<T, Signature> target_; }; template <typename Executor, typename... Signatures> struct async_result<partial_immediate_executor_binder<Executor>, Signatures...> { template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate<Signatures...>( static_cast<Initiation&&>(initiation), immediate_executor_binder< default_completion_token_t<associated_executor_t<Initiation>>, Executor>(token.executor_, default_completion_token_t<associated_executor_t<Initiation>>{}), static_cast<Args&&>(args)...)) { return async_initiate<Signatures...>( static_cast<Initiation&&>(initiation), immediate_executor_binder< default_completion_token_t<associated_executor_t<Initiation>>, Executor>(token.executor_, default_completion_token_t<associated_executor_t<Initiation>>{}), static_cast<Args&&>(args)...); } }; template <template <typename, typename> class Associator, typename T, typename Executor, typename DefaultCandidate> struct associator<Associator, immediate_executor_binder<T, Executor>, DefaultCandidate> : Associator<T, DefaultCandidate> { static typename Associator<T, DefaultCandidate>::type get( const immediate_executor_binder<T, Executor>& b) noexcept { return Associator<T, DefaultCandidate>::get(b.get()); } static auto get(const immediate_executor_binder<T, Executor>& b, const DefaultCandidate& c) noexcept -> decltype(Associator<T, DefaultCandidate>::get(b.get(), c)) { return Associator<T, DefaultCandidate>::get(b.get(), c); } }; template <typename T, typename Executor, typename Executor1> struct associated_immediate_executor< immediate_executor_binder<T, Executor>, Executor1> { typedef Executor type; static auto get(const immediate_executor_binder<T, Executor>& b, const Executor1& = Executor1()) noexcept -> decltype(b.get_immediate_executor()) { return b.get_immediate_executor(); } }; #endif // !defined(GENERATING_DOCUMENTATION) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_BIND_IMMEDIATE_EXECUTOR_HPP
18,655
C++
.h
540
31.005556
80
0.721794
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,431
cancellation_signal.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/cancellation_signal.hpp
// // cancellation_signal.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_CANCELLATION_SIGNAL_HPP #define BOOST_ASIO_CANCELLATION_SIGNAL_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <cassert> #include <new> #include <utility> #include <boost/asio/cancellation_type.hpp> #include <boost/asio/detail/cstddef.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { class cancellation_handler_base { public: virtual void call(cancellation_type_t) = 0; virtual std::pair<void*, std::size_t> destroy() noexcept = 0; protected: ~cancellation_handler_base() {} }; template <typename Handler> class cancellation_handler : public cancellation_handler_base { public: template <typename... Args> cancellation_handler(std::size_t size, Args&&... args) : handler_(static_cast<Args&&>(args)...), size_(size) { } void call(cancellation_type_t type) { handler_(type); } std::pair<void*, std::size_t> destroy() noexcept { std::pair<void*, std::size_t> mem(this, size_); this->cancellation_handler::~cancellation_handler(); return mem; } Handler& handler() noexcept { return handler_; } private: ~cancellation_handler() { } Handler handler_; std::size_t size_; }; } // namespace detail class cancellation_slot; /// A cancellation signal with a single slot. class cancellation_signal { public: constexpr cancellation_signal() : handler_(0) { } BOOST_ASIO_DECL ~cancellation_signal(); /// Emits the signal and causes invocation of the slot's handler, if any. void emit(cancellation_type_t type) { if (handler_) handler_->call(type); } /// Returns the single slot associated with the signal. /** * The signal object must remain valid for as long the slot may be used. * Destruction of the signal invalidates the slot. */ cancellation_slot slot() noexcept; private: cancellation_signal(const cancellation_signal&) = delete; cancellation_signal& operator=(const cancellation_signal&) = delete; detail::cancellation_handler_base* handler_; }; /// A slot associated with a cancellation signal. class cancellation_slot { public: /// Creates a slot that is not connected to any cancellation signal. constexpr cancellation_slot() : handler_(0) { } /// Installs a handler into the slot, constructing the new object directly. /** * Destroys any existing handler in the slot, then installs the new handler, * constructing it with the supplied @c args. * * The handler is a function object to be called when the signal is emitted. * The signature of the handler must be * @code void handler(boost::asio::cancellation_type_t); @endcode * * @param args Arguments to be passed to the @c CancellationHandler object's * constructor. * * @returns A reference to the newly installed handler. * * @note Handlers installed into the slot via @c emplace are not required to * be copy constructible or move constructible. */ template <typename CancellationHandler, typename... Args> CancellationHandler& emplace(Args&&... args) { typedef detail::cancellation_handler<CancellationHandler> cancellation_handler_type; auto_delete_helper del = { prepare_memory( sizeof(cancellation_handler_type), alignof(CancellationHandler)) }; cancellation_handler_type* handler_obj = new (del.mem.first) cancellation_handler_type( del.mem.second, static_cast<Args&&>(args)...); del.mem.first = 0; *handler_ = handler_obj; return handler_obj->handler(); } /// Installs a handler into the slot. /** * Destroys any existing handler in the slot, then installs the new handler, * constructing it as a decay-copy of the supplied handler. * * The handler is a function object to be called when the signal is emitted. * The signature of the handler must be * @code void handler(boost::asio::cancellation_type_t); @endcode * * @param handler The handler to be installed. * * @returns A reference to the newly installed handler. */ template <typename CancellationHandler> decay_t<CancellationHandler>& assign(CancellationHandler&& handler) { return this->emplace<decay_t<CancellationHandler>>( static_cast<CancellationHandler&&>(handler)); } /// Clears the slot. /** * Destroys any existing handler in the slot. */ BOOST_ASIO_DECL void clear(); /// Returns whether the slot is connected to a signal. constexpr bool is_connected() const noexcept { return handler_ != 0; } /// Returns whether the slot is connected and has an installed handler. constexpr bool has_handler() const noexcept { return handler_ != 0 && *handler_ != 0; } /// Compare two slots for equality. friend constexpr bool operator==(const cancellation_slot& lhs, const cancellation_slot& rhs) noexcept { return lhs.handler_ == rhs.handler_; } /// Compare two slots for inequality. friend constexpr bool operator!=(const cancellation_slot& lhs, const cancellation_slot& rhs) noexcept { return lhs.handler_ != rhs.handler_; } private: friend class cancellation_signal; constexpr cancellation_slot(int, detail::cancellation_handler_base** handler) : handler_(handler) { } BOOST_ASIO_DECL std::pair<void*, std::size_t> prepare_memory( std::size_t size, std::size_t align); struct auto_delete_helper { std::pair<void*, std::size_t> mem; BOOST_ASIO_DECL ~auto_delete_helper(); }; detail::cancellation_handler_base** handler_; }; inline cancellation_slot cancellation_signal::slot() noexcept { return cancellation_slot(0, &handler_); } } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #if defined(BOOST_ASIO_HEADER_ONLY) # include <boost/asio/impl/cancellation_signal.ipp> #endif // defined(BOOST_ASIO_HEADER_ONLY) #endif // BOOST_ASIO_CANCELLATION_SIGNAL_HPP
6,405
C++
.h
207
27.68599
79
0.715005
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,432
associated_executor.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/associated_executor.hpp
// // associated_executor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_ASSOCIATED_EXECUTOR_HPP #define BOOST_ASIO_ASSOCIATED_EXECUTOR_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associator.hpp> #include <boost/asio/detail/functional.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/executor.hpp> #include <boost/asio/is_executor.hpp> #include <boost/asio/system_executor.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { template <typename T, typename Executor> struct associated_executor; namespace detail { template <typename T, typename = void> struct has_executor_type : false_type { }; template <typename T> struct has_executor_type<T, void_t<typename T::executor_type>> : true_type { }; template <typename T, typename E, typename = void, typename = void> struct associated_executor_impl { typedef void asio_associated_executor_is_unspecialised; typedef E type; static type get(const T&) noexcept { return type(); } static const type& get(const T&, const E& e) noexcept { return e; } }; template <typename T, typename E> struct associated_executor_impl<T, E, void_t<typename T::executor_type>> { typedef typename T::executor_type type; static auto get(const T& t) noexcept -> decltype(t.get_executor()) { return t.get_executor(); } static auto get(const T& t, const E&) noexcept -> decltype(t.get_executor()) { return t.get_executor(); } }; template <typename T, typename E> struct associated_executor_impl<T, E, enable_if_t< !has_executor_type<T>::value >, void_t< typename associator<associated_executor, T, E>::type >> : associator<associated_executor, T, E> { }; } // namespace detail /// Traits type used to obtain the executor associated with an object. /** * A program may specialise this traits type if the @c T template parameter in * the specialisation is a user-defined type. The template parameter @c * Executor shall be a type meeting the Executor requirements. * * Specialisations shall meet the following requirements, where @c t is a const * reference to an object of type @c T, and @c e is an object of type @c * Executor. * * @li Provide a nested typedef @c type that identifies a type meeting the * Executor requirements. * * @li Provide a noexcept static member function named @c get, callable as @c * get(t) and with return type @c type or a (possibly const) reference to @c * type. * * @li Provide a noexcept static member function named @c get, callable as @c * get(t,e) and with return type @c type or a (possibly const) reference to @c * type. */ template <typename T, typename Executor = system_executor> struct associated_executor #if !defined(GENERATING_DOCUMENTATION) : detail::associated_executor_impl<T, Executor> #endif // !defined(GENERATING_DOCUMENTATION) { #if defined(GENERATING_DOCUMENTATION) /// If @c T has a nested type @c executor_type, <tt>T::executor_type</tt>. /// Otherwise @c Executor. typedef see_below type; /// If @c T has a nested type @c executor_type, returns /// <tt>t.get_executor()</tt>. Otherwise returns @c type(). static decltype(auto) get(const T& t) noexcept; /// If @c T has a nested type @c executor_type, returns /// <tt>t.get_executor()</tt>. Otherwise returns @c ex. static decltype(auto) get(const T& t, const Executor& ex) noexcept; #endif // defined(GENERATING_DOCUMENTATION) }; /// Helper function to obtain an object's associated executor. /** * @returns <tt>associated_executor<T>::get(t)</tt> */ template <typename T> BOOST_ASIO_NODISCARD inline typename associated_executor<T>::type get_associated_executor(const T& t) noexcept { return associated_executor<T>::get(t); } /// Helper function to obtain an object's associated executor. /** * @returns <tt>associated_executor<T, Executor>::get(t, ex)</tt> */ template <typename T, typename Executor> BOOST_ASIO_NODISCARD inline auto get_associated_executor( const T& t, const Executor& ex, constraint_t< is_executor<Executor>::value || execution::is_executor<Executor>::value > = 0) noexcept -> decltype(associated_executor<T, Executor>::get(t, ex)) { return associated_executor<T, Executor>::get(t, ex); } /// Helper function to obtain an object's associated executor. /** * @returns <tt>associated_executor<T, typename * ExecutionContext::executor_type>::get(t, ctx.get_executor())</tt> */ template <typename T, typename ExecutionContext> BOOST_ASIO_NODISCARD inline typename associated_executor<T, typename ExecutionContext::executor_type>::type get_associated_executor(const T& t, ExecutionContext& ctx, constraint_t<is_convertible<ExecutionContext&, execution_context&>::value> = 0) noexcept { return associated_executor<T, typename ExecutionContext::executor_type>::get(t, ctx.get_executor()); } template <typename T, typename Executor = system_executor> using associated_executor_t = typename associated_executor<T, Executor>::type; namespace detail { template <typename T, typename E, typename = void> struct associated_executor_forwarding_base { }; template <typename T, typename E> struct associated_executor_forwarding_base<T, E, enable_if_t< is_same< typename associated_executor<T, E>::asio_associated_executor_is_unspecialised, void >::value >> { typedef void asio_associated_executor_is_unspecialised; }; } // namespace detail /// Specialisation of associated_executor for @c std::reference_wrapper. template <typename T, typename Executor> struct associated_executor<reference_wrapper<T>, Executor> #if !defined(GENERATING_DOCUMENTATION) : detail::associated_executor_forwarding_base<T, Executor> #endif // !defined(GENERATING_DOCUMENTATION) { /// Forwards @c type to the associator specialisation for the unwrapped type /// @c T. typedef typename associated_executor<T, Executor>::type type; /// Forwards the request to get the executor to the associator specialisation /// for the unwrapped type @c T. static type get(reference_wrapper<T> t) noexcept { return associated_executor<T, Executor>::get(t.get()); } /// Forwards the request to get the executor to the associator specialisation /// for the unwrapped type @c T. static auto get(reference_wrapper<T> t, const Executor& ex) noexcept -> decltype(associated_executor<T, Executor>::get(t.get(), ex)) { return associated_executor<T, Executor>::get(t.get(), ex); } }; } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_ASSOCIATED_EXECUTOR_HPP
7,024
C++
.h
202
32.351485
79
0.735376
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,433
associated_immediate_executor.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/associated_immediate_executor.hpp
// // associated_immediate_executor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_ASSOCIATED_IMMEDIATE_EXECUTOR_HPP #define BOOST_ASIO_ASSOCIATED_IMMEDIATE_EXECUTOR_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associator.hpp> #include <boost/asio/detail/functional.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/blocking.hpp> #include <boost/asio/execution/executor.hpp> #include <boost/asio/execution_context.hpp> #include <boost/asio/is_executor.hpp> #include <boost/asio/require.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { template <typename T, typename Executor> struct associated_immediate_executor; namespace detail { template <typename T, typename = void> struct has_immediate_executor_type : false_type { }; template <typename T> struct has_immediate_executor_type<T, void_t<typename T::immediate_executor_type>> : true_type { }; template <typename E, typename = void, typename = void> struct default_immediate_executor { typedef decay_t<require_result_t<E, execution::blocking_t::never_t>> type; static auto get(const E& e) noexcept -> decltype(boost::asio::require(e, execution::blocking.never)) { return boost::asio::require(e, execution::blocking.never); } }; template <typename E> struct default_immediate_executor<E, enable_if_t< !execution::is_executor<E>::value >, enable_if_t< is_executor<E>::value >> { class type : public E { public: template <typename Executor1> explicit type(const Executor1& e, constraint_t< conditional_t< !is_same<Executor1, type>::value, is_convertible<Executor1, E>, false_type >::value > = 0) noexcept : E(e) { } type(const type& other) noexcept : E(static_cast<const E&>(other)) { } type(type&& other) noexcept : E(static_cast<E&&>(other)) { } template <typename Function, typename Allocator> void dispatch(Function&& f, const Allocator& a) const { this->post(static_cast<Function&&>(f), a); } friend bool operator==(const type& a, const type& b) noexcept { return static_cast<const E&>(a) == static_cast<const E&>(b); } friend bool operator!=(const type& a, const type& b) noexcept { return static_cast<const E&>(a) != static_cast<const E&>(b); } }; static type get(const E& e) noexcept { return type(e); } }; template <typename T, typename E, typename = void, typename = void> struct associated_immediate_executor_impl { typedef void asio_associated_immediate_executor_is_unspecialised; typedef typename default_immediate_executor<E>::type type; static auto get(const T&, const E& e) noexcept -> decltype(default_immediate_executor<E>::get(e)) { return default_immediate_executor<E>::get(e); } }; template <typename T, typename E> struct associated_immediate_executor_impl<T, E, void_t<typename T::immediate_executor_type>> { typedef typename T::immediate_executor_type type; static auto get(const T& t, const E&) noexcept -> decltype(t.get_immediate_executor()) { return t.get_immediate_executor(); } }; template <typename T, typename E> struct associated_immediate_executor_impl<T, E, enable_if_t< !has_immediate_executor_type<T>::value >, void_t< typename associator<associated_immediate_executor, T, E>::type >> : associator<associated_immediate_executor, T, E> { }; } // namespace detail /// Traits type used to obtain the immediate executor associated with an object. /** * A program may specialise this traits type if the @c T template parameter in * the specialisation is a user-defined type. The template parameter @c * Executor shall be a type meeting the Executor requirements. * * Specialisations shall meet the following requirements, where @c t is a const * reference to an object of type @c T, and @c e is an object of type @c * Executor. * * @li Provide a nested typedef @c type that identifies a type meeting the * Executor requirements. * * @li Provide a noexcept static member function named @c get, callable as @c * get(t) and with return type @c type or a (possibly const) reference to @c * type. * * @li Provide a noexcept static member function named @c get, callable as @c * get(t,e) and with return type @c type or a (possibly const) reference to @c * type. */ template <typename T, typename Executor> struct associated_immediate_executor #if !defined(GENERATING_DOCUMENTATION) : detail::associated_immediate_executor_impl<T, Executor> #endif // !defined(GENERATING_DOCUMENTATION) { #if defined(GENERATING_DOCUMENTATION) /// If @c T has a nested type @c immediate_executor_type, // <tt>T::immediate_executor_type</tt>. Otherwise @c Executor. typedef see_below type; /// If @c T has a nested type @c immediate_executor_type, returns /// <tt>t.get_immediate_executor()</tt>. Otherwise returns /// <tt>boost::asio::require(ex, boost::asio::execution::blocking.never)</tt>. static decltype(auto) get(const T& t, const Executor& ex) noexcept; #endif // defined(GENERATING_DOCUMENTATION) }; /// Helper function to obtain an object's associated executor. /** * @returns <tt>associated_immediate_executor<T, Executor>::get(t, ex)</tt> */ template <typename T, typename Executor> BOOST_ASIO_NODISCARD inline auto get_associated_immediate_executor( const T& t, const Executor& ex, constraint_t< is_executor<Executor>::value || execution::is_executor<Executor>::value > = 0) noexcept -> decltype(associated_immediate_executor<T, Executor>::get(t, ex)) { return associated_immediate_executor<T, Executor>::get(t, ex); } /// Helper function to obtain an object's associated executor. /** * @returns <tt>associated_immediate_executor<T, typename * ExecutionContext::executor_type>::get(t, ctx.get_executor())</tt> */ template <typename T, typename ExecutionContext> BOOST_ASIO_NODISCARD inline typename associated_immediate_executor<T, typename ExecutionContext::executor_type>::type get_associated_immediate_executor(const T& t, ExecutionContext& ctx, constraint_t< is_convertible<ExecutionContext&, execution_context&>::value > = 0) noexcept { return associated_immediate_executor<T, typename ExecutionContext::executor_type>::get(t, ctx.get_executor()); } template <typename T, typename Executor> using associated_immediate_executor_t = typename associated_immediate_executor<T, Executor>::type; namespace detail { template <typename T, typename E, typename = void> struct associated_immediate_executor_forwarding_base { }; template <typename T, typename E> struct associated_immediate_executor_forwarding_base<T, E, enable_if_t< is_same< typename associated_immediate_executor<T, E>::asio_associated_immediate_executor_is_unspecialised, void >::value >> { typedef void asio_associated_immediate_executor_is_unspecialised; }; } // namespace detail /// Specialisation of associated_immediate_executor for /// @c std::reference_wrapper. template <typename T, typename Executor> struct associated_immediate_executor<reference_wrapper<T>, Executor> #if !defined(GENERATING_DOCUMENTATION) : detail::associated_immediate_executor_forwarding_base<T, Executor> #endif // !defined(GENERATING_DOCUMENTATION) { /// Forwards @c type to the associator specialisation for the unwrapped type /// @c T. typedef typename associated_immediate_executor<T, Executor>::type type; /// Forwards the request to get the executor to the associator specialisation /// for the unwrapped type @c T. static auto get(reference_wrapper<T> t, const Executor& ex) noexcept -> decltype(associated_immediate_executor<T, Executor>::get(t.get(), ex)) { return associated_immediate_executor<T, Executor>::get(t.get(), ex); } }; } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_ASSOCIATED_IMMEDIATE_EXECUTOR_HPP
8,447
C++
.h
244
31.581967
80
0.726237
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,436
completion_condition.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/completion_condition.hpp
// // completion_condition.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_COMPLETION_CONDITION_HPP #define BOOST_ASIO_COMPLETION_CONDITION_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <cstddef> #include <boost/asio/detail/type_traits.hpp> #include <boost/system/error_code.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { // The default maximum number of bytes to transfer in a single operation. enum default_max_transfer_size_t { default_max_transfer_size = 65536 }; // Adapt result of old-style completion conditions (which had a bool result // where true indicated that the operation was complete). inline std::size_t adapt_completion_condition_result(bool result) { return result ? 0 : default_max_transfer_size; } // Adapt result of current completion conditions (which have a size_t result // where 0 means the operation is complete, and otherwise the result is the // maximum number of bytes to transfer on the next underlying operation). inline std::size_t adapt_completion_condition_result(std::size_t result) { return result; } class transfer_all_t { public: typedef std::size_t result_type; template <typename Error> std::size_t operator()(const Error& err, std::size_t) { return !!err ? 0 : default_max_transfer_size; } }; class transfer_at_least_t { public: typedef std::size_t result_type; explicit transfer_at_least_t(std::size_t minimum) : minimum_(minimum) { } template <typename Error> std::size_t operator()(const Error& err, std::size_t bytes_transferred) { return (!!err || bytes_transferred >= minimum_) ? 0 : default_max_transfer_size; } private: std::size_t minimum_; }; class transfer_exactly_t { public: typedef std::size_t result_type; explicit transfer_exactly_t(std::size_t size) : size_(size) { } template <typename Error> std::size_t operator()(const Error& err, std::size_t bytes_transferred) { return (!!err || bytes_transferred >= size_) ? 0 : (size_ - bytes_transferred < default_max_transfer_size ? size_ - bytes_transferred : std::size_t(default_max_transfer_size)); } private: std::size_t size_; }; template <typename T, typename = void> struct is_completion_condition_helper : false_type { }; template <typename T> struct is_completion_condition_helper<T, enable_if_t< is_same< result_of_t<T(boost::system::error_code, std::size_t)>, bool >::value > > : true_type { }; template <typename T> struct is_completion_condition_helper<T, enable_if_t< is_same< result_of_t<T(boost::system::error_code, std::size_t)>, std::size_t >::value > > : true_type { }; } // namespace detail #if defined(GENERATING_DOCUMENTATION) /// Trait for determining whether a function object is a completion condition. template <typename T> struct is_completion_condition { static constexpr bool value = automatically_determined; }; #else // defined(GENERATING_DOCUMENTATION) template <typename T> struct is_completion_condition : detail::is_completion_condition_helper<T> { }; #endif // defined(GENERATING_DOCUMENTATION) /** * @defgroup completion_condition Completion Condition Function Objects * * Function objects used for determining when a read or write operation should * complete. */ /*@{*/ /// Return a completion condition function object that indicates that a read or /// write operation should continue until all of the data has been transferred, /// or until an error occurs. /** * This function is used to create an object, of unspecified type, that meets * CompletionCondition requirements. * * @par Example * Reading until a buffer is full: * @code * boost::array<char, 128> buf; * boost::system::error_code ec; * std::size_t n = boost::asio::read( * sock, boost::asio::buffer(buf), * boost::asio::transfer_all(), ec); * if (ec) * { * // An error occurred. * } * else * { * // n == 128 * } * @endcode */ #if defined(GENERATING_DOCUMENTATION) unspecified transfer_all(); #else inline detail::transfer_all_t transfer_all() { return detail::transfer_all_t(); } #endif /// Return a completion condition function object that indicates that a read or /// write operation should continue until a minimum number of bytes has been /// transferred, or until an error occurs. /** * This function is used to create an object, of unspecified type, that meets * CompletionCondition requirements. * * @par Example * Reading until a buffer is full or contains at least 64 bytes: * @code * boost::array<char, 128> buf; * boost::system::error_code ec; * std::size_t n = boost::asio::read( * sock, boost::asio::buffer(buf), * boost::asio::transfer_at_least(64), ec); * if (ec) * { * // An error occurred. * } * else * { * // n >= 64 && n <= 128 * } * @endcode */ #if defined(GENERATING_DOCUMENTATION) unspecified transfer_at_least(std::size_t minimum); #else inline detail::transfer_at_least_t transfer_at_least(std::size_t minimum) { return detail::transfer_at_least_t(minimum); } #endif /// Return a completion condition function object that indicates that a read or /// write operation should continue until an exact number of bytes has been /// transferred, or until an error occurs. /** * This function is used to create an object, of unspecified type, that meets * CompletionCondition requirements. * * @par Example * Reading until a buffer is full or contains exactly 64 bytes: * @code * boost::array<char, 128> buf; * boost::system::error_code ec; * std::size_t n = boost::asio::read( * sock, boost::asio::buffer(buf), * boost::asio::transfer_exactly(64), ec); * if (ec) * { * // An error occurred. * } * else * { * // n == 64 * } * @endcode */ #if defined(GENERATING_DOCUMENTATION) unspecified transfer_exactly(std::size_t size); #else inline detail::transfer_exactly_t transfer_exactly(std::size_t size) { return detail::transfer_exactly_t(size); } #endif /*@}*/ } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_COMPLETION_CONDITION_HPP
6,544
C++
.h
233
25.892704
79
0.712988
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,441
uses_executor.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/uses_executor.hpp
// // uses_executor.hpp // ~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_USES_EXECUTOR_HPP #define BOOST_ASIO_USES_EXECUTOR_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { /// A special type, similar to std::nothrow_t, used to disambiguate /// constructors that accept executor arguments. /** * The executor_arg_t struct is an empty structure type used as a unique type * to disambiguate constructor and function overloading. Specifically, some * types have constructors with executor_arg_t as the first argument, * immediately followed by an argument of a type that satisfies the Executor * type requirements. */ struct executor_arg_t { /// Constructor. constexpr executor_arg_t() noexcept { } }; /// A special value, similar to std::nothrow, used to disambiguate constructors /// that accept executor arguments. /** * See boost::asio::executor_arg_t and boost::asio::uses_executor * for more information. */ BOOST_ASIO_INLINE_VARIABLE constexpr executor_arg_t executor_arg; /// The uses_executor trait detects whether a type T has an associated executor /// that is convertible from type Executor. /** * Meets the BinaryTypeTrait requirements. The Asio library provides a * definition that is derived from false_type. A program may specialize this * template to derive from true_type for a user-defined type T that can be * constructed with an executor, where the first argument of a constructor has * type executor_arg_t and the second argument is convertible from type * Executor. */ template <typename T, typename Executor> struct uses_executor : false_type {}; } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_USES_EXECUTOR_HPP
2,189
C++
.h
58
36.137931
79
0.756604
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
true
true
false
32,451
write.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/impl/write.hpp
// // impl/write.hpp // ~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_IMPL_WRITE_HPP #define BOOST_ASIO_IMPL_WRITE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/associator.hpp> #include <boost/asio/buffer.hpp> #include <boost/asio/detail/array_fwd.hpp> #include <boost/asio/detail/base_from_cancellation_state.hpp> #include <boost/asio/detail/base_from_completion_cond.hpp> #include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/consuming_buffers.hpp> #include <boost/asio/detail/dependent_type.hpp> #include <boost/asio/detail/handler_cont_helpers.hpp> #include <boost/asio/detail/handler_tracking.hpp> #include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/non_const_lvalue.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename SyncWriteStream, typename ConstBufferSequence, typename ConstBufferIterator, typename CompletionCondition> std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, const ConstBufferIterator&, CompletionCondition completion_condition, boost::system::error_code& ec) { ec = boost::system::error_code(); boost::asio::detail::consuming_buffers<const_buffer, ConstBufferSequence, ConstBufferIterator> tmp(buffers); while (!tmp.empty()) { if (std::size_t max_size = detail::adapt_completion_condition_result( completion_condition(ec, tmp.total_consumed()))) tmp.consume(s.write_some(tmp.prepare(max_size), ec)); else break; } return tmp.total_consumed(); } } // namespace detail template <typename SyncWriteStream, typename ConstBufferSequence, typename CompletionCondition> inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, CompletionCondition completion_condition, boost::system::error_code& ec, constraint_t< is_const_buffer_sequence<ConstBufferSequence>::value >, constraint_t< is_completion_condition<CompletionCondition>::value >) { return detail::write(s, buffers, boost::asio::buffer_sequence_begin(buffers), static_cast<CompletionCondition&&>(completion_condition), ec); } template <typename SyncWriteStream, typename ConstBufferSequence> inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, constraint_t< is_const_buffer_sequence<ConstBufferSequence>::value >) { boost::system::error_code ec; std::size_t bytes_transferred = write(s, buffers, transfer_all(), ec); boost::asio::detail::throw_error(ec, "write"); return bytes_transferred; } template <typename SyncWriteStream, typename ConstBufferSequence> inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, boost::system::error_code& ec, constraint_t< is_const_buffer_sequence<ConstBufferSequence>::value >) { return write(s, buffers, transfer_all(), ec); } template <typename SyncWriteStream, typename ConstBufferSequence, typename CompletionCondition> inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, CompletionCondition completion_condition, constraint_t< is_const_buffer_sequence<ConstBufferSequence>::value >, constraint_t< is_completion_condition<CompletionCondition>::value >) { boost::system::error_code ec; std::size_t bytes_transferred = write(s, buffers, static_cast<CompletionCondition&&>(completion_condition), ec); boost::asio::detail::throw_error(ec, "write"); return bytes_transferred; } #if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) template <typename SyncWriteStream, typename DynamicBuffer_v1, typename CompletionCondition> std::size_t write(SyncWriteStream& s, DynamicBuffer_v1&& buffers, CompletionCondition completion_condition, boost::system::error_code& ec, constraint_t< is_dynamic_buffer_v1<decay_t<DynamicBuffer_v1>>::value >, constraint_t< !is_dynamic_buffer_v2<decay_t<DynamicBuffer_v1>>::value >, constraint_t< is_completion_condition<CompletionCondition>::value >) { decay_t<DynamicBuffer_v1> b( static_cast<DynamicBuffer_v1&&>(buffers)); std::size_t bytes_transferred = write(s, b.data(), static_cast<CompletionCondition&&>(completion_condition), ec); b.consume(bytes_transferred); return bytes_transferred; } template <typename SyncWriteStream, typename DynamicBuffer_v1> inline std::size_t write(SyncWriteStream& s, DynamicBuffer_v1&& buffers, constraint_t< is_dynamic_buffer_v1<decay_t<DynamicBuffer_v1>>::value >, constraint_t< !is_dynamic_buffer_v2<decay_t<DynamicBuffer_v1>>::value >) { boost::system::error_code ec; std::size_t bytes_transferred = write(s, static_cast<DynamicBuffer_v1&&>(buffers), transfer_all(), ec); boost::asio::detail::throw_error(ec, "write"); return bytes_transferred; } template <typename SyncWriteStream, typename DynamicBuffer_v1> inline std::size_t write(SyncWriteStream& s, DynamicBuffer_v1&& buffers, boost::system::error_code& ec, constraint_t< is_dynamic_buffer_v1<decay_t<DynamicBuffer_v1>>::value >, constraint_t< !is_dynamic_buffer_v2<decay_t<DynamicBuffer_v1>>::value >) { return write(s, static_cast<DynamicBuffer_v1&&>(buffers), transfer_all(), ec); } template <typename SyncWriteStream, typename DynamicBuffer_v1, typename CompletionCondition> inline std::size_t write(SyncWriteStream& s, DynamicBuffer_v1&& buffers, CompletionCondition completion_condition, constraint_t< is_dynamic_buffer_v1<decay_t<DynamicBuffer_v1>>::value >, constraint_t< !is_dynamic_buffer_v2<decay_t<DynamicBuffer_v1>>::value >, constraint_t< is_completion_condition<CompletionCondition>::value >) { boost::system::error_code ec; std::size_t bytes_transferred = write(s, static_cast<DynamicBuffer_v1&&>(buffers), static_cast<CompletionCondition&&>(completion_condition), ec); boost::asio::detail::throw_error(ec, "write"); return bytes_transferred; } #if !defined(BOOST_ASIO_NO_EXTENSIONS) #if !defined(BOOST_ASIO_NO_IOSTREAM) template <typename SyncWriteStream, typename Allocator, typename CompletionCondition> inline std::size_t write(SyncWriteStream& s, boost::asio::basic_streambuf<Allocator>& b, CompletionCondition completion_condition, boost::system::error_code& ec, constraint_t< is_completion_condition<CompletionCondition>::value >) { return write(s, basic_streambuf_ref<Allocator>(b), static_cast<CompletionCondition&&>(completion_condition), ec); } template <typename SyncWriteStream, typename Allocator> inline std::size_t write(SyncWriteStream& s, boost::asio::basic_streambuf<Allocator>& b) { return write(s, basic_streambuf_ref<Allocator>(b)); } template <typename SyncWriteStream, typename Allocator> inline std::size_t write(SyncWriteStream& s, boost::asio::basic_streambuf<Allocator>& b, boost::system::error_code& ec) { return write(s, basic_streambuf_ref<Allocator>(b), ec); } template <typename SyncWriteStream, typename Allocator, typename CompletionCondition> inline std::size_t write(SyncWriteStream& s, boost::asio::basic_streambuf<Allocator>& b, CompletionCondition completion_condition, constraint_t< is_completion_condition<CompletionCondition>::value >) { return write(s, basic_streambuf_ref<Allocator>(b), static_cast<CompletionCondition&&>(completion_condition)); } #endif // !defined(BOOST_ASIO_NO_IOSTREAM) #endif // !defined(BOOST_ASIO_NO_EXTENSIONS) #endif // !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) template <typename SyncWriteStream, typename DynamicBuffer_v2, typename CompletionCondition> std::size_t write(SyncWriteStream& s, DynamicBuffer_v2 buffers, CompletionCondition completion_condition, boost::system::error_code& ec, constraint_t< is_dynamic_buffer_v2<DynamicBuffer_v2>::value >, constraint_t< is_completion_condition<CompletionCondition>::value >) { std::size_t bytes_transferred = write(s, buffers.data(0, buffers.size()), static_cast<CompletionCondition&&>(completion_condition), ec); buffers.consume(bytes_transferred); return bytes_transferred; } template <typename SyncWriteStream, typename DynamicBuffer_v2> inline std::size_t write(SyncWriteStream& s, DynamicBuffer_v2 buffers, constraint_t< is_dynamic_buffer_v2<DynamicBuffer_v2>::value >) { boost::system::error_code ec; std::size_t bytes_transferred = write(s, static_cast<DynamicBuffer_v2&&>(buffers), transfer_all(), ec); boost::asio::detail::throw_error(ec, "write"); return bytes_transferred; } template <typename SyncWriteStream, typename DynamicBuffer_v2> inline std::size_t write(SyncWriteStream& s, DynamicBuffer_v2 buffers, boost::system::error_code& ec, constraint_t< is_dynamic_buffer_v2<DynamicBuffer_v2>::value >) { return write(s, static_cast<DynamicBuffer_v2&&>(buffers), transfer_all(), ec); } template <typename SyncWriteStream, typename DynamicBuffer_v2, typename CompletionCondition> inline std::size_t write(SyncWriteStream& s, DynamicBuffer_v2 buffers, CompletionCondition completion_condition, constraint_t< is_dynamic_buffer_v2<DynamicBuffer_v2>::value >, constraint_t< is_completion_condition<CompletionCondition>::value >) { boost::system::error_code ec; std::size_t bytes_transferred = write(s, static_cast<DynamicBuffer_v2&&>(buffers), static_cast<CompletionCondition&&>(completion_condition), ec); boost::asio::detail::throw_error(ec, "write"); return bytes_transferred; } namespace detail { template <typename AsyncWriteStream, typename ConstBufferSequence, typename ConstBufferIterator, typename CompletionCondition, typename WriteHandler> class write_op : public base_from_cancellation_state<WriteHandler>, base_from_completion_cond<CompletionCondition> { public: write_op(AsyncWriteStream& stream, const ConstBufferSequence& buffers, CompletionCondition& completion_condition, WriteHandler& handler) : base_from_cancellation_state<WriteHandler>( handler, enable_partial_cancellation()), base_from_completion_cond<CompletionCondition>(completion_condition), stream_(stream), buffers_(buffers), start_(0), handler_(static_cast<WriteHandler&&>(handler)) { } write_op(const write_op& other) : base_from_cancellation_state<WriteHandler>(other), base_from_completion_cond<CompletionCondition>(other), stream_(other.stream_), buffers_(other.buffers_), start_(other.start_), handler_(other.handler_) { } write_op(write_op&& other) : base_from_cancellation_state<WriteHandler>( static_cast<base_from_cancellation_state<WriteHandler>&&>(other)), base_from_completion_cond<CompletionCondition>( static_cast<base_from_completion_cond<CompletionCondition>&&>(other)), stream_(other.stream_), buffers_(static_cast<buffers_type&&>(other.buffers_)), start_(other.start_), handler_(static_cast<WriteHandler&&>(other.handler_)) { } void operator()(boost::system::error_code ec, std::size_t bytes_transferred, int start = 0) { std::size_t max_size; switch (start_ = start) { case 1: max_size = this->check_for_completion(ec, buffers_.total_consumed()); for (;;) { { BOOST_ASIO_HANDLER_LOCATION((__FILE__, __LINE__, "async_write")); stream_.async_write_some(buffers_.prepare(max_size), static_cast<write_op&&>(*this)); } return; default: buffers_.consume(bytes_transferred); if ((!ec && bytes_transferred == 0) || buffers_.empty()) break; max_size = this->check_for_completion(ec, buffers_.total_consumed()); if (max_size == 0) break; if (this->cancelled() != cancellation_type::none) { ec = error::operation_aborted; break; } } static_cast<WriteHandler&&>(handler_)( static_cast<const boost::system::error_code&>(ec), static_cast<const std::size_t&>(buffers_.total_consumed())); } } //private: typedef boost::asio::detail::consuming_buffers<const_buffer, ConstBufferSequence, ConstBufferIterator> buffers_type; AsyncWriteStream& stream_; buffers_type buffers_; int start_; WriteHandler handler_; }; template <typename AsyncWriteStream, typename ConstBufferSequence, typename ConstBufferIterator, typename CompletionCondition, typename WriteHandler> inline bool asio_handler_is_continuation( write_op<AsyncWriteStream, ConstBufferSequence, ConstBufferIterator, CompletionCondition, WriteHandler>* this_handler) { return this_handler->start_ == 0 ? true : boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename AsyncWriteStream, typename ConstBufferSequence, typename ConstBufferIterator, typename CompletionCondition, typename WriteHandler> inline void start_write_op(AsyncWriteStream& stream, const ConstBufferSequence& buffers, const ConstBufferIterator&, CompletionCondition& completion_condition, WriteHandler& handler) { detail::write_op<AsyncWriteStream, ConstBufferSequence, ConstBufferIterator, CompletionCondition, WriteHandler>( stream, buffers, completion_condition, handler)( boost::system::error_code(), 0, 1); } template <typename AsyncWriteStream> class initiate_async_write { public: typedef typename AsyncWriteStream::executor_type executor_type; explicit initiate_async_write(AsyncWriteStream& stream) : stream_(stream) { } executor_type get_executor() const noexcept { return stream_.get_executor(); } template <typename WriteHandler, typename ConstBufferSequence, typename CompletionCondition> void operator()(WriteHandler&& handler, const ConstBufferSequence& buffers, CompletionCondition&& completion_cond) const { // If you get an error on the following line it means that your handler // does not meet the documented type requirements for a WriteHandler. BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; non_const_lvalue<WriteHandler> handler2(handler); non_const_lvalue<CompletionCondition> completion_cond2(completion_cond); start_write_op(stream_, buffers, boost::asio::buffer_sequence_begin(buffers), completion_cond2.value, handler2.value); } private: AsyncWriteStream& stream_; }; } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <template <typename, typename> class Associator, typename AsyncWriteStream, typename ConstBufferSequence, typename ConstBufferIterator, typename CompletionCondition, typename WriteHandler, typename DefaultCandidate> struct associator<Associator, detail::write_op<AsyncWriteStream, ConstBufferSequence, ConstBufferIterator, CompletionCondition, WriteHandler>, DefaultCandidate> : Associator<WriteHandler, DefaultCandidate> { static typename Associator<WriteHandler, DefaultCandidate>::type get( const detail::write_op<AsyncWriteStream, ConstBufferSequence, ConstBufferIterator, CompletionCondition, WriteHandler>& h) noexcept { return Associator<WriteHandler, DefaultCandidate>::get(h.handler_); } static auto get( const detail::write_op<AsyncWriteStream, ConstBufferSequence, ConstBufferIterator, CompletionCondition, WriteHandler>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c)) { return Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c); } }; #endif // !defined(GENERATING_DOCUMENTATION) #if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) namespace detail { template <typename AsyncWriteStream, typename DynamicBuffer_v1, typename CompletionCondition, typename WriteHandler> class write_dynbuf_v1_op { public: template <typename BufferSequence> write_dynbuf_v1_op(AsyncWriteStream& stream, BufferSequence&& buffers, CompletionCondition& completion_condition, WriteHandler& handler) : stream_(stream), buffers_(static_cast<BufferSequence&&>(buffers)), completion_condition_( static_cast<CompletionCondition&&>(completion_condition)), handler_(static_cast<WriteHandler&&>(handler)) { } write_dynbuf_v1_op(const write_dynbuf_v1_op& other) : stream_(other.stream_), buffers_(other.buffers_), completion_condition_(other.completion_condition_), handler_(other.handler_) { } write_dynbuf_v1_op(write_dynbuf_v1_op&& other) : stream_(other.stream_), buffers_(static_cast<DynamicBuffer_v1&&>(other.buffers_)), completion_condition_( static_cast<CompletionCondition&&>( other.completion_condition_)), handler_(static_cast<WriteHandler&&>(other.handler_)) { } void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { switch (start) { case 1: async_write(stream_, buffers_.data(), static_cast<CompletionCondition&&>(completion_condition_), static_cast<write_dynbuf_v1_op&&>(*this)); return; default: buffers_.consume(bytes_transferred); static_cast<WriteHandler&&>(handler_)(ec, static_cast<const std::size_t&>(bytes_transferred)); } } //private: AsyncWriteStream& stream_; DynamicBuffer_v1 buffers_; CompletionCondition completion_condition_; WriteHandler handler_; }; template <typename AsyncWriteStream, typename DynamicBuffer_v1, typename CompletionCondition, typename WriteHandler> inline bool asio_handler_is_continuation( write_dynbuf_v1_op<AsyncWriteStream, DynamicBuffer_v1, CompletionCondition, WriteHandler>* this_handler) { return boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename AsyncWriteStream> class initiate_async_write_dynbuf_v1 { public: typedef typename AsyncWriteStream::executor_type executor_type; explicit initiate_async_write_dynbuf_v1(AsyncWriteStream& stream) : stream_(stream) { } executor_type get_executor() const noexcept { return stream_.get_executor(); } template <typename WriteHandler, typename DynamicBuffer_v1, typename CompletionCondition> void operator()(WriteHandler&& handler, DynamicBuffer_v1&& buffers, CompletionCondition&& completion_cond) const { // If you get an error on the following line it means that your handler // does not meet the documented type requirements for a WriteHandler. BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; non_const_lvalue<WriteHandler> handler2(handler); non_const_lvalue<CompletionCondition> completion_cond2(completion_cond); write_dynbuf_v1_op<AsyncWriteStream, decay_t<DynamicBuffer_v1>, CompletionCondition, decay_t<WriteHandler>>( stream_, static_cast<DynamicBuffer_v1&&>(buffers), completion_cond2.value, handler2.value)( boost::system::error_code(), 0, 1); } private: AsyncWriteStream& stream_; }; } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <template <typename, typename> class Associator, typename AsyncWriteStream, typename DynamicBuffer_v1, typename CompletionCondition, typename WriteHandler, typename DefaultCandidate> struct associator<Associator, detail::write_dynbuf_v1_op<AsyncWriteStream, DynamicBuffer_v1, CompletionCondition, WriteHandler>, DefaultCandidate> : Associator<WriteHandler, DefaultCandidate> { static typename Associator<WriteHandler, DefaultCandidate>::type get( const detail::write_dynbuf_v1_op<AsyncWriteStream, DynamicBuffer_v1, CompletionCondition, WriteHandler>& h) noexcept { return Associator<WriteHandler, DefaultCandidate>::get(h.handler_); } static auto get( const detail::write_dynbuf_v1_op<AsyncWriteStream, DynamicBuffer_v1, CompletionCondition, WriteHandler>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c)) { return Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c); } }; #endif // !defined(GENERATING_DOCUMENTATION) #endif // !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) namespace detail { template <typename AsyncWriteStream, typename DynamicBuffer_v2, typename CompletionCondition, typename WriteHandler> class write_dynbuf_v2_op { public: template <typename BufferSequence> write_dynbuf_v2_op(AsyncWriteStream& stream, BufferSequence&& buffers, CompletionCondition& completion_condition, WriteHandler& handler) : stream_(stream), buffers_(static_cast<BufferSequence&&>(buffers)), completion_condition_( static_cast<CompletionCondition&&>(completion_condition)), handler_(static_cast<WriteHandler&&>(handler)) { } write_dynbuf_v2_op(const write_dynbuf_v2_op& other) : stream_(other.stream_), buffers_(other.buffers_), completion_condition_(other.completion_condition_), handler_(other.handler_) { } write_dynbuf_v2_op(write_dynbuf_v2_op&& other) : stream_(other.stream_), buffers_(static_cast<DynamicBuffer_v2&&>(other.buffers_)), completion_condition_( static_cast<CompletionCondition&&>( other.completion_condition_)), handler_(static_cast<WriteHandler&&>(other.handler_)) { } void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { switch (start) { case 1: async_write(stream_, buffers_.data(0, buffers_.size()), static_cast<CompletionCondition&&>(completion_condition_), static_cast<write_dynbuf_v2_op&&>(*this)); return; default: buffers_.consume(bytes_transferred); static_cast<WriteHandler&&>(handler_)(ec, static_cast<const std::size_t&>(bytes_transferred)); } } //private: AsyncWriteStream& stream_; DynamicBuffer_v2 buffers_; CompletionCondition completion_condition_; WriteHandler handler_; }; template <typename AsyncWriteStream, typename DynamicBuffer_v2, typename CompletionCondition, typename WriteHandler> inline bool asio_handler_is_continuation( write_dynbuf_v2_op<AsyncWriteStream, DynamicBuffer_v2, CompletionCondition, WriteHandler>* this_handler) { return boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename AsyncWriteStream> class initiate_async_write_dynbuf_v2 { public: typedef typename AsyncWriteStream::executor_type executor_type; explicit initiate_async_write_dynbuf_v2(AsyncWriteStream& stream) : stream_(stream) { } executor_type get_executor() const noexcept { return stream_.get_executor(); } template <typename WriteHandler, typename DynamicBuffer_v2, typename CompletionCondition> void operator()(WriteHandler&& handler, DynamicBuffer_v2&& buffers, CompletionCondition&& completion_cond) const { // If you get an error on the following line it means that your handler // does not meet the documented type requirements for a WriteHandler. BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; non_const_lvalue<WriteHandler> handler2(handler); non_const_lvalue<CompletionCondition> completion_cond2(completion_cond); write_dynbuf_v2_op<AsyncWriteStream, decay_t<DynamicBuffer_v2>, CompletionCondition, decay_t<WriteHandler>>( stream_, static_cast<DynamicBuffer_v2&&>(buffers), completion_cond2.value, handler2.value)( boost::system::error_code(), 0, 1); } private: AsyncWriteStream& stream_; }; } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <template <typename, typename> class Associator, typename AsyncWriteStream, typename DynamicBuffer_v2, typename CompletionCondition, typename WriteHandler, typename DefaultCandidate> struct associator<Associator, detail::write_dynbuf_v2_op<AsyncWriteStream, DynamicBuffer_v2, CompletionCondition, WriteHandler>, DefaultCandidate> : Associator<WriteHandler, DefaultCandidate> { static typename Associator<WriteHandler, DefaultCandidate>::type get( const detail::write_dynbuf_v2_op<AsyncWriteStream, DynamicBuffer_v2, CompletionCondition, WriteHandler>& h) noexcept { return Associator<WriteHandler, DefaultCandidate>::get(h.handler_); } static auto get( const detail::write_dynbuf_v2_op<AsyncWriteStream, DynamicBuffer_v2, CompletionCondition, WriteHandler>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c)) { return Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c); } }; #endif // !defined(GENERATING_DOCUMENTATION) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_IMPL_WRITE_HPP
26,361
C++
.h
700
32.35
80
0.716994
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,452
consign.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/impl/consign.hpp
// // impl/consign.hpp // ~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_IMPL_CONSIGN_HPP #define BOOST_ASIO_IMPL_CONSIGN_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associator.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/handler_cont_helpers.hpp> #include <boost/asio/detail/initiation_base.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/utility.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { // Class to adapt a consign_t as a completion handler. template <typename Handler, typename... Values> class consign_handler { public: typedef void result_type; template <typename H> consign_handler(H&& handler, std::tuple<Values...> values) : handler_(static_cast<H&&>(handler)), values_(static_cast<std::tuple<Values...>&&>(values)) { } template <typename... Args> void operator()(Args&&... args) { static_cast<Handler&&>(handler_)(static_cast<Args&&>(args)...); } //private: Handler handler_; std::tuple<Values...> values_; }; template <typename Handler> inline bool asio_handler_is_continuation( consign_handler<Handler>* this_handler) { return boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <typename CompletionToken, typename... Values, typename... Signatures> struct async_result<consign_t<CompletionToken, Values...>, Signatures...> : async_result<CompletionToken, Signatures...> { template <typename Initiation> struct init_wrapper : detail::initiation_base<Initiation> { using detail::initiation_base<Initiation>::initiation_base; template <typename Handler, typename... Args> void operator()(Handler&& handler, std::tuple<Values...> values, Args&&... args) && { static_cast<Initiation&&>(*this)( detail::consign_handler<decay_t<Handler>, Values...>( static_cast<Handler&&>(handler), static_cast<std::tuple<Values...>&&>(values)), static_cast<Args&&>(args)...); } template <typename Handler, typename... Args> void operator()(Handler&& handler, std::tuple<Values...> values, Args&&... args) const & { static_cast<const Initiation&>(*this)( detail::consign_handler<decay_t<Handler>, Values...>( static_cast<Handler&&>(handler), static_cast<std::tuple<Values...>&&>(values)), static_cast<Args&&>(args)...); } }; template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate<CompletionToken, Signatures...>( init_wrapper<decay_t<Initiation>>( static_cast<Initiation&&>(initiation)), token.token_, static_cast<std::tuple<Values...>&&>(token.values_), static_cast<Args&&>(args)...)) { return async_initiate<CompletionToken, Signatures...>( init_wrapper<decay_t<Initiation>>( static_cast<Initiation&&>(initiation)), token.token_, static_cast<std::tuple<Values...>&&>(token.values_), static_cast<Args&&>(args)...); } }; template <template <typename, typename> class Associator, typename Handler, typename... Values, typename DefaultCandidate> struct associator<Associator, detail::consign_handler<Handler, Values...>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { static typename Associator<Handler, DefaultCandidate>::type get( const detail::consign_handler<Handler, Values...>& h) noexcept { return Associator<Handler, DefaultCandidate>::get(h.handler_); } static auto get(const detail::consign_handler<Handler, Values...>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<Handler, DefaultCandidate>::get(h.handler_, c)) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } }; #endif // !defined(GENERATING_DOCUMENTATION) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_IMPL_CONSIGN_HPP
4,572
C++
.h
124
32.854839
79
0.691821
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,456
cancel_at.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/impl/cancel_at.hpp
// // impl/cancel_at.hpp // ~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_IMPL_CANCEL_AT_HPP #define BOOST_ASIO_IMPL_CANCEL_AT_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associated_executor.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/initiation_base.hpp> #include <boost/asio/detail/timed_cancel_op.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename Initiation, typename Clock, typename WaitTraits, typename... Signatures> struct initiate_cancel_at : initiation_base<Initiation> { using initiation_base<Initiation>::initiation_base; template <typename Handler, typename Duration, typename... Args> void operator()(Handler&& handler, const chrono::time_point<Clock, Duration>& expiry, cancellation_type_t cancel_type, Args&&... args) && { using op = detail::timed_cancel_op<decay_t<Handler>, basic_waitable_timer<Clock, WaitTraits>, Signatures...>; non_const_lvalue<Handler> handler2(handler); typename op::ptr p = { boost::asio::detail::addressof(handler2.value), op::ptr::allocate(handler2.value), 0 }; p.p = new (p.v) op(handler2.value, basic_waitable_timer<Clock, WaitTraits, typename Initiation::executor_type>(this->get_executor(), expiry), cancel_type); op* o = p.p; p.v = p.p = 0; o->start(static_cast<Initiation&&>(*this), static_cast<Args&&>(args)...); } template <typename Handler, typename Duration, typename... Args> void operator()(Handler&& handler, const chrono::time_point<Clock, Duration>& expiry, cancellation_type_t cancel_type, Args&&... args) const & { using op = detail::timed_cancel_op<decay_t<Handler>, basic_waitable_timer<Clock, WaitTraits>, Signatures...>; non_const_lvalue<Handler> handler2(handler); typename op::ptr p = { boost::asio::detail::addressof(handler2.value), op::ptr::allocate(handler2.value), 0 }; p.p = new (p.v) op(handler2.value, basic_waitable_timer<Clock, WaitTraits, typename Initiation::executor_type>(this->get_executor(), expiry), cancel_type); op* o = p.p; p.v = p.p = 0; o->start(static_cast<const Initiation&>(*this), static_cast<Args&&>(args)...); } }; template <typename Initiation, typename Clock, typename WaitTraits, typename Executor, typename... Signatures> struct initiate_cancel_at_timer : initiation_base<Initiation> { using initiation_base<Initiation>::initiation_base; template <typename Handler, typename Duration, typename... Args> void operator()(Handler&& handler, basic_waitable_timer<Clock, WaitTraits, Executor>* timer, const chrono::time_point<Clock, Duration>& expiry, cancellation_type_t cancel_type, Args&&... args) && { using op = detail::timed_cancel_op<decay_t<Handler>, basic_waitable_timer<Clock, WaitTraits, Executor>&, Signatures...>; non_const_lvalue<Handler> handler2(handler); typename op::ptr p = { boost::asio::detail::addressof(handler2.value), op::ptr::allocate(handler2.value), 0 }; timer->expires_at(expiry); p.p = new (p.v) op(handler2.value, *timer, cancel_type); op* o = p.p; p.v = p.p = 0; o->start(static_cast<Initiation&&>(*this), static_cast<Args&&>(args)...); } template <typename Handler, typename Duration, typename... Args> void operator()(Handler&& handler, basic_waitable_timer<Clock, WaitTraits, Executor>* timer, const chrono::time_point<Clock, Duration>& expiry, cancellation_type_t cancel_type, Args&&... args) const & { using op = detail::timed_cancel_op<decay_t<Handler>, basic_waitable_timer<Clock, WaitTraits, Executor>&, Signatures...>; non_const_lvalue<Handler> handler2(handler); typename op::ptr p = { boost::asio::detail::addressof(handler2.value), op::ptr::allocate(handler2.value), 0 }; timer->expires_at(expiry); p.p = new (p.v) op(handler2.value, *timer, cancel_type); op* o = p.p; p.v = p.p = 0; o->start(static_cast<const Initiation&>(*this), static_cast<Args&&>(args)...); } }; } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <typename CompletionToken, typename Clock, typename WaitTraits, typename... Signatures> struct async_result< cancel_at_t<CompletionToken, Clock, WaitTraits>, Signatures...> : async_result<CompletionToken, Signatures...> { template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate< conditional_t< is_const<remove_reference_t<RawCompletionToken>>::value, const CompletionToken, CompletionToken>, Signatures...>( declval<detail::initiate_cancel_at< decay_t<Initiation>, Clock, WaitTraits, Signatures...>>(), token.token_, token.expiry_, token.cancel_type_, static_cast<Args&&>(args)...)) { return async_initiate< conditional_t< is_const<remove_reference_t<RawCompletionToken>>::value, const CompletionToken, CompletionToken>, Signatures...>( detail::initiate_cancel_at< decay_t<Initiation>, Clock, WaitTraits, Signatures...>( static_cast<Initiation&&>(initiation)), token.token_, token.expiry_, token.cancel_type_, static_cast<Args&&>(args)...); } }; template <typename CompletionToken, typename Clock, typename WaitTraits, typename Executor, typename... Signatures> struct async_result< cancel_at_timer<CompletionToken, Clock, WaitTraits, Executor>, Signatures...> : async_result<CompletionToken, Signatures...> { template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate< conditional_t< is_const<remove_reference_t<RawCompletionToken>>::value, const CompletionToken, CompletionToken>, Signatures...>( declval<detail::initiate_cancel_at_timer< decay_t<Initiation>, Clock, WaitTraits, Executor, Signatures...>>(), token.token_, &token.timer_, token.expiry_, token.cancel_type_, static_cast<Args&&>(args)...)) { return async_initiate< conditional_t< is_const<remove_reference_t<RawCompletionToken>>::value, const CompletionToken, CompletionToken>, Signatures...>( detail::initiate_cancel_at_timer< decay_t<Initiation>, Clock, WaitTraits, Executor, Signatures...>( static_cast<Initiation&&>(initiation)), token.token_, &token.timer_, token.expiry_, token.cancel_type_, static_cast<Args&&>(args)...); } }; template <typename Clock, typename WaitTraits, typename... Signatures> struct async_result<partial_cancel_at<Clock, WaitTraits>, Signatures...> { template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate< const cancel_at_t< default_completion_token_t<associated_executor_t<Initiation>>, Clock, WaitTraits>&, Signatures...>( static_cast<Initiation&&>(initiation), cancel_at_t< default_completion_token_t<associated_executor_t<Initiation>>, Clock, WaitTraits>( default_completion_token_t<associated_executor_t<Initiation>>{}, token.expiry_, token.cancel_type_), static_cast<Args&&>(args)...)) { return async_initiate< const cancel_at_t< default_completion_token_t<associated_executor_t<Initiation>>, Clock, WaitTraits>&, Signatures...>( static_cast<Initiation&&>(initiation), cancel_at_t< default_completion_token_t<associated_executor_t<Initiation>>, Clock, WaitTraits>( default_completion_token_t<associated_executor_t<Initiation>>{}, token.expiry_, token.cancel_type_), static_cast<Args&&>(args)...); } }; template <typename Clock, typename WaitTraits, typename Executor, typename... Signatures> struct async_result< partial_cancel_at_timer<Clock, WaitTraits, Executor>, Signatures...> { template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate<Signatures...>( static_cast<Initiation&&>(initiation), cancel_at_timer< default_completion_token_t<associated_executor_t<Initiation>>, Clock, WaitTraits, Executor>( default_completion_token_t<associated_executor_t<Initiation>>{}, token.timer_, token.expiry_, token.cancel_type_), static_cast<Args&&>(args)...)) { return async_initiate<Signatures...>( static_cast<Initiation&&>(initiation), cancel_at_timer< default_completion_token_t<associated_executor_t<Initiation>>, Clock, WaitTraits, Executor>( default_completion_token_t<associated_executor_t<Initiation>>{}, token.timer_, token.expiry_, token.cancel_type_), static_cast<Args&&>(args)...); } }; #endif // !defined(GENERATING_DOCUMENTATION) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_IMPL_CANCEL_AT_HPP
10,050
C++
.h
241
35.759336
80
0.67229
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,460
detached.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/impl/detached.hpp
// // impl/detached.hpp // ~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_IMPL_DETACHED_HPP #define BOOST_ASIO_IMPL_DETACHED_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { // Class to adapt a detached_t as a completion handler. class detached_handler { public: typedef void result_type; detached_handler(detached_t) { } template <typename... Args> void operator()(Args...) { } }; } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <typename... Signatures> struct async_result<detached_t, Signatures...> { typedef boost::asio::detail::detached_handler completion_handler_type; typedef void return_type; explicit async_result(completion_handler_type&) { } void get() { } template <typename Initiation, typename RawCompletionToken, typename... Args> static return_type initiate(Initiation&& initiation, RawCompletionToken&&, Args&&... args) { static_cast<Initiation&&>(initiation)( detail::detached_handler(detached_t()), static_cast<Args&&>(args)...); } }; #endif // !defined(GENERATING_DOCUMENTATION) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_IMPL_DETACHED_HPP
1,730
C++
.h
60
25.983333
79
0.709873
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,462
append.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/impl/append.hpp
// // impl/append.hpp // ~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_IMPL_APPEND_HPP #define BOOST_ASIO_IMPL_APPEND_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associator.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/handler_cont_helpers.hpp> #include <boost/asio/detail/initiation_base.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/utility.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { // Class to adapt an append_t as a completion handler. template <typename Handler, typename... Values> class append_handler { public: typedef void result_type; template <typename H> append_handler(H&& handler, std::tuple<Values...> values) : handler_(static_cast<H&&>(handler)), values_(static_cast<std::tuple<Values...>&&>(values)) { } template <typename... Args> void operator()(Args&&... args) { this->invoke( index_sequence_for<Values...>{}, static_cast<Args&&>(args)...); } template <std::size_t... I, typename... Args> void invoke(index_sequence<I...>, Args&&... args) { static_cast<Handler&&>(handler_)( static_cast<Args&&>(args)..., static_cast<Values&&>(std::get<I>(values_))...); } //private: Handler handler_; std::tuple<Values...> values_; }; template <typename Handler> inline bool asio_handler_is_continuation( append_handler<Handler>* this_handler) { return boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename Signature, typename... Values> struct append_signature; template <typename R, typename... Args, typename... Values> struct append_signature<R(Args...), Values...> { typedef R type(decay_t<Args>..., Values...); }; } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <typename CompletionToken, typename... Values, typename Signature> struct async_result<append_t<CompletionToken, Values...>, Signature> : async_result<CompletionToken, typename detail::append_signature< Signature, Values...>::type> { typedef typename detail::append_signature< Signature, Values...>::type signature; template <typename Initiation> struct init_wrapper : detail::initiation_base<Initiation> { using detail::initiation_base<Initiation>::initiation_base; template <typename Handler, typename... Args> void operator()(Handler&& handler, std::tuple<Values...> values, Args&&... args) && { static_cast<Initiation&&>(*this)( detail::append_handler<decay_t<Handler>, Values...>( static_cast<Handler&&>(handler), static_cast<std::tuple<Values...>&&>(values)), static_cast<Args&&>(args)...); } template <typename Handler, typename... Args> void operator()(Handler&& handler, std::tuple<Values...> values, Args&&... args) const & { static_cast<const Initiation&>(*this)( detail::append_handler<decay_t<Handler>, Values...>( static_cast<Handler&&>(handler), static_cast<std::tuple<Values...>&&>(values)), static_cast<Args&&>(args)...); } }; template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate<CompletionToken, signature>( declval<init_wrapper<decay_t<Initiation>>>(), token.token_, static_cast<std::tuple<Values...>&&>(token.values_), static_cast<Args&&>(args)...)) { return async_initiate<CompletionToken, signature>( init_wrapper<decay_t<Initiation>>( static_cast<Initiation&&>(initiation)), token.token_, static_cast<std::tuple<Values...>&&>(token.values_), static_cast<Args&&>(args)...); } }; template <template <typename, typename> class Associator, typename Handler, typename... Values, typename DefaultCandidate> struct associator<Associator, detail::append_handler<Handler, Values...>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { static typename Associator<Handler, DefaultCandidate>::type get( const detail::append_handler<Handler, Values...>& h) noexcept { return Associator<Handler, DefaultCandidate>::get(h.handler_); } static auto get(const detail::append_handler<Handler, Values...>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<Handler, DefaultCandidate>::get(h.handler_, c)) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } }; #endif // !defined(GENERATING_DOCUMENTATION) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_IMPL_APPEND_HPP
5,181
C++
.h
145
31.613793
79
0.684032
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,463
read_at.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/impl/read_at.hpp
// // impl/read_at.hpp // ~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_IMPL_READ_AT_HPP #define BOOST_ASIO_IMPL_READ_AT_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <algorithm> #include <boost/asio/associator.hpp> #include <boost/asio/buffer.hpp> #include <boost/asio/detail/array_fwd.hpp> #include <boost/asio/detail/base_from_cancellation_state.hpp> #include <boost/asio/detail/base_from_completion_cond.hpp> #include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/consuming_buffers.hpp> #include <boost/asio/detail/dependent_type.hpp> #include <boost/asio/detail/handler_cont_helpers.hpp> #include <boost/asio/detail/handler_tracking.hpp> #include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/non_const_lvalue.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence, typename MutableBufferIterator, typename CompletionCondition> std::size_t read_at_buffer_sequence(SyncRandomAccessReadDevice& d, uint64_t offset, const MutableBufferSequence& buffers, const MutableBufferIterator&, CompletionCondition completion_condition, boost::system::error_code& ec) { ec = boost::system::error_code(); boost::asio::detail::consuming_buffers<mutable_buffer, MutableBufferSequence, MutableBufferIterator> tmp(buffers); while (!tmp.empty()) { if (std::size_t max_size = detail::adapt_completion_condition_result( completion_condition(ec, tmp.total_consumed()))) { tmp.consume(d.read_some_at(offset + tmp.total_consumed(), tmp.prepare(max_size), ec)); } else break; } return tmp.total_consumed(); } } // namespace detail template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence, typename CompletionCondition> std::size_t read_at(SyncRandomAccessReadDevice& d, uint64_t offset, const MutableBufferSequence& buffers, CompletionCondition completion_condition, boost::system::error_code& ec, constraint_t< is_completion_condition<CompletionCondition>::value >) { return detail::read_at_buffer_sequence(d, offset, buffers, boost::asio::buffer_sequence_begin(buffers), static_cast<CompletionCondition&&>(completion_condition), ec); } template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence> inline std::size_t read_at(SyncRandomAccessReadDevice& d, uint64_t offset, const MutableBufferSequence& buffers) { boost::system::error_code ec; std::size_t bytes_transferred = read_at( d, offset, buffers, transfer_all(), ec); boost::asio::detail::throw_error(ec, "read_at"); return bytes_transferred; } template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence> inline std::size_t read_at(SyncRandomAccessReadDevice& d, uint64_t offset, const MutableBufferSequence& buffers, boost::system::error_code& ec) { return read_at(d, offset, buffers, transfer_all(), ec); } template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence, typename CompletionCondition> inline std::size_t read_at(SyncRandomAccessReadDevice& d, uint64_t offset, const MutableBufferSequence& buffers, CompletionCondition completion_condition, constraint_t< is_completion_condition<CompletionCondition>::value >) { boost::system::error_code ec; std::size_t bytes_transferred = read_at(d, offset, buffers, static_cast<CompletionCondition&&>(completion_condition), ec); boost::asio::detail::throw_error(ec, "read_at"); return bytes_transferred; } #if !defined(BOOST_ASIO_NO_EXTENSIONS) #if !defined(BOOST_ASIO_NO_IOSTREAM) template <typename SyncRandomAccessReadDevice, typename Allocator, typename CompletionCondition> std::size_t read_at(SyncRandomAccessReadDevice& d, uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, CompletionCondition completion_condition, boost::system::error_code& ec, constraint_t< is_completion_condition<CompletionCondition>::value >) { ec = boost::system::error_code(); std::size_t total_transferred = 0; std::size_t max_size = detail::adapt_completion_condition_result( completion_condition(ec, total_transferred)); std::size_t bytes_available = read_size_helper(b, max_size); while (bytes_available > 0) { std::size_t bytes_transferred = d.read_some_at( offset + total_transferred, b.prepare(bytes_available), ec); b.commit(bytes_transferred); total_transferred += bytes_transferred; max_size = detail::adapt_completion_condition_result( completion_condition(ec, total_transferred)); bytes_available = read_size_helper(b, max_size); } return total_transferred; } template <typename SyncRandomAccessReadDevice, typename Allocator> inline std::size_t read_at(SyncRandomAccessReadDevice& d, uint64_t offset, boost::asio::basic_streambuf<Allocator>& b) { boost::system::error_code ec; std::size_t bytes_transferred = read_at( d, offset, b, transfer_all(), ec); boost::asio::detail::throw_error(ec, "read_at"); return bytes_transferred; } template <typename SyncRandomAccessReadDevice, typename Allocator> inline std::size_t read_at(SyncRandomAccessReadDevice& d, uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, boost::system::error_code& ec) { return read_at(d, offset, b, transfer_all(), ec); } template <typename SyncRandomAccessReadDevice, typename Allocator, typename CompletionCondition> inline std::size_t read_at(SyncRandomAccessReadDevice& d, uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, CompletionCondition completion_condition, constraint_t< is_completion_condition<CompletionCondition>::value >) { boost::system::error_code ec; std::size_t bytes_transferred = read_at(d, offset, b, static_cast<CompletionCondition&&>(completion_condition), ec); boost::asio::detail::throw_error(ec, "read_at"); return bytes_transferred; } #endif // !defined(BOOST_ASIO_NO_IOSTREAM) #endif // !defined(BOOST_ASIO_NO_EXTENSIONS) namespace detail { template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename MutableBufferIterator, typename CompletionCondition, typename ReadHandler> class read_at_op : public base_from_cancellation_state<ReadHandler>, base_from_completion_cond<CompletionCondition> { public: read_at_op(AsyncRandomAccessReadDevice& device, uint64_t offset, const MutableBufferSequence& buffers, CompletionCondition& completion_condition, ReadHandler& handler) : base_from_cancellation_state<ReadHandler>( handler, enable_partial_cancellation()), base_from_completion_cond<CompletionCondition>(completion_condition), device_(device), offset_(offset), buffers_(buffers), start_(0), handler_(static_cast<ReadHandler&&>(handler)) { } read_at_op(const read_at_op& other) : base_from_cancellation_state<ReadHandler>(other), base_from_completion_cond<CompletionCondition>(other), device_(other.device_), offset_(other.offset_), buffers_(other.buffers_), start_(other.start_), handler_(other.handler_) { } read_at_op(read_at_op&& other) : base_from_cancellation_state<ReadHandler>( static_cast<base_from_cancellation_state<ReadHandler>&&>(other)), base_from_completion_cond<CompletionCondition>( static_cast<base_from_completion_cond<CompletionCondition>&&>(other)), device_(other.device_), offset_(other.offset_), buffers_(static_cast<buffers_type&&>(other.buffers_)), start_(other.start_), handler_(static_cast<ReadHandler&&>(other.handler_)) { } void operator()(boost::system::error_code ec, std::size_t bytes_transferred, int start = 0) { std::size_t max_size; switch (start_ = start) { case 1: max_size = this->check_for_completion(ec, buffers_.total_consumed()); for (;;) { { BOOST_ASIO_HANDLER_LOCATION((__FILE__, __LINE__, "async_read_at")); device_.async_read_some_at( offset_ + buffers_.total_consumed(), buffers_.prepare(max_size), static_cast<read_at_op&&>(*this)); } return; default: buffers_.consume(bytes_transferred); if ((!ec && bytes_transferred == 0) || buffers_.empty()) break; max_size = this->check_for_completion(ec, buffers_.total_consumed()); if (max_size == 0) break; if (this->cancelled() != cancellation_type::none) { ec = boost::asio::error::operation_aborted; break; } } static_cast<ReadHandler&&>(handler_)( static_cast<const boost::system::error_code&>(ec), static_cast<const std::size_t&>(buffers_.total_consumed())); } } //private: typedef boost::asio::detail::consuming_buffers<mutable_buffer, MutableBufferSequence, MutableBufferIterator> buffers_type; AsyncRandomAccessReadDevice& device_; uint64_t offset_; buffers_type buffers_; int start_; ReadHandler handler_; }; template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename MutableBufferIterator, typename CompletionCondition, typename ReadHandler> inline bool asio_handler_is_continuation( read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, MutableBufferIterator, CompletionCondition, ReadHandler>* this_handler) { return this_handler->start_ == 0 ? true : boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename MutableBufferIterator, typename CompletionCondition, typename ReadHandler> inline void start_read_at_op(AsyncRandomAccessReadDevice& d, uint64_t offset, const MutableBufferSequence& buffers, const MutableBufferIterator&, CompletionCondition& completion_condition, ReadHandler& handler) { detail::read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, MutableBufferIterator, CompletionCondition, ReadHandler>( d, offset, buffers, completion_condition, handler)( boost::system::error_code(), 0, 1); } template <typename AsyncRandomAccessReadDevice> class initiate_async_read_at { public: typedef typename AsyncRandomAccessReadDevice::executor_type executor_type; explicit initiate_async_read_at(AsyncRandomAccessReadDevice& device) : device_(device) { } executor_type get_executor() const noexcept { return device_.get_executor(); } template <typename ReadHandler, typename MutableBufferSequence, typename CompletionCondition> void operator()(ReadHandler&& handler, uint64_t offset, const MutableBufferSequence& buffers, CompletionCondition&& completion_cond) const { // If you get an error on the following line it means that your handler // does not meet the documented type requirements for a ReadHandler. BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; non_const_lvalue<ReadHandler> handler2(handler); non_const_lvalue<CompletionCondition> completion_cond2(completion_cond); start_read_at_op(device_, offset, buffers, boost::asio::buffer_sequence_begin(buffers), completion_cond2.value, handler2.value); } private: AsyncRandomAccessReadDevice& device_; }; } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <template <typename, typename> class Associator, typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename MutableBufferIterator, typename CompletionCondition, typename ReadHandler, typename DefaultCandidate> struct associator<Associator, detail::read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, MutableBufferIterator, CompletionCondition, ReadHandler>, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { static typename Associator<ReadHandler, DefaultCandidate>::type get( const detail::read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, MutableBufferIterator, CompletionCondition, ReadHandler>& h) noexcept { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); } static auto get( const detail::read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, MutableBufferIterator, CompletionCondition, ReadHandler>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c)) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } }; #endif // !defined(GENERATING_DOCUMENTATION) #if !defined(BOOST_ASIO_NO_EXTENSIONS) #if !defined(BOOST_ASIO_NO_IOSTREAM) namespace detail { template <typename AsyncRandomAccessReadDevice, typename Allocator, typename CompletionCondition, typename ReadHandler> class read_at_streambuf_op : public base_from_cancellation_state<ReadHandler>, base_from_completion_cond<CompletionCondition> { public: read_at_streambuf_op(AsyncRandomAccessReadDevice& device, uint64_t offset, basic_streambuf<Allocator>& streambuf, CompletionCondition& completion_condition, ReadHandler& handler) : base_from_cancellation_state<ReadHandler>( handler, enable_partial_cancellation()), base_from_completion_cond<CompletionCondition>(completion_condition), device_(device), offset_(offset), streambuf_(streambuf), start_(0), total_transferred_(0), handler_(static_cast<ReadHandler&&>(handler)) { } read_at_streambuf_op(const read_at_streambuf_op& other) : base_from_cancellation_state<ReadHandler>(other), base_from_completion_cond<CompletionCondition>(other), device_(other.device_), offset_(other.offset_), streambuf_(other.streambuf_), start_(other.start_), total_transferred_(other.total_transferred_), handler_(other.handler_) { } read_at_streambuf_op(read_at_streambuf_op&& other) : base_from_cancellation_state<ReadHandler>( static_cast<base_from_cancellation_state<ReadHandler>&&>(other)), base_from_completion_cond<CompletionCondition>( static_cast<base_from_completion_cond<CompletionCondition>&&>(other)), device_(other.device_), offset_(other.offset_), streambuf_(other.streambuf_), start_(other.start_), total_transferred_(other.total_transferred_), handler_(static_cast<ReadHandler&&>(other.handler_)) { } void operator()(boost::system::error_code ec, std::size_t bytes_transferred, int start = 0) { std::size_t max_size, bytes_available; switch (start_ = start) { case 1: max_size = this->check_for_completion(ec, total_transferred_); bytes_available = read_size_helper(streambuf_, max_size); for (;;) { { BOOST_ASIO_HANDLER_LOCATION((__FILE__, __LINE__, "async_read_at")); device_.async_read_some_at(offset_ + total_transferred_, streambuf_.prepare(bytes_available), static_cast<read_at_streambuf_op&&>(*this)); } return; default: total_transferred_ += bytes_transferred; streambuf_.commit(bytes_transferred); max_size = this->check_for_completion(ec, total_transferred_); bytes_available = read_size_helper(streambuf_, max_size); if ((!ec && bytes_transferred == 0) || bytes_available == 0) break; if (this->cancelled() != cancellation_type::none) { ec = boost::asio::error::operation_aborted; break; } } static_cast<ReadHandler&&>(handler_)( static_cast<const boost::system::error_code&>(ec), static_cast<const std::size_t&>(total_transferred_)); } } //private: AsyncRandomAccessReadDevice& device_; uint64_t offset_; boost::asio::basic_streambuf<Allocator>& streambuf_; int start_; std::size_t total_transferred_; ReadHandler handler_; }; template <typename AsyncRandomAccessReadDevice, typename Allocator, typename CompletionCondition, typename ReadHandler> inline bool asio_handler_is_continuation( read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator, CompletionCondition, ReadHandler>* this_handler) { return this_handler->start_ == 0 ? true : boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename AsyncRandomAccessReadDevice> class initiate_async_read_at_streambuf { public: typedef typename AsyncRandomAccessReadDevice::executor_type executor_type; explicit initiate_async_read_at_streambuf( AsyncRandomAccessReadDevice& device) : device_(device) { } executor_type get_executor() const noexcept { return device_.get_executor(); } template <typename ReadHandler, typename Allocator, typename CompletionCondition> void operator()(ReadHandler&& handler, uint64_t offset, basic_streambuf<Allocator>* b, CompletionCondition&& completion_cond) const { // If you get an error on the following line it means that your handler // does not meet the documented type requirements for a ReadHandler. BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; non_const_lvalue<ReadHandler> handler2(handler); non_const_lvalue<CompletionCondition> completion_cond2(completion_cond); read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator, CompletionCondition, decay_t<ReadHandler>>( device_, offset, *b, completion_cond2.value, handler2.value)( boost::system::error_code(), 0, 1); } private: AsyncRandomAccessReadDevice& device_; }; } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <template <typename, typename> class Associator, typename AsyncRandomAccessReadDevice, typename Executor, typename CompletionCondition, typename ReadHandler, typename DefaultCandidate> struct associator<Associator, detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, Executor, CompletionCondition, ReadHandler>, DefaultCandidate> : Associator<ReadHandler, DefaultCandidate> { static typename Associator<ReadHandler, DefaultCandidate>::type get( const detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, Executor, CompletionCondition, ReadHandler>& h) noexcept { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_); } static auto get( const detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, Executor, CompletionCondition, ReadHandler>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c)) { return Associator<ReadHandler, DefaultCandidate>::get(h.handler_, c); } }; #endif // !defined(GENERATING_DOCUMENTATION) #endif // !defined(BOOST_ASIO_NO_IOSTREAM) #endif // !defined(BOOST_ASIO_NO_EXTENSIONS) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_IMPL_READ_AT_HPP
20,239
C++
.h
507
34.175542
80
0.710343
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,467
prepend.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/impl/prepend.hpp
// // impl/prepend.hpp // ~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_IMPL_PREPEND_HPP #define BOOST_ASIO_IMPL_PREPEND_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associator.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/handler_cont_helpers.hpp> #include <boost/asio/detail/initiation_base.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/utility.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { // Class to adapt a prepend_t as a completion handler. template <typename Handler, typename... Values> class prepend_handler { public: typedef void result_type; template <typename H> prepend_handler(H&& handler, std::tuple<Values...> values) : handler_(static_cast<H&&>(handler)), values_(static_cast<std::tuple<Values...>&&>(values)) { } template <typename... Args> void operator()(Args&&... args) { this->invoke( index_sequence_for<Values...>{}, static_cast<Args&&>(args)...); } template <std::size_t... I, typename... Args> void invoke(index_sequence<I...>, Args&&... args) { static_cast<Handler&&>(handler_)( static_cast<Values&&>(std::get<I>(values_))..., static_cast<Args&&>(args)...); } //private: Handler handler_; std::tuple<Values...> values_; }; template <typename Handler> inline bool asio_handler_is_continuation( prepend_handler<Handler>* this_handler) { return boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename Signature, typename... Values> struct prepend_signature; template <typename R, typename... Args, typename... Values> struct prepend_signature<R(Args...), Values...> { typedef R type(Values..., decay_t<Args>...); }; } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <typename CompletionToken, typename... Values, typename Signature> struct async_result< prepend_t<CompletionToken, Values...>, Signature> : async_result<CompletionToken, typename detail::prepend_signature< Signature, Values...>::type> { typedef typename detail::prepend_signature< Signature, Values...>::type signature; template <typename Initiation> struct init_wrapper : detail::initiation_base<Initiation> { using detail::initiation_base<Initiation>::initiation_base; template <typename Handler, typename... Args> void operator()(Handler&& handler, std::tuple<Values...> values, Args&&... args) && { static_cast<Initiation&&>(*this)( detail::prepend_handler<decay_t<Handler>, Values...>( static_cast<Handler&&>(handler), static_cast<std::tuple<Values...>&&>(values)), static_cast<Args&&>(args)...); } template <typename Handler, typename... Args> void operator()(Handler&& handler, std::tuple<Values...> values, Args&&... args) const & { static_cast<const Initiation&>(*this)( detail::prepend_handler<decay_t<Handler>, Values...>( static_cast<Handler&&>(handler), static_cast<std::tuple<Values...>&&>(values)), static_cast<Args&&>(args)...); } }; template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate<CompletionToken, signature>( declval<init_wrapper<decay_t<Initiation>>>(), token.token_, static_cast<std::tuple<Values...>&&>(token.values_), static_cast<Args&&>(args)...)) { return async_initiate<CompletionToken, signature>( init_wrapper<decay_t<Initiation>>( static_cast<Initiation&&>(initiation)), token.token_, static_cast<std::tuple<Values...>&&>(token.values_), static_cast<Args&&>(args)...); } }; template <template <typename, typename> class Associator, typename Handler, typename... Values, typename DefaultCandidate> struct associator<Associator, detail::prepend_handler<Handler, Values...>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { static typename Associator<Handler, DefaultCandidate>::type get( const detail::prepend_handler<Handler, Values...>& h) noexcept { return Associator<Handler, DefaultCandidate>::get(h.handler_); } static auto get(const detail::prepend_handler<Handler, Values...>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<Handler, DefaultCandidate>::get(h.handler_, c)) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } }; #endif // !defined(GENERATING_DOCUMENTATION) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_IMPL_PREPEND_HPP
5,206
C++
.h
146
31.520548
79
0.684148
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,468
cancel_after.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/impl/cancel_after.hpp
// // impl/cancel_after.hpp // ~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_IMPL_CANCEL_AFTER_HPP #define BOOST_ASIO_IMPL_CANCEL_AFTER_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associated_executor.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/initiation_base.hpp> #include <boost/asio/detail/timed_cancel_op.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename Initiation, typename Clock, typename WaitTraits, typename... Signatures> struct initiate_cancel_after : initiation_base<Initiation> { using initiation_base<Initiation>::initiation_base; template <typename Handler, typename Rep, typename Period, typename... Args> void operator()(Handler&& handler, const chrono::duration<Rep, Period>& timeout, cancellation_type_t cancel_type, Args&&... args) && { using op = detail::timed_cancel_op<decay_t<Handler>, basic_waitable_timer<Clock, WaitTraits>, Signatures...>; non_const_lvalue<Handler> handler2(handler); typename op::ptr p = { boost::asio::detail::addressof(handler2.value), op::ptr::allocate(handler2.value), 0 }; p.p = new (p.v) op(handler2.value, basic_waitable_timer<Clock, WaitTraits, typename Initiation::executor_type>(this->get_executor(), timeout), cancel_type); op* o = p.p; p.v = p.p = 0; o->start(static_cast<Initiation&&>(*this), static_cast<Args&&>(args)...); } template <typename Handler, typename Rep, typename Period, typename... Args> void operator()(Handler&& handler, const chrono::duration<Rep, Period>& timeout, cancellation_type_t cancel_type, Args&&... args) const & { using op = detail::timed_cancel_op<decay_t<Handler>, basic_waitable_timer<Clock, WaitTraits>, Signatures...>; non_const_lvalue<Handler> handler2(handler); typename op::ptr p = { boost::asio::detail::addressof(handler2.value), op::ptr::allocate(handler2.value), 0 }; p.p = new (p.v) op(handler2.value, basic_waitable_timer<Clock, WaitTraits, typename Initiation::executor_type>(this->get_executor(), timeout), cancel_type); op* o = p.p; p.v = p.p = 0; o->start(static_cast<const Initiation&>(*this), static_cast<Args&&>(args)...); } }; template <typename Initiation, typename Clock, typename WaitTraits, typename Executor, typename... Signatures> struct initiate_cancel_after_timer : initiation_base<Initiation> { using initiation_base<Initiation>::initiation_base; template <typename Handler, typename Rep, typename Period, typename... Args> void operator()(Handler&& handler, basic_waitable_timer<Clock, WaitTraits, Executor>* timer, const chrono::duration<Rep, Period>& timeout, cancellation_type_t cancel_type, Args&&... args) && { using op = detail::timed_cancel_op<decay_t<Handler>, basic_waitable_timer<Clock, WaitTraits, Executor>&, Signatures...>; non_const_lvalue<Handler> handler2(handler); typename op::ptr p = { boost::asio::detail::addressof(handler2.value), op::ptr::allocate(handler2.value), 0 }; timer->expires_after(timeout); p.p = new (p.v) op(handler2.value, *timer, cancel_type); op* o = p.p; p.v = p.p = 0; o->start(static_cast<Initiation&&>(*this), static_cast<Args&&>(args)...); } template <typename Handler, typename Rep, typename Period, typename... Args> void operator()(Handler&& handler, basic_waitable_timer<Clock, WaitTraits, Executor>* timer, const chrono::duration<Rep, Period>& timeout, cancellation_type_t cancel_type, Args&&... args) const & { using op = detail::timed_cancel_op<decay_t<Handler>, basic_waitable_timer<Clock, WaitTraits, Executor>&, Signatures...>; non_const_lvalue<Handler> handler2(handler); typename op::ptr p = { boost::asio::detail::addressof(handler2.value), op::ptr::allocate(handler2.value), 0 }; timer->expires_after(timeout); p.p = new (p.v) op(handler2.value, *timer, cancel_type); op* o = p.p; p.v = p.p = 0; o->start(static_cast<const Initiation&>(*this), static_cast<Args&&>(args)...); } }; } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <typename CompletionToken, typename Clock, typename WaitTraits, typename... Signatures> struct async_result< cancel_after_t<CompletionToken, Clock, WaitTraits>, Signatures...> : async_result<CompletionToken, Signatures...> { template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate< conditional_t< is_const<remove_reference_t<RawCompletionToken>>::value, const CompletionToken, CompletionToken>, Signatures...>( declval<detail::initiate_cancel_after< decay_t<Initiation>, Clock, WaitTraits, Signatures...>>(), token.token_, token.timeout_, token.cancel_type_, static_cast<Args&&>(args)...)) { return async_initiate< conditional_t< is_const<remove_reference_t<RawCompletionToken>>::value, const CompletionToken, CompletionToken>, Signatures...>( detail::initiate_cancel_after< decay_t<Initiation>, Clock, WaitTraits, Signatures...>( static_cast<Initiation&&>(initiation)), token.token_, token.timeout_, token.cancel_type_, static_cast<Args&&>(args)...); } }; template <typename CompletionToken, typename Clock, typename WaitTraits, typename Executor, typename... Signatures> struct async_result< cancel_after_timer<CompletionToken, Clock, WaitTraits, Executor>, Signatures...> : async_result<CompletionToken, Signatures...> { template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate< conditional_t< is_const<remove_reference_t<RawCompletionToken>>::value, const CompletionToken, CompletionToken>, Signatures...>( declval<detail::initiate_cancel_after_timer< decay_t<Initiation>, Clock, WaitTraits, Executor, Signatures...>>(), token.token_, &token.timer_, token.timeout_, token.cancel_type_, static_cast<Args&&>(args)...)) { return async_initiate< conditional_t< is_const<remove_reference_t<RawCompletionToken>>::value, const CompletionToken, CompletionToken>, Signatures...>( detail::initiate_cancel_after_timer< decay_t<Initiation>, Clock, WaitTraits, Executor, Signatures...>( static_cast<Initiation&&>(initiation)), token.token_, &token.timer_, token.timeout_, token.cancel_type_, static_cast<Args&&>(args)...); } }; template <typename Clock, typename WaitTraits, typename... Signatures> struct async_result<partial_cancel_after<Clock, WaitTraits>, Signatures...> { template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate< const cancel_after_t< default_completion_token_t<associated_executor_t<Initiation>>, Clock, WaitTraits>&, Signatures...>( static_cast<Initiation&&>(initiation), cancel_after_t< default_completion_token_t<associated_executor_t<Initiation>>, Clock, WaitTraits>( default_completion_token_t<associated_executor_t<Initiation>>{}, token.timeout_, token.cancel_type_), static_cast<Args&&>(args)...)) { return async_initiate< const cancel_after_t< default_completion_token_t<associated_executor_t<Initiation>>, Clock, WaitTraits>&, Signatures...>( static_cast<Initiation&&>(initiation), cancel_after_t< default_completion_token_t<associated_executor_t<Initiation>>, Clock, WaitTraits>( default_completion_token_t<associated_executor_t<Initiation>>{}, token.timeout_, token.cancel_type_), static_cast<Args&&>(args)...); } }; template <typename Clock, typename WaitTraits, typename Executor, typename... Signatures> struct async_result< partial_cancel_after_timer<Clock, WaitTraits, Executor>, Signatures...> { template <typename Initiation, typename RawCompletionToken, typename... Args> static auto initiate(Initiation&& initiation, RawCompletionToken&& token, Args&&... args) -> decltype( async_initiate<Signatures...>( static_cast<Initiation&&>(initiation), cancel_after_timer< default_completion_token_t<associated_executor_t<Initiation>>, Clock, WaitTraits, Executor>( default_completion_token_t<associated_executor_t<Initiation>>{}, token.timer_, token.timeout_, token.cancel_type_), static_cast<Args&&>(args)...)) { return async_initiate<Signatures...>( static_cast<Initiation&&>(initiation), cancel_after_timer< default_completion_token_t<associated_executor_t<Initiation>>, Clock, WaitTraits, Executor>( default_completion_token_t<associated_executor_t<Initiation>>{}, token.timer_, token.timeout_, token.cancel_type_), static_cast<Args&&>(args)...); } }; #endif // !defined(GENERATING_DOCUMENTATION) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_IMPL_CANCEL_AFTER_HPP
10,159
C++
.h
241
36.211618
80
0.67479
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,473
execution_context.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/impl/execution_context.hpp
// // impl/execution_context.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_IMPL_EXECUTION_CONTEXT_HPP #define BOOST_ASIO_IMPL_EXECUTION_CONTEXT_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/scoped_ptr.hpp> #include <boost/asio/detail/service_registry.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { #if !defined(GENERATING_DOCUMENTATION) template <typename Service> inline Service& use_service(execution_context& e) { // Check that Service meets the necessary type requirements. (void)static_cast<execution_context::service*>(static_cast<Service*>(0)); return e.service_registry_->template use_service<Service>(); } template <typename Service, typename... Args> Service& make_service(execution_context& e, Args&&... args) { detail::scoped_ptr<Service> svc( new Service(e, static_cast<Args&&>(args)...)); e.service_registry_->template add_service<Service>(svc.get()); Service& result = *svc; svc.release(); return result; } template <typename Service> inline void add_service(execution_context& e, Service* svc) { // Check that Service meets the necessary type requirements. (void)static_cast<execution_context::service*>(static_cast<Service*>(0)); e.service_registry_->template add_service<Service>(svc); } template <typename Service> inline bool has_service(execution_context& e) { // Check that Service meets the necessary type requirements. (void)static_cast<execution_context::service*>(static_cast<Service*>(0)); return e.service_registry_->template has_service<Service>(); } #endif // !defined(GENERATING_DOCUMENTATION) inline execution_context& execution_context::service::context() { return owner_; } } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_IMPL_EXECUTION_CONTEXT_HPP
2,236
C++
.h
61
34.770492
79
0.745943
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,475
write_at.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/impl/write_at.hpp
// // impl/write_at.hpp // ~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_IMPL_WRITE_AT_HPP #define BOOST_ASIO_IMPL_WRITE_AT_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/associator.hpp> #include <boost/asio/buffer.hpp> #include <boost/asio/detail/array_fwd.hpp> #include <boost/asio/detail/base_from_cancellation_state.hpp> #include <boost/asio/detail/base_from_completion_cond.hpp> #include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/consuming_buffers.hpp> #include <boost/asio/detail/dependent_type.hpp> #include <boost/asio/detail/handler_cont_helpers.hpp> #include <boost/asio/detail/handler_tracking.hpp> #include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/non_const_lvalue.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence, typename ConstBufferIterator, typename CompletionCondition> std::size_t write_at_buffer_sequence(SyncRandomAccessWriteDevice& d, uint64_t offset, const ConstBufferSequence& buffers, const ConstBufferIterator&, CompletionCondition completion_condition, boost::system::error_code& ec) { ec = boost::system::error_code(); boost::asio::detail::consuming_buffers<const_buffer, ConstBufferSequence, ConstBufferIterator> tmp(buffers); while (!tmp.empty()) { if (std::size_t max_size = detail::adapt_completion_condition_result( completion_condition(ec, tmp.total_consumed()))) { tmp.consume(d.write_some_at(offset + tmp.total_consumed(), tmp.prepare(max_size), ec)); } else break; } return tmp.total_consumed(); } } // namespace detail template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence, typename CompletionCondition> std::size_t write_at(SyncRandomAccessWriteDevice& d, uint64_t offset, const ConstBufferSequence& buffers, CompletionCondition completion_condition, boost::system::error_code& ec, constraint_t< is_completion_condition<CompletionCondition>::value >) { return detail::write_at_buffer_sequence(d, offset, buffers, boost::asio::buffer_sequence_begin(buffers), static_cast<CompletionCondition&&>(completion_condition), ec); } template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence> inline std::size_t write_at(SyncRandomAccessWriteDevice& d, uint64_t offset, const ConstBufferSequence& buffers) { boost::system::error_code ec; std::size_t bytes_transferred = write_at( d, offset, buffers, transfer_all(), ec); boost::asio::detail::throw_error(ec, "write_at"); return bytes_transferred; } template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence> inline std::size_t write_at(SyncRandomAccessWriteDevice& d, uint64_t offset, const ConstBufferSequence& buffers, boost::system::error_code& ec) { return write_at(d, offset, buffers, transfer_all(), ec); } template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence, typename CompletionCondition> inline std::size_t write_at(SyncRandomAccessWriteDevice& d, uint64_t offset, const ConstBufferSequence& buffers, CompletionCondition completion_condition, constraint_t< is_completion_condition<CompletionCondition>::value >) { boost::system::error_code ec; std::size_t bytes_transferred = write_at(d, offset, buffers, static_cast<CompletionCondition&&>(completion_condition), ec); boost::asio::detail::throw_error(ec, "write_at"); return bytes_transferred; } #if !defined(BOOST_ASIO_NO_EXTENSIONS) #if !defined(BOOST_ASIO_NO_IOSTREAM) template <typename SyncRandomAccessWriteDevice, typename Allocator, typename CompletionCondition> std::size_t write_at(SyncRandomAccessWriteDevice& d, uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, CompletionCondition completion_condition, boost::system::error_code& ec, constraint_t< is_completion_condition<CompletionCondition>::value >) { std::size_t bytes_transferred = write_at(d, offset, b.data(), static_cast<CompletionCondition&&>(completion_condition), ec); b.consume(bytes_transferred); return bytes_transferred; } template <typename SyncRandomAccessWriteDevice, typename Allocator> inline std::size_t write_at(SyncRandomAccessWriteDevice& d, uint64_t offset, boost::asio::basic_streambuf<Allocator>& b) { boost::system::error_code ec; std::size_t bytes_transferred = write_at(d, offset, b, transfer_all(), ec); boost::asio::detail::throw_error(ec, "write_at"); return bytes_transferred; } template <typename SyncRandomAccessWriteDevice, typename Allocator> inline std::size_t write_at(SyncRandomAccessWriteDevice& d, uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, boost::system::error_code& ec) { return write_at(d, offset, b, transfer_all(), ec); } template <typename SyncRandomAccessWriteDevice, typename Allocator, typename CompletionCondition> inline std::size_t write_at(SyncRandomAccessWriteDevice& d, uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, CompletionCondition completion_condition, constraint_t< is_completion_condition<CompletionCondition>::value >) { boost::system::error_code ec; std::size_t bytes_transferred = write_at(d, offset, b, static_cast<CompletionCondition&&>(completion_condition), ec); boost::asio::detail::throw_error(ec, "write_at"); return bytes_transferred; } #endif // !defined(BOOST_ASIO_NO_IOSTREAM) #endif // !defined(BOOST_ASIO_NO_EXTENSIONS) namespace detail { template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, typename ConstBufferIterator, typename CompletionCondition, typename WriteHandler> class write_at_op : public base_from_cancellation_state<WriteHandler>, base_from_completion_cond<CompletionCondition> { public: write_at_op(AsyncRandomAccessWriteDevice& device, uint64_t offset, const ConstBufferSequence& buffers, CompletionCondition& completion_condition, WriteHandler& handler) : base_from_cancellation_state<WriteHandler>( handler, enable_partial_cancellation()), base_from_completion_cond<CompletionCondition>(completion_condition), device_(device), offset_(offset), buffers_(buffers), start_(0), handler_(static_cast<WriteHandler&&>(handler)) { } write_at_op(const write_at_op& other) : base_from_cancellation_state<WriteHandler>(other), base_from_completion_cond<CompletionCondition>(other), device_(other.device_), offset_(other.offset_), buffers_(other.buffers_), start_(other.start_), handler_(other.handler_) { } write_at_op(write_at_op&& other) : base_from_cancellation_state<WriteHandler>( static_cast<base_from_cancellation_state<WriteHandler>&&>(other)), base_from_completion_cond<CompletionCondition>( static_cast<base_from_completion_cond<CompletionCondition>&&>(other)), device_(other.device_), offset_(other.offset_), buffers_(static_cast<buffers_type&&>(other.buffers_)), start_(other.start_), handler_(static_cast<WriteHandler&&>(other.handler_)) { } void operator()(boost::system::error_code ec, std::size_t bytes_transferred, int start = 0) { std::size_t max_size; switch (start_ = start) { case 1: max_size = this->check_for_completion(ec, buffers_.total_consumed()); for (;;) { { BOOST_ASIO_HANDLER_LOCATION((__FILE__, __LINE__, "async_write_at")); device_.async_write_some_at( offset_ + buffers_.total_consumed(), buffers_.prepare(max_size), static_cast<write_at_op&&>(*this)); } return; default: buffers_.consume(bytes_transferred); if ((!ec && bytes_transferred == 0) || buffers_.empty()) break; max_size = this->check_for_completion(ec, buffers_.total_consumed()); if (max_size == 0) break; if (this->cancelled() != cancellation_type::none) { ec = boost::asio::error::operation_aborted; break; } } static_cast<WriteHandler&&>(handler_)( static_cast<const boost::system::error_code&>(ec), static_cast<const std::size_t&>(buffers_.total_consumed())); } } //private: typedef boost::asio::detail::consuming_buffers<const_buffer, ConstBufferSequence, ConstBufferIterator> buffers_type; AsyncRandomAccessWriteDevice& device_; uint64_t offset_; buffers_type buffers_; int start_; WriteHandler handler_; }; template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, typename ConstBufferIterator, typename CompletionCondition, typename WriteHandler> inline bool asio_handler_is_continuation( write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, ConstBufferIterator, CompletionCondition, WriteHandler>* this_handler) { return this_handler->start_ == 0 ? true : boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, typename ConstBufferIterator, typename CompletionCondition, typename WriteHandler> inline void start_write_at_op(AsyncRandomAccessWriteDevice& d, uint64_t offset, const ConstBufferSequence& buffers, const ConstBufferIterator&, CompletionCondition& completion_condition, WriteHandler& handler) { detail::write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, ConstBufferIterator, CompletionCondition, WriteHandler>( d, offset, buffers, completion_condition, handler)( boost::system::error_code(), 0, 1); } template <typename AsyncRandomAccessWriteDevice> class initiate_async_write_at { public: typedef typename AsyncRandomAccessWriteDevice::executor_type executor_type; explicit initiate_async_write_at(AsyncRandomAccessWriteDevice& device) : device_(device) { } executor_type get_executor() const noexcept { return device_.get_executor(); } template <typename WriteHandler, typename ConstBufferSequence, typename CompletionCondition> void operator()(WriteHandler&& handler, uint64_t offset, const ConstBufferSequence& buffers, CompletionCondition&& completion_cond) const { // If you get an error on the following line it means that your handler // does not meet the documented type requirements for a WriteHandler. BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; non_const_lvalue<WriteHandler> handler2(handler); non_const_lvalue<CompletionCondition> completion_cond2(completion_cond); start_write_at_op(device_, offset, buffers, boost::asio::buffer_sequence_begin(buffers), completion_cond2.value, handler2.value); } private: AsyncRandomAccessWriteDevice& device_; }; } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <template <typename, typename> class Associator, typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, typename ConstBufferIterator, typename CompletionCondition, typename WriteHandler, typename DefaultCandidate> struct associator<Associator, detail::write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, ConstBufferIterator, CompletionCondition, WriteHandler>, DefaultCandidate> : Associator<WriteHandler, DefaultCandidate> { static typename Associator<WriteHandler, DefaultCandidate>::type get( const detail::write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, ConstBufferIterator, CompletionCondition, WriteHandler>& h) noexcept { return Associator<WriteHandler, DefaultCandidate>::get(h.handler_); } static auto get( const detail::write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, ConstBufferIterator, CompletionCondition, WriteHandler>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c)) { return Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c); } }; #endif // !defined(GENERATING_DOCUMENTATION) #if !defined(BOOST_ASIO_NO_EXTENSIONS) #if !defined(BOOST_ASIO_NO_IOSTREAM) namespace detail { template <typename Allocator, typename WriteHandler> class write_at_streambuf_op { public: write_at_streambuf_op( boost::asio::basic_streambuf<Allocator>& streambuf, WriteHandler& handler) : streambuf_(streambuf), handler_(static_cast<WriteHandler&&>(handler)) { } write_at_streambuf_op(const write_at_streambuf_op& other) : streambuf_(other.streambuf_), handler_(other.handler_) { } write_at_streambuf_op(write_at_streambuf_op&& other) : streambuf_(other.streambuf_), handler_(static_cast<WriteHandler&&>(other.handler_)) { } void operator()(const boost::system::error_code& ec, const std::size_t bytes_transferred) { streambuf_.consume(bytes_transferred); static_cast<WriteHandler&&>(handler_)(ec, bytes_transferred); } //private: boost::asio::basic_streambuf<Allocator>& streambuf_; WriteHandler handler_; }; template <typename Allocator, typename WriteHandler> inline bool asio_handler_is_continuation( write_at_streambuf_op<Allocator, WriteHandler>* this_handler) { return boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename AsyncRandomAccessWriteDevice> class initiate_async_write_at_streambuf { public: typedef typename AsyncRandomAccessWriteDevice::executor_type executor_type; explicit initiate_async_write_at_streambuf( AsyncRandomAccessWriteDevice& device) : device_(device) { } executor_type get_executor() const noexcept { return device_.get_executor(); } template <typename WriteHandler, typename Allocator, typename CompletionCondition> void operator()(WriteHandler&& handler, uint64_t offset, basic_streambuf<Allocator>* b, CompletionCondition&& completion_condition) const { // If you get an error on the following line it means that your handler // does not meet the documented type requirements for a WriteHandler. BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; non_const_lvalue<WriteHandler> handler2(handler); async_write_at(device_, offset, b->data(), static_cast<CompletionCondition&&>(completion_condition), write_at_streambuf_op<Allocator, decay_t<WriteHandler>>( *b, handler2.value)); } private: AsyncRandomAccessWriteDevice& device_; }; } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <template <typename, typename> class Associator, typename Executor, typename WriteHandler, typename DefaultCandidate> struct associator<Associator, detail::write_at_streambuf_op<Executor, WriteHandler>, DefaultCandidate> : Associator<WriteHandler, DefaultCandidate> { static typename Associator<WriteHandler, DefaultCandidate>::type get( const detail::write_at_streambuf_op<Executor, WriteHandler>& h) noexcept { return Associator<WriteHandler, DefaultCandidate>::get(h.handler_); } static auto get( const detail::write_at_streambuf_op<Executor, WriteHandler>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c)) { return Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c); } }; #endif // !defined(GENERATING_DOCUMENTATION) #endif // !defined(BOOST_ASIO_NO_IOSTREAM) #endif // !defined(BOOST_ASIO_NO_EXTENSIONS) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_IMPL_WRITE_AT_HPP
16,738
C++
.h
426
34.084507
80
0.722687
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,487
static_require_concept.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/traits/static_require_concept.hpp
// // traits/static_require_concept.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_TRAITS_STATIC_REQUIRE_CONCEPT_HPP #define BOOST_ASIO_TRAITS_STATIC_REQUIRE_CONCEPT_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/traits/static_query.hpp> #define BOOST_ASIO_HAS_DEDUCED_STATIC_REQUIRE_CONCEPT_TRAIT 1 #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace traits { template <typename T, typename Property, typename = void> struct static_require_concept_default; template <typename T, typename Property, typename = void> struct static_require_concept; } // namespace traits namespace detail { struct no_static_require_concept { static constexpr bool is_valid = false; }; template <typename T, typename Property, typename = void> struct static_require_concept_trait : conditional_t< is_same<T, decay_t<T>>::value && is_same<Property, decay_t<Property>>::value, no_static_require_concept, traits::static_require_concept< decay_t<T>, decay_t<Property>> > { }; #if defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE) template <typename T, typename Property> struct static_require_concept_trait<T, Property, enable_if_t< decay_t<Property>::value() == traits::static_query<T, Property>::value() >> { static constexpr bool is_valid = true; }; #else // defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE) false_type static_require_concept_test(...); template <typename T, typename Property> true_type static_require_concept_test(T*, Property*, enable_if_t< Property::value() == traits::static_query<T, Property>::value() >* = 0); template <typename T, typename Property> struct has_static_require_concept { static constexpr bool value = decltype((static_require_concept_test)( static_cast<T*>(0), static_cast<Property*>(0)))::value; }; template <typename T, typename Property> struct static_require_concept_trait<T, Property, enable_if_t< has_static_require_concept<decay_t<T>, decay_t<Property>>::value >> { static constexpr bool is_valid = true; }; #endif // defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE) } // namespace detail namespace traits { template <typename T, typename Property, typename> struct static_require_concept_default : detail::static_require_concept_trait<T, Property> { }; template <typename T, typename Property, typename> struct static_require_concept : static_require_concept_default<T, Property> { }; } // namespace traits } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_TRAITS_STATIC_REQUIRE_CONCEPT_HPP
3,055
C++
.h
93
30.612903
79
0.739871
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,489
query_free.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/traits/query_free.hpp
// // traits/query_free.hpp // ~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_TRAITS_QUERY_FREE_HPP #define BOOST_ASIO_TRAITS_QUERY_FREE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #if defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE) # define BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT 1 #endif // defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE) #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace traits { template <typename T, typename Property, typename = void> struct query_free_default; template <typename T, typename Property, typename = void> struct query_free; } // namespace traits namespace detail { struct no_query_free { static constexpr bool is_valid = false; static constexpr bool is_noexcept = false; }; #if defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) template <typename T, typename Property, typename = void> struct query_free_trait : no_query_free { }; template <typename T, typename Property> struct query_free_trait<T, Property, void_t< decltype(query(declval<T>(), declval<Property>())) >> { static constexpr bool is_valid = true; using result_type = decltype( query(declval<T>(), declval<Property>())); static constexpr bool is_noexcept = noexcept(query(declval<T>(), declval<Property>())); }; #else // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) template <typename T, typename Property, typename = void> struct query_free_trait : conditional_t< is_same<T, decay_t<T>>::value && is_same<Property, decay_t<Property>>::value, no_query_free, traits::query_free< decay_t<T>, decay_t<Property>> > { }; #endif // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) } // namespace detail namespace traits { template <typename T, typename Property, typename> struct query_free_default : detail::query_free_trait<T, Property> { }; template <typename T, typename Property, typename> struct query_free : query_free_default<T, Property> { }; } // namespace traits } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_TRAITS_QUERY_FREE_HPP
2,524
C++
.h
82
28.707317
79
0.735318
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,491
execute_member.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/traits/execute_member.hpp
// // traits/execute_member.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_TRAITS_EXECUTE_MEMBER_HPP #define BOOST_ASIO_TRAITS_EXECUTE_MEMBER_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #if defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE) # define BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT 1 #endif // defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE) #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace traits { template <typename T, typename F, typename = void> struct execute_member_default; template <typename T, typename F, typename = void> struct execute_member; } // namespace traits namespace detail { struct no_execute_member { static constexpr bool is_valid = false; static constexpr bool is_noexcept = false; }; #if defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) template <typename T, typename F, typename = void> struct execute_member_trait : no_execute_member { }; template <typename T, typename F> struct execute_member_trait<T, F, void_t< decltype(declval<T>().execute(declval<F>())) >> { static constexpr bool is_valid = true; using result_type = decltype( declval<T>().execute(declval<F>())); static constexpr bool is_noexcept = noexcept(declval<T>().execute(declval<F>())); }; #else // defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) template <typename T, typename F, typename = void> struct execute_member_trait : conditional_t< is_same<T, decay_t<T>>::value && is_same<F, decay_t<F>>::value, no_execute_member, traits::execute_member< decay_t<T>, decay_t<F>> > { }; #endif // defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) } // namespace detail namespace traits { template <typename T, typename F, typename> struct execute_member_default : detail::execute_member_trait<T, F> { }; template <typename T, typename F, typename> struct execute_member : execute_member_default<T, F> { }; } // namespace traits } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_TRAITS_EXECUTE_MEMBER_HPP
2,503
C++
.h
82
28.45122
79
0.732582
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,492
static_require.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/traits/static_require.hpp
// // traits/static_require.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_TRAITS_STATIC_REQUIRE_HPP #define BOOST_ASIO_TRAITS_STATIC_REQUIRE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/traits/static_query.hpp> #define BOOST_ASIO_HAS_DEDUCED_STATIC_REQUIRE_TRAIT 1 #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace traits { template <typename T, typename Property, typename = void> struct static_require_default; template <typename T, typename Property, typename = void> struct static_require; } // namespace traits namespace detail { struct no_static_require { static constexpr bool is_valid = false; }; template <typename T, typename Property, typename = void> struct static_require_trait : conditional_t< is_same<T, decay_t<T>>::value && is_same<Property, decay_t<Property>>::value, no_static_require, traits::static_require< decay_t<T>, decay_t<Property>> > { }; #if defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE) template <typename T, typename Property> struct static_require_trait<T, Property, enable_if_t< decay_t<Property>::value() == traits::static_query<T, Property>::value() >> { static constexpr bool is_valid = true; }; #else // defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE) false_type static_require_test(...); template <typename T, typename Property> true_type static_require_test(T*, Property*, enable_if_t< Property::value() == traits::static_query<T, Property>::value() >* = 0); template <typename T, typename Property> struct has_static_require { static constexpr bool value = decltype((static_require_test)( static_cast<T*>(0), static_cast<Property*>(0)))::value; }; template <typename T, typename Property> struct static_require_trait<T, Property, enable_if_t< has_static_require<decay_t<T>, decay_t<Property>>::value >> { static constexpr bool is_valid = true; }; #endif // defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE) } // namespace detail namespace traits { template <typename T, typename Property, typename> struct static_require_default : detail::static_require_trait<T, Property> { }; template <typename T, typename Property, typename> struct static_require : static_require_default<T, Property> { }; } // namespace traits } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_TRAITS_STATIC_REQUIRE_HPP
2,869
C++
.h
92
28.956522
79
0.733648
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,495
equality_comparable.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/traits/equality_comparable.hpp
// // traits/equality_comparable.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_TRAITS_EQUALITY_COMPARABLE_HPP #define BOOST_ASIO_TRAITS_EQUALITY_COMPARABLE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #if defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE) # define BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT 1 #endif // defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE) namespace boost { namespace asio { namespace traits { template <typename T, typename = void> struct equality_comparable_default; template <typename T, typename = void> struct equality_comparable; } // namespace traits namespace detail { struct no_equality_comparable { static constexpr bool is_valid = false; static constexpr bool is_noexcept = false; }; #if defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) template <typename T, typename = void> struct equality_comparable_trait : no_equality_comparable { }; template <typename T> struct equality_comparable_trait<T, void_t< decltype( static_cast<void>( static_cast<bool>(declval<const T>() == declval<const T>()) ), static_cast<void>( static_cast<bool>(declval<const T>() != declval<const T>()) ) ) >> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = noexcept(declval<const T>() == declval<const T>()) && noexcept(declval<const T>() != declval<const T>()); }; #else // defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) template <typename T, typename = void> struct equality_comparable_trait : conditional_t< is_same<T, decay_t<T>>::value, no_equality_comparable, traits::equality_comparable<decay_t<T>> > { }; #endif // defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) } // namespace detail namespace traits { template <typename T, typename> struct equality_comparable_default : detail::equality_comparable_trait<T> { }; template <typename T, typename> struct equality_comparable : equality_comparable_default<T> { }; } // namespace traits } // namespace asio } // namespace boost #endif // BOOST_ASIO_TRAITS_EQUALITY_COMPARABLE_HPP
2,525
C++
.h
81
28.851852
79
0.73215
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,497
prefer_free.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/traits/prefer_free.hpp
// // traits/prefer_free.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_TRAITS_PREFER_FREE_HPP #define BOOST_ASIO_TRAITS_PREFER_FREE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #if defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE) # define BOOST_ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT 1 #endif // defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE) #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace traits { template <typename T, typename Property, typename = void> struct prefer_free_default; template <typename T, typename Property, typename = void> struct prefer_free; } // namespace traits namespace detail { struct no_prefer_free { static constexpr bool is_valid = false; static constexpr bool is_noexcept = false; }; #if defined(BOOST_ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT) template <typename T, typename Property, typename = void> struct prefer_free_trait : no_prefer_free { }; template <typename T, typename Property> struct prefer_free_trait<T, Property, void_t< decltype(prefer(declval<T>(), declval<Property>())) >> { static constexpr bool is_valid = true; using result_type = decltype( prefer(declval<T>(), declval<Property>())); static constexpr bool is_noexcept = noexcept(prefer(declval<T>(), declval<Property>())); }; #else // defined(BOOST_ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT) template <typename T, typename Property, typename = void> struct prefer_free_trait : conditional_t< is_same<T, decay_t<T>>::value && is_same<Property, decay_t<Property>>::value, no_prefer_free, traits::prefer_free< decay_t<T>, decay_t<Property>> > { }; #endif // defined(BOOST_ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT) } // namespace detail namespace traits { template <typename T, typename Property, typename> struct prefer_free_default : detail::prefer_free_trait<T, Property> { }; template <typename T, typename Property, typename> struct prefer_free : prefer_free_default<T, Property> { }; } // namespace traits } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_TRAITS_PREFER_FREE_HPP
2,549
C++
.h
82
29.012195
79
0.737618
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,517
type_traits.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/detail/type_traits.hpp
// // detail/type_traits.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DETAIL_TYPE_TRAITS_HPP #define BOOST_ASIO_DETAIL_TYPE_TRAITS_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <type_traits> namespace boost { namespace asio { using std::add_const; template <typename T> using add_const_t = typename std::add_const<T>::type; using std::add_lvalue_reference; template <typename T> using add_lvalue_reference_t = typename std::add_lvalue_reference<T>::type; template <std::size_t N, std::size_t A> struct aligned_storage { struct type { alignas(A) unsigned char data[N]; }; }; template <std::size_t N, std::size_t A> using aligned_storage_t = typename aligned_storage<N, A>::type; using std::alignment_of; using std::conditional; template <bool C, typename T, typename U> using conditional_t = typename std::conditional<C, T, U>::type; using std::decay; template <typename T> using decay_t = typename std::decay<T>::type; using std::declval; using std::enable_if; template <bool C, typename T = void> using enable_if_t = typename std::enable_if<C, T>::type; using std::false_type; using std::integral_constant; using std::is_base_of; using std::is_class; using std::is_const; using std::is_constructible; using std::is_convertible; using std::is_copy_constructible; using std::is_destructible; using std::is_function; using std::is_move_constructible; using std::is_nothrow_copy_constructible; using std::is_nothrow_destructible; using std::is_object; using std::is_pointer; using std::is_reference; using std::is_same; using std::is_scalar; using std::remove_cv; template <typename T> using remove_cv_t = typename std::remove_cv<T>::type; template <typename T> struct remove_cvref : std::remove_cv<typename std::remove_reference<T>::type> {}; template <typename T> using remove_cvref_t = typename remove_cvref<T>::type; using std::remove_pointer; template <typename T> using remove_pointer_t = typename std::remove_pointer<T>::type; using std::remove_reference; template <typename T> using remove_reference_t = typename std::remove_reference<T>::type; #if defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT) template <typename> struct result_of; template <typename F, typename... Args> struct result_of<F(Args...)> : std::invoke_result<F, Args...> {}; template <typename T> using result_of_t = typename result_of<T>::type; #else // defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT) using std::result_of; template <typename T> using result_of_t = typename std::result_of<T>::type; #endif // defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT) using std::true_type; template <typename> struct void_type { typedef void type; }; template <typename T> using void_t = typename void_type<T>::type; template <typename...> struct conjunction : true_type {}; template <typename T> struct conjunction<T> : T {}; template <typename Head, typename... Tail> struct conjunction<Head, Tail...> : conditional_t<Head::value, conjunction<Tail...>, Head> {}; struct defaulted_constraint { constexpr defaulted_constraint() {} }; template <bool Condition, typename Type = int> struct constraint : std::enable_if<Condition, Type> {}; template <bool Condition, typename Type = int> using constraint_t = typename constraint<Condition, Type>::type; template <typename T> struct type_identity { typedef T type; }; template <typename T> using type_identity_t = typename type_identity<T>::type; } // namespace asio } // namespace boost #endif // BOOST_ASIO_DETAIL_TYPE_TRAITS_HPP
3,864
C++
.h
115
31.878261
79
0.746743
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,527
initiate_dispatch.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/detail/initiate_dispatch.hpp
// // detail/initiate_dispatch.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DETAIL_INITIATE_DISPATCH_HPP #define BOOST_ASIO_DETAIL_INITIATE_DISPATCH_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associated_allocator.hpp> #include <boost/asio/associated_executor.hpp> #include <boost/asio/detail/work_dispatcher.hpp> #include <boost/asio/execution/allocator.hpp> #include <boost/asio/execution/blocking.hpp> #include <boost/asio/prefer.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { class initiate_dispatch { public: template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< execution::is_executor< associated_executor_t<decay_t<CompletionHandler>> >::value >* = 0) const { associated_executor_t<decay_t<CompletionHandler>> ex( (get_associated_executor)(handler)); associated_allocator_t<decay_t<CompletionHandler>> alloc( (get_associated_allocator)(handler)); boost::asio::prefer(ex, execution::allocator(alloc)).execute( boost::asio::detail::bind_handler( static_cast<CompletionHandler&&>(handler))); } template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< !execution::is_executor< associated_executor_t<decay_t<CompletionHandler>> >::value >* = 0) const { associated_executor_t<decay_t<CompletionHandler>> ex( (get_associated_executor)(handler)); associated_allocator_t<decay_t<CompletionHandler>> alloc( (get_associated_allocator)(handler)); ex.dispatch(boost::asio::detail::bind_handler( static_cast<CompletionHandler&&>(handler)), alloc); } }; template <typename Executor> class initiate_dispatch_with_executor { public: typedef Executor executor_type; explicit initiate_dispatch_with_executor(const Executor& ex) : ex_(ex) { } executor_type get_executor() const noexcept { return ex_; } template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< execution::is_executor< conditional_t<true, executor_type, CompletionHandler> >::value >* = 0, enable_if_t< !detail::is_work_dispatcher_required< decay_t<CompletionHandler>, Executor >::value >* = 0) const { associated_allocator_t<decay_t<CompletionHandler>> alloc( (get_associated_allocator)(handler)); boost::asio::prefer(ex_, execution::allocator(alloc)).execute( boost::asio::detail::bind_handler( static_cast<CompletionHandler&&>(handler))); } template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< execution::is_executor< conditional_t<true, executor_type, CompletionHandler> >::value >* = 0, enable_if_t< detail::is_work_dispatcher_required< decay_t<CompletionHandler>, Executor >::value >* = 0) const { typedef decay_t<CompletionHandler> handler_t; typedef associated_executor_t<handler_t, Executor> handler_ex_t; handler_ex_t handler_ex((get_associated_executor)(handler, ex_)); associated_allocator_t<handler_t> alloc( (get_associated_allocator)(handler)); boost::asio::prefer(ex_, execution::allocator(alloc)).execute( detail::work_dispatcher<handler_t, handler_ex_t>( static_cast<CompletionHandler&&>(handler), handler_ex)); } template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< !execution::is_executor< conditional_t<true, executor_type, CompletionHandler> >::value >* = 0, enable_if_t< !detail::is_work_dispatcher_required< decay_t<CompletionHandler>, Executor >::value >* = 0) const { associated_allocator_t<decay_t<CompletionHandler>> alloc( (get_associated_allocator)(handler)); ex_.dispatch(boost::asio::detail::bind_handler( static_cast<CompletionHandler&&>(handler)), alloc); } template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< !execution::is_executor< conditional_t<true, executor_type, CompletionHandler> >::value >* = 0, enable_if_t< detail::is_work_dispatcher_required< decay_t<CompletionHandler>, Executor >::value >* = 0) const { typedef decay_t<CompletionHandler> handler_t; typedef associated_executor_t<handler_t, Executor> handler_ex_t; handler_ex_t handler_ex((get_associated_executor)(handler, ex_)); associated_allocator_t<handler_t> alloc( (get_associated_allocator)(handler)); ex_.dispatch(detail::work_dispatcher<handler_t, handler_ex_t>( static_cast<CompletionHandler&&>(handler), handler_ex), alloc); } private: Executor ex_; }; } // namespace detail } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DETAIL_INITIATE_DISPATCH_HPP
5,611
C++
.h
165
28.460606
79
0.677437
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,530
non_const_lvalue.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/detail/non_const_lvalue.hpp
// // detail/non_const_lvalue.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DETAIL_NON_CONST_LVALUE_HPP #define BOOST_ASIO_DETAIL_NON_CONST_LVALUE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename T> struct non_const_lvalue { explicit non_const_lvalue(T& t) : value(static_cast<conditional_t< is_same<T, decay_t<T>>::value, decay_t<T>&, T&&>>(t)) { } conditional_t<is_same<T, decay_t<T>>::value, decay_t<T>&, decay_t<T>> value; }; } // namespace detail } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DETAIL_NON_CONST_LVALUE_HPP
1,133
C++
.h
35
30.514286
79
0.69761
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,539
composed_work.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/detail/composed_work.hpp
// // detail/composed_work.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DETAIL_COMPOSED_WORK_HPP #define BOOST_ASIO_DETAIL_COMPOSED_WORK_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/executor.hpp> #include <boost/asio/execution/outstanding_work.hpp> #include <boost/asio/executor_work_guard.hpp> #include <boost/asio/is_executor.hpp> #include <boost/asio/system_executor.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename Executor, typename = void> class composed_work_guard { public: typedef decay_t< prefer_result_t<Executor, execution::outstanding_work_t::tracked_t> > executor_type; composed_work_guard(const Executor& ex) : executor_(boost::asio::prefer(ex, execution::outstanding_work.tracked)) { } void reset() { } executor_type get_executor() const noexcept { return executor_; } private: executor_type executor_; }; template <> struct composed_work_guard<system_executor> { public: typedef system_executor executor_type; composed_work_guard(const system_executor&) { } void reset() { } executor_type get_executor() const noexcept { return system_executor(); } }; #if !defined(BOOST_ASIO_NO_TS_EXECUTORS) template <typename Executor> struct composed_work_guard<Executor, enable_if_t< !execution::is_executor<Executor>::value > > : executor_work_guard<Executor> { composed_work_guard(const Executor& ex) : executor_work_guard<Executor>(ex) { } }; #endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS) template <typename> struct composed_io_executors; template <> struct composed_io_executors<void()> { composed_io_executors() noexcept : head_(system_executor()) { } typedef system_executor head_type; system_executor head_; }; inline composed_io_executors<void()> make_composed_io_executors() { return composed_io_executors<void()>(); } template <typename Head> struct composed_io_executors<void(Head)> { explicit composed_io_executors(const Head& ex) noexcept : head_(ex) { } typedef Head head_type; Head head_; }; template <typename Head> inline composed_io_executors<void(Head)> make_composed_io_executors(const Head& head) { return composed_io_executors<void(Head)>(head); } template <typename Head, typename... Tail> struct composed_io_executors<void(Head, Tail...)> { explicit composed_io_executors(const Head& head, const Tail&... tail) noexcept : head_(head), tail_(tail...) { } void reset() { head_.reset(); tail_.reset(); } typedef Head head_type; Head head_; composed_io_executors<void(Tail...)> tail_; }; template <typename Head, typename... Tail> inline composed_io_executors<void(Head, Tail...)> make_composed_io_executors(const Head& head, const Tail&... tail) { return composed_io_executors<void(Head, Tail...)>(head, tail...); } template <typename> struct composed_work; template <> struct composed_work<void()> { typedef composed_io_executors<void()> executors_type; composed_work(const executors_type&) noexcept : head_(system_executor()) { } void reset() { head_.reset(); } typedef system_executor head_type; composed_work_guard<system_executor> head_; }; template <typename Head> struct composed_work<void(Head)> { typedef composed_io_executors<void(Head)> executors_type; explicit composed_work(const executors_type& ex) noexcept : head_(ex.head_) { } void reset() { head_.reset(); } typedef Head head_type; composed_work_guard<Head> head_; }; template <typename Head, typename... Tail> struct composed_work<void(Head, Tail...)> { typedef composed_io_executors<void(Head, Tail...)> executors_type; explicit composed_work(const executors_type& ex) noexcept : head_(ex.head_), tail_(ex.tail_) { } void reset() { head_.reset(); tail_.reset(); } typedef Head head_type; composed_work_guard<Head> head_; composed_work<void(Tail...)> tail_; }; template <typename IoObject> inline typename IoObject::executor_type get_composed_io_executor(IoObject& io_object, enable_if_t< !is_executor<IoObject>::value >* = 0, enable_if_t< !execution::is_executor<IoObject>::value >* = 0) { return io_object.get_executor(); } template <typename Executor> inline const Executor& get_composed_io_executor(const Executor& ex, enable_if_t< is_executor<Executor>::value || execution::is_executor<Executor>::value >* = 0) { return ex; } } // namespace detail } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DETAIL_COMPOSED_WORK_HPP
5,142
C++
.h
208
22.009615
79
0.714607
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,565
wrapped_handler.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/detail/wrapped_handler.hpp
// // detail/wrapped_handler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DETAIL_WRAPPED_HANDLER_HPP #define BOOST_ASIO_DETAIL_WRAPPED_HANDLER_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/handler_cont_helpers.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { struct is_continuation_delegated { template <typename Dispatcher, typename Handler> bool operator()(Dispatcher&, Handler& handler) const { return boost_asio_handler_cont_helpers::is_continuation(handler); } }; struct is_continuation_if_running { template <typename Dispatcher, typename Handler> bool operator()(Dispatcher& dispatcher, Handler&) const { return dispatcher.running_in_this_thread(); } }; template <typename Dispatcher, typename = void> struct wrapped_executor { typedef Dispatcher executor_type; static const Dispatcher& get(const Dispatcher& dispatcher) noexcept { return dispatcher; } }; template <typename Dispatcher> struct wrapped_executor<Dispatcher, void_type<typename Dispatcher::executor_type>> { typedef typename Dispatcher::executor_type executor_type; static executor_type get(const Dispatcher& dispatcher) noexcept { return dispatcher.get_executor(); } }; template <typename Dispatcher, typename Handler, typename IsContinuation = is_continuation_delegated> class wrapped_handler { public: typedef void result_type; typedef typename wrapped_executor<Dispatcher>::executor_type executor_type; wrapped_handler(Dispatcher dispatcher, Handler& handler) : dispatcher_(dispatcher), handler_(static_cast<Handler&&>(handler)) { } wrapped_handler(const wrapped_handler& other) : dispatcher_(other.dispatcher_), handler_(other.handler_) { } wrapped_handler(wrapped_handler&& other) : dispatcher_(other.dispatcher_), handler_(static_cast<Handler&&>(other.handler_)) { } executor_type get_executor() const noexcept { return wrapped_executor<Dispatcher>::get(dispatcher_); } void operator()() { dispatcher_.dispatch(static_cast<Handler&&>(handler_)); } void operator()() const { dispatcher_.dispatch(handler_); } template <typename Arg1> void operator()(const Arg1& arg1) { dispatcher_.dispatch(detail::bind_handler(handler_, arg1)); } template <typename Arg1> void operator()(const Arg1& arg1) const { dispatcher_.dispatch(detail::bind_handler(handler_, arg1)); } template <typename Arg1, typename Arg2> void operator()(const Arg1& arg1, const Arg2& arg2) { dispatcher_.dispatch(detail::bind_handler(handler_, arg1, arg2)); } template <typename Arg1, typename Arg2> void operator()(const Arg1& arg1, const Arg2& arg2) const { dispatcher_.dispatch(detail::bind_handler(handler_, arg1, arg2)); } template <typename Arg1, typename Arg2, typename Arg3> void operator()(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3) { dispatcher_.dispatch(detail::bind_handler(handler_, arg1, arg2, arg3)); } template <typename Arg1, typename Arg2, typename Arg3> void operator()(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3) const { dispatcher_.dispatch(detail::bind_handler(handler_, arg1, arg2, arg3)); } template <typename Arg1, typename Arg2, typename Arg3, typename Arg4> void operator()(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4) { dispatcher_.dispatch( detail::bind_handler(handler_, arg1, arg2, arg3, arg4)); } template <typename Arg1, typename Arg2, typename Arg3, typename Arg4> void operator()(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4) const { dispatcher_.dispatch( detail::bind_handler(handler_, arg1, arg2, arg3, arg4)); } template <typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> void operator()(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4, const Arg5& arg5) { dispatcher_.dispatch( detail::bind_handler(handler_, arg1, arg2, arg3, arg4, arg5)); } template <typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> void operator()(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4, const Arg5& arg5) const { dispatcher_.dispatch( detail::bind_handler(handler_, arg1, arg2, arg3, arg4, arg5)); } //private: Dispatcher dispatcher_; Handler handler_; }; template <typename Dispatcher, typename Handler, typename IsContinuation> inline bool asio_handler_is_continuation( wrapped_handler<Dispatcher, Handler, IsContinuation>* this_handler) { return IsContinuation()(this_handler->dispatcher_, this_handler->handler_); } } // namespace detail } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DETAIL_WRAPPED_HANDLER_HPP
5,320
C++
.h
164
29.189024
79
0.726527
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,569
initiate_post.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/detail/initiate_post.hpp
// // detail/initiate_post.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DETAIL_INITIATE_POST_HPP #define BOOST_ASIO_DETAIL_INITIATE_POST_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associated_allocator.hpp> #include <boost/asio/associated_executor.hpp> #include <boost/asio/detail/work_dispatcher.hpp> #include <boost/asio/execution/allocator.hpp> #include <boost/asio/execution/blocking.hpp> #include <boost/asio/execution/relationship.hpp> #include <boost/asio/prefer.hpp> #include <boost/asio/require.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { class initiate_post { public: template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< execution::is_executor< associated_executor_t<decay_t<CompletionHandler>> >::value >* = 0) const { associated_executor_t<decay_t<CompletionHandler>> ex( (get_associated_executor)(handler)); associated_allocator_t<decay_t<CompletionHandler>> alloc( (get_associated_allocator)(handler)); boost::asio::prefer( boost::asio::require(ex, execution::blocking.never), execution::relationship.fork, execution::allocator(alloc) ).execute( boost::asio::detail::bind_handler( static_cast<CompletionHandler&&>(handler))); } template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< !execution::is_executor< associated_executor_t<decay_t<CompletionHandler>> >::value >* = 0) const { associated_executor_t<decay_t<CompletionHandler>> ex( (get_associated_executor)(handler)); associated_allocator_t<decay_t<CompletionHandler>> alloc( (get_associated_allocator)(handler)); ex.post(boost::asio::detail::bind_handler( static_cast<CompletionHandler&&>(handler)), alloc); } }; template <typename Executor> class initiate_post_with_executor { public: typedef Executor executor_type; explicit initiate_post_with_executor(const Executor& ex) : ex_(ex) { } executor_type get_executor() const noexcept { return ex_; } template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< execution::is_executor< conditional_t<true, executor_type, CompletionHandler> >::value >* = 0, enable_if_t< !detail::is_work_dispatcher_required< decay_t<CompletionHandler>, Executor >::value >* = 0) const { associated_allocator_t<decay_t<CompletionHandler>> alloc( (get_associated_allocator)(handler)); boost::asio::prefer( boost::asio::require(ex_, execution::blocking.never), execution::relationship.fork, execution::allocator(alloc) ).execute( boost::asio::detail::bind_handler( static_cast<CompletionHandler&&>(handler))); } template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< execution::is_executor< conditional_t<true, executor_type, CompletionHandler> >::value >* = 0, enable_if_t< detail::is_work_dispatcher_required< decay_t<CompletionHandler>, Executor >::value >* = 0) const { typedef decay_t<CompletionHandler> handler_t; typedef associated_executor_t<handler_t, Executor> handler_ex_t; handler_ex_t handler_ex((get_associated_executor)(handler, ex_)); associated_allocator_t<handler_t> alloc( (get_associated_allocator)(handler)); boost::asio::prefer( boost::asio::require(ex_, execution::blocking.never), execution::relationship.fork, execution::allocator(alloc) ).execute( detail::work_dispatcher<handler_t, handler_ex_t>( static_cast<CompletionHandler&&>(handler), handler_ex)); } template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< !execution::is_executor< conditional_t<true, executor_type, CompletionHandler> >::value >* = 0, enable_if_t< !detail::is_work_dispatcher_required< decay_t<CompletionHandler>, Executor >::value >* = 0) const { associated_allocator_t<decay_t<CompletionHandler>> alloc( (get_associated_allocator)(handler)); ex_.post(boost::asio::detail::bind_handler( static_cast<CompletionHandler&&>(handler)), alloc); } template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< !execution::is_executor< conditional_t<true, executor_type, CompletionHandler> >::value >* = 0, enable_if_t< detail::is_work_dispatcher_required< decay_t<CompletionHandler>, Executor >::value >* = 0) const { typedef decay_t<CompletionHandler> handler_t; typedef associated_executor_t<handler_t, Executor> handler_ex_t; handler_ex_t handler_ex((get_associated_executor)(handler, ex_)); associated_allocator_t<handler_t> alloc( (get_associated_allocator)(handler)); ex_.post(detail::work_dispatcher<handler_t, handler_ex_t>( static_cast<CompletionHandler&&>(handler), handler_ex), alloc); } private: Executor ex_; }; } // namespace detail } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DETAIL_INITIATE_POST_HPP
5,983
C++
.h
179
27.731844
79
0.672671
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,605
bind_handler.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/detail/bind_handler.hpp
// // detail/bind_handler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DETAIL_BIND_HANDLER_HPP #define BOOST_ASIO_DETAIL_BIND_HANDLER_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associator.hpp> #include <boost/asio/detail/handler_cont_helpers.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename Handler> class binder0 { public: template <typename T> binder0(int, T&& handler) : handler_(static_cast<T&&>(handler)) { } binder0(Handler& handler) : handler_(static_cast<Handler&&>(handler)) { } binder0(const binder0& other) : handler_(other.handler_) { } binder0(binder0&& other) : handler_(static_cast<Handler&&>(other.handler_)) { } void operator()() { static_cast<Handler&&>(handler_)(); } void operator()() const { handler_(); } //private: Handler handler_; }; template <typename Handler> inline bool asio_handler_is_continuation( binder0<Handler>* this_handler) { return boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename Handler> inline binder0<decay_t<Handler>> bind_handler( Handler&& handler) { return binder0<decay_t<Handler>>( 0, static_cast<Handler&&>(handler)); } template <typename Handler, typename Arg1> class binder1 { public: template <typename T> binder1(int, T&& handler, const Arg1& arg1) : handler_(static_cast<T&&>(handler)), arg1_(arg1) { } binder1(Handler& handler, const Arg1& arg1) : handler_(static_cast<Handler&&>(handler)), arg1_(arg1) { } binder1(const binder1& other) : handler_(other.handler_), arg1_(other.arg1_) { } binder1(binder1&& other) : handler_(static_cast<Handler&&>(other.handler_)), arg1_(static_cast<Arg1&&>(other.arg1_)) { } void operator()() { static_cast<Handler&&>(handler_)( static_cast<const Arg1&>(arg1_)); } void operator()() const { handler_(arg1_); } //private: Handler handler_; Arg1 arg1_; }; template <typename Handler, typename Arg1> inline bool asio_handler_is_continuation( binder1<Handler, Arg1>* this_handler) { return boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename Handler, typename Arg1> inline binder1<decay_t<Handler>, Arg1> bind_handler( Handler&& handler, const Arg1& arg1) { return binder1<decay_t<Handler>, Arg1>(0, static_cast<Handler&&>(handler), arg1); } template <typename Handler, typename Arg1, typename Arg2> class binder2 { public: template <typename T> binder2(int, T&& handler, const Arg1& arg1, const Arg2& arg2) : handler_(static_cast<T&&>(handler)), arg1_(arg1), arg2_(arg2) { } binder2(Handler& handler, const Arg1& arg1, const Arg2& arg2) : handler_(static_cast<Handler&&>(handler)), arg1_(arg1), arg2_(arg2) { } binder2(const binder2& other) : handler_(other.handler_), arg1_(other.arg1_), arg2_(other.arg2_) { } binder2(binder2&& other) : handler_(static_cast<Handler&&>(other.handler_)), arg1_(static_cast<Arg1&&>(other.arg1_)), arg2_(static_cast<Arg2&&>(other.arg2_)) { } void operator()() { static_cast<Handler&&>(handler_)( static_cast<const Arg1&>(arg1_), static_cast<const Arg2&>(arg2_)); } void operator()() const { handler_(arg1_, arg2_); } //private: Handler handler_; Arg1 arg1_; Arg2 arg2_; }; template <typename Handler, typename Arg1, typename Arg2> inline bool asio_handler_is_continuation( binder2<Handler, Arg1, Arg2>* this_handler) { return boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename Handler, typename Arg1, typename Arg2> inline binder2<decay_t<Handler>, Arg1, Arg2> bind_handler( Handler&& handler, const Arg1& arg1, const Arg2& arg2) { return binder2<decay_t<Handler>, Arg1, Arg2>(0, static_cast<Handler&&>(handler), arg1, arg2); } template <typename Handler, typename Arg1, typename Arg2, typename Arg3> class binder3 { public: template <typename T> binder3(int, T&& handler, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3) : handler_(static_cast<T&&>(handler)), arg1_(arg1), arg2_(arg2), arg3_(arg3) { } binder3(Handler& handler, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3) : handler_(static_cast<Handler&&>(handler)), arg1_(arg1), arg2_(arg2), arg3_(arg3) { } binder3(const binder3& other) : handler_(other.handler_), arg1_(other.arg1_), arg2_(other.arg2_), arg3_(other.arg3_) { } binder3(binder3&& other) : handler_(static_cast<Handler&&>(other.handler_)), arg1_(static_cast<Arg1&&>(other.arg1_)), arg2_(static_cast<Arg2&&>(other.arg2_)), arg3_(static_cast<Arg3&&>(other.arg3_)) { } void operator()() { static_cast<Handler&&>(handler_)( static_cast<const Arg1&>(arg1_), static_cast<const Arg2&>(arg2_), static_cast<const Arg3&>(arg3_)); } void operator()() const { handler_(arg1_, arg2_, arg3_); } //private: Handler handler_; Arg1 arg1_; Arg2 arg2_; Arg3 arg3_; }; template <typename Handler, typename Arg1, typename Arg2, typename Arg3> inline bool asio_handler_is_continuation( binder3<Handler, Arg1, Arg2, Arg3>* this_handler) { return boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename Handler, typename Arg1, typename Arg2, typename Arg3> inline binder3<decay_t<Handler>, Arg1, Arg2, Arg3> bind_handler( Handler&& handler, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3) { return binder3<decay_t<Handler>, Arg1, Arg2, Arg3>(0, static_cast<Handler&&>(handler), arg1, arg2, arg3); } template <typename Handler, typename Arg1, typename Arg2, typename Arg3, typename Arg4> class binder4 { public: template <typename T> binder4(int, T&& handler, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4) : handler_(static_cast<T&&>(handler)), arg1_(arg1), arg2_(arg2), arg3_(arg3), arg4_(arg4) { } binder4(Handler& handler, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4) : handler_(static_cast<Handler&&>(handler)), arg1_(arg1), arg2_(arg2), arg3_(arg3), arg4_(arg4) { } binder4(const binder4& other) : handler_(other.handler_), arg1_(other.arg1_), arg2_(other.arg2_), arg3_(other.arg3_), arg4_(other.arg4_) { } binder4(binder4&& other) : handler_(static_cast<Handler&&>(other.handler_)), arg1_(static_cast<Arg1&&>(other.arg1_)), arg2_(static_cast<Arg2&&>(other.arg2_)), arg3_(static_cast<Arg3&&>(other.arg3_)), arg4_(static_cast<Arg4&&>(other.arg4_)) { } void operator()() { static_cast<Handler&&>(handler_)( static_cast<const Arg1&>(arg1_), static_cast<const Arg2&>(arg2_), static_cast<const Arg3&>(arg3_), static_cast<const Arg4&>(arg4_)); } void operator()() const { handler_(arg1_, arg2_, arg3_, arg4_); } //private: Handler handler_; Arg1 arg1_; Arg2 arg2_; Arg3 arg3_; Arg4 arg4_; }; template <typename Handler, typename Arg1, typename Arg2, typename Arg3, typename Arg4> inline bool asio_handler_is_continuation( binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler) { return boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename Handler, typename Arg1, typename Arg2, typename Arg3, typename Arg4> inline binder4<decay_t<Handler>, Arg1, Arg2, Arg3, Arg4> bind_handler(Handler&& handler, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4) { return binder4<decay_t<Handler>, Arg1, Arg2, Arg3, Arg4>(0, static_cast<Handler&&>(handler), arg1, arg2, arg3, arg4); } template <typename Handler, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> class binder5 { public: template <typename T> binder5(int, T&& handler, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4, const Arg5& arg5) : handler_(static_cast<T&&>(handler)), arg1_(arg1), arg2_(arg2), arg3_(arg3), arg4_(arg4), arg5_(arg5) { } binder5(Handler& handler, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4, const Arg5& arg5) : handler_(static_cast<Handler&&>(handler)), arg1_(arg1), arg2_(arg2), arg3_(arg3), arg4_(arg4), arg5_(arg5) { } binder5(const binder5& other) : handler_(other.handler_), arg1_(other.arg1_), arg2_(other.arg2_), arg3_(other.arg3_), arg4_(other.arg4_), arg5_(other.arg5_) { } binder5(binder5&& other) : handler_(static_cast<Handler&&>(other.handler_)), arg1_(static_cast<Arg1&&>(other.arg1_)), arg2_(static_cast<Arg2&&>(other.arg2_)), arg3_(static_cast<Arg3&&>(other.arg3_)), arg4_(static_cast<Arg4&&>(other.arg4_)), arg5_(static_cast<Arg5&&>(other.arg5_)) { } void operator()() { static_cast<Handler&&>(handler_)( static_cast<const Arg1&>(arg1_), static_cast<const Arg2&>(arg2_), static_cast<const Arg3&>(arg3_), static_cast<const Arg4&>(arg4_), static_cast<const Arg5&>(arg5_)); } void operator()() const { handler_(arg1_, arg2_, arg3_, arg4_, arg5_); } //private: Handler handler_; Arg1 arg1_; Arg2 arg2_; Arg3 arg3_; Arg4 arg4_; Arg5 arg5_; }; template <typename Handler, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> inline bool asio_handler_is_continuation( binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler) { return boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename Handler, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> inline binder5<decay_t<Handler>, Arg1, Arg2, Arg3, Arg4, Arg5> bind_handler(Handler&& handler, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4, const Arg5& arg5) { return binder5<decay_t<Handler>, Arg1, Arg2, Arg3, Arg4, Arg5>(0, static_cast<Handler&&>(handler), arg1, arg2, arg3, arg4, arg5); } template <typename Handler, typename Arg1> class move_binder1 { public: move_binder1(int, Handler&& handler, Arg1&& arg1) : handler_(static_cast<Handler&&>(handler)), arg1_(static_cast<Arg1&&>(arg1)) { } move_binder1(move_binder1&& other) : handler_(static_cast<Handler&&>(other.handler_)), arg1_(static_cast<Arg1&&>(other.arg1_)) { } void operator()() { static_cast<Handler&&>(handler_)( static_cast<Arg1&&>(arg1_)); } //private: Handler handler_; Arg1 arg1_; }; template <typename Handler, typename Arg1> inline bool asio_handler_is_continuation( move_binder1<Handler, Arg1>* this_handler) { return boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } template <typename Handler, typename Arg1, typename Arg2> class move_binder2 { public: move_binder2(int, Handler&& handler, const Arg1& arg1, Arg2&& arg2) : handler_(static_cast<Handler&&>(handler)), arg1_(arg1), arg2_(static_cast<Arg2&&>(arg2)) { } move_binder2(move_binder2&& other) : handler_(static_cast<Handler&&>(other.handler_)), arg1_(static_cast<Arg1&&>(other.arg1_)), arg2_(static_cast<Arg2&&>(other.arg2_)) { } void operator()() { static_cast<Handler&&>(handler_)( static_cast<const Arg1&>(arg1_), static_cast<Arg2&&>(arg2_)); } //private: Handler handler_; Arg1 arg1_; Arg2 arg2_; }; template <typename Handler, typename Arg1, typename Arg2> inline bool asio_handler_is_continuation( move_binder2<Handler, Arg1, Arg2>* this_handler) { return boost_asio_handler_cont_helpers::is_continuation( this_handler->handler_); } } // namespace detail template <template <typename, typename> class Associator, typename Handler, typename DefaultCandidate> struct associator<Associator, detail::binder0<Handler>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { static typename Associator<Handler, DefaultCandidate>::type get( const detail::binder0<Handler>& h) noexcept { return Associator<Handler, DefaultCandidate>::get(h.handler_); } static auto get(const detail::binder0<Handler>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<Handler, DefaultCandidate>::get(h.handler_, c)) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } }; template <template <typename, typename> class Associator, typename Handler, typename Arg1, typename DefaultCandidate> struct associator<Associator, detail::binder1<Handler, Arg1>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { static typename Associator<Handler, DefaultCandidate>::type get( const detail::binder1<Handler, Arg1>& h) noexcept { return Associator<Handler, DefaultCandidate>::get(h.handler_); } static auto get(const detail::binder1<Handler, Arg1>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<Handler, DefaultCandidate>::get(h.handler_, c)) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } }; template <template <typename, typename> class Associator, typename Handler, typename Arg1, typename Arg2, typename DefaultCandidate> struct associator<Associator, detail::binder2<Handler, Arg1, Arg2>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { static typename Associator<Handler, DefaultCandidate>::type get( const detail::binder2<Handler, Arg1, Arg2>& h) noexcept { return Associator<Handler, DefaultCandidate>::get(h.handler_); } static auto get(const detail::binder2<Handler, Arg1, Arg2>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<Handler, DefaultCandidate>::get(h.handler_, c)) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } }; template <template <typename, typename> class Associator, typename Handler, typename Arg1, typename Arg2, typename Arg3, typename DefaultCandidate> struct associator<Associator, detail::binder3<Handler, Arg1, Arg2, Arg3>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { static typename Associator<Handler, DefaultCandidate>::type get( const detail::binder3<Handler, Arg1, Arg2, Arg3>& h) noexcept { return Associator<Handler, DefaultCandidate>::get(h.handler_); } static auto get(const detail::binder3<Handler, Arg1, Arg2, Arg3>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<Handler, DefaultCandidate>::get(h.handler_, c)) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } }; template <template <typename, typename> class Associator, typename Handler, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename DefaultCandidate> struct associator<Associator, detail::binder4<Handler, Arg1, Arg2, Arg3, Arg4>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { static typename Associator<Handler, DefaultCandidate>::type get( const detail::binder4<Handler, Arg1, Arg2, Arg3, Arg4>& h) noexcept { return Associator<Handler, DefaultCandidate>::get(h.handler_); } static auto get(const detail::binder4<Handler, Arg1, Arg2, Arg3, Arg4>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<Handler, DefaultCandidate>::get(h.handler_, c)) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } }; template <template <typename, typename> class Associator, typename Handler, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename DefaultCandidate> struct associator<Associator, detail::binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { static typename Associator<Handler, DefaultCandidate>::type get( const detail::binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>& h) noexcept { return Associator<Handler, DefaultCandidate>::get(h.handler_); } static auto get( const detail::binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<Handler, DefaultCandidate>::get(h.handler_, c)) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } }; template <template <typename, typename> class Associator, typename Handler, typename Arg1, typename DefaultCandidate> struct associator<Associator, detail::move_binder1<Handler, Arg1>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { static typename Associator<Handler, DefaultCandidate>::type get( const detail::move_binder1<Handler, Arg1>& h) noexcept { return Associator<Handler, DefaultCandidate>::get(h.handler_); } static auto get(const detail::move_binder1<Handler, Arg1>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<Handler, DefaultCandidate>::get(h.handler_, c)) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } }; template <template <typename, typename> class Associator, typename Handler, typename Arg1, typename Arg2, typename DefaultCandidate> struct associator<Associator, detail::move_binder2<Handler, Arg1, Arg2>, DefaultCandidate> : Associator<Handler, DefaultCandidate> { static typename Associator<Handler, DefaultCandidate>::type get( const detail::move_binder2<Handler, Arg1, Arg2>& h) noexcept { return Associator<Handler, DefaultCandidate>::get(h.handler_); } static auto get(const detail::move_binder2<Handler, Arg1, Arg2>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<Handler, DefaultCandidate>::get(h.handler_, c)) { return Associator<Handler, DefaultCandidate>::get(h.handler_, c); } }; } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DETAIL_BIND_HANDLER_HPP
18,788
C++
.h
624
26.299679
79
0.690788
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,610
functional.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/detail/functional.hpp
// // detail/functional.hpp // ~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DETAIL_FUNCTIONAL_HPP #define BOOST_ASIO_DETAIL_FUNCTIONAL_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <functional> namespace boost { namespace asio { namespace detail { using std::function; } // namespace detail using std::ref; using std::reference_wrapper; } // namespace asio } // namespace boost #endif // BOOST_ASIO_DETAIL_FUNCTIONAL_HPP
782
C++
.h
26
28.730769
79
0.721553
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,639
initiate_defer.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/detail/initiate_defer.hpp
// // detail/initiate_defer.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DETAIL_INITIATE_DEFER_HPP #define BOOST_ASIO_DETAIL_INITIATE_DEFER_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associated_allocator.hpp> #include <boost/asio/associated_executor.hpp> #include <boost/asio/detail/work_dispatcher.hpp> #include <boost/asio/execution/allocator.hpp> #include <boost/asio/execution/blocking.hpp> #include <boost/asio/execution/relationship.hpp> #include <boost/asio/prefer.hpp> #include <boost/asio/require.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { class initiate_defer { public: template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< execution::is_executor< associated_executor_t<decay_t<CompletionHandler>> >::value >* = 0) const { associated_executor_t<decay_t<CompletionHandler>> ex( (get_associated_executor)(handler)); associated_allocator_t<decay_t<CompletionHandler>> alloc( (get_associated_allocator)(handler)); boost::asio::prefer( boost::asio::require(ex, execution::blocking.never), execution::relationship.continuation, execution::allocator(alloc) ).execute( boost::asio::detail::bind_handler( static_cast<CompletionHandler&&>(handler))); } template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< !execution::is_executor< associated_executor_t<decay_t<CompletionHandler>> >::value >* = 0) const { associated_executor_t<decay_t<CompletionHandler>> ex( (get_associated_executor)(handler)); associated_allocator_t<decay_t<CompletionHandler>> alloc( (get_associated_allocator)(handler)); ex.defer(boost::asio::detail::bind_handler( static_cast<CompletionHandler&&>(handler)), alloc); } }; template <typename Executor> class initiate_defer_with_executor { public: typedef Executor executor_type; explicit initiate_defer_with_executor(const Executor& ex) : ex_(ex) { } executor_type get_executor() const noexcept { return ex_; } template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< execution::is_executor< conditional_t<true, executor_type, CompletionHandler> >::value >* = 0, enable_if_t< !detail::is_work_dispatcher_required< decay_t<CompletionHandler>, Executor >::value >* = 0) const { associated_allocator_t<decay_t<CompletionHandler>> alloc( (get_associated_allocator)(handler)); boost::asio::prefer( boost::asio::require(ex_, execution::blocking.never), execution::relationship.continuation, execution::allocator(alloc) ).execute( boost::asio::detail::bind_handler( static_cast<CompletionHandler&&>(handler))); } template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< execution::is_executor< conditional_t<true, executor_type, CompletionHandler> >::value >* = 0, enable_if_t< detail::is_work_dispatcher_required< decay_t<CompletionHandler>, Executor >::value >* = 0) const { typedef decay_t<CompletionHandler> handler_t; typedef associated_executor_t<handler_t, Executor> handler_ex_t; handler_ex_t handler_ex((get_associated_executor)(handler, ex_)); associated_allocator_t<handler_t> alloc( (get_associated_allocator)(handler)); boost::asio::prefer( boost::asio::require(ex_, execution::blocking.never), execution::relationship.continuation, execution::allocator(alloc) ).execute( detail::work_dispatcher<handler_t, handler_ex_t>( static_cast<CompletionHandler&&>(handler), handler_ex)); } template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< !execution::is_executor< conditional_t<true, executor_type, CompletionHandler> >::value >* = 0, enable_if_t< !detail::is_work_dispatcher_required< decay_t<CompletionHandler>, Executor >::value >* = 0) const { associated_allocator_t<decay_t<CompletionHandler>> alloc( (get_associated_allocator)(handler)); ex_.defer(boost::asio::detail::bind_handler( static_cast<CompletionHandler&&>(handler)), alloc); } template <typename CompletionHandler> void operator()(CompletionHandler&& handler, enable_if_t< !execution::is_executor< conditional_t<true, executor_type, CompletionHandler> >::value >* = 0, enable_if_t< detail::is_work_dispatcher_required< decay_t<CompletionHandler>, Executor >::value >* = 0) const { typedef decay_t<CompletionHandler> handler_t; typedef associated_executor_t<handler_t, Executor> handler_ex_t; handler_ex_t handler_ex((get_associated_executor)(handler, ex_)); associated_allocator_t<handler_t> alloc( (get_associated_allocator)(handler)); ex_.defer(detail::work_dispatcher<handler_t, handler_ex_t>( static_cast<CompletionHandler&&>(handler), handler_ex), alloc); } private: Executor ex_; }; } // namespace detail } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DETAIL_INITIATE_DEFER_HPP
6,018
C++
.h
179
27.927374
79
0.674471
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,641
completion_message.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/detail/completion_message.hpp
// // detail/completion_message.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DETAIL_COMPLETION_MESSAGE_HPP #define BOOST_ASIO_DETAIL_COMPLETION_MESSAGE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <tuple> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/utility.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename Signature> class completion_message; template <typename R> class completion_message<R()> { public: completion_message(int) { } template <typename Handler> void receive(Handler& handler) { static_cast<Handler&&>(handler)(); } }; template <typename R, typename Arg0> class completion_message<R(Arg0)> { public: template <typename T0> completion_message(int, T0&& t0) : arg0_(static_cast<T0&&>(t0)) { } template <typename Handler> void receive(Handler& handler) { static_cast<Handler&&>(handler)( static_cast<arg0_type&&>(arg0_)); } private: typedef decay_t<Arg0> arg0_type; arg0_type arg0_; }; template <typename R, typename Arg0, typename Arg1> class completion_message<R(Arg0, Arg1)> { public: template <typename T0, typename T1> completion_message(int, T0&& t0, T1&& t1) : arg0_(static_cast<T0&&>(t0)), arg1_(static_cast<T1&&>(t1)) { } template <typename Handler> void receive(Handler& handler) { static_cast<Handler&&>(handler)( static_cast<arg0_type&&>(arg0_), static_cast<arg1_type&&>(arg1_)); } private: typedef decay_t<Arg0> arg0_type; arg0_type arg0_; typedef decay_t<Arg1> arg1_type; arg1_type arg1_; }; template <typename R, typename... Args> class completion_message<R(Args...)> { public: template <typename... T> completion_message(int, T&&... t) : args_(static_cast<T&&>(t)...) { } template <typename Handler> void receive(Handler& h) { this->do_receive(h, boost::asio::detail::index_sequence_for<Args...>()); } private: template <typename Handler, std::size_t... I> void do_receive(Handler& h, boost::asio::detail::index_sequence<I...>) { static_cast<Handler&&>(h)( std::get<I>(static_cast<args_type&&>(args_))...); } typedef std::tuple<decay_t<Args>...> args_type; args_type args_; }; } // namespace detail } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DETAIL_COMPLETION_MESSAGE_HPP
2,810
C++
.h
108
23.37963
79
0.690041
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,656
completion_payload.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/detail/completion_payload.hpp
// // detail/completion_payload.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DETAIL_COMPLETION_PAYLOAD_HPP #define BOOST_ASIO_DETAIL_COMPLETION_PAYLOAD_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/system/error_code.hpp> #include <boost/asio/detail/completion_message.hpp> #if defined(BOOST_ASIO_HAS_STD_VARIANT) # include <variant> #else // defined(BOOST_ASIO_HAS_STD_VARIANT) # include <new> #endif // defined(BOOST_ASIO_HAS_STD_VARIANT) #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename... Signatures> class completion_payload; template <typename R> class completion_payload<R()> { public: explicit completion_payload(completion_message<R()>) { } template <typename Handler> void receive(Handler& handler) { static_cast<Handler&&>(handler)(); } }; template <typename Signature> class completion_payload<Signature> { public: completion_payload(completion_message<Signature>&& m) : message_(static_cast<completion_message<Signature>&&>(m)) { } template <typename Handler> void receive(Handler& handler) { message_.receive(handler); } private: completion_message<Signature> message_; }; #if defined(BOOST_ASIO_HAS_STD_VARIANT) template <typename... Signatures> class completion_payload { public: template <typename Signature> completion_payload(completion_message<Signature>&& m) : message_(static_cast<completion_message<Signature>&&>(m)) { } template <typename Handler> void receive(Handler& handler) { std::visit( [&](auto& message) { message.receive(handler); }, message_); } private: std::variant<completion_message<Signatures>...> message_; }; #else // defined(BOOST_ASIO_HAS_STD_VARIANT) template <typename R1, typename R2> class completion_payload<R1(), R2(boost::system::error_code)> { public: typedef completion_message<R1()> void_message_type; typedef completion_message<R2(boost::system::error_code)> error_message_type; completion_payload(void_message_type&&) : message_(0, boost::system::error_code()), empty_(true) { } completion_payload(error_message_type&& m) : message_(static_cast<error_message_type&&>(m)), empty_(false) { } template <typename Handler> void receive(Handler& handler) { if (empty_) completion_message<R1()>(0).receive(handler); else message_.receive(handler); } private: error_message_type message_; bool empty_; }; template <typename Sig1, typename Sig2> class completion_payload<Sig1, Sig2> { public: typedef completion_message<Sig1> message_1_type; typedef completion_message<Sig2> message_2_type; completion_payload(message_1_type&& m) : index_(1) { new (&storage_.message_1_) message_1_type(static_cast<message_1_type&&>(m)); } completion_payload(message_2_type&& m) : index_(2) { new (&storage_.message_2_) message_2_type(static_cast<message_2_type&&>(m)); } completion_payload(completion_payload&& other) : index_(other.index_) { switch (index_) { case 1: new (&storage_.message_1_) message_1_type( static_cast<message_1_type&&>(other.storage_.message_1_)); break; case 2: new (&storage_.message_2_) message_2_type( static_cast<message_2_type&&>(other.storage_.message_2_)); break; default: break; } } ~completion_payload() { switch (index_) { case 1: storage_.message_1_.~message_1_type(); break; case 2: storage_.message_2_.~message_2_type(); break; default: break; } } template <typename Handler> void receive(Handler& handler) { switch (index_) { case 1: storage_.message_1_.receive(handler); break; case 2: storage_.message_2_.receive(handler); break; default: break; } } private: union storage { storage() {} ~storage() {} char dummy_; message_1_type message_1_; message_2_type message_2_; } storage_; unsigned char index_; }; #endif // defined(BOOST_ASIO_HAS_STD_VARIANT) } // namespace detail } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DETAIL_COMPLETION_PAYLOAD_HPP
4,739
C++
.h
188
21.707447
80
0.685632
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,659
initiation_base.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/detail/initiation_base.hpp
// // detail/initiation_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DETAIL_INITIATION_BASE_HPP #define BOOST_ASIO_DETAIL_INITIATION_BASE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename Initiation, typename = void> class initiation_base : public Initiation { public: template <typename I> explicit initiation_base(I&& initiation) : Initiation(static_cast<I&&>(initiation)) { } }; template <typename Initiation> class initiation_base<Initiation, enable_if_t<!is_class<Initiation>::value>> { public: template <typename I> explicit initiation_base(I&& initiation) : initiation_(static_cast<I&&>(initiation)) { } template <typename... Args> void operator()(Args&&... args) const { initiation_(static_cast<Args&&>(args)...); } private: Initiation initiation_; }; } // namespace detail } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DETAIL_INITIATION_BASE_HPP
1,486
C++
.h
52
26.615385
79
0.721519
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,692
timed_cancel_op.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/detail/timed_cancel_op.hpp
// // detail/timed_cancel_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DETAIL_TIMED_CANCEL_OP_HPP #define BOOST_ASIO_DETAIL_TIMED_CANCEL_OP_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/associated_cancellation_slot.hpp> #include <boost/asio/associator.hpp> #include <boost/asio/basic_waitable_timer.hpp> #include <boost/asio/cancellation_signal.hpp> #include <boost/asio/detail/atomic_count.hpp> #include <boost/asio/detail/completion_payload.hpp> #include <boost/asio/detail/completion_payload_handler.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename Op, typename... Signatures> class timed_cancel_op_handler; template <typename Op> class timed_cancel_timer_handler; template <typename Handler, typename Timer, typename... Signatures> class timed_cancel_op { public: using handler_type = Handler; BOOST_ASIO_DEFINE_TAGGED_HANDLER_PTR( thread_info_base::timed_cancel_tag, timed_cancel_op); timed_cancel_op(Handler& handler, Timer timer, cancellation_type_t cancel_type) : ref_count_(2), handler_(static_cast<Handler&&>(handler)), timer_(static_cast<Timer&&>(timer)), cancellation_type_(cancel_type), cancel_proxy_(nullptr), has_payload_(false), has_pending_timer_wait_(true) { } ~timed_cancel_op() { if (has_payload_) payload_storage_.payload_.~payload_type(); } cancellation_slot get_cancellation_slot() noexcept { return cancellation_signal_.slot(); } template <typename Initiation, typename... Args> void start(Initiation&& initiation, Args&&... args) { using op_handler_type = timed_cancel_op_handler<timed_cancel_op, Signatures...>; op_handler_type op_handler(this); using timer_handler_type = timed_cancel_timer_handler<timed_cancel_op>; timer_handler_type timer_handler(this); associated_cancellation_slot_t<Handler> slot = (get_associated_cancellation_slot)(handler_); if (slot.is_connected()) cancel_proxy_ = &slot.template emplace<cancel_proxy>(this); timer_.async_wait(static_cast<timer_handler_type&&>(timer_handler)); async_initiate<op_handler_type, Signatures...>( static_cast<Initiation&&>(initiation), static_cast<op_handler_type&>(op_handler), static_cast<Args&&>(args)...); } template <typename Message> void handle_op(Message&& message) { if (cancel_proxy_) cancel_proxy_->op_ = nullptr; new (&payload_storage_.payload_) payload_type( static_cast<Message&&>(message)); has_payload_ = true; if (has_pending_timer_wait_) { timer_.cancel(); release(); } else { complete(); } } void handle_timer() { has_pending_timer_wait_ = false; if (has_payload_) { complete(); } else { cancellation_signal_.emit(cancellation_type_); release(); } } void release() { if (--ref_count_ == 0) { ptr p = { boost::asio::detail::addressof(handler_), this, this }; Handler handler(static_cast<Handler&&>(handler_)); p.h = boost::asio::detail::addressof(handler); p.reset(); } } void complete() { if (--ref_count_ == 0) { ptr p = { boost::asio::detail::addressof(handler_), this, this }; completion_payload_handler<payload_type, Handler> handler( static_cast<payload_type&&>(payload_storage_.payload_), handler_); p.h = boost::asio::detail::addressof(handler.handler()); p.reset(); handler(); } } //private: typedef completion_payload<Signatures...> payload_type; struct cancel_proxy { cancel_proxy(timed_cancel_op* op) : op_(op) { } void operator()(cancellation_type_t type) { if (op_) op_->cancellation_signal_.emit(type); } timed_cancel_op* op_; }; // The number of handlers that share a reference to the state. atomic_count ref_count_; // The handler to be called when the operation completes. Handler handler_; // The timer used to determine when to cancel the pending operation. Timer timer_; // The cancellation signal and type used to cancel the pending operation. cancellation_signal cancellation_signal_; cancellation_type_t cancellation_type_; // A proxy cancel handler used to allow cancellation of the timed operation. cancel_proxy* cancel_proxy_; // Arguments to be passed to the completion handler. union payload_storage { payload_storage() {} ~payload_storage() {} char dummy_; payload_type payload_; } payload_storage_; // Whether the payload storage contains a valid payload. bool has_payload_; // Whether the asynchronous wait on the timer is still pending bool has_pending_timer_wait_; }; template <typename Op, typename R, typename... Args> class timed_cancel_op_handler<Op, R(Args...)> { public: using cancellation_slot_type = cancellation_slot; explicit timed_cancel_op_handler(Op* op) : op_(op) { } timed_cancel_op_handler(timed_cancel_op_handler&& other) noexcept : op_(other.op_) { other.op_ = nullptr; } ~timed_cancel_op_handler() { if (op_) op_->release(); } cancellation_slot_type get_cancellation_slot() const noexcept { return op_->get_cancellation_slot(); } template <typename... Args2> enable_if_t< is_constructible<completion_message<R(Args...)>, int, Args2...>::value > operator()(Args2&&... args) { Op* op = op_; op_ = nullptr; typedef completion_message<R(Args...)> message_type; op->handle_op(message_type(0, static_cast<Args2&&>(args)...)); } //protected: Op* op_; }; template <typename Op, typename R, typename... Args, typename... Signatures> class timed_cancel_op_handler<Op, R(Args...), Signatures...> : public timed_cancel_op_handler<Op, Signatures...> { public: using timed_cancel_op_handler<Op, Signatures...>::timed_cancel_op_handler; using timed_cancel_op_handler<Op, Signatures...>::operator(); template <typename... Args2> enable_if_t< is_constructible<completion_message<R(Args...)>, int, Args2...>::value > operator()(Args2&&... args) { Op* op = this->op_; this->op_ = nullptr; typedef completion_message<R(Args...)> message_type; op->handle_op(message_type(0, static_cast<Args2&&>(args)...)); } }; template <typename Op> class timed_cancel_timer_handler { public: using cancellation_slot_type = cancellation_slot; explicit timed_cancel_timer_handler(Op* op) : op_(op) { } timed_cancel_timer_handler(timed_cancel_timer_handler&& other) noexcept : op_(other.op_) { other.op_ = nullptr; } ~timed_cancel_timer_handler() { if (op_) op_->release(); } cancellation_slot_type get_cancellation_slot() const noexcept { return cancellation_slot_type(); } void operator()(const boost::system::error_code&) { Op* op = op_; op_ = nullptr; op->handle_timer(); } //private: Op* op_; }; } // namespace detail template <template <typename, typename> class Associator, typename Op, typename... Signatures, typename DefaultCandidate> struct associator<Associator, detail::timed_cancel_op_handler<Op, Signatures...>, DefaultCandidate> : Associator<typename Op::handler_type, DefaultCandidate> { static typename Associator<typename Op::handler_type, DefaultCandidate>::type get(const detail::timed_cancel_op_handler<Op, Signatures...>& h) noexcept { return Associator<typename Op::handler_type, DefaultCandidate>::get( h.op_->handler_); } static auto get(const detail::timed_cancel_op_handler<Op, Signatures...>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<typename Op::handler_type, DefaultCandidate>::get( h.op_->handler_, c)) { return Associator<typename Op::handler_type, DefaultCandidate>::get( h.op_->handler_, c); } }; template <template <typename, typename> class Associator, typename Op, typename DefaultCandidate> struct associator<Associator, detail::timed_cancel_timer_handler<Op>, DefaultCandidate> : Associator<typename Op::handler_type, DefaultCandidate> { static typename Associator<typename Op::handler_type, DefaultCandidate>::type get(const detail::timed_cancel_timer_handler<Op>& h) noexcept { return Associator<typename Op::handler_type, DefaultCandidate>::get( h.op_->handler_); } static auto get(const detail::timed_cancel_timer_handler<Op>& h, const DefaultCandidate& c) noexcept -> decltype(Associator<typename Op::handler_type, DefaultCandidate>::get( h.op_->handler_, c)) { return Associator<typename Op::handler_type, DefaultCandidate>::get( h.op_->handler_, c); } }; } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DETAIL_TIMED_CANCEL_OP_HPP
9,424
C++
.h
303
27.138614
79
0.68701
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,720
strand_executor_service.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/detail/impl/strand_executor_service.hpp
// // detail/impl/strand_executor_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_DETAIL_IMPL_STRAND_EXECUTOR_SERVICE_HPP #define BOOST_ASIO_DETAIL_IMPL_STRAND_EXECUTOR_SERVICE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/fenced_block.hpp> #include <boost/asio/detail/recycling_allocator.hpp> #include <boost/asio/executor_work_guard.hpp> #include <boost/asio/defer.hpp> #include <boost/asio/dispatch.hpp> #include <boost/asio/post.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename F, typename Allocator> class strand_executor_service::allocator_binder { public: typedef Allocator allocator_type; allocator_binder(F&& f, const Allocator& a) : f_(static_cast<F&&>(f)), allocator_(a) { } allocator_binder(const allocator_binder& other) : f_(other.f_), allocator_(other.allocator_) { } allocator_binder(allocator_binder&& other) : f_(static_cast<F&&>(other.f_)), allocator_(static_cast<allocator_type&&>(other.allocator_)) { } allocator_type get_allocator() const noexcept { return allocator_; } void operator()() { f_(); } private: F f_; allocator_type allocator_; }; template <typename Executor> class strand_executor_service::invoker<Executor, enable_if_t< execution::is_executor<Executor>::value >> { public: invoker(const implementation_type& impl, Executor& ex) : impl_(impl), executor_(boost::asio::prefer(ex, execution::outstanding_work.tracked)) { } invoker(const invoker& other) : impl_(other.impl_), executor_(other.executor_) { } invoker(invoker&& other) : impl_(static_cast<implementation_type&&>(other.impl_)), executor_(static_cast<executor_type&&>(other.executor_)) { } struct on_invoker_exit { invoker* this_; ~on_invoker_exit() { if (push_waiting_to_ready(this_->impl_)) { recycling_allocator<void> allocator; executor_type ex = this_->executor_; boost::asio::prefer( boost::asio::require( static_cast<executor_type&&>(ex), execution::blocking.never), execution::allocator(allocator) ).execute(static_cast<invoker&&>(*this_)); } } }; void operator()() { // Ensure the next handler, if any, is scheduled on block exit. on_invoker_exit on_exit = { this }; (void)on_exit; run_ready_handlers(impl_); } private: typedef decay_t< prefer_result_t< Executor, execution::outstanding_work_t::tracked_t > > executor_type; implementation_type impl_; executor_type executor_; }; #if !defined(BOOST_ASIO_NO_TS_EXECUTORS) template <typename Executor> class strand_executor_service::invoker<Executor, enable_if_t< !execution::is_executor<Executor>::value >> { public: invoker(const implementation_type& impl, Executor& ex) : impl_(impl), work_(ex) { } invoker(const invoker& other) : impl_(other.impl_), work_(other.work_) { } invoker(invoker&& other) : impl_(static_cast<implementation_type&&>(other.impl_)), work_(static_cast<executor_work_guard<Executor>&&>(other.work_)) { } struct on_invoker_exit { invoker* this_; ~on_invoker_exit() { if (push_waiting_to_ready(this_->impl_)) { Executor ex(this_->work_.get_executor()); recycling_allocator<void> allocator; ex.post(static_cast<invoker&&>(*this_), allocator); } } }; void operator()() { // Ensure the next handler, if any, is scheduled on block exit. on_invoker_exit on_exit = { this }; (void)on_exit; run_ready_handlers(impl_); } private: implementation_type impl_; executor_work_guard<Executor> work_; }; #endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS) template <typename Executor, typename Function> inline void strand_executor_service::execute(const implementation_type& impl, Executor& ex, Function&& function, enable_if_t< can_query<Executor, execution::allocator_t<void>>::value >*) { return strand_executor_service::do_execute(impl, ex, static_cast<Function&&>(function), boost::asio::query(ex, execution::allocator)); } template <typename Executor, typename Function> inline void strand_executor_service::execute(const implementation_type& impl, Executor& ex, Function&& function, enable_if_t< !can_query<Executor, execution::allocator_t<void>>::value >*) { return strand_executor_service::do_execute(impl, ex, static_cast<Function&&>(function), std::allocator<void>()); } template <typename Executor, typename Function, typename Allocator> void strand_executor_service::do_execute(const implementation_type& impl, Executor& ex, Function&& function, const Allocator& a) { typedef decay_t<Function> function_type; // If the executor is not never-blocking, and we are already in the strand, // then the function can run immediately. if (boost::asio::query(ex, execution::blocking) != execution::blocking.never && running_in_this_thread(impl)) { // Make a local, non-const copy of the function. function_type tmp(static_cast<Function&&>(function)); fenced_block b(fenced_block::full); static_cast<function_type&&>(tmp)(); return; } // Allocate and construct an operation to wrap the function. typedef executor_op<function_type, Allocator> op; typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 }; p.p = new (p.v) op(static_cast<Function&&>(function), a); BOOST_ASIO_HANDLER_CREATION((impl->service_->context(), *p.p, "strand_executor", impl.get(), 0, "execute")); // Add the function to the strand and schedule the strand if required. bool first = enqueue(impl, p.p); p.v = p.p = 0; if (first) { ex.execute(invoker<Executor>(impl, ex)); } } template <typename Executor, typename Function, typename Allocator> void strand_executor_service::dispatch(const implementation_type& impl, Executor& ex, Function&& function, const Allocator& a) { typedef decay_t<Function> function_type; // If we are already in the strand then the function can run immediately. if (running_in_this_thread(impl)) { // Make a local, non-const copy of the function. function_type tmp(static_cast<Function&&>(function)); fenced_block b(fenced_block::full); static_cast<function_type&&>(tmp)(); return; } // Allocate and construct an operation to wrap the function. typedef executor_op<function_type, Allocator> op; typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 }; p.p = new (p.v) op(static_cast<Function&&>(function), a); BOOST_ASIO_HANDLER_CREATION((impl->service_->context(), *p.p, "strand_executor", impl.get(), 0, "dispatch")); // Add the function to the strand and schedule the strand if required. bool first = enqueue(impl, p.p); p.v = p.p = 0; if (first) { boost::asio::dispatch(ex, allocator_binder<invoker<Executor>, Allocator>( invoker<Executor>(impl, ex), a)); } } // Request invocation of the given function and return immediately. template <typename Executor, typename Function, typename Allocator> void strand_executor_service::post(const implementation_type& impl, Executor& ex, Function&& function, const Allocator& a) { typedef decay_t<Function> function_type; // Allocate and construct an operation to wrap the function. typedef executor_op<function_type, Allocator> op; typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 }; p.p = new (p.v) op(static_cast<Function&&>(function), a); BOOST_ASIO_HANDLER_CREATION((impl->service_->context(), *p.p, "strand_executor", impl.get(), 0, "post")); // Add the function to the strand and schedule the strand if required. bool first = enqueue(impl, p.p); p.v = p.p = 0; if (first) { boost::asio::post(ex, allocator_binder<invoker<Executor>, Allocator>( invoker<Executor>(impl, ex), a)); } } // Request invocation of the given function and return immediately. template <typename Executor, typename Function, typename Allocator> void strand_executor_service::defer(const implementation_type& impl, Executor& ex, Function&& function, const Allocator& a) { typedef decay_t<Function> function_type; // Allocate and construct an operation to wrap the function. typedef executor_op<function_type, Allocator> op; typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 }; p.p = new (p.v) op(static_cast<Function&&>(function), a); BOOST_ASIO_HANDLER_CREATION((impl->service_->context(), *p.p, "strand_executor", impl.get(), 0, "defer")); // Add the function to the strand and schedule the strand if required. bool first = enqueue(impl, p.p); p.v = p.p = 0; if (first) { boost::asio::defer(ex, allocator_binder<invoker<Executor>, Allocator>( invoker<Executor>(impl, ex), a)); } } } // namespace detail } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DETAIL_IMPL_STRAND_EXECUTOR_SERVICE_HPP
9,605
C++
.h
292
28.907534
79
0.683375
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,729
executor.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/execution/executor.hpp
// // execution/executor.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_EXECUTION_EXECUTOR_HPP #define BOOST_ASIO_EXECUTION_EXECUTOR_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/invocable_archetype.hpp> #include <boost/asio/traits/equality_comparable.hpp> #include <boost/asio/traits/execute_member.hpp> #if defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) \ && defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) # define BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT 1 #endif // defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) // && defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace execution { namespace detail { template <typename T, typename F, typename = void, typename = void, typename = void, typename = void, typename = void, typename = void, typename = void, typename = void> struct is_executor_of_impl : false_type { }; template <typename T, typename F> struct is_executor_of_impl<T, F, enable_if_t< traits::execute_member<add_const_t<T>, F>::is_valid >, void_t< result_of_t<decay_t<F>&()> >, enable_if_t< is_constructible<decay_t<F>, F>::value >, enable_if_t< is_move_constructible<decay_t<F>>::value >, enable_if_t< is_nothrow_copy_constructible<T>::value >, enable_if_t< is_nothrow_destructible<T>::value >, enable_if_t< traits::equality_comparable<T>::is_valid >, enable_if_t< traits::equality_comparable<T>::is_noexcept >> : true_type { }; } // namespace detail /// The is_executor trait detects whether a type T satisfies the /// execution::executor concept. /** * Class template @c is_executor is a UnaryTypeTrait that is derived from @c * true_type if the type @c T meets the concept definition for an executor, * otherwise @c false_type. */ template <typename T> struct is_executor : #if defined(GENERATING_DOCUMENTATION) integral_constant<bool, automatically_determined> #else // defined(GENERATING_DOCUMENTATION) detail::is_executor_of_impl<T, invocable_archetype> #endif // defined(GENERATING_DOCUMENTATION) { }; #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) template <typename T> constexpr const bool is_executor_v = is_executor<T>::value; #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) #if defined(BOOST_ASIO_HAS_CONCEPTS) template <typename T> BOOST_ASIO_CONCEPT executor = is_executor<T>::value; #define BOOST_ASIO_EXECUTION_EXECUTOR ::boost::asio::execution::executor #else // defined(BOOST_ASIO_HAS_CONCEPTS) #define BOOST_ASIO_EXECUTION_EXECUTOR typename #endif // defined(BOOST_ASIO_HAS_CONCEPTS) } // namespace execution } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_EXECUTION_EXECUTOR_HPP
3,248
C++
.h
96
31.677083
79
0.740895
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,736
context.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/execution/context.hpp
// // execution/context.hpp // ~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_EXECUTION_CONTEXT2_HPP #define BOOST_ASIO_EXECUTION_CONTEXT2_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/executor.hpp> #include <boost/asio/is_applicable_property.hpp> #include <boost/asio/traits/query_static_constexpr_member.hpp> #include <boost/asio/traits/static_query.hpp> #if defined(BOOST_ASIO_HAS_STD_ANY) # include <any> #endif // defined(BOOST_ASIO_HAS_STD_ANY) #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { #if defined(GENERATING_DOCUMENTATION) namespace execution { /// A property that is used to obtain the execution context that is associated /// with an executor. struct context_t { /// The context_t property applies to executors. template <typename T> static constexpr bool is_applicable_property_v = is_executor_v<T>; /// The context_t property cannot be required. static constexpr bool is_requirable = false; /// The context_t property cannot be preferred. static constexpr bool is_preferable = false; /// The type returned by queries against an @c any_executor. typedef std::any polymorphic_query_result_type; }; /// A special value used for accessing the context_t property. constexpr context_t context; } // namespace execution #else // defined(GENERATING_DOCUMENTATION) namespace execution { namespace detail { template <int I = 0> struct context_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) template <typename T> static constexpr bool is_applicable_property_v = is_executor<T>::value; #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) static constexpr bool is_requirable = false; static constexpr bool is_preferable = false; #if defined(BOOST_ASIO_HAS_STD_ANY) typedef std::any polymorphic_query_result_type; #endif // defined(BOOST_ASIO_HAS_STD_ANY) constexpr context_t() { } template <typename T> struct static_proxy { #if defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) struct type { template <typename P> static constexpr auto query(P&& p) noexcept( noexcept( conditional_t<true, T, P>::query(static_cast<P&&>(p)) ) ) -> decltype( conditional_t<true, T, P>::query(static_cast<P&&>(p)) ) { return T::query(static_cast<P&&>(p)); } }; #else // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) typedef T type; #endif // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) }; template <typename T> struct query_static_constexpr_member : traits::query_static_constexpr_member< typename static_proxy<T>::type, context_t> {}; #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \ && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES) template <typename T> static constexpr typename query_static_constexpr_member<T>::result_type static_query() noexcept(query_static_constexpr_member<T>::is_noexcept) { return query_static_constexpr_member<T>::value(); } template <typename E, typename T = decltype(context_t::static_query<E>())> static constexpr const T static_query_v = context_t::static_query<E>(); #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES) }; #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \ && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES) template <int I> template <typename E, typename T> const T context_t<I>::static_query_v; #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES) } // namespace detail typedef detail::context_t<> context_t; BOOST_ASIO_INLINE_VARIABLE constexpr context_t context; } // namespace execution #if !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) template <typename T> struct is_applicable_property<T, execution::context_t> : integral_constant<bool, execution::is_executor<T>::value> { }; #endif // !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \ || !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES) template <typename T> struct static_query<T, execution::context_t, enable_if_t< execution::detail::context_t<0>:: query_static_constexpr_member<T>::is_valid >> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef typename execution::detail::context_t<0>:: query_static_constexpr_member<T>::result_type result_type; static constexpr result_type value() { return execution::detail::context_t<0>:: query_static_constexpr_member<T>::value(); } }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) // || !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES) } // namespace traits #endif // defined(GENERATING_DOCUMENTATION) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_EXECUTION_CONTEXT2_HPP
5,484
C++
.h
150
33.48
79
0.731809
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,737
invocable_archetype.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/execution/invocable_archetype.hpp
// // execution/invocable_archetype.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_EXECUTION_INVOCABLE_ARCHETYPE_HPP #define BOOST_ASIO_EXECUTION_INVOCABLE_ARCHETYPE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace execution { /// An archetypal function object used for determining adherence to the /// execution::executor concept. struct invocable_archetype { /// Function call operator. template <typename... Args> void operator()(Args&&...) { } }; } // namespace execution } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_EXECUTION_INVOCABLE_ARCHETYPE_HPP
1,130
C++
.h
35
30.714286
79
0.727189
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,738
occupancy.hpp
supercollider_supercollider/external_libraries/boost/boost/asio/execution/occupancy.hpp
// // execution/occupancy.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_EXECUTION_OCCUPANCY_HPP #define BOOST_ASIO_EXECUTION_OCCUPANCY_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/execution/executor.hpp> #include <boost/asio/is_applicable_property.hpp> #include <boost/asio/traits/query_static_constexpr_member.hpp> #include <boost/asio/traits/static_query.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { #if defined(GENERATING_DOCUMENTATION) namespace execution { /// A property that gives an estimate of the number of execution agents that /// should occupy the associated execution context. struct occupancy_t { /// The occupancy_t property applies to executors. template <typename T> static constexpr bool is_applicable_property_v = is_executor_v<T>; /// The occupancy_t property cannot be required. static constexpr bool is_requirable = false; /// The occupancy_t property cannot be preferred. static constexpr bool is_preferable = false; /// The type returned by queries against an @c any_executor. typedef std::size_t polymorphic_query_result_type; }; /// A special value used for accessing the occupancy_t property. constexpr occupancy_t occupancy; } // namespace execution #else // defined(GENERATING_DOCUMENTATION) namespace execution { namespace detail { template <int I = 0> struct occupancy_t { #if defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) template <typename T> static constexpr bool is_applicable_property_v = is_executor<T>::value; #endif // defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) static constexpr bool is_requirable = false; static constexpr bool is_preferable = false; typedef std::size_t polymorphic_query_result_type; constexpr occupancy_t() { } template <typename T> struct static_proxy { #if defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) struct type { template <typename P> static constexpr auto query(P&& p) noexcept( noexcept( conditional_t<true, T, P>::query(static_cast<P&&>(p)) ) ) -> decltype( conditional_t<true, T, P>::query(static_cast<P&&>(p)) ) { return T::query(static_cast<P&&>(p)); } }; #else // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) typedef T type; #endif // defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) }; template <typename T> struct query_static_constexpr_member : traits::query_static_constexpr_member< typename static_proxy<T>::type, occupancy_t> {}; #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \ && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES) template <typename T> static constexpr typename query_static_constexpr_member<T>::result_type static_query() noexcept(query_static_constexpr_member<T>::is_noexcept) { return query_static_constexpr_member<T>::value(); } template <typename E, typename T = decltype(occupancy_t::static_query<E>())> static constexpr const T static_query_v = occupancy_t::static_query<E>(); #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES) }; #if defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \ && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES) template <int I> template <typename E, typename T> const T occupancy_t<I>::static_query_v; #endif // defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) // && defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES) } // namespace detail typedef detail::occupancy_t<> occupancy_t; BOOST_ASIO_INLINE_VARIABLE constexpr occupancy_t occupancy; } // namespace execution #if !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) template <typename T> struct is_applicable_property<T, execution::occupancy_t> : integral_constant<bool, execution::is_executor<T>::value> { }; #endif // !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES) namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \ || !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES) template <typename T> struct static_query<T, execution::occupancy_t, enable_if_t< execution::detail::occupancy_t<0>:: query_static_constexpr_member<T>::is_valid >> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef typename execution::detail::occupancy_t<0>:: query_static_constexpr_member<T>::result_type result_type; static constexpr result_type value() { return execution::detail::occupancy_t<0>:: query_static_constexpr_member<T>::value(); } }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) // || !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES) } // namespace traits #endif // defined(GENERATING_DOCUMENTATION) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_EXECUTION_OCCUPANCY_HPP
5,395
C++
.h
145
34.068966
79
0.734498
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
32,801
hash_integral.hpp
supercollider_supercollider/external_libraries/boost/boost/container_hash/detail/hash_integral.hpp
// Copyright 2021-2023 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #ifndef BOOST_HASH_DETAIL_HASH_INTEGRAL_HPP #define BOOST_HASH_DETAIL_HASH_INTEGRAL_HPP #include <boost/container_hash/detail/hash_mix.hpp> #include <type_traits> #include <cstddef> #include <climits> namespace boost { namespace hash_detail { // libstdc++ doesn't provide support for __int128 in the standard traits template<class T> struct is_integral: public std::is_integral<T> { }; template<class T> struct is_unsigned: public std::is_unsigned<T> { }; template<class T> struct make_unsigned: public std::make_unsigned<T> { }; #if defined(__SIZEOF_INT128__) template<> struct is_integral<__int128_t>: public std::true_type { }; template<> struct is_integral<__uint128_t>: public std::true_type { }; template<> struct is_unsigned<__int128_t>: public std::false_type { }; template<> struct is_unsigned<__uint128_t>: public std::true_type { }; template<> struct make_unsigned<__int128_t> { typedef __uint128_t type; }; template<> struct make_unsigned<__uint128_t> { typedef __uint128_t type; }; #endif template<class T, bool bigger_than_size_t = (sizeof(T) > sizeof(std::size_t)), bool is_unsigned = is_unsigned<T>::value, std::size_t size_t_bits = sizeof(std::size_t) * CHAR_BIT, std::size_t type_bits = sizeof(T) * CHAR_BIT> struct hash_integral_impl; template<class T, bool is_unsigned, std::size_t size_t_bits, std::size_t type_bits> struct hash_integral_impl<T, false, is_unsigned, size_t_bits, type_bits> { static std::size_t fn( T v ) { return static_cast<std::size_t>( v ); } }; template<class T, std::size_t size_t_bits, std::size_t type_bits> struct hash_integral_impl<T, true, false, size_t_bits, type_bits> { static std::size_t fn( T v ) { typedef typename make_unsigned<T>::type U; if( v >= 0 ) { return hash_integral_impl<U>::fn( static_cast<U>( v ) ); } else { return ~hash_integral_impl<U>::fn( static_cast<U>( ~static_cast<U>( v ) ) ); } } }; template<class T> struct hash_integral_impl<T, true, true, 32, 64> { static std::size_t fn( T v ) { std::size_t seed = 0; seed = static_cast<std::size_t>( v >> 32 ) + hash_detail::hash_mix( seed ); seed = static_cast<std::size_t>( v & 0xFFFFFFFF ) + hash_detail::hash_mix( seed ); return seed; } }; template<class T> struct hash_integral_impl<T, true, true, 32, 128> { static std::size_t fn( T v ) { std::size_t seed = 0; seed = static_cast<std::size_t>( v >> 96 ) + hash_detail::hash_mix( seed ); seed = static_cast<std::size_t>( v >> 64 ) + hash_detail::hash_mix( seed ); seed = static_cast<std::size_t>( v >> 32 ) + hash_detail::hash_mix( seed ); seed = static_cast<std::size_t>( v ) + hash_detail::hash_mix( seed ); return seed; } }; template<class T> struct hash_integral_impl<T, true, true, 64, 128> { static std::size_t fn( T v ) { std::size_t seed = 0; seed = static_cast<std::size_t>( v >> 64 ) + hash_detail::hash_mix( seed ); seed = static_cast<std::size_t>( v ) + hash_detail::hash_mix( seed ); return seed; } }; } // namespace hash_detail template <typename T> typename std::enable_if<hash_detail::is_integral<T>::value, std::size_t>::type hash_value( T v ) { return hash_detail::hash_integral_impl<T>::fn( v ); } } // namespace boost #endif // #ifndef BOOST_HASH_DETAIL_HASH_INTEGRAL_HPP
3,625
C++
.h
114
27.95614
156
0.644151
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
33,927
predef_check_cc.h
supercollider_supercollider/external_libraries/boost/libs/predef/tools/check/predef_check_cc.h
/* Copyright Rene Rivera 2015 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) */ #include <boost/predef.h> #ifdef CHECK # if ((CHECK) == 0) # error "FAILED" # endif #endif int dummy() { static int d = 0; return d++; }
331
C++
.h
17
18.235294
58
0.708333
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
33,928
predef_check.h
supercollider_supercollider/external_libraries/boost/libs/predef/tools/check/predef_check.h
/* Copyright Rene Rivera 2011-2015 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) */ #include <boost/predef/detail/test_def.h> const char * str_token(const char ** str, const char * space) { unsigned span; char * token; for (; **str != 0; *str += 1) { if (0 == strchr(space, **str)) { break; } } span = strcspn(*str, space); token = (char *)malloc(span+1); strncpy(token, *str, span); token[span] = 0; for (*str += span; **str != 0; *str += 1) { if (0 == strchr(space, **str)) { break; } } return token; } const char * whitespace = " "; const char * dot = "."; int main(int argc, const char ** argv) { unsigned x = 0; int argi = 1; create_predef_entries(); #if 0 qsort(generated_predef_info,generated_predef_info_count, sizeof(predef_info),predef_info_compare); for (x = 0; x < generated_predef_info_count; ++x) { printf("%s: %d\n", generated_predef_info[x].name, generated_predef_info[x].value); } #endif int result = -1; for (argi = 1; argi < argc; ++argi) { const char * exp = argv[argi]; const char * exp_name = str_token(&exp, whitespace); const char * exp_op = str_token(&exp, whitespace); const char * exp_val = str_token(&exp, whitespace); unsigned exp_version = 0; if (*exp_val != 0) { exp = exp_val; const char * exp_val_a = str_token(&exp, dot); const char * exp_val_b = str_token(&exp, dot); const char * exp_val_c = str_token(&exp, dot); exp_version = BOOST_VERSION_NUMBER(atoi(exp_val_a), atoi(exp_val_b),atoi(exp_val_c)); } for (x = 0; x < generated_predef_info_count; ++x) { if (*exp_op == 0 && generated_predef_info[x].value > 0 && strcmp(exp_name, generated_predef_info[x].name) == 0) { /* Expression of the form "BOOST_x_yy" is true. */ result = 0; break; } else if (*exp_op == 0 && generated_predef_info[x].value == 0 && strcmp(exp_name, generated_predef_info[x].name) == 0) { /* Expression of the form "BOOST_x_yy" is false. */ return argi; } else if (*exp_op != 0 && *exp_val != 0 && strcmp(exp_name, generated_predef_info[x].name) == 0) { /* Expression of the form "BOOST_x_yy op val". */ result = 0; if (0 == strcmp(">",exp_op) && !(generated_predef_info[x].value > exp_version)) return argi; if (0 == strcmp("<",exp_op) && !(generated_predef_info[x].value < exp_version)) return argi; if (0 == strcmp(">=",exp_op) && !(generated_predef_info[x].value >= exp_version)) return argi; if (0 == strcmp("<=",exp_op) && !(generated_predef_info[x].value <= exp_version)) return argi; if (0 == strcmp("==",exp_op) && !(generated_predef_info[x].value == exp_version)) return argi; if (0 == strcmp("!=",exp_op) && !(generated_predef_info[x].value != exp_version)) return argi; } } } return result; }
3,448
C++
.h
95
27.557895
110
0.518806
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
33,934
tlsf.h
supercollider_supercollider/external_libraries/TLSF-2.4.6/src/tlsf.h
/* * Two Levels Segregate Fit memory allocator (TLSF) * Version 2.4.6 * * Written by Miguel Masmano Tello <mimastel@doctor.upv.es> * * Thanks to Ismael Ripoll for his suggestions and reviews * * Copyright (C) 2008, 2007, 2006, 2005, 2004 * * This code is released using a dual license strategy: GPL/LGPL * You can choose the licence that better fits your requirements. * * Released under the terms of the GNU General Public License Version 2.0 * Released under the terms of the GNU Lesser General Public License Version 2.1 * */ #ifndef _TLSF_H_ #define _TLSF_H_ #include <sys/types.h> extern size_t init_memory_pool(size_t, void *); extern size_t get_used_size(void *); extern size_t get_max_size(void *); extern void destroy_memory_pool(void *); extern size_t add_new_area(void *, size_t, void *); extern void *malloc_ex(size_t, void *); extern void free_ex(void *, void *); extern void *realloc_ex(void *, size_t, void *); extern void *calloc_ex(size_t, size_t, void *); extern void *tlsf_malloc(size_t size); extern void tlsf_free(void *ptr); extern void *tlsf_realloc(void *ptr, size_t size); extern void *tlsf_calloc(size_t nelem, size_t elem_size); #endif
1,184
C++
.h
34
33.205882
80
0.732751
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
33,935
target.h
supercollider_supercollider/external_libraries/TLSF-2.4.6/src/target.h
#ifndef _TARGET_H_ #define _TARGET_H_ #include <pthread.h> #define TLSF_MLOCK_T pthread_mutex_t #define TLSF_CREATE_LOCK(l) pthread_mutex_init (l, NULL) #define TLSF_DESTROY_LOCK(l) pthread_mutex_destroy(l) #define TLSF_ACQUIRE_LOCK(l) pthread_mutex_lock(l) #define TLSF_RELEASE_LOCK(l) pthread_mutex_unlock(l) #endif
345
C++
.h
9
37
60
0.717718
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
33,936
utf8.h
supercollider_supercollider/external_libraries/icu/unicode/utf8.h
/* ******************************************************************************* * * Copyright (C) 1999-2004, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: utf8.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 1999sep13 * created by: Markus W. Scherer */ /** * \file * \brief C API: 8-bit Unicode handling macros * * This file defines macros to deal with 8-bit Unicode (UTF-8) code units (bytes) and strings. * utf8.h is included by utf.h after unicode/umachine.h * and some common definitions. * * For more information see utf.h and the ICU User Guide Strings chapter * (http://oss.software.ibm.com/icu/userguide/). * * <em>Usage:</em> * ICU coding guidelines for if() statements should be followed when using these macros. * Compound statements (curly braces {}) must be used for if-else-while... * bodies and all macro statements should be terminated with semicolon. */ #ifndef __UTF8_H__ #define __UTF8_H__ /* utf.h must be included first. */ #ifndef __UTF_H__ # include "utf.h" #endif /* internal definitions ----------------------------------------------------- */ /** * \var utf8_countTrailBytes * Internal array with numbers of trail bytes for any given byte used in * lead byte position. * @internal */ #ifdef U_UTF8_IMPL U_INTERNAL const uint8_t #elif defined(U_STATIC_IMPLEMENTATION) U_CFUNC const uint8_t #else U_CFUNC U_IMPORT const uint8_t /* U_IMPORT2? */ /*U_IMPORT*/ #endif utf8_countTrailBytes[256]; /** * Count the trail bytes for a UTF-8 lead byte. * @internal */ #define U8_COUNT_TRAIL_BYTES(leadByte) (utf8_countTrailBytes[(uint8_t)leadByte]) /** * Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value. * @internal */ #define U8_MASK_LEAD_BYTE(leadByte, countTrailBytes) ((leadByte)&=(1<<(6-(countTrailBytes)))-1) /** * Function for handling "next code point" with error-checking. * @internal */ U_INTERNAL UChar32 U_EXPORT2 utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, UBool strict); /** * Function for handling "append code point" with error-checking. * @internal */ U_INTERNAL int32_t U_EXPORT2 utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool *pIsError); /** * Function for handling "previous code point" with error-checking. * @internal */ U_INTERNAL UChar32 U_EXPORT2 utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, UBool strict); /** * Function for handling "skip backward one code point" with error-checking. * @internal */ U_INTERNAL int32_t U_EXPORT2 utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); /* single-code point definitions -------------------------------------------- */ /** * Does this code unit (byte) encode a code point by itself (US-ASCII 0..0x7f)? * @param c 8-bit code unit (byte) * @return TRUE or FALSE * @stable ICU 2.4 */ #define U8_IS_SINGLE(c) (((c)&0x80)==0) /** * Is this code unit (byte) a UTF-8 lead byte? * @param c 8-bit code unit (byte) * @return TRUE or FALSE * @stable ICU 2.4 */ #define U8_IS_LEAD(c) ((uint8_t)((c)-0xc0)<0x3e) /** * Is this code unit (byte) a UTF-8 trail byte? * @param c 8-bit code unit (byte) * @return TRUE or FALSE * @stable ICU 2.4 */ #define U8_IS_TRAIL(c) (((c)&0xc0)==0x80) /** * How many code units (bytes) are used for the UTF-8 encoding * of this Unicode code point? * @param c 32-bit code point * @return 1..4, or 0 if c is a surrogate or not a Unicode code point * @stable ICU 2.4 */ #define U8_LENGTH(c) \ ((uint32_t)(c)<=0x7f ? 1 : \ ((uint32_t)(c)<=0x7ff ? 2 : \ ((uint32_t)(c)<=0xd7ff ? 3 : \ ((uint32_t)(c)<=0xdfff || (uint32_t)(c)>0x10ffff ? 0 : \ ((uint32_t)(c)<=0xffff ? 3 : 4)\ ) \ ) \ ) \ ) /** * The maximum number of UTF-8 code units (bytes) per Unicode code point (U+0000..U+10ffff). * @return 4 * @stable ICU 2.4 */ #define U8_MAX_LENGTH 4 /** * Get a code point from a string at a random-access offset, * without changing the offset. * The offset may point to either the lead byte or one of the trail bytes * for a code point, in which case the macro will read all of the bytes * for the code point. * The result is undefined if the offset points to an illegal UTF-8 * byte sequence. * Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT. * * @param s const uint8_t * string * @param i string offset * @param c output UChar32 variable * @see U8_GET * @stable ICU 2.4 */ #define U8_GET_UNSAFE(s, i, c) { \ int32_t _u8_get_unsafe_index=(int32_t)(i); \ U8_SET_CP_START_UNSAFE(s, _u8_get_unsafe_index); \ U8_NEXT_UNSAFE(s, _u8_get_unsafe_index, c); \ } /** * Get a code point from a string at a random-access offset, * without changing the offset. * The offset may point to either the lead byte or one of the trail bytes * for a code point, in which case the macro will read all of the bytes * for the code point. * If the offset points to an illegal UTF-8 byte sequence, then * c is set to a negative value. * Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT. * * @param s const uint8_t * string * @param start starting string offset * @param i string offset, start<=i<length * @param length string length * @param c output UChar32 variable, set to <0 in case of an error * @see U8_GET_UNSAFE * @stable ICU 2.4 */ #define U8_GET(s, start, i, length, c) { \ int32_t _u8_get_index=(int32_t)(i); \ U8_SET_CP_START(s, start, _u8_get_index); \ U8_NEXT(s, _u8_get_index, length, c); \ } /* definitions with forward iteration --------------------------------------- */ /** * Get a code point from a string at a code point boundary offset, * and advance the offset to the next code point boundary. * (Post-incrementing forward iteration.) * "Unsafe" macro, assumes well-formed UTF-8. * * The offset may point to the lead byte of a multi-byte sequence, * in which case the macro will read the whole sequence. * The result is undefined if the offset points to a trail byte * or an illegal UTF-8 sequence. * * @param s const uint8_t * string * @param i string offset * @param c output UChar32 variable * @see U8_NEXT * @stable ICU 2.4 */ #define U8_NEXT_UNSAFE(s, i, c) { \ (c)=(s)[(i)++]; \ if((uint8_t)((c)-0xc0)<0x35) { \ uint8_t __count=U8_COUNT_TRAIL_BYTES(c); \ U8_MASK_LEAD_BYTE(c, __count); \ switch(__count) { \ /* each following branch falls through to the next one */ \ case 3: \ (c)=((c)<<6)|((s)[(i)++]&0x3f); \ case 2: \ (c)=((c)<<6)|((s)[(i)++]&0x3f); \ case 1: \ (c)=((c)<<6)|((s)[(i)++]&0x3f); \ /* no other branches to optimize switch() */ \ break; \ } \ } \ } /** * Get a code point from a string at a code point boundary offset, * and advance the offset to the next code point boundary. * (Post-incrementing forward iteration.) * "Safe" macro, checks for illegal sequences and for string boundaries. * * The offset may point to the lead byte of a multi-byte sequence, * in which case the macro will read the whole sequence. * If the offset points to a trail byte or an illegal UTF-8 sequence, then * c is set to a negative value. * * @param s const uint8_t * string * @param i string offset, i<length * @param length string length * @param c output UChar32 variable, set to <0 in case of an error * @see U8_NEXT_UNSAFE * @stable ICU 2.4 */ #define U8_NEXT(s, i, length, c) { \ (c)=(s)[(i)++]; \ if(((uint8_t)(c))>=0x80) { \ if(U8_IS_LEAD(c)) { \ (c)=utf8_nextCharSafeBody((const uint8_t *)s, &(i), (int32_t)(length), c, -1); \ } else { \ (c)=U_SENTINEL; \ } \ } \ } /** * Append a code point to a string, overwriting 1 to 4 bytes. * The offset points to the current end of the string contents * and is advanced (post-increment). * "Unsafe" macro, assumes a valid code point and sufficient space in the string. * Otherwise, the result is undefined. * * @param s const uint8_t * string buffer * @param i string offset * @param c code point to append * @see U8_APPEND * @stable ICU 2.4 */ #define U8_APPEND_UNSAFE(s, i, c) { \ if((uint32_t)(c)<=0x7f) { \ (s)[(i)++]=(uint8_t)(c); \ } else { \ if((uint32_t)(c)<=0x7ff) { \ (s)[(i)++]=(uint8_t)(((c)>>6)|0xc0); \ } else { \ if((uint32_t)(c)<=0xffff) { \ (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \ } else { \ (s)[(i)++]=(uint8_t)(((c)>>18)|0xf0); \ (s)[(i)++]=(uint8_t)((((c)>>12)&0x3f)|0x80); \ } \ (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80); \ } \ (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \ } \ } /** * Append a code point to a string, overwriting 1 or 2 code units. * The offset points to the current end of the string contents * and is advanced (post-increment). * "Safe" macro, checks for a valid code point. * If a non-ASCII code point is written, checks for sufficient space in the string. * If the code point is not valid or trail bytes do not fit, * then isError is set to TRUE. * * @param s const uint8_t * string buffer * @param i string offset, i<length * @param length size of the string buffer * @param c code point to append * @param isError output UBool set to TRUE if an error occurs, otherwise not modified * @see U8_APPEND_UNSAFE * @stable ICU 2.4 */ #define U8_APPEND(s, i, length, c, isError) { \ if((uint32_t)(c)<=0x7f) { \ (s)[(i)++]=(uint8_t)(c); \ } else { \ (i)=utf8_appendCharSafeBody(s, (int32_t)(i), (int32_t)(length), c, &(isError)); \ } \ } /** * Advance the string offset from one code point boundary to the next. * (Post-incrementing iteration.) * "Unsafe" macro, assumes well-formed UTF-8. * * @param s const uint8_t * string * @param i string offset * @see U8_FWD_1 * @stable ICU 2.4 */ #define U8_FWD_1_UNSAFE(s, i) { \ (i)+=1+U8_COUNT_TRAIL_BYTES((s)[i]); \ } /** * Advance the string offset from one code point boundary to the next. * (Post-incrementing iteration.) * "Safe" macro, checks for illegal sequences and for string boundaries. * * @param s const uint8_t * string * @param i string offset, i<length * @param length string length * @see U8_FWD_1_UNSAFE * @stable ICU 2.4 */ #define U8_FWD_1(s, i, length) { \ uint8_t __b=(s)[(i)++]; \ if(U8_IS_LEAD(__b)) { \ uint8_t __count=U8_COUNT_TRAIL_BYTES(__b); \ if((i)+__count>(length)) { \ __count=(uint8_t)((length)-(i)); \ } \ while(__count>0 && U8_IS_TRAIL((s)[i])) { \ ++(i); \ --__count; \ } \ } \ } /** * Advance the string offset from one code point boundary to the n-th next one, * i.e., move forward by n code points. * (Post-incrementing iteration.) * "Unsafe" macro, assumes well-formed UTF-8. * * @param s const uint8_t * string * @param i string offset * @param n number of code points to skip * @see U8_FWD_N * @stable ICU 2.4 */ #define U8_FWD_N_UNSAFE(s, i, n) { \ int32_t __N=(n); \ while(__N>0) { \ U8_FWD_1_UNSAFE(s, i); \ --__N; \ } \ } /** * Advance the string offset from one code point boundary to the n-th next one, * i.e., move forward by n code points. * (Post-incrementing iteration.) * "Safe" macro, checks for illegal sequences and for string boundaries. * * @param s const uint8_t * string * @param i string offset, i<length * @param length string length * @param n number of code points to skip * @see U8_FWD_N_UNSAFE * @stable ICU 2.4 */ #define U8_FWD_N(s, i, length, n) { \ int32_t __N=(n); \ while(__N>0 && (i)<(length)) { \ U8_FWD_1(s, i, length); \ --__N; \ } \ } /** * Adjust a random-access offset to a code point boundary * at the start of a code point. * If the offset points to a UTF-8 trail byte, * then the offset is moved backward to the corresponding lead byte. * Otherwise, it is not modified. * "Unsafe" macro, assumes well-formed UTF-8. * * @param s const uint8_t * string * @param i string offset * @see U8_SET_CP_START * @stable ICU 2.4 */ #define U8_SET_CP_START_UNSAFE(s, i) { \ while(U8_IS_TRAIL((s)[i])) { --(i); } \ } /** * Adjust a random-access offset to a code point boundary * at the start of a code point. * If the offset points to a UTF-8 trail byte, * then the offset is moved backward to the corresponding lead byte. * Otherwise, it is not modified. * "Safe" macro, checks for illegal sequences and for string boundaries. * * @param s const uint8_t * string * @param start starting string offset (usually 0) * @param i string offset, start<=i * @see U8_SET_CP_START_UNSAFE * @stable ICU 2.4 */ #define U8_SET_CP_START(s, start, i) { \ if(U8_IS_TRAIL((s)[(i)])) { \ (i)=utf8_back1SafeBody(s, start, (int32_t)(i)); \ } \ } /* definitions with backward iteration -------------------------------------- */ /** * Move the string offset from one code point boundary to the previous one * and get the code point between them. * (Pre-decrementing backward iteration.) * "Unsafe" macro, assumes well-formed UTF-8. * * The input offset may be the same as the string length. * If the offset is behind a multi-byte sequence, then the macro will read * the whole sequence. * If the offset is behind a lead byte, then that itself * will be returned as the code point. * The result is undefined if the offset is behind an illegal UTF-8 sequence. * * @param s const uint8_t * string * @param i string offset * @param c output UChar32 variable * @see U8_PREV * @stable ICU 2.4 */ #define U8_PREV_UNSAFE(s, i, c) { \ (c)=(s)[--(i)]; \ if(U8_IS_TRAIL(c)) { \ uint8_t __b, __count=1, __shift=6; \ \ /* c is a trail byte */ \ (c)&=0x3f; \ for(;;) { \ __b=(s)[--(i)]; \ if(__b>=0xc0) { \ U8_MASK_LEAD_BYTE(__b, __count); \ (c)|=(UChar32)__b<<__shift; \ break; \ } else { \ (c)|=(UChar32)(__b&0x3f)<<__shift; \ ++__count; \ __shift+=6; \ } \ } \ } \ } /** * Move the string offset from one code point boundary to the previous one * and get the code point between them. * (Pre-decrementing backward iteration.) * "Safe" macro, checks for illegal sequences and for string boundaries. * * The input offset may be the same as the string length. * If the offset is behind a multi-byte sequence, then the macro will read * the whole sequence. * If the offset is behind a lead byte, then that itself * will be returned as the code point. * If the offset is behind an illegal UTF-8 sequence, then c is set to a negative value. * * @param s const uint8_t * string * @param start starting string offset (usually 0) * @param i string offset, start<=i * @param c output UChar32 variable, set to <0 in case of an error * @see U8_PREV_UNSAFE * @stable ICU 2.4 */ #define U8_PREV(s, start, i, c) { \ (c)=(s)[--(i)]; \ if((c)>=0x80) { \ if((c)<=0xbf) { \ (c)=utf8_prevCharSafeBody(s, start, &(i), c, -1); \ } else { \ (c)=U_SENTINEL; \ } \ } \ } /** * Move the string offset from one code point boundary to the previous one. * (Pre-decrementing backward iteration.) * The input offset may be the same as the string length. * "Unsafe" macro, assumes well-formed UTF-8. * * @param s const uint8_t * string * @param i string offset * @see U8_BACK_1 * @stable ICU 2.4 */ #define U8_BACK_1_UNSAFE(s, i) { \ while(U8_IS_TRAIL((s)[--(i)])) {} \ } /** * Move the string offset from one code point boundary to the previous one. * (Pre-decrementing backward iteration.) * The input offset may be the same as the string length. * "Safe" macro, checks for illegal sequences and for string boundaries. * * @param s const uint8_t * string * @param start starting string offset (usually 0) * @param i string offset, start<=i * @see U8_BACK_1_UNSAFE * @stable ICU 2.4 */ #define U8_BACK_1(s, start, i) { \ if(U8_IS_TRAIL((s)[--(i)])) { \ (i)=utf8_back1SafeBody(s, start, (int32_t)(i)); \ } \ } /** * Move the string offset from one code point boundary to the n-th one before it, * i.e., move backward by n code points. * (Pre-decrementing backward iteration.) * The input offset may be the same as the string length. * "Unsafe" macro, assumes well-formed UTF-8. * * @param s const uint8_t * string * @param i string offset * @param n number of code points to skip * @see U8_BACK_N * @stable ICU 2.4 */ #define U8_BACK_N_UNSAFE(s, i, n) { \ int32_t __N=(n); \ while(__N>0) { \ U8_BACK_1_UNSAFE(s, i); \ --__N; \ } \ } /** * Move the string offset from one code point boundary to the n-th one before it, * i.e., move backward by n code points. * (Pre-decrementing backward iteration.) * The input offset may be the same as the string length. * "Safe" macro, checks for illegal sequences and for string boundaries. * * @param s const uint8_t * string * @param start index of the start of the string * @param i string offset, i<length * @param n number of code points to skip * @see U8_BACK_N_UNSAFE * @stable ICU 2.4 */ #define U8_BACK_N(s, start, i, n) { \ int32_t __N=(n); \ while(__N>0 && (i)>(start)) { \ U8_BACK_1(s, start, i); \ --__N; \ } \ } /** * Adjust a random-access offset to a code point boundary after a code point. * If the offset is behind a partial multi-byte sequence, * then the offset is incremented to behind the whole sequence. * Otherwise, it is not modified. * The input offset may be the same as the string length. * "Unsafe" macro, assumes well-formed UTF-8. * * @param s const uint8_t * string * @param i string offset * @see U8_SET_CP_LIMIT * @stable ICU 2.4 */ #define U8_SET_CP_LIMIT_UNSAFE(s, i) { \ U8_BACK_1_UNSAFE(s, i); \ U8_FWD_1_UNSAFE(s, i); \ } /** * Adjust a random-access offset to a code point boundary after a code point. * If the offset is behind a partial multi-byte sequence, * then the offset is incremented to behind the whole sequence. * Otherwise, it is not modified. * The input offset may be the same as the string length. * "Safe" macro, checks for illegal sequences and for string boundaries. * * @param s const uint8_t * string * @param start starting string offset (usually 0) * @param i string offset, start<=i<=length * @param length string length * @see U8_SET_CP_LIMIT_UNSAFE * @stable ICU 2.4 */ #define U8_SET_CP_LIMIT(s, start, i, length) { \ if((start)<(i) && (i)<(length)) { \ U8_BACK_1(s, start, i); \ U8_FWD_1(s, i, length); \ } \ } #endif
19,153
C++
.h
587
29.229983
95
0.626579
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
33,937
urename.h
supercollider_supercollider/external_libraries/icu/unicode/urename.h
/* ******************************************************************************* * Copyright (C) 2002-2005, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * * file name: urename.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * Created by: Perl script written by Vladimir Weinstein * * Contains data for renaming ICU exports. * Gets included by umachine.h * * THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT * YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN! */ #ifndef URENAME_H #define URENAME_H /* Uncomment the following line to disable renaming on platforms that do not use Autoconf. */ /* #define U_DISABLE_RENAMING 1 */ #if !U_DISABLE_RENAMING /* C exports renaming data */ #define T_CString_int64ToString T_CString_int64ToString_3_2 #define T_CString_integerToString T_CString_integerToString_3_2 #define T_CString_stricmp T_CString_stricmp_3_2 #define T_CString_stringToInteger T_CString_stringToInteger_3_2 #define T_CString_strnicmp T_CString_strnicmp_3_2 #define T_CString_toLowerCase T_CString_toLowerCase_3_2 #define T_CString_toUpperCase T_CString_toUpperCase_3_2 #define T_FileStream_close T_FileStream_close_3_2 #define T_FileStream_eof T_FileStream_eof_3_2 #define T_FileStream_error T_FileStream_error_3_2 #define T_FileStream_file_exists T_FileStream_file_exists_3_2 #define T_FileStream_getc T_FileStream_getc_3_2 #define T_FileStream_open T_FileStream_open_3_2 #define T_FileStream_peek T_FileStream_peek_3_2 #define T_FileStream_putc T_FileStream_putc_3_2 #define T_FileStream_read T_FileStream_read_3_2 #define T_FileStream_readLine T_FileStream_readLine_3_2 #define T_FileStream_remove T_FileStream_remove_3_2 #define T_FileStream_rewind T_FileStream_rewind_3_2 #define T_FileStream_size T_FileStream_size_3_2 #define T_FileStream_stderr T_FileStream_stderr_3_2 #define T_FileStream_stdin T_FileStream_stdin_3_2 #define T_FileStream_stdout T_FileStream_stdout_3_2 #define T_FileStream_ungetc T_FileStream_ungetc_3_2 #define T_FileStream_write T_FileStream_write_3_2 #define T_FileStream_writeLine T_FileStream_writeLine_3_2 #define UCNV_FROM_U_CALLBACK_ESCAPE UCNV_FROM_U_CALLBACK_ESCAPE_3_2 #define UCNV_FROM_U_CALLBACK_SKIP UCNV_FROM_U_CALLBACK_SKIP_3_2 #define UCNV_FROM_U_CALLBACK_STOP UCNV_FROM_U_CALLBACK_STOP_3_2 #define UCNV_FROM_U_CALLBACK_SUBSTITUTE UCNV_FROM_U_CALLBACK_SUBSTITUTE_3_2 #define UCNV_TO_U_CALLBACK_ESCAPE UCNV_TO_U_CALLBACK_ESCAPE_3_2 #define UCNV_TO_U_CALLBACK_SKIP UCNV_TO_U_CALLBACK_SKIP_3_2 #define UCNV_TO_U_CALLBACK_STOP UCNV_TO_U_CALLBACK_STOP_3_2 #define UCNV_TO_U_CALLBACK_SUBSTITUTE UCNV_TO_U_CALLBACK_SUBSTITUTE_3_2 #define UDataMemory_createNewInstance UDataMemory_createNewInstance_3_2 #define UDataMemory_init UDataMemory_init_3_2 #define UDataMemory_isLoaded UDataMemory_isLoaded_3_2 #define UDataMemory_normalizeDataPointer UDataMemory_normalizeDataPointer_3_2 #define UDataMemory_setData UDataMemory_setData_3_2 #define UDatamemory_assign UDatamemory_assign_3_2 #define _ASCIIData _ASCIIData_3_2 #define _Bocu1Data _Bocu1Data_3_2 #define _CESU8Data _CESU8Data_3_2 #define _HZData _HZData_3_2 #define _IMAPData _IMAPData_3_2 #define _ISCIIData _ISCIIData_3_2 #define _ISO2022Data _ISO2022Data_3_2 #define _LMBCSData1 _LMBCSData1_3_2 #define _LMBCSData11 _LMBCSData11_3_2 #define _LMBCSData16 _LMBCSData16_3_2 #define _LMBCSData17 _LMBCSData17_3_2 #define _LMBCSData18 _LMBCSData18_3_2 #define _LMBCSData19 _LMBCSData19_3_2 #define _LMBCSData2 _LMBCSData2_3_2 #define _LMBCSData3 _LMBCSData3_3_2 #define _LMBCSData4 _LMBCSData4_3_2 #define _LMBCSData5 _LMBCSData5_3_2 #define _LMBCSData6 _LMBCSData6_3_2 #define _LMBCSData8 _LMBCSData8_3_2 #define _Latin1Data _Latin1Data_3_2 #define _MBCSData _MBCSData_3_2 #define _SCSUData _SCSUData_3_2 #define _UTF16BEData _UTF16BEData_3_2 #define _UTF16Data _UTF16Data_3_2 #define _UTF16LEData _UTF16LEData_3_2 #define _UTF32BEData _UTF32BEData_3_2 #define _UTF32Data _UTF32Data_3_2 #define _UTF32LEData _UTF32LEData_3_2 #define _UTF7Data _UTF7Data_3_2 #define _UTF8Data _UTF8Data_3_2 #define cmemory_cleanup cmemory_cleanup_3_2 #define cmemory_inUse cmemory_inUse_3_2 #define locale_getKeywords locale_getKeywords_3_2 #define locale_get_default locale_get_default_3_2 #define locale_set_default locale_set_default_3_2 #define res_countArrayItems res_countArrayItems_3_2 #define res_findResource res_findResource_3_2 #define res_getAlias res_getAlias_3_2 #define res_getArrayItem res_getArrayItem_3_2 #define res_getBinary res_getBinary_3_2 #define res_getIntVector res_getIntVector_3_2 #define res_getResource res_getResource_3_2 #define res_getString res_getString_3_2 #define res_getTableItemByIndex res_getTableItemByIndex_3_2 #define res_getTableItemByKey res_getTableItemByKey_3_2 #define res_load res_load_3_2 #define res_unload res_unload_3_2 #define transliterator_cleanup transliterator_cleanup_3_2 #define u_UCharsToChars u_UCharsToChars_3_2 #define u_austrcpy u_austrcpy_3_2 #define u_austrncpy u_austrncpy_3_2 #define u_catclose u_catclose_3_2 #define u_catgets u_catgets_3_2 #define u_catopen u_catopen_3_2 #define u_charAge u_charAge_3_2 #define u_charDigitValue u_charDigitValue_3_2 #define u_charDirection u_charDirection_3_2 #define u_charFromName u_charFromName_3_2 #define u_charMirror u_charMirror_3_2 #define u_charName u_charName_3_2 #define u_charType u_charType_3_2 #define u_charsToUChars u_charsToUChars_3_2 #define u_cleanup u_cleanup_3_2 #define u_countChar32 u_countChar32_3_2 #define u_digit u_digit_3_2 #define u_enumCharNames u_enumCharNames_3_2 #define u_enumCharTypes u_enumCharTypes_3_2 #define u_errorName u_errorName_3_2 #define u_fclose u_fclose_3_2 #define u_feof u_feof_3_2 #define u_fflush u_fflush_3_2 #define u_fgetConverter u_fgetConverter_3_2 #define u_fgetc u_fgetc_3_2 #define u_fgetcodepage u_fgetcodepage_3_2 #define u_fgetcx u_fgetcx_3_2 #define u_fgetfile u_fgetfile_3_2 #define u_fgetlocale u_fgetlocale_3_2 #define u_fgets u_fgets_3_2 #define u_file_read u_file_read_3_2 #define u_file_write u_file_write_3_2 #define u_file_write_flush u_file_write_flush_3_2 #define u_finit u_finit_3_2 #define u_foldCase u_foldCase_3_2 #define u_fopen u_fopen_3_2 #define u_forDigit u_forDigit_3_2 #define u_formatMessage u_formatMessage_3_2 #define u_formatMessageWithError u_formatMessageWithError_3_2 #define u_fprintf u_fprintf_3_2 #define u_fprintf_u u_fprintf_u_3_2 #define u_fputc u_fputc_3_2 #define u_fputs u_fputs_3_2 #define u_frewind u_frewind_3_2 #define u_fscanf u_fscanf_3_2 #define u_fscanf_u u_fscanf_u_3_2 #define u_fsetcodepage u_fsetcodepage_3_2 #define u_fsetlocale u_fsetlocale_3_2 #define u_fsettransliterator u_fsettransliterator_3_2 #define u_fstropen u_fstropen_3_2 #define u_fungetc u_fungetc_3_2 #define u_getCombiningClass u_getCombiningClass_3_2 #define u_getDataDirectory u_getDataDirectory_3_2 #define u_getDefaultConverter u_getDefaultConverter_3_2 #define u_getFC_NFKC_Closure u_getFC_NFKC_Closure_3_2 #define u_getISOComment u_getISOComment_3_2 #define u_getIntPropertyMaxValue u_getIntPropertyMaxValue_3_2 #define u_getIntPropertyMinValue u_getIntPropertyMinValue_3_2 #define u_getIntPropertyValue u_getIntPropertyValue_3_2 #define u_getNumericValue u_getNumericValue_3_2 #define u_getPropertyEnum u_getPropertyEnum_3_2 #define u_getPropertyName u_getPropertyName_3_2 #define u_getPropertyValueEnum u_getPropertyValueEnum_3_2 #define u_getPropertyValueName u_getPropertyValueName_3_2 #define u_getUnicodeProperties u_getUnicodeProperties_3_2 #define u_getUnicodeVersion u_getUnicodeVersion_3_2 #define u_getVersion u_getVersion_3_2 #define u_growBufferFromStatic u_growBufferFromStatic_3_2 #define u_hasBinaryProperty u_hasBinaryProperty_3_2 #define u_init u_init_3_2 #define u_isIDIgnorable u_isIDIgnorable_3_2 #define u_isIDPart u_isIDPart_3_2 #define u_isIDStart u_isIDStart_3_2 #define u_isISOControl u_isISOControl_3_2 #define u_isJavaIDPart u_isJavaIDPart_3_2 #define u_isJavaIDStart u_isJavaIDStart_3_2 #define u_isJavaSpaceChar u_isJavaSpaceChar_3_2 #define u_isMirrored u_isMirrored_3_2 #define u_isUAlphabetic u_isUAlphabetic_3_2 #define u_isULowercase u_isULowercase_3_2 #define u_isUUppercase u_isUUppercase_3_2 #define u_isUWhiteSpace u_isUWhiteSpace_3_2 #define u_isWhitespace u_isWhitespace_3_2 #define u_isalnum u_isalnum_3_2 #define u_isalpha u_isalpha_3_2 #define u_isbase u_isbase_3_2 #define u_isblank u_isblank_3_2 #define u_iscntrl u_iscntrl_3_2 #define u_isdefined u_isdefined_3_2 #define u_isdigit u_isdigit_3_2 #define u_isgraph u_isgraph_3_2 #define u_islower u_islower_3_2 #define u_isprint u_isprint_3_2 #define u_ispunct u_ispunct_3_2 #define u_isspace u_isspace_3_2 #define u_istitle u_istitle_3_2 #define u_isupper u_isupper_3_2 #define u_isxdigit u_isxdigit_3_2 #define u_lengthOfIdenticalLevelRun u_lengthOfIdenticalLevelRun_3_2 #define u_locbund_close u_locbund_close_3_2 #define u_locbund_getNumberFormat u_locbund_getNumberFormat_3_2 #define u_locbund_init u_locbund_init_3_2 #define u_memcasecmp u_memcasecmp_3_2 #define u_memchr u_memchr_3_2 #define u_memchr32 u_memchr32_3_2 #define u_memcmp u_memcmp_3_2 #define u_memcmpCodePointOrder u_memcmpCodePointOrder_3_2 #define u_memcpy u_memcpy_3_2 #define u_memmove u_memmove_3_2 #define u_memrchr u_memrchr_3_2 #define u_memrchr32 u_memrchr32_3_2 #define u_memset u_memset_3_2 #define u_parseMessage u_parseMessage_3_2 #define u_parseMessageWithError u_parseMessageWithError_3_2 #define u_printf_parse u_printf_parse_3_2 #define u_releaseDefaultConverter u_releaseDefaultConverter_3_2 #define u_scanf_parse u_scanf_parse_3_2 #define u_setAtomicIncDecFunctions u_setAtomicIncDecFunctions_3_2 #define u_setDataDirectory u_setDataDirectory_3_2 #define u_setMemoryFunctions u_setMemoryFunctions_3_2 #define u_setMutexFunctions u_setMutexFunctions_3_2 #define u_shapeArabic u_shapeArabic_3_2 #define u_snprintf u_snprintf_3_2 #define u_snprintf_u u_snprintf_u_3_2 #define u_sprintf u_sprintf_3_2 #define u_sprintf_u u_sprintf_u_3_2 #define u_sscanf u_sscanf_3_2 #define u_sscanf_u u_sscanf_u_3_2 #define u_strCaseCompare u_strCaseCompare_3_2 #define u_strCompare u_strCompare_3_2 #define u_strCompareIter u_strCompareIter_3_2 #define u_strFindFirst u_strFindFirst_3_2 #define u_strFindLast u_strFindLast_3_2 #define u_strFoldCase u_strFoldCase_3_2 #define u_strFromPunycode u_strFromPunycode_3_2 #define u_strFromUTF32 u_strFromUTF32_3_2 #define u_strFromUTF8 u_strFromUTF8_3_2 #define u_strFromWCS u_strFromWCS_3_2 #define u_strHasMoreChar32Than u_strHasMoreChar32Than_3_2 #define u_strToLower u_strToLower_3_2 #define u_strToPunycode u_strToPunycode_3_2 #define u_strToTitle u_strToTitle_3_2 #define u_strToUTF32 u_strToUTF32_3_2 #define u_strToUTF8 u_strToUTF8_3_2 #define u_strToUpper u_strToUpper_3_2 #define u_strToWCS u_strToWCS_3_2 #define u_strcasecmp u_strcasecmp_3_2 #define u_strcat u_strcat_3_2 #define u_strchr u_strchr_3_2 #define u_strchr32 u_strchr32_3_2 #define u_strcmp u_strcmp_3_2 #define u_strcmpCodePointOrder u_strcmpCodePointOrder_3_2 #define u_strcmpFold u_strcmpFold_3_2 #define u_strcpy u_strcpy_3_2 #define u_strcspn u_strcspn_3_2 #define u_strlen u_strlen_3_2 #define u_strncasecmp u_strncasecmp_3_2 #define u_strncat u_strncat_3_2 #define u_strncmp u_strncmp_3_2 #define u_strncmpCodePointOrder u_strncmpCodePointOrder_3_2 #define u_strncpy u_strncpy_3_2 #define u_strpbrk u_strpbrk_3_2 #define u_strrchr u_strrchr_3_2 #define u_strrchr32 u_strrchr32_3_2 #define u_strrstr u_strrstr_3_2 #define u_strspn u_strspn_3_2 #define u_strstr u_strstr_3_2 #define u_strtok_r u_strtok_r_3_2 #define u_terminateChars u_terminateChars_3_2 #define u_terminateUChar32s u_terminateUChar32s_3_2 #define u_terminateUChars u_terminateUChars_3_2 #define u_terminateWChars u_terminateWChars_3_2 #define u_tolower u_tolower_3_2 #define u_totitle u_totitle_3_2 #define u_toupper u_toupper_3_2 #define u_uastrcpy u_uastrcpy_3_2 #define u_uastrncpy u_uastrncpy_3_2 #define u_unescape u_unescape_3_2 #define u_unescapeAt u_unescapeAt_3_2 #define u_versionFromString u_versionFromString_3_2 #define u_versionToString u_versionToString_3_2 #define u_vformatMessage u_vformatMessage_3_2 #define u_vformatMessageWithError u_vformatMessageWithError_3_2 #define u_vfprintf u_vfprintf_3_2 #define u_vfprintf_u u_vfprintf_u_3_2 #define u_vfscanf u_vfscanf_3_2 #define u_vfscanf_u u_vfscanf_u_3_2 #define u_vparseMessage u_vparseMessage_3_2 #define u_vparseMessageWithError u_vparseMessageWithError_3_2 #define u_vsnprintf u_vsnprintf_3_2 #define u_vsnprintf_u u_vsnprintf_u_3_2 #define u_vsprintf u_vsprintf_3_2 #define u_vsprintf_u u_vsprintf_u_3_2 #define u_vsscanf u_vsscanf_3_2 #define u_vsscanf_u u_vsscanf_u_3_2 #define u_writeDiff u_writeDiff_3_2 #define u_writeIdenticalLevelRun u_writeIdenticalLevelRun_3_2 #define u_writeIdenticalLevelRunTwoChars u_writeIdenticalLevelRunTwoChars_3_2 #define ubidi_close ubidi_close_3_2 #define ubidi_countRuns ubidi_countRuns_3_2 #define ubidi_getDirection ubidi_getDirection_3_2 #define ubidi_getLength ubidi_getLength_3_2 #define ubidi_getLevelAt ubidi_getLevelAt_3_2 #define ubidi_getLevels ubidi_getLevels_3_2 #define ubidi_getLogicalIndex ubidi_getLogicalIndex_3_2 #define ubidi_getLogicalMap ubidi_getLogicalMap_3_2 #define ubidi_getLogicalRun ubidi_getLogicalRun_3_2 #define ubidi_getMemory ubidi_getMemory_3_2 #define ubidi_getParaLevel ubidi_getParaLevel_3_2 #define ubidi_getRuns ubidi_getRuns_3_2 #define ubidi_getText ubidi_getText_3_2 #define ubidi_getVisualIndex ubidi_getVisualIndex_3_2 #define ubidi_getVisualMap ubidi_getVisualMap_3_2 #define ubidi_getVisualRun ubidi_getVisualRun_3_2 #define ubidi_invertMap ubidi_invertMap_3_2 #define ubidi_isInverse ubidi_isInverse_3_2 #define ubidi_open ubidi_open_3_2 #define ubidi_openSized ubidi_openSized_3_2 #define ubidi_reorderLogical ubidi_reorderLogical_3_2 #define ubidi_reorderVisual ubidi_reorderVisual_3_2 #define ubidi_setInverse ubidi_setInverse_3_2 #define ubidi_setLine ubidi_setLine_3_2 #define ubidi_setPara ubidi_setPara_3_2 #define ubidi_writeReordered ubidi_writeReordered_3_2 #define ubidi_writeReverse ubidi_writeReverse_3_2 #define ublock_getCode ublock_getCode_3_2 #define ubrk_close ubrk_close_3_2 #define ubrk_countAvailable ubrk_countAvailable_3_2 #define ubrk_current ubrk_current_3_2 #define ubrk_first ubrk_first_3_2 #define ubrk_following ubrk_following_3_2 #define ubrk_getAvailable ubrk_getAvailable_3_2 #define ubrk_getLocaleByType ubrk_getLocaleByType_3_2 #define ubrk_getRuleStatus ubrk_getRuleStatus_3_2 #define ubrk_getRuleStatusVec ubrk_getRuleStatusVec_3_2 #define ubrk_isBoundary ubrk_isBoundary_3_2 #define ubrk_last ubrk_last_3_2 #define ubrk_next ubrk_next_3_2 #define ubrk_open ubrk_open_3_2 #define ubrk_openRules ubrk_openRules_3_2 #define ubrk_preceding ubrk_preceding_3_2 #define ubrk_previous ubrk_previous_3_2 #define ubrk_safeClone ubrk_safeClone_3_2 #define ubrk_setText ubrk_setText_3_2 #define ubrk_swap ubrk_swap_3_2 #define ucal_add ucal_add_3_2 #define ucal_clear ucal_clear_3_2 #define ucal_clearField ucal_clearField_3_2 #define ucal_close ucal_close_3_2 #define ucal_countAvailable ucal_countAvailable_3_2 #define ucal_equivalentTo ucal_equivalentTo_3_2 #define ucal_get ucal_get_3_2 #define ucal_getAttribute ucal_getAttribute_3_2 #define ucal_getAvailable ucal_getAvailable_3_2 #define ucal_getDSTSavings ucal_getDSTSavings_3_2 #define ucal_getDefaultTimeZone ucal_getDefaultTimeZone_3_2 #define ucal_getLimit ucal_getLimit_3_2 #define ucal_getLocaleByType ucal_getLocaleByType_3_2 #define ucal_getMillis ucal_getMillis_3_2 #define ucal_getNow ucal_getNow_3_2 #define ucal_getTimeZoneDisplayName ucal_getTimeZoneDisplayName_3_2 #define ucal_inDaylightTime ucal_inDaylightTime_3_2 #define ucal_isSet ucal_isSet_3_2 #define ucal_open ucal_open_3_2 #define ucal_openCountryTimeZones ucal_openCountryTimeZones_3_2 #define ucal_openTimeZones ucal_openTimeZones_3_2 #define ucal_roll ucal_roll_3_2 #define ucal_set ucal_set_3_2 #define ucal_setAttribute ucal_setAttribute_3_2 #define ucal_setDate ucal_setDate_3_2 #define ucal_setDateTime ucal_setDateTime_3_2 #define ucal_setDefaultTimeZone ucal_setDefaultTimeZone_3_2 #define ucal_setMillis ucal_setMillis_3_2 #define ucal_setTimeZone ucal_setTimeZone_3_2 #define ucase_addPropertyStarts ucase_addPropertyStarts_3_2 #define ucase_close ucase_close_3_2 #define ucase_fold ucase_fold_3_2 #define ucase_getSingleton ucase_getSingleton_3_2 #define ucase_getType ucase_getType_3_2 #define ucase_getTypeOrIgnorable ucase_getTypeOrIgnorable_3_2 #define ucase_isCaseSensitive ucase_isCaseSensitive_3_2 #define ucase_isSoftDotted ucase_isSoftDotted_3_2 #define ucase_open ucase_open_3_2 #define ucase_openBinary ucase_openBinary_3_2 #define ucase_swap ucase_swap_3_2 #define ucase_toFullFolding ucase_toFullFolding_3_2 #define ucase_toFullLower ucase_toFullLower_3_2 #define ucase_toFullTitle ucase_toFullTitle_3_2 #define ucase_toFullUpper ucase_toFullUpper_3_2 #define ucase_tolower ucase_tolower_3_2 #define ucase_totitle ucase_totitle_3_2 #define ucase_toupper ucase_toupper_3_2 #define uchar_addPropertyStarts uchar_addPropertyStarts_3_2 #define uchar_getHST uchar_getHST_3_2 #define uchar_swapNames uchar_swapNames_3_2 #define ucln_common_lib_cleanup ucln_common_lib_cleanup_3_2 #define ucln_common_registerCleanup ucln_common_registerCleanup_3_2 #define ucln_i18n_registerCleanup ucln_i18n_registerCleanup_3_2 #define ucln_registerCleanup ucln_registerCleanup_3_2 #define ucmp8_close ucmp8_close_3_2 #define ucmp8_compact ucmp8_compact_3_2 #define ucmp8_expand ucmp8_expand_3_2 #define ucmp8_flattenMem ucmp8_flattenMem_3_2 #define ucmp8_getArray ucmp8_getArray_3_2 #define ucmp8_getCount ucmp8_getCount_3_2 #define ucmp8_getIndex ucmp8_getIndex_3_2 #define ucmp8_getkBlockCount ucmp8_getkBlockCount_3_2 #define ucmp8_getkUnicodeCount ucmp8_getkUnicodeCount_3_2 #define ucmp8_init ucmp8_init_3_2 #define ucmp8_initAdopt ucmp8_initAdopt_3_2 #define ucmp8_initAlias ucmp8_initAlias_3_2 #define ucmp8_initBogus ucmp8_initBogus_3_2 #define ucmp8_initFromData ucmp8_initFromData_3_2 #define ucmp8_isBogus ucmp8_isBogus_3_2 #define ucmp8_open ucmp8_open_3_2 #define ucmp8_openAdopt ucmp8_openAdopt_3_2 #define ucmp8_openAlias ucmp8_openAlias_3_2 #define ucmp8_set ucmp8_set_3_2 #define ucmp8_setRange ucmp8_setRange_3_2 #define ucnv_MBCSFromUChar32 ucnv_MBCSFromUChar32_3_2 #define ucnv_MBCSFromUnicodeWithOffsets ucnv_MBCSFromUnicodeWithOffsets_3_2 #define ucnv_MBCSGetType ucnv_MBCSGetType_3_2 #define ucnv_MBCSGetUnicodeSetForBytes ucnv_MBCSGetUnicodeSetForBytes_3_2 #define ucnv_MBCSGetUnicodeSetForUnicode ucnv_MBCSGetUnicodeSetForUnicode_3_2 #define ucnv_MBCSIsLeadByte ucnv_MBCSIsLeadByte_3_2 #define ucnv_MBCSSimpleGetNextUChar ucnv_MBCSSimpleGetNextUChar_3_2 #define ucnv_MBCSToUnicodeWithOffsets ucnv_MBCSToUnicodeWithOffsets_3_2 #define ucnv_cbFromUWriteBytes ucnv_cbFromUWriteBytes_3_2 #define ucnv_cbFromUWriteSub ucnv_cbFromUWriteSub_3_2 #define ucnv_cbFromUWriteUChars ucnv_cbFromUWriteUChars_3_2 #define ucnv_cbToUWriteSub ucnv_cbToUWriteSub_3_2 #define ucnv_cbToUWriteUChars ucnv_cbToUWriteUChars_3_2 #define ucnv_close ucnv_close_3_2 #define ucnv_compareNames ucnv_compareNames_3_2 #define ucnv_convert ucnv_convert_3_2 #define ucnv_convertEx ucnv_convertEx_3_2 #define ucnv_copyPlatformString ucnv_copyPlatformString_3_2 #define ucnv_countAliases ucnv_countAliases_3_2 #define ucnv_countAvailable ucnv_countAvailable_3_2 #define ucnv_countStandards ucnv_countStandards_3_2 #define ucnv_createAlgorithmicConverter ucnv_createAlgorithmicConverter_3_2 #define ucnv_createConverter ucnv_createConverter_3_2 #define ucnv_createConverterFromPackage ucnv_createConverterFromPackage_3_2 #define ucnv_createConverterFromSharedData ucnv_createConverterFromSharedData_3_2 #define ucnv_detectUnicodeSignature ucnv_detectUnicodeSignature_3_2 #define ucnv_extContinueMatchFromU ucnv_extContinueMatchFromU_3_2 #define ucnv_extContinueMatchToU ucnv_extContinueMatchToU_3_2 #define ucnv_extGetUnicodeSet ucnv_extGetUnicodeSet_3_2 #define ucnv_extInitialMatchFromU ucnv_extInitialMatchFromU_3_2 #define ucnv_extInitialMatchToU ucnv_extInitialMatchToU_3_2 #define ucnv_extSimpleMatchFromU ucnv_extSimpleMatchFromU_3_2 #define ucnv_extSimpleMatchToU ucnv_extSimpleMatchToU_3_2 #define ucnv_fixFileSeparator ucnv_fixFileSeparator_3_2 #define ucnv_flushCache ucnv_flushCache_3_2 #define ucnv_fromAlgorithmic ucnv_fromAlgorithmic_3_2 #define ucnv_fromUChars ucnv_fromUChars_3_2 #define ucnv_fromUWriteBytes ucnv_fromUWriteBytes_3_2 #define ucnv_fromUnicode ucnv_fromUnicode_3_2 #define ucnv_fromUnicode_UTF8 ucnv_fromUnicode_UTF8_3_2 #define ucnv_fromUnicode_UTF8_OFFSETS_LOGIC ucnv_fromUnicode_UTF8_OFFSETS_LOGIC_3_2 #define ucnv_getAlias ucnv_getAlias_3_2 #define ucnv_getAliases ucnv_getAliases_3_2 #define ucnv_getAvailableName ucnv_getAvailableName_3_2 #define ucnv_getCCSID ucnv_getCCSID_3_2 #define ucnv_getCanonicalName ucnv_getCanonicalName_3_2 #define ucnv_getCompleteUnicodeSet ucnv_getCompleteUnicodeSet_3_2 #define ucnv_getDefaultName ucnv_getDefaultName_3_2 #define ucnv_getDisplayName ucnv_getDisplayName_3_2 #define ucnv_getFromUCallBack ucnv_getFromUCallBack_3_2 #define ucnv_getInvalidChars ucnv_getInvalidChars_3_2 #define ucnv_getInvalidUChars ucnv_getInvalidUChars_3_2 #define ucnv_getMaxCharSize ucnv_getMaxCharSize_3_2 #define ucnv_getMinCharSize ucnv_getMinCharSize_3_2 #define ucnv_getName ucnv_getName_3_2 #define ucnv_getNextUChar ucnv_getNextUChar_3_2 #define ucnv_getNonSurrogateUnicodeSet ucnv_getNonSurrogateUnicodeSet_3_2 #define ucnv_getPlatform ucnv_getPlatform_3_2 #define ucnv_getStandard ucnv_getStandard_3_2 #define ucnv_getStandardName ucnv_getStandardName_3_2 #define ucnv_getStarters ucnv_getStarters_3_2 #define ucnv_getSubstChars ucnv_getSubstChars_3_2 #define ucnv_getToUCallBack ucnv_getToUCallBack_3_2 #define ucnv_getType ucnv_getType_3_2 #define ucnv_getUnicodeSet ucnv_getUnicodeSet_3_2 #define ucnv_incrementRefCount ucnv_incrementRefCount_3_2 #define ucnv_io_countAliases ucnv_io_countAliases_3_2 #define ucnv_io_countAvailableAliases ucnv_io_countAvailableAliases_3_2 #define ucnv_io_countAvailableConverters ucnv_io_countAvailableConverters_3_2 #define ucnv_io_countStandards ucnv_io_countStandards_3_2 #define ucnv_io_flushAvailableConverterCache ucnv_io_flushAvailableConverterCache_3_2 #define ucnv_io_getAlias ucnv_io_getAlias_3_2 #define ucnv_io_getAliases ucnv_io_getAliases_3_2 #define ucnv_io_getAvailableConverter ucnv_io_getAvailableConverter_3_2 #define ucnv_io_getConverterName ucnv_io_getConverterName_3_2 #define ucnv_io_getDefaultConverterName ucnv_io_getDefaultConverterName_3_2 #define ucnv_io_setDefaultConverterName ucnv_io_setDefaultConverterName_3_2 #define ucnv_io_stripASCIIForCompare ucnv_io_stripASCIIForCompare_3_2 #define ucnv_io_stripEBCDICForCompare ucnv_io_stripEBCDICForCompare_3_2 #define ucnv_isAmbiguous ucnv_isAmbiguous_3_2 #define ucnv_load ucnv_load_3_2 #define ucnv_loadSharedData ucnv_loadSharedData_3_2 #define ucnv_open ucnv_open_3_2 #define ucnv_openAllNames ucnv_openAllNames_3_2 #define ucnv_openCCSID ucnv_openCCSID_3_2 #define ucnv_openPackage ucnv_openPackage_3_2 #define ucnv_openStandardNames ucnv_openStandardNames_3_2 #define ucnv_openU ucnv_openU_3_2 #define ucnv_reset ucnv_reset_3_2 #define ucnv_resetFromUnicode ucnv_resetFromUnicode_3_2 #define ucnv_resetToUnicode ucnv_resetToUnicode_3_2 #define ucnv_safeClone ucnv_safeClone_3_2 #define ucnv_setDefaultName ucnv_setDefaultName_3_2 #define ucnv_setFallback ucnv_setFallback_3_2 #define ucnv_setFromUCallBack ucnv_setFromUCallBack_3_2 #define ucnv_setSubstChars ucnv_setSubstChars_3_2 #define ucnv_setToUCallBack ucnv_setToUCallBack_3_2 #define ucnv_swap ucnv_swap_3_2 #define ucnv_swapAliases ucnv_swapAliases_3_2 #define ucnv_toAlgorithmic ucnv_toAlgorithmic_3_2 #define ucnv_toUChars ucnv_toUChars_3_2 #define ucnv_toUWriteCodePoint ucnv_toUWriteCodePoint_3_2 #define ucnv_toUWriteUChars ucnv_toUWriteUChars_3_2 #define ucnv_toUnicode ucnv_toUnicode_3_2 #define ucnv_unload ucnv_unload_3_2 #define ucnv_unloadSharedDataIfReady ucnv_unloadSharedDataIfReady_3_2 #define ucnv_usesFallback ucnv_usesFallback_3_2 #define ucol_allocWeights ucol_allocWeights_3_2 #define ucol_assembleTailoringTable ucol_assembleTailoringTable_3_2 #define ucol_calcSortKey ucol_calcSortKey_3_2 #define ucol_calcSortKeySimpleTertiary ucol_calcSortKeySimpleTertiary_3_2 #define ucol_cloneBinary ucol_cloneBinary_3_2 #define ucol_cloneRuleData ucol_cloneRuleData_3_2 #define ucol_close ucol_close_3_2 #define ucol_closeElements ucol_closeElements_3_2 #define ucol_collatorToIdentifier ucol_collatorToIdentifier_3_2 #define ucol_countAvailable ucol_countAvailable_3_2 #define ucol_createElements ucol_createElements_3_2 #define ucol_doCE ucol_doCE_3_2 #define ucol_equal ucol_equal_3_2 #define ucol_equals ucol_equals_3_2 #define ucol_forgetUCA ucol_forgetUCA_3_2 #define ucol_getAttribute ucol_getAttribute_3_2 #define ucol_getAttributeOrDefault ucol_getAttributeOrDefault_3_2 #define ucol_getAvailable ucol_getAvailable_3_2 #define ucol_getBound ucol_getBound_3_2 #define ucol_getCEGenerator ucol_getCEGenerator_3_2 #define ucol_getCEStrengthDifference ucol_getCEStrengthDifference_3_2 #define ucol_getContractions ucol_getContractions_3_2 #define ucol_getDisplayName ucol_getDisplayName_3_2 #define ucol_getFirstCE ucol_getFirstCE_3_2 #define ucol_getFunctionalEquivalent ucol_getFunctionalEquivalent_3_2 #define ucol_getKeywordValues ucol_getKeywordValues_3_2 #define ucol_getKeywords ucol_getKeywords_3_2 #define ucol_getLocale ucol_getLocale_3_2 #define ucol_getLocaleByType ucol_getLocaleByType_3_2 #define ucol_getMaxExpansion ucol_getMaxExpansion_3_2 #define ucol_getNextCE ucol_getNextCE_3_2 #define ucol_getNextGenerated ucol_getNextGenerated_3_2 #define ucol_getOffset ucol_getOffset_3_2 #define ucol_getPrevCE ucol_getPrevCE_3_2 #define ucol_getRules ucol_getRules_3_2 #define ucol_getRulesEx ucol_getRulesEx_3_2 #define ucol_getShortDefinitionString ucol_getShortDefinitionString_3_2 #define ucol_getSimpleCEGenerator ucol_getSimpleCEGenerator_3_2 #define ucol_getSortKey ucol_getSortKey_3_2 #define ucol_getSortKeySize ucol_getSortKeySize_3_2 #define ucol_getSortKeyWithAllocation ucol_getSortKeyWithAllocation_3_2 #define ucol_getStrength ucol_getStrength_3_2 #define ucol_getTailoredSet ucol_getTailoredSet_3_2 #define ucol_getUCAVersion ucol_getUCAVersion_3_2 #define ucol_getUnsafeSet ucol_getUnsafeSet_3_2 #define ucol_getVariableTop ucol_getVariableTop_3_2 #define ucol_getVersion ucol_getVersion_3_2 #define ucol_greater ucol_greater_3_2 #define ucol_greaterOrEqual ucol_greaterOrEqual_3_2 #define ucol_identifierToShortString ucol_identifierToShortString_3_2 #define ucol_initBuffers ucol_initBuffers_3_2 #define ucol_initCollator ucol_initCollator_3_2 #define ucol_initInverseUCA ucol_initInverseUCA_3_2 #define ucol_initUCA ucol_initUCA_3_2 #define ucol_inv_getGapPositions ucol_inv_getGapPositions_3_2 #define ucol_inv_getNextCE ucol_inv_getNextCE_3_2 #define ucol_inv_getPrevCE ucol_inv_getPrevCE_3_2 #define ucol_isTailored ucol_isTailored_3_2 #define ucol_keyHashCode ucol_keyHashCode_3_2 #define ucol_mergeSortkeys ucol_mergeSortkeys_3_2 #define ucol_next ucol_next_3_2 #define ucol_nextSortKeyPart ucol_nextSortKeyPart_3_2 #define ucol_nextWeight ucol_nextWeight_3_2 #define ucol_normalizeShortDefinitionString ucol_normalizeShortDefinitionString_3_2 #define ucol_open ucol_open_3_2 #define ucol_openAvailableLocales ucol_openAvailableLocales_3_2 #define ucol_openBinary ucol_openBinary_3_2 #define ucol_openElements ucol_openElements_3_2 #define ucol_openFromIdentifier ucol_openFromIdentifier_3_2 #define ucol_openFromShortString ucol_openFromShortString_3_2 #define ucol_openRules ucol_openRules_3_2 #define ucol_open_internal ucol_open_internal_3_2 #define ucol_prepareShortStringOpen ucol_prepareShortStringOpen_3_2 #define ucol_previous ucol_previous_3_2 #define ucol_primaryOrder ucol_primaryOrder_3_2 #define ucol_prv_getSpecialCE ucol_prv_getSpecialCE_3_2 #define ucol_prv_getSpecialPrevCE ucol_prv_getSpecialPrevCE_3_2 #define ucol_reset ucol_reset_3_2 #define ucol_restoreVariableTop ucol_restoreVariableTop_3_2 #define ucol_safeClone ucol_safeClone_3_2 #define ucol_secondaryOrder ucol_secondaryOrder_3_2 #define ucol_setAttribute ucol_setAttribute_3_2 #define ucol_setOffset ucol_setOffset_3_2 #define ucol_setOptionsFromHeader ucol_setOptionsFromHeader_3_2 #define ucol_setReqValidLocales ucol_setReqValidLocales_3_2 #define ucol_setStrength ucol_setStrength_3_2 #define ucol_setText ucol_setText_3_2 #define ucol_setVariableTop ucol_setVariableTop_3_2 #define ucol_shortStringToIdentifier ucol_shortStringToIdentifier_3_2 #define ucol_sortKeyToString ucol_sortKeyToString_3_2 #define ucol_strcoll ucol_strcoll_3_2 #define ucol_strcollIter ucol_strcollIter_3_2 #define ucol_swap ucol_swap_3_2 #define ucol_swapBinary ucol_swapBinary_3_2 #define ucol_swapInverseUCA ucol_swapInverseUCA_3_2 #define ucol_tertiaryOrder ucol_tertiaryOrder_3_2 #define ucol_tok_assembleTokenList ucol_tok_assembleTokenList_3_2 #define ucol_tok_closeTokenList ucol_tok_closeTokenList_3_2 #define ucol_tok_getNextArgument ucol_tok_getNextArgument_3_2 #define ucol_tok_initTokenList ucol_tok_initTokenList_3_2 #define ucol_tok_parseNextToken ucol_tok_parseNextToken_3_2 #define ucol_updateInternalState ucol_updateInternalState_3_2 #define ucurr_forLocale ucurr_forLocale_3_2 #define ucurr_getDefaultFractionDigits ucurr_getDefaultFractionDigits_3_2 #define ucurr_getName ucurr_getName_3_2 #define ucurr_getRoundingIncrement ucurr_getRoundingIncrement_3_2 #define ucurr_register ucurr_register_3_2 #define ucurr_unregister ucurr_unregister_3_2 #define udat_applyPattern udat_applyPattern_3_2 #define udat_clone udat_clone_3_2 #define udat_close udat_close_3_2 #define udat_countAvailable udat_countAvailable_3_2 #define udat_countSymbols udat_countSymbols_3_2 #define udat_format udat_format_3_2 #define udat_get2DigitYearStart udat_get2DigitYearStart_3_2 #define udat_getAvailable udat_getAvailable_3_2 #define udat_getCalendar udat_getCalendar_3_2 #define udat_getLocaleByType udat_getLocaleByType_3_2 #define udat_getNumberFormat udat_getNumberFormat_3_2 #define udat_getSymbols udat_getSymbols_3_2 #define udat_isLenient udat_isLenient_3_2 #define udat_open udat_open_3_2 #define udat_parse udat_parse_3_2 #define udat_parseCalendar udat_parseCalendar_3_2 #define udat_set2DigitYearStart udat_set2DigitYearStart_3_2 #define udat_setCalendar udat_setCalendar_3_2 #define udat_setLenient udat_setLenient_3_2 #define udat_setNumberFormat udat_setNumberFormat_3_2 #define udat_setSymbols udat_setSymbols_3_2 #define udat_toPattern udat_toPattern_3_2 #define udata_checkCommonData udata_checkCommonData_3_2 #define udata_close udata_close_3_2 #define udata_closeSwapper udata_closeSwapper_3_2 #define udata_getHeaderSize udata_getHeaderSize_3_2 #define udata_getInfo udata_getInfo_3_2 #define udata_getInfoSize udata_getInfoSize_3_2 #define udata_getLength udata_getLength_3_2 #define udata_getMemory udata_getMemory_3_2 #define udata_getRawMemory udata_getRawMemory_3_2 #define udata_open udata_open_3_2 #define udata_openChoice udata_openChoice_3_2 #define udata_openSwapper udata_openSwapper_3_2 #define udata_openSwapperForInputData udata_openSwapperForInputData_3_2 #define udata_printError udata_printError_3_2 #define udata_readInt16 udata_readInt16_3_2 #define udata_readInt32 udata_readInt32_3_2 #define udata_setAppData udata_setAppData_3_2 #define udata_setCommonData udata_setCommonData_3_2 #define udata_swapDataHeader udata_swapDataHeader_3_2 #define udata_swapInvStringBlock udata_swapInvStringBlock_3_2 #define uenum_close uenum_close_3_2 #define uenum_count uenum_count_3_2 #define uenum_next uenum_next_3_2 #define uenum_nextDefault uenum_nextDefault_3_2 #define uenum_openCharStringsEnumeration uenum_openCharStringsEnumeration_3_2 #define uenum_openStringEnumeration uenum_openStringEnumeration_3_2 #define uenum_reset uenum_reset_3_2 #define uenum_unext uenum_unext_3_2 #define uenum_unextDefault uenum_unextDefault_3_2 #define ufile_close_translit ufile_close_translit_3_2 #define ufile_fill_uchar_buffer ufile_fill_uchar_buffer_3_2 #define ufile_flush_translit ufile_flush_translit_3_2 #define ufile_getch ufile_getch_3_2 #define ufile_getch32 ufile_getch32_3_2 #define ufmt_64tou ufmt_64tou_3_2 #define ufmt_defaultCPToUnicode ufmt_defaultCPToUnicode_3_2 #define ufmt_digitvalue ufmt_digitvalue_3_2 #define ufmt_isdigit ufmt_isdigit_3_2 #define ufmt_ptou ufmt_ptou_3_2 #define ufmt_uto64 ufmt_uto64_3_2 #define ufmt_utop ufmt_utop_3_2 #define uhash_close uhash_close_3_2 #define uhash_compareCaselessUnicodeString uhash_compareCaselessUnicodeString_3_2 #define uhash_compareChars uhash_compareChars_3_2 #define uhash_compareIChars uhash_compareIChars_3_2 #define uhash_compareLong uhash_compareLong_3_2 #define uhash_compareUChars uhash_compareUChars_3_2 #define uhash_compareUnicodeString uhash_compareUnicodeString_3_2 #define uhash_count uhash_count_3_2 #define uhash_deleteHashtable uhash_deleteHashtable_3_2 #define uhash_deleteUVector uhash_deleteUVector_3_2 #define uhash_deleteUnicodeString uhash_deleteUnicodeString_3_2 #define uhash_find uhash_find_3_2 #define uhash_freeBlock uhash_freeBlock_3_2 #define uhash_get uhash_get_3_2 #define uhash_geti uhash_geti_3_2 #define uhash_hashCaselessUnicodeString uhash_hashCaselessUnicodeString_3_2 #define uhash_hashChars uhash_hashChars_3_2 #define uhash_hashIChars uhash_hashIChars_3_2 #define uhash_hashLong uhash_hashLong_3_2 #define uhash_hashUChars uhash_hashUChars_3_2 #define uhash_hashUCharsN uhash_hashUCharsN_3_2 #define uhash_hashUnicodeString uhash_hashUnicodeString_3_2 #define uhash_iget uhash_iget_3_2 #define uhash_igeti uhash_igeti_3_2 #define uhash_iput uhash_iput_3_2 #define uhash_iputi uhash_iputi_3_2 #define uhash_iremove uhash_iremove_3_2 #define uhash_iremovei uhash_iremovei_3_2 #define uhash_nextElement uhash_nextElement_3_2 #define uhash_open uhash_open_3_2 #define uhash_openSize uhash_openSize_3_2 #define uhash_put uhash_put_3_2 #define uhash_puti uhash_puti_3_2 #define uhash_remove uhash_remove_3_2 #define uhash_removeAll uhash_removeAll_3_2 #define uhash_removeElement uhash_removeElement_3_2 #define uhash_removei uhash_removei_3_2 #define uhash_setKeyComparator uhash_setKeyComparator_3_2 #define uhash_setKeyDeleter uhash_setKeyDeleter_3_2 #define uhash_setKeyHasher uhash_setKeyHasher_3_2 #define uhash_setResizePolicy uhash_setResizePolicy_3_2 #define uhash_setValueDeleter uhash_setValueDeleter_3_2 #define uhash_toki uhash_toki_3_2 #define uhash_tokp uhash_tokp_3_2 #define uhst_addPropertyStarts uhst_addPropertyStarts_3_2 #define uidna_IDNToASCII uidna_IDNToASCII_3_2 #define uidna_IDNToUnicode uidna_IDNToUnicode_3_2 #define uidna_compare uidna_compare_3_2 #define uidna_toASCII uidna_toASCII_3_2 #define uidna_toUnicode uidna_toUnicode_3_2 #define uiter_current32 uiter_current32_3_2 #define uiter_getState uiter_getState_3_2 #define uiter_next32 uiter_next32_3_2 #define uiter_previous32 uiter_previous32_3_2 #define uiter_setCharacterIterator uiter_setCharacterIterator_3_2 #define uiter_setReplaceable uiter_setReplaceable_3_2 #define uiter_setState uiter_setState_3_2 #define uiter_setString uiter_setString_3_2 #define uiter_setUTF16BE uiter_setUTF16BE_3_2 #define uiter_setUTF8 uiter_setUTF8_3_2 #define uloc_acceptLanguage uloc_acceptLanguage_3_2 #define uloc_acceptLanguageFromHTTP uloc_acceptLanguageFromHTTP_3_2 #define uloc_canonicalize uloc_canonicalize_3_2 #define uloc_countAvailable uloc_countAvailable_3_2 #define uloc_getAvailable uloc_getAvailable_3_2 #define uloc_getBaseName uloc_getBaseName_3_2 #define uloc_getCountry uloc_getCountry_3_2 #define uloc_getDefault uloc_getDefault_3_2 #define uloc_getDisplayCountry uloc_getDisplayCountry_3_2 #define uloc_getDisplayKeyword uloc_getDisplayKeyword_3_2 #define uloc_getDisplayKeywordValue uloc_getDisplayKeywordValue_3_2 #define uloc_getDisplayLanguage uloc_getDisplayLanguage_3_2 #define uloc_getDisplayName uloc_getDisplayName_3_2 #define uloc_getDisplayScript uloc_getDisplayScript_3_2 #define uloc_getDisplayVariant uloc_getDisplayVariant_3_2 #define uloc_getISO3Country uloc_getISO3Country_3_2 #define uloc_getISO3Language uloc_getISO3Language_3_2 #define uloc_getISOCountries uloc_getISOCountries_3_2 #define uloc_getISOLanguages uloc_getISOLanguages_3_2 #define uloc_getKeywordValue uloc_getKeywordValue_3_2 #define uloc_getLCID uloc_getLCID_3_2 #define uloc_getLanguage uloc_getLanguage_3_2 #define uloc_getName uloc_getName_3_2 #define uloc_getParent uloc_getParent_3_2 #define uloc_getScript uloc_getScript_3_2 #define uloc_getVariant uloc_getVariant_3_2 #define uloc_openKeywordList uloc_openKeywordList_3_2 #define uloc_openKeywords uloc_openKeywords_3_2 #define uloc_setDefault uloc_setDefault_3_2 #define uloc_setKeywordValue uloc_setKeywordValue_3_2 #define ulocdata_getExemplarSet ulocdata_getExemplarSet_3_2 #define ulocdata_getMeasurementSystem ulocdata_getMeasurementSystem_3_2 #define ulocdata_getPaperSize ulocdata_getPaperSize_3_2 #define umsg_applyPattern umsg_applyPattern_3_2 #define umsg_clone umsg_clone_3_2 #define umsg_close umsg_close_3_2 #define umsg_format umsg_format_3_2 #define umsg_getLocale umsg_getLocale_3_2 #define umsg_getLocaleByType umsg_getLocaleByType_3_2 #define umsg_open umsg_open_3_2 #define umsg_parse umsg_parse_3_2 #define umsg_setLocale umsg_setLocale_3_2 #define umsg_toPattern umsg_toPattern_3_2 #define umsg_vformat umsg_vformat_3_2 #define umsg_vparse umsg_vparse_3_2 #define umtx_atomic_dec umtx_atomic_dec_3_2 #define umtx_atomic_inc umtx_atomic_inc_3_2 #define umtx_cleanup umtx_cleanup_3_2 #define umtx_destroy umtx_destroy_3_2 #define umtx_init umtx_init_3_2 #define umtx_lock umtx_lock_3_2 #define umtx_unlock umtx_unlock_3_2 #define unorm_addPropertyStarts unorm_addPropertyStarts_3_2 #define unorm_closeIter unorm_closeIter_3_2 #define unorm_compare unorm_compare_3_2 #define unorm_compose unorm_compose_3_2 #define unorm_concatenate unorm_concatenate_3_2 #define unorm_decompose unorm_decompose_3_2 #define unorm_getCanonStartSet unorm_getCanonStartSet_3_2 #define unorm_getCanonicalDecomposition unorm_getCanonicalDecomposition_3_2 #define unorm_getDecomposition unorm_getDecomposition_3_2 #define unorm_getFCD16FromCodePoint unorm_getFCD16FromCodePoint_3_2 #define unorm_getFCDTrie unorm_getFCDTrie_3_2 #define unorm_getNX unorm_getNX_3_2 #define unorm_getQuickCheck unorm_getQuickCheck_3_2 #define unorm_getUnicodeVersion unorm_getUnicodeVersion_3_2 #define unorm_haveData unorm_haveData_3_2 #define unorm_internalIsFullCompositionExclusion unorm_internalIsFullCompositionExclusion_3_2 #define unorm_internalNormalize unorm_internalNormalize_3_2 #define unorm_internalNormalizeWithNX unorm_internalNormalizeWithNX_3_2 #define unorm_internalQuickCheck unorm_internalQuickCheck_3_2 #define unorm_isCanonSafeStart unorm_isCanonSafeStart_3_2 #define unorm_isNFSkippable unorm_isNFSkippable_3_2 #define unorm_isNormalized unorm_isNormalized_3_2 #define unorm_isNormalizedWithOptions unorm_isNormalizedWithOptions_3_2 #define unorm_next unorm_next_3_2 #define unorm_normalize unorm_normalize_3_2 #define unorm_openIter unorm_openIter_3_2 #define unorm_previous unorm_previous_3_2 #define unorm_quickCheck unorm_quickCheck_3_2 #define unorm_quickCheckWithOptions unorm_quickCheckWithOptions_3_2 #define unorm_setIter unorm_setIter_3_2 #define unorm_swap unorm_swap_3_2 #define unum_applyPattern unum_applyPattern_3_2 #define unum_clone unum_clone_3_2 #define unum_close unum_close_3_2 #define unum_countAvailable unum_countAvailable_3_2 #define unum_format unum_format_3_2 #define unum_formatDouble unum_formatDouble_3_2 #define unum_formatDoubleCurrency unum_formatDoubleCurrency_3_2 #define unum_formatInt64 unum_formatInt64_3_2 #define unum_getAttribute unum_getAttribute_3_2 #define unum_getAvailable unum_getAvailable_3_2 #define unum_getDoubleAttribute unum_getDoubleAttribute_3_2 #define unum_getLocaleByType unum_getLocaleByType_3_2 #define unum_getSymbol unum_getSymbol_3_2 #define unum_getTextAttribute unum_getTextAttribute_3_2 #define unum_open unum_open_3_2 #define unum_parse unum_parse_3_2 #define unum_parseDouble unum_parseDouble_3_2 #define unum_parseDoubleCurrency unum_parseDoubleCurrency_3_2 #define unum_parseInt64 unum_parseInt64_3_2 #define unum_setAttribute unum_setAttribute_3_2 #define unum_setDoubleAttribute unum_setDoubleAttribute_3_2 #define unum_setSymbol unum_setSymbol_3_2 #define unum_setTextAttribute unum_setTextAttribute_3_2 #define unum_toPattern unum_toPattern_3_2 #define upname_swap upname_swap_3_2 #define uprops_getSource uprops_getSource_3_2 #define uprops_swap uprops_swap_3_2 #define uprv_asciiFromEbcdic uprv_asciiFromEbcdic_3_2 #define uprv_asciitolower uprv_asciitolower_3_2 #define uprv_ceil uprv_ceil_3_2 #define uprv_cnttab_addContraction uprv_cnttab_addContraction_3_2 #define uprv_cnttab_changeContraction uprv_cnttab_changeContraction_3_2 #define uprv_cnttab_changeLastCE uprv_cnttab_changeLastCE_3_2 #define uprv_cnttab_clone uprv_cnttab_clone_3_2 #define uprv_cnttab_close uprv_cnttab_close_3_2 #define uprv_cnttab_constructTable uprv_cnttab_constructTable_3_2 #define uprv_cnttab_findCE uprv_cnttab_findCE_3_2 #define uprv_cnttab_findCP uprv_cnttab_findCP_3_2 #define uprv_cnttab_getCE uprv_cnttab_getCE_3_2 #define uprv_cnttab_insertContraction uprv_cnttab_insertContraction_3_2 #define uprv_cnttab_isTailored uprv_cnttab_isTailored_3_2 #define uprv_cnttab_open uprv_cnttab_open_3_2 #define uprv_cnttab_setContraction uprv_cnttab_setContraction_3_2 #define uprv_compareASCIIPropertyNames uprv_compareASCIIPropertyNames_3_2 #define uprv_compareEBCDICPropertyNames uprv_compareEBCDICPropertyNames_3_2 #define uprv_compareInvAscii uprv_compareInvAscii_3_2 #define uprv_compareInvEbcdic uprv_compareInvEbcdic_3_2 #define uprv_convertToLCID uprv_convertToLCID_3_2 #define uprv_convertToPosix uprv_convertToPosix_3_2 #define uprv_copyAscii uprv_copyAscii_3_2 #define uprv_copyEbcdic uprv_copyEbcdic_3_2 #define uprv_dtostr uprv_dtostr_3_2 #define uprv_ebcdicFromAscii uprv_ebcdicFromAscii_3_2 #define uprv_ebcdictolower uprv_ebcdictolower_3_2 #define uprv_fabs uprv_fabs_3_2 #define uprv_floor uprv_floor_3_2 #define uprv_fmax uprv_fmax_3_2 #define uprv_fmin uprv_fmin_3_2 #define uprv_fmod uprv_fmod_3_2 #define uprv_free uprv_free_3_2 #define uprv_getCharNameCharacters uprv_getCharNameCharacters_3_2 #define uprv_getDefaultCodepage uprv_getDefaultCodepage_3_2 #define uprv_getDefaultLocaleID uprv_getDefaultLocaleID_3_2 #define uprv_getInfinity uprv_getInfinity_3_2 #define uprv_getMaxCharNameLength uprv_getMaxCharNameLength_3_2 #define uprv_getMaxValues uprv_getMaxValues_3_2 #define uprv_getNaN uprv_getNaN_3_2 #define uprv_getStaticCurrencyName uprv_getStaticCurrencyName_3_2 #define uprv_getUTCtime uprv_getUTCtime_3_2 #define uprv_haveProperties uprv_haveProperties_3_2 #define uprv_init_collIterate uprv_init_collIterate_3_2 #define uprv_int32Comparator uprv_int32Comparator_3_2 #define uprv_isInfinite uprv_isInfinite_3_2 #define uprv_isInvariantString uprv_isInvariantString_3_2 #define uprv_isInvariantUString uprv_isInvariantUString_3_2 #define uprv_isNaN uprv_isNaN_3_2 #define uprv_isNegativeInfinity uprv_isNegativeInfinity_3_2 #define uprv_isPositiveInfinity uprv_isPositiveInfinity_3_2 #define uprv_isRuleWhiteSpace uprv_isRuleWhiteSpace_3_2 #define uprv_itou uprv_itou_3_2 #define uprv_loadPropsData uprv_loadPropsData_3_2 #define uprv_log uprv_log_3_2 #define uprv_log10 uprv_log10_3_2 #define uprv_malloc uprv_malloc_3_2 #define uprv_mapFile uprv_mapFile_3_2 #define uprv_max uprv_max_3_2 #define uprv_maxMantissa uprv_maxMantissa_3_2 #define uprv_min uprv_min_3_2 #define uprv_modf uprv_modf_3_2 #define uprv_openRuleWhiteSpaceSet uprv_openRuleWhiteSpaceSet_3_2 #define uprv_pathIsAbsolute uprv_pathIsAbsolute_3_2 #define uprv_pow uprv_pow_3_2 #define uprv_pow10 uprv_pow10_3_2 #define uprv_realloc uprv_realloc_3_2 #define uprv_round uprv_round_3_2 #define uprv_sortArray uprv_sortArray_3_2 #define uprv_strCompare uprv_strCompare_3_2 #define uprv_strdup uprv_strdup_3_2 #define uprv_strndup uprv_strndup_3_2 #define uprv_syntaxError uprv_syntaxError_3_2 #define uprv_timezone uprv_timezone_3_2 #define uprv_toupper uprv_toupper_3_2 #define uprv_trunc uprv_trunc_3_2 #define uprv_tzname uprv_tzname_3_2 #define uprv_tzset uprv_tzset_3_2 #define uprv_uca_addAnElement uprv_uca_addAnElement_3_2 #define uprv_uca_assembleTable uprv_uca_assembleTable_3_2 #define uprv_uca_canonicalClosure uprv_uca_canonicalClosure_3_2 #define uprv_uca_cloneTempTable uprv_uca_cloneTempTable_3_2 #define uprv_uca_closeTempTable uprv_uca_closeTempTable_3_2 #define uprv_uca_getCodePointFromRaw uprv_uca_getCodePointFromRaw_3_2 #define uprv_uca_getImplicitFromRaw uprv_uca_getImplicitFromRaw_3_2 #define uprv_uca_getImplicitPrimary uprv_uca_getImplicitPrimary_3_2 #define uprv_uca_getRawFromCodePoint uprv_uca_getRawFromCodePoint_3_2 #define uprv_uca_getRawFromImplicit uprv_uca_getRawFromImplicit_3_2 #define uprv_uca_initImplicitConstants uprv_uca_initImplicitConstants_3_2 #define uprv_uca_initTempTable uprv_uca_initTempTable_3_2 #define uprv_uint16Comparator uprv_uint16Comparator_3_2 #define uprv_uint32Comparator uprv_uint32Comparator_3_2 #define uprv_unmapFile uprv_unmapFile_3_2 #define uregex_appendReplacement uregex_appendReplacement_3_2 #define uregex_appendTail uregex_appendTail_3_2 #define uregex_clone uregex_clone_3_2 #define uregex_close uregex_close_3_2 #define uregex_end uregex_end_3_2 #define uregex_find uregex_find_3_2 #define uregex_findNext uregex_findNext_3_2 #define uregex_flags uregex_flags_3_2 #define uregex_getText uregex_getText_3_2 #define uregex_group uregex_group_3_2 #define uregex_groupCount uregex_groupCount_3_2 #define uregex_lookingAt uregex_lookingAt_3_2 #define uregex_matches uregex_matches_3_2 #define uregex_open uregex_open_3_2 #define uregex_openC uregex_openC_3_2 #define uregex_pattern uregex_pattern_3_2 #define uregex_replaceAll uregex_replaceAll_3_2 #define uregex_replaceFirst uregex_replaceFirst_3_2 #define uregex_reset uregex_reset_3_2 #define uregex_setText uregex_setText_3_2 #define uregex_split uregex_split_3_2 #define uregex_start uregex_start_3_2 #define ures_appendResPath ures_appendResPath_3_2 #define ures_close ures_close_3_2 #define ures_copyResb ures_copyResb_3_2 #define ures_countArrayItems ures_countArrayItems_3_2 #define ures_findResource ures_findResource_3_2 #define ures_findSubResource ures_findSubResource_3_2 #define ures_freeResPath ures_freeResPath_3_2 #define ures_getBinary ures_getBinary_3_2 #define ures_getByIndex ures_getByIndex_3_2 #define ures_getByKey ures_getByKey_3_2 #define ures_getByKeyWithFallback ures_getByKeyWithFallback_3_2 #define ures_getFunctionalEquivalent ures_getFunctionalEquivalent_3_2 #define ures_getInt ures_getInt_3_2 #define ures_getIntVector ures_getIntVector_3_2 #define ures_getKey ures_getKey_3_2 #define ures_getKeywordValues ures_getKeywordValues_3_2 #define ures_getLocale ures_getLocale_3_2 #define ures_getLocaleByType ures_getLocaleByType_3_2 #define ures_getName ures_getName_3_2 #define ures_getNextResource ures_getNextResource_3_2 #define ures_getNextString ures_getNextString_3_2 #define ures_getPath ures_getPath_3_2 #define ures_getSize ures_getSize_3_2 #define ures_getString ures_getString_3_2 #define ures_getStringByIndex ures_getStringByIndex_3_2 #define ures_getStringByKey ures_getStringByKey_3_2 #define ures_getType ures_getType_3_2 #define ures_getUInt ures_getUInt_3_2 #define ures_getVersion ures_getVersion_3_2 #define ures_getVersionNumber ures_getVersionNumber_3_2 #define ures_hasNext ures_hasNext_3_2 #define ures_initStackObject ures_initStackObject_3_2 #define ures_open ures_open_3_2 #define ures_openAvailableLocales ures_openAvailableLocales_3_2 #define ures_openDirect ures_openDirect_3_2 #define ures_openFillIn ures_openFillIn_3_2 #define ures_openU ures_openU_3_2 #define ures_resetIterator ures_resetIterator_3_2 #define ures_swap ures_swap_3_2 #define uscript_closeRun uscript_closeRun_3_2 #define uscript_getCode uscript_getCode_3_2 #define uscript_getName uscript_getName_3_2 #define uscript_getScript uscript_getScript_3_2 #define uscript_getShortName uscript_getShortName_3_2 #define uscript_nextRun uscript_nextRun_3_2 #define uscript_openRun uscript_openRun_3_2 #define uscript_resetRun uscript_resetRun_3_2 #define uscript_setRunText uscript_setRunText_3_2 #define usearch_close usearch_close_3_2 #define usearch_first usearch_first_3_2 #define usearch_following usearch_following_3_2 #define usearch_getAttribute usearch_getAttribute_3_2 #define usearch_getBreakIterator usearch_getBreakIterator_3_2 #define usearch_getCollator usearch_getCollator_3_2 #define usearch_getMatchedLength usearch_getMatchedLength_3_2 #define usearch_getMatchedStart usearch_getMatchedStart_3_2 #define usearch_getMatchedText usearch_getMatchedText_3_2 #define usearch_getOffset usearch_getOffset_3_2 #define usearch_getPattern usearch_getPattern_3_2 #define usearch_getText usearch_getText_3_2 #define usearch_handleNextCanonical usearch_handleNextCanonical_3_2 #define usearch_handleNextExact usearch_handleNextExact_3_2 #define usearch_handlePreviousCanonical usearch_handlePreviousCanonical_3_2 #define usearch_handlePreviousExact usearch_handlePreviousExact_3_2 #define usearch_last usearch_last_3_2 #define usearch_next usearch_next_3_2 #define usearch_open usearch_open_3_2 #define usearch_openFromCollator usearch_openFromCollator_3_2 #define usearch_preceding usearch_preceding_3_2 #define usearch_previous usearch_previous_3_2 #define usearch_reset usearch_reset_3_2 #define usearch_setAttribute usearch_setAttribute_3_2 #define usearch_setBreakIterator usearch_setBreakIterator_3_2 #define usearch_setCollator usearch_setCollator_3_2 #define usearch_setOffset usearch_setOffset_3_2 #define usearch_setPattern usearch_setPattern_3_2 #define usearch_setText usearch_setText_3_2 #define userv_deleteStringPair userv_deleteStringPair_3_2 #define uset_add uset_add_3_2 #define uset_addAll uset_addAll_3_2 #define uset_addRange uset_addRange_3_2 #define uset_addString uset_addString_3_2 #define uset_applyIntPropertyValue uset_applyIntPropertyValue_3_2 #define uset_applyPattern uset_applyPattern_3_2 #define uset_applyPropertyAlias uset_applyPropertyAlias_3_2 #define uset_charAt uset_charAt_3_2 #define uset_clear uset_clear_3_2 #define uset_close uset_close_3_2 #define uset_compact uset_compact_3_2 #define uset_complement uset_complement_3_2 #define uset_complementAll uset_complementAll_3_2 #define uset_contains uset_contains_3_2 #define uset_containsAll uset_containsAll_3_2 #define uset_containsNone uset_containsNone_3_2 #define uset_containsRange uset_containsRange_3_2 #define uset_containsSome uset_containsSome_3_2 #define uset_containsString uset_containsString_3_2 #define uset_equals uset_equals_3_2 #define uset_getItem uset_getItem_3_2 #define uset_getItemCount uset_getItemCount_3_2 #define uset_getSerializedRange uset_getSerializedRange_3_2 #define uset_getSerializedRangeCount uset_getSerializedRangeCount_3_2 #define uset_getSerializedSet uset_getSerializedSet_3_2 #define uset_indexOf uset_indexOf_3_2 #define uset_isEmpty uset_isEmpty_3_2 #define uset_open uset_open_3_2 #define uset_openPattern uset_openPattern_3_2 #define uset_openPatternOptions uset_openPatternOptions_3_2 #define uset_remove uset_remove_3_2 #define uset_removeAll uset_removeAll_3_2 #define uset_removeRange uset_removeRange_3_2 #define uset_removeString uset_removeString_3_2 #define uset_resemblesPattern uset_resemblesPattern_3_2 #define uset_retain uset_retain_3_2 #define uset_retainAll uset_retainAll_3_2 #define uset_serialize uset_serialize_3_2 #define uset_serializedContains uset_serializedContains_3_2 #define uset_set uset_set_3_2 #define uset_setSerializedToOne uset_setSerializedToOne_3_2 #define uset_size uset_size_3_2 #define uset_toPattern uset_toPattern_3_2 #define usprep_close usprep_close_3_2 #define usprep_open usprep_open_3_2 #define usprep_prepare usprep_prepare_3_2 #define usprep_swap usprep_swap_3_2 #define ustr_foldCase ustr_foldCase_3_2 #define ustr_toLower ustr_toLower_3_2 #define ustr_toTitle ustr_toTitle_3_2 #define ustr_toUpper ustr_toUpper_3_2 #define utf8_appendCharSafeBody utf8_appendCharSafeBody_3_2 #define utf8_back1SafeBody utf8_back1SafeBody_3_2 #define utf8_countTrailBytes utf8_countTrailBytes_3_2 #define utf8_nextCharSafeBody utf8_nextCharSafeBody_3_2 #define utf8_prevCharSafeBody utf8_prevCharSafeBody_3_2 #define utmscale_fromInt64 utmscale_fromInt64_3_2 #define utmscale_getTimeScaleValue utmscale_getTimeScaleValue_3_2 #define utmscale_toInt64 utmscale_toInt64_3_2 #define utrace_cleanup utrace_cleanup_3_2 #define utrace_data utrace_data_3_2 #define utrace_entry utrace_entry_3_2 #define utrace_exit utrace_exit_3_2 #define utrace_format utrace_format_3_2 #define utrace_functionName utrace_functionName_3_2 #define utrace_getFunctions utrace_getFunctions_3_2 #define utrace_getLevel utrace_getLevel_3_2 #define utrace_level utrace_level_3_2 #define utrace_setFunctions utrace_setFunctions_3_2 #define utrace_setLevel utrace_setLevel_3_2 #define utrace_vformat utrace_vformat_3_2 #define utrans_clone utrans_clone_3_2 #define utrans_close utrans_close_3_2 #define utrans_countAvailableIDs utrans_countAvailableIDs_3_2 #define utrans_getAvailableID utrans_getAvailableID_3_2 #define utrans_getID utrans_getID_3_2 #define utrans_getUnicodeID utrans_getUnicodeID_3_2 #define utrans_open utrans_open_3_2 #define utrans_openIDs utrans_openIDs_3_2 #define utrans_openInverse utrans_openInverse_3_2 #define utrans_openU utrans_openU_3_2 #define utrans_register utrans_register_3_2 #define utrans_rep_caseContextIterator utrans_rep_caseContextIterator_3_2 #define utrans_setFilter utrans_setFilter_3_2 #define utrans_trans utrans_trans_3_2 #define utrans_transIncremental utrans_transIncremental_3_2 #define utrans_transIncrementalUChars utrans_transIncrementalUChars_3_2 #define utrans_transUChars utrans_transUChars_3_2 #define utrans_unregister utrans_unregister_3_2 #define utrans_unregisterID utrans_unregisterID_3_2 #define utrie_clone utrie_clone_3_2 #define utrie_close utrie_close_3_2 #define utrie_enum utrie_enum_3_2 #define utrie_get32 utrie_get32_3_2 #define utrie_getData utrie_getData_3_2 #define utrie_open utrie_open_3_2 #define utrie_serialize utrie_serialize_3_2 #define utrie_set32 utrie_set32_3_2 #define utrie_setRange32 utrie_setRange32_3_2 #define utrie_swap utrie_swap_3_2 #define utrie_unserialize utrie_unserialize_3_2 /* C++ class names renaming defines */ #ifdef XP_CPLUSPLUS #if !U_HAVE_NAMESPACE #define AbsoluteValueSubstitution AbsoluteValueSubstitution_3_2 #define AlternateSubstitutionSubtable AlternateSubstitutionSubtable_3_2 #define AnchorTable AnchorTable_3_2 #define AnyTransliterator AnyTransliterator_3_2 #define ArabicOpenTypeLayoutEngine ArabicOpenTypeLayoutEngine_3_2 #define ArabicShaping ArabicShaping_3_2 #define BasicCalendarFactory BasicCalendarFactory_3_2 #define BinarySearchLookupTable BinarySearchLookupTable_3_2 #define BreakDictionary BreakDictionary_3_2 #define BreakIterator BreakIterator_3_2 #define BuddhistCalendar BuddhistCalendar_3_2 #define CFactory CFactory_3_2 #define Calendar Calendar_3_2 #define CalendarAstronomer CalendarAstronomer_3_2 #define CalendarCache CalendarCache_3_2 #define CalendarData CalendarData_3_2 #define CalendarService CalendarService_3_2 #define CanonShaping CanonShaping_3_2 #define CanonicalIterator CanonicalIterator_3_2 #define CaseMapTransliterator CaseMapTransliterator_3_2 #define ChainingContextualSubstitutionFormat1Subtable ChainingContextualSubstitutionFormat1Subtable_3_2 #define ChainingContextualSubstitutionFormat2Subtable ChainingContextualSubstitutionFormat2Subtable_3_2 #define ChainingContextualSubstitutionFormat3Subtable ChainingContextualSubstitutionFormat3Subtable_3_2 #define ChainingContextualSubstitutionSubtable ChainingContextualSubstitutionSubtable_3_2 #define CharSubstitutionFilter CharSubstitutionFilter_3_2 #define CharacterIterator CharacterIterator_3_2 #define ChoiceFormat ChoiceFormat_3_2 #define ClassDefFormat1Table ClassDefFormat1Table_3_2 #define ClassDefFormat2Table ClassDefFormat2Table_3_2 #define ClassDefinitionTable ClassDefinitionTable_3_2 #define CollationElementIterator CollationElementIterator_3_2 #define CollationKey CollationKey_3_2 #define Collator Collator_3_2 #define CollatorFactory CollatorFactory_3_2 #define CompoundTransliterator CompoundTransliterator_3_2 #define ContextualGlyphSubstitutionProcessor ContextualGlyphSubstitutionProcessor_3_2 #define ContextualSubstitutionBase ContextualSubstitutionBase_3_2 #define ContextualSubstitutionFormat1Subtable ContextualSubstitutionFormat1Subtable_3_2 #define ContextualSubstitutionFormat2Subtable ContextualSubstitutionFormat2Subtable_3_2 #define ContextualSubstitutionFormat3Subtable ContextualSubstitutionFormat3Subtable_3_2 #define ContextualSubstitutionSubtable ContextualSubstitutionSubtable_3_2 #define CoverageFormat1Table CoverageFormat1Table_3_2 #define CoverageFormat2Table CoverageFormat2Table_3_2 #define CoverageTable CoverageTable_3_2 #define CurrencyAmount CurrencyAmount_3_2 #define CurrencyFormat CurrencyFormat_3_2 #define CurrencyUnit CurrencyUnit_3_2 #define CursiveAttachmentSubtable CursiveAttachmentSubtable_3_2 #define DateFormat DateFormat_3_2 #define DateFormatSymbols DateFormatSymbols_3_2 #define DecimalFormat DecimalFormat_3_2 #define DecimalFormatSymbols DecimalFormatSymbols_3_2 #define DefaultCalendarFactory DefaultCalendarFactory_3_2 #define DefaultCharMapper DefaultCharMapper_3_2 #define DeviceTable DeviceTable_3_2 #define DictionaryBasedBreakIterator DictionaryBasedBreakIterator_3_2 #define DictionaryBasedBreakIteratorTables DictionaryBasedBreakIteratorTables_3_2 #define DigitList DigitList_3_2 #define Entry Entry_3_2 #define EnumToOffset EnumToOffset_3_2 #define EscapeTransliterator EscapeTransliterator_3_2 #define EventListener EventListener_3_2 #define ExtensionSubtable ExtensionSubtable_3_2 #define FeatureListTable FeatureListTable_3_2 #define FieldPosition FieldPosition_3_2 #define FontRuns FontRuns_3_2 #define Format Format_3_2 #define Format1AnchorTable Format1AnchorTable_3_2 #define Format2AnchorTable Format2AnchorTable_3_2 #define Format3AnchorTable Format3AnchorTable_3_2 #define Formattable Formattable_3_2 #define ForwardCharacterIterator ForwardCharacterIterator_3_2 #define FractionalPartSubstitution FractionalPartSubstitution_3_2 #define FunctionReplacer FunctionReplacer_3_2 #define GDEFMarkFilter GDEFMarkFilter_3_2 #define GXLayoutEngine GXLayoutEngine_3_2 #define GlyphDefinitionTableHeader GlyphDefinitionTableHeader_3_2 #define GlyphIterator GlyphIterator_3_2 #define GlyphLookupTableHeader GlyphLookupTableHeader_3_2 #define GlyphPositioningLookupProcessor GlyphPositioningLookupProcessor_3_2 #define GlyphPositioningTableHeader GlyphPositioningTableHeader_3_2 #define GlyphSubstitutionLookupProcessor GlyphSubstitutionLookupProcessor_3_2 #define GlyphSubstitutionTableHeader GlyphSubstitutionTableHeader_3_2 #define Grego Grego_3_2 #define GregorianCalendar GregorianCalendar_3_2 #define HanOpenTypeLayoutEngine HanOpenTypeLayoutEngine_3_2 #define HebrewCalendar HebrewCalendar_3_2 #define ICUBreakIteratorFactory ICUBreakIteratorFactory_3_2 #define ICUBreakIteratorService ICUBreakIteratorService_3_2 #define ICUCollatorFactory ICUCollatorFactory_3_2 #define ICUCollatorService ICUCollatorService_3_2 #define ICULayoutEngine ICULayoutEngine_3_2 #define ICULocaleService ICULocaleService_3_2 #define ICUNotifier ICUNotifier_3_2 #define ICUNumberFormatFactory ICUNumberFormatFactory_3_2 #define ICUNumberFormatService ICUNumberFormatService_3_2 #define ICUResourceBundleFactory ICUResourceBundleFactory_3_2 #define ICUService ICUService_3_2 #define ICUServiceFactory ICUServiceFactory_3_2 #define ICUServiceKey ICUServiceKey_3_2 #define ICU_Utility ICU_Utility_3_2 #define IndicClassTable IndicClassTable_3_2 #define IndicOpenTypeLayoutEngine IndicOpenTypeLayoutEngine_3_2 #define IndicRearrangementProcessor IndicRearrangementProcessor_3_2 #define IndicReordering IndicReordering_3_2 #define IntegralPartSubstitution IntegralPartSubstitution_3_2 #define IslamicCalendar IslamicCalendar_3_2 #define JapaneseCalendar JapaneseCalendar_3_2 #define KeywordEnumeration KeywordEnumeration_3_2 #define LECharMapper LECharMapper_3_2 #define LEFontInstance LEFontInstance_3_2 #define LEGlyphFilter LEGlyphFilter_3_2 #define LEGlyphStorage LEGlyphStorage_3_2 #define LEInsertionCallback LEInsertionCallback_3_2 #define LEInsertionList LEInsertionList_3_2 #define LXUtilities LXUtilities_3_2 #define LayoutEngine LayoutEngine_3_2 #define LigatureSubstitutionProcessor LigatureSubstitutionProcessor_3_2 #define LigatureSubstitutionSubtable LigatureSubstitutionSubtable_3_2 #define LocDataParser LocDataParser_3_2 #define Locale Locale_3_2 #define LocaleBased LocaleBased_3_2 #define LocaleKey LocaleKey_3_2 #define LocaleKeyFactory LocaleKeyFactory_3_2 #define LocaleRuns LocaleRuns_3_2 #define LocaleUtility LocaleUtility_3_2 #define LocalizationInfo LocalizationInfo_3_2 #define LookupListTable LookupListTable_3_2 #define LookupProcessor LookupProcessor_3_2 #define LookupSubtable LookupSubtable_3_2 #define LookupTable LookupTable_3_2 #define LowercaseTransliterator LowercaseTransliterator_3_2 #define MPreFixups MPreFixups_3_2 #define MarkArray MarkArray_3_2 #define MarkToBasePositioningSubtable MarkToBasePositioningSubtable_3_2 #define MarkToLigaturePositioningSubtable MarkToLigaturePositioningSubtable_3_2 #define MarkToMarkPositioningSubtable MarkToMarkPositioningSubtable_3_2 #define Math Math_3_2 #define Measure Measure_3_2 #define MeasureFormat MeasureFormat_3_2 #define MeasureUnit MeasureUnit_3_2 #define MessageFormat MessageFormat_3_2 #define MessageFormatAdapter MessageFormatAdapter_3_2 #define ModulusSubstitution ModulusSubstitution_3_2 #define MoonRiseSetCoordFunc MoonRiseSetCoordFunc_3_2 #define MoonTimeAngleFunc MoonTimeAngleFunc_3_2 #define MorphSubtableHeader MorphSubtableHeader_3_2 #define MorphTableHeader MorphTableHeader_3_2 #define MultipleSubstitutionSubtable MultipleSubstitutionSubtable_3_2 #define MultiplierSubstitution MultiplierSubstitution_3_2 #define NFFactory NFFactory_3_2 #define NFRule NFRule_3_2 #define NFRuleSet NFRuleSet_3_2 #define NFSubstitution NFSubstitution_3_2 #define NameToEnum NameToEnum_3_2 #define NameUnicodeTransliterator NameUnicodeTransliterator_3_2 #define NonContextualGlyphSubstitutionProcessor NonContextualGlyphSubstitutionProcessor_3_2 #define NonContiguousEnumToOffset NonContiguousEnumToOffset_3_2 #define NormalizationTransliterator NormalizationTransliterator_3_2 #define Normalizer Normalizer_3_2 #define NullSubstitution NullSubstitution_3_2 #define NullTransliterator NullTransliterator_3_2 #define NumberFormat NumberFormat_3_2 #define NumberFormatFactory NumberFormatFactory_3_2 #define NumeratorSubstitution NumeratorSubstitution_3_2 #define OlsonTimeZone OlsonTimeZone_3_2 #define OpenTypeLayoutEngine OpenTypeLayoutEngine_3_2 #define OpenTypeUtilities OpenTypeUtilities_3_2 #define PairPositioningFormat1Subtable PairPositioningFormat1Subtable_3_2 #define PairPositioningFormat2Subtable PairPositioningFormat2Subtable_3_2 #define PairPositioningSubtable PairPositioningSubtable_3_2 #define ParagraphLayout ParagraphLayout_3_2 #define ParseData ParseData_3_2 #define ParsePosition ParsePosition_3_2 #define PropertyAliases PropertyAliases_3_2 #define Quantifier Quantifier_3_2 #define RBBIDataWrapper RBBIDataWrapper_3_2 #define RBBINode RBBINode_3_2 #define RBBIRuleBuilder RBBIRuleBuilder_3_2 #define RBBIRuleScanner RBBIRuleScanner_3_2 #define RBBISetBuilder RBBISetBuilder_3_2 #define RBBIStateDescriptor RBBIStateDescriptor_3_2 #define RBBISymbolTable RBBISymbolTable_3_2 #define RBBISymbolTableEntry RBBISymbolTableEntry_3_2 #define RBBITableBuilder RBBITableBuilder_3_2 #define RangeDescriptor RangeDescriptor_3_2 #define RegexCompile RegexCompile_3_2 #define RegexMatcher RegexMatcher_3_2 #define RegexPattern RegexPattern_3_2 #define RegexStaticSets RegexStaticSets_3_2 #define RemoveTransliterator RemoveTransliterator_3_2 #define Replaceable Replaceable_3_2 #define ReplaceableGlue ReplaceableGlue_3_2 #define ResourceBundle ResourceBundle_3_2 #define RiseSetCoordFunc RiseSetCoordFunc_3_2 #define RuleBasedBreakIterator RuleBasedBreakIterator_3_2 #define RuleBasedCollator RuleBasedCollator_3_2 #define RuleBasedNumberFormat RuleBasedNumberFormat_3_2 #define RuleBasedTransliterator RuleBasedTransliterator_3_2 #define RuleCharacterIterator RuleCharacterIterator_3_2 #define RuleHalf RuleHalf_3_2 #define RunArray RunArray_3_2 #define SameValueSubstitution SameValueSubstitution_3_2 #define ScriptListTable ScriptListTable_3_2 #define ScriptRunIterator ScriptRunIterator_3_2 #define ScriptTable ScriptTable_3_2 #define SearchIterator SearchIterator_3_2 #define SegmentArrayProcessor SegmentArrayProcessor_3_2 #define SegmentSingleProcessor SegmentSingleProcessor_3_2 #define ServiceEnumeration ServiceEnumeration_3_2 #define ServiceListener ServiceListener_3_2 #define SimpleArrayProcessor SimpleArrayProcessor_3_2 #define SimpleDateFormat SimpleDateFormat_3_2 #define SimpleFactory SimpleFactory_3_2 #define SimpleLocaleKeyFactory SimpleLocaleKeyFactory_3_2 #define SimpleNumberFormatFactory SimpleNumberFormatFactory_3_2 #define SimpleTimeZone SimpleTimeZone_3_2 #define SinglePositioningFormat1Subtable SinglePositioningFormat1Subtable_3_2 #define SinglePositioningFormat2Subtable SinglePositioningFormat2Subtable_3_2 #define SinglePositioningSubtable SinglePositioningSubtable_3_2 #define SingleSubstitutionFormat1Subtable SingleSubstitutionFormat1Subtable_3_2 #define SingleSubstitutionFormat2Subtable SingleSubstitutionFormat2Subtable_3_2 #define SingleSubstitutionSubtable SingleSubstitutionSubtable_3_2 #define SingleTableProcessor SingleTableProcessor_3_2 #define Spec Spec_3_2 #define StateTableProcessor StateTableProcessor_3_2 #define StringCharacterIterator StringCharacterIterator_3_2 #define StringEnumeration StringEnumeration_3_2 #define StringLocalizationInfo StringLocalizationInfo_3_2 #define StringMatcher StringMatcher_3_2 #define StringPair StringPair_3_2 #define StringReplacer StringReplacer_3_2 #define StringSearch StringSearch_3_2 #define StyleRuns StyleRuns_3_2 #define SubstitutionLookup SubstitutionLookup_3_2 #define SubtableProcessor SubtableProcessor_3_2 #define SunTimeAngleFunc SunTimeAngleFunc_3_2 #define SymbolTable SymbolTable_3_2 #define TZEnumeration TZEnumeration_3_2 #define ThaiLayoutEngine ThaiLayoutEngine_3_2 #define ThaiShaping ThaiShaping_3_2 #define TimeZone TimeZone_3_2 #define TitlecaseTransliterator TitlecaseTransliterator_3_2 #define TransliterationRule TransliterationRule_3_2 #define TransliterationRuleData TransliterationRuleData_3_2 #define TransliterationRuleSet TransliterationRuleSet_3_2 #define Transliterator Transliterator_3_2 #define TransliteratorAlias TransliteratorAlias_3_2 #define TransliteratorIDParser TransliteratorIDParser_3_2 #define TransliteratorParser TransliteratorParser_3_2 #define TransliteratorRegistry TransliteratorRegistry_3_2 #define TrimmedArrayProcessor TrimmedArrayProcessor_3_2 #define UCharCharacterIterator UCharCharacterIterator_3_2 #define UMemory UMemory_3_2 #define UObject UObject_3_2 #define URegularExpression URegularExpression_3_2 #define UStack UStack_3_2 #define UStringEnumeration UStringEnumeration_3_2 #define UVector UVector_3_2 #define UVector32 UVector32_3_2 #define UnescapeTransliterator UnescapeTransliterator_3_2 #define UnicodeArabicOpenTypeLayoutEngine UnicodeArabicOpenTypeLayoutEngine_3_2 #define UnicodeFilter UnicodeFilter_3_2 #define UnicodeFunctor UnicodeFunctor_3_2 #define UnicodeMatcher UnicodeMatcher_3_2 #define UnicodeNameTransliterator UnicodeNameTransliterator_3_2 #define UnicodeReplacer UnicodeReplacer_3_2 #define UnicodeSet UnicodeSet_3_2 #define UnicodeSetIterator UnicodeSetIterator_3_2 #define UnicodeString UnicodeString_3_2 #define UppercaseTransliterator UppercaseTransliterator_3_2 #define ValueRecord ValueRecord_3_2 #define ValueRuns ValueRuns_3_2 #define locale_set_default_internal locale_set_default_internal_3_2 #define uprv_parseCurrency uprv_parseCurrency_3_2 #define util64_fromDouble util64_fromDouble_3_2 #define util64_pow util64_pow_3_2 #define util64_tou util64_tou_3_2 #define util64_utoi util64_utoi_3_2 #endif #endif #endif #endif
68,572
C++
.h
1,461
45.926078
103
0.849481
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
33,938
ustring.h
supercollider_supercollider/external_libraries/icu/unicode/ustring.h
/* ********************************************************************** * Copyright (C) 1998-2004, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * * File ustring.h * * Modification History: * * Date Name Description * 12/07/98 bertrand Creation. ****************************************************************************** */ #ifndef USTRING_H #define USTRING_H #include "utypes.h" #include "putil.h" #include "uiter.h" /** Simple declaration for u_strToTitle() to avoid including unicode/ubrk.h. @stable ICU 2.1*/ #ifndef UBRK_TYPEDEF_UBREAK_ITERATOR # define UBRK_TYPEDEF_UBREAK_ITERATOR typedef void UBreakIterator; #endif /** * \file * \brief C API: Unicode string handling functions * * These C API functions provide general Unicode string handling. * * Some functions are equivalent in name, signature, and behavior to the ANSI C <string.h> * functions. (For example, they do not check for bad arguments like NULL string pointers.) * In some cases, only the thread-safe variant of such a function is implemented here * (see u_strtok_r()). * * Other functions provide more Unicode-specific functionality like locale-specific * upper/lower-casing and string comparison in code point order. * * ICU uses 16-bit Unicode (UTF-16) in the form of arrays of UChar code units. * UTF-16 encodes each Unicode code point with either one or two UChar code units. * (This is the default form of Unicode, and a forward-compatible extension of the original, * fixed-width form that was known as UCS-2. UTF-16 superseded UCS-2 with Unicode 2.0 * in 1996.) * * Some APIs accept a 32-bit UChar32 value for a single code point. * * ICU also handles 16-bit Unicode text with unpaired surrogates. * Such text is not well-formed UTF-16. * Code-point-related functions treat unpaired surrogates as surrogate code points, * i.e., as separate units. * * Although UTF-16 is a variable-width encoding form (like some legacy multi-byte encodings), * it is much more efficient even for random access because the code unit values * for single-unit characters vs. lead units vs. trail units are completely disjoint. * This means that it is easy to determine character (code point) boundaries from * random offsets in the string. * * Unicode (UTF-16) string processing is optimized for the single-unit case. * Although it is important to support supplementary characters * (which use pairs of lead/trail code units called "surrogates"), * their occurrence is rare. Almost all characters in modern use require only * a single UChar code unit (i.e., their code point values are <=0xffff). * * For more details see the User Guide Strings chapter (http://oss.software.ibm.com/icu/userguide/strings.html). * For a discussion of the handling of unpaired surrogates see also * Jitterbug 2145 and its icu mailing list proposal on 2002-sep-18. */ /** * Determine the length of an array of UChar. * * @param s The array of UChars, NULL (U+0000) terminated. * @return The number of UChars in <code>chars</code>, minus the terminator. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strlen(const UChar *s); /** * Count Unicode code points in the length UChar code units of the string. * A code point may occupy either one or two UChar code units. * Counting code points involves reading all code units. * * This functions is basically the inverse of the U16_FWD_N() macro (see utf.h). * * @param s The input string. * @param length The number of UChar code units to be checked, or -1 to count all * code points before the first NUL (U+0000). * @return The number of code points in the specified code units. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_countChar32(const UChar *s, int32_t length); /** * Check if the string contains more Unicode code points than a certain number. * This is more efficient than counting all code points in the entire string * and comparing that number with a threshold. * This function may not need to scan the string at all if the length is known * (not -1 for NUL-termination) and falls within a certain range, and * never needs to count more than 'number+1' code points. * Logically equivalent to (u_countChar32(s, length)>number). * A Unicode code point may occupy either one or two UChar code units. * * @param s The input string. * @param length The length of the string, or -1 if it is NUL-terminated. * @param number The number of code points in the string is compared against * the 'number' parameter. * @return Boolean value for whether the string contains more Unicode code points * than 'number'. Same as (u_countChar32(s, length)>number). * @stable ICU 2.4 */ U_STABLE UBool U_EXPORT2 u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number); /** * Concatenate two ustrings. Appends a copy of <code>src</code>, * including the null terminator, to <code>dst</code>. The initial copied * character from <code>src</code> overwrites the null terminator in <code>dst</code>. * * @param dst The destination string. * @param src The source string. * @return A pointer to <code>dst</code>. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_strcat(UChar *dst, const UChar *src); /** * Concatenate two ustrings. * Appends at most <code>n</code> characters from <code>src</code> to <code>dst</code>. * Adds a terminating NUL. * If src is too long, then only <code>n-1</code> characters will be copied * before the terminating NUL. * If <code>n&lt;=0</code> then dst is not modified. * * @param dst The destination string. * @param src The source string. * @param n The maximum number of characters to compare. * @return A pointer to <code>dst</code>. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_strncat(UChar *dst, const UChar *src, int32_t n); /** * Find the first occurrence of a substring in a string. * The substring is found at code point boundaries. * That means that if the substring begins with * a trail surrogate or ends with a lead surrogate, * then it is found only if these surrogates stand alone in the text. * Otherwise, the substring edge units would be matched against * halves of surrogate pairs. * * @param s The string to search (NUL-terminated). * @param substring The substring to find (NUL-terminated). * @return A pointer to the first occurrence of <code>substring</code> in <code>s</code>, * or <code>s</code> itself if the <code>substring</code> is empty, * or <code>NULL</code> if <code>substring</code> is not in <code>s</code>. * @stable ICU 2.0 * * @see u_strrstr * @see u_strFindFirst * @see u_strFindLast */ U_STABLE UChar * U_EXPORT2 u_strstr(const UChar *s, const UChar *substring); /** * Find the first occurrence of a substring in a string. * The substring is found at code point boundaries. * That means that if the substring begins with * a trail surrogate or ends with a lead surrogate, * then it is found only if these surrogates stand alone in the text. * Otherwise, the substring edge units would be matched against * halves of surrogate pairs. * * @param s The string to search. * @param length The length of s (number of UChars), or -1 if it is NUL-terminated. * @param substring The substring to find (NUL-terminated). * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated. * @return A pointer to the first occurrence of <code>substring</code> in <code>s</code>, * or <code>s</code> itself if the <code>substring</code> is empty, * or <code>NULL</code> if <code>substring</code> is not in <code>s</code>. * @stable ICU 2.4 * * @see u_strstr * @see u_strFindLast */ U_STABLE UChar * U_EXPORT2 u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); /** * Find the first occurrence of a BMP code point in a string. * A surrogate code point is found only if its match in the text is not * part of a surrogate pair. * A NUL character is found at the string terminator. * * @param s The string to search (NUL-terminated). * @param c The BMP code point to find. * @return A pointer to the first occurrence of <code>c</code> in <code>s</code> * or <code>NULL</code> if <code>c</code> is not in <code>s</code>. * @stable ICU 2.0 * * @see u_strchr32 * @see u_memchr * @see u_strstr * @see u_strFindFirst */ U_STABLE UChar * U_EXPORT2 u_strchr(const UChar *s, UChar c); /** * Find the first occurrence of a code point in a string. * A surrogate code point is found only if its match in the text is not * part of a surrogate pair. * A NUL character is found at the string terminator. * * @param s The string to search (NUL-terminated). * @param c The code point to find. * @return A pointer to the first occurrence of <code>c</code> in <code>s</code> * or <code>NULL</code> if <code>c</code> is not in <code>s</code>. * @stable ICU 2.0 * * @see u_strchr * @see u_memchr32 * @see u_strstr * @see u_strFindFirst */ U_STABLE UChar * U_EXPORT2 u_strchr32(const UChar *s, UChar32 c); /** * Find the last occurrence of a substring in a string. * The substring is found at code point boundaries. * That means that if the substring begins with * a trail surrogate or ends with a lead surrogate, * then it is found only if these surrogates stand alone in the text. * Otherwise, the substring edge units would be matched against * halves of surrogate pairs. * * @param s The string to search (NUL-terminated). * @param substring The substring to find (NUL-terminated). * @return A pointer to the last occurrence of <code>substring</code> in <code>s</code>, * or <code>s</code> itself if the <code>substring</code> is empty, * or <code>NULL</code> if <code>substring</code> is not in <code>s</code>. * @stable ICU 2.4 * * @see u_strstr * @see u_strFindFirst * @see u_strFindLast */ U_STABLE UChar * U_EXPORT2 u_strrstr(const UChar *s, const UChar *substring); /** * Find the last occurrence of a substring in a string. * The substring is found at code point boundaries. * That means that if the substring begins with * a trail surrogate or ends with a lead surrogate, * then it is found only if these surrogates stand alone in the text. * Otherwise, the substring edge units would be matched against * halves of surrogate pairs. * * @param s The string to search. * @param length The length of s (number of UChars), or -1 if it is NUL-terminated. * @param substring The substring to find (NUL-terminated). * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated. * @return A pointer to the last occurrence of <code>substring</code> in <code>s</code>, * or <code>s</code> itself if the <code>substring</code> is empty, * or <code>NULL</code> if <code>substring</code> is not in <code>s</code>. * @stable ICU 2.4 * * @see u_strstr * @see u_strFindLast */ U_STABLE UChar * U_EXPORT2 u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); /** * Find the last occurrence of a BMP code point in a string. * A surrogate code point is found only if its match in the text is not * part of a surrogate pair. * A NUL character is found at the string terminator. * * @param s The string to search (NUL-terminated). * @param c The BMP code point to find. * @return A pointer to the last occurrence of <code>c</code> in <code>s</code> * or <code>NULL</code> if <code>c</code> is not in <code>s</code>. * @stable ICU 2.4 * * @see u_strrchr32 * @see u_memrchr * @see u_strrstr * @see u_strFindLast */ U_STABLE UChar * U_EXPORT2 u_strrchr(const UChar *s, UChar c); /** * Find the last occurrence of a code point in a string. * A surrogate code point is found only if its match in the text is not * part of a surrogate pair. * A NUL character is found at the string terminator. * * @param s The string to search (NUL-terminated). * @param c The code point to find. * @return A pointer to the last occurrence of <code>c</code> in <code>s</code> * or <code>NULL</code> if <code>c</code> is not in <code>s</code>. * @stable ICU 2.4 * * @see u_strrchr * @see u_memchr32 * @see u_strrstr * @see u_strFindLast */ U_STABLE UChar * U_EXPORT2 u_strrchr32(const UChar *s, UChar32 c); /** * Locates the first occurrence in the string <code>string</code> of any of the characters * in the string <code>matchSet</code>. * Works just like C's strpbrk but with Unicode. * * @param string The string in which to search, NUL-terminated. * @param matchSet A NUL-terminated string defining a set of code points * for which to search in the text string. * @return A pointer to the character in <code>string</code> that matches one of the * characters in <code>matchSet</code>, or NULL if no such character is found. * @stable ICU 2.0 */ U_STABLE UChar * U_EXPORT2 u_strpbrk(const UChar *string, const UChar *matchSet); /** * Returns the number of consecutive characters in <code>string</code>, * beginning with the first, that do not occur somewhere in <code>matchSet</code>. * Works just like C's strcspn but with Unicode. * * @param string The string in which to search, NUL-terminated. * @param matchSet A NUL-terminated string defining a set of code points * for which to search in the text string. * @return The number of initial characters in <code>string</code> that do not * occur in <code>matchSet</code>. * @see u_strspn * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strcspn(const UChar *string, const UChar *matchSet); /** * Returns the number of consecutive characters in <code>string</code>, * beginning with the first, that occur somewhere in <code>matchSet</code>. * Works just like C's strspn but with Unicode. * * @param string The string in which to search, NUL-terminated. * @param matchSet A NUL-terminated string defining a set of code points * for which to search in the text string. * @return The number of initial characters in <code>string</code> that do * occur in <code>matchSet</code>. * @see u_strcspn * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strspn(const UChar *string, const UChar *matchSet); /** * The string tokenizer API allows an application to break a string into * tokens. Unlike strtok(), the saveState (the current pointer within the * original string) is maintained in saveState. In the first call, the * argument src is a pointer to the string. In subsequent calls to * return successive tokens of that string, src must be specified as * NULL. The value saveState is set by this function to maintain the * function's position within the string, and on each subsequent call * you must give this argument the same variable. This function does * handle surrogate pairs. This function is similar to the strtok_r() * the POSIX Threads Extension (1003.1c-1995) version. * * @param src String containing token(s). This string will be modified. * After the first call to u_strtok_r(), this argument must * be NULL to get to the next token. * @param delim Set of delimiter characters (Unicode code points). * @param saveState The current pointer within the original string, * which is set by this function. The saveState * parameter should the address of a local variable of type * UChar *. (i.e. defined "Uhar *myLocalSaveState" and use * &myLocalSaveState for this parameter). * @return A pointer to the next token found in src, or NULL * when there are no more tokens. * @stable ICU 2.0 */ U_STABLE UChar * U_EXPORT2 u_strtok_r(UChar *src, const UChar *delim, UChar **saveState); /** * Compare two Unicode strings for bitwise equality (code unit order). * * @param s1 A string to compare. * @param s2 A string to compare. * @return 0 if <code>s1</code> and <code>s2</code> are bitwise equal; a negative * value if <code>s1</code> is bitwise less than <code>s2,</code>; a positive * value if <code>s1</code> is bitwise greater than <code>s2</code>. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strcmp(const UChar *s1, const UChar *s2); /** * Compare two Unicode strings in code point order. * See u_strCompare for details. * * @param s1 A string to compare. * @param s2 A string to compare. * @return a negative/zero/positive integer corresponding to whether * the first string is less than/equal to/greater than the second one * in code point order * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strcmpCodePointOrder(const UChar *s1, const UChar *s2); /** * Compare two Unicode strings (binary order). * * The comparison can be done in code unit order or in code point order. * They differ only in UTF-16 when * comparing supplementary code points (U+10000..U+10ffff) * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). * In code unit order, high BMP code points sort after supplementary code points * because they are stored as pairs of surrogates which are at U+d800..U+dfff. * * This functions works with strings of different explicitly specified lengths * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. * NUL-terminated strings are possible with length arguments of -1. * * @param s1 First source string. * @param length1 Length of first source string, or -1 if NUL-terminated. * * @param s2 Second source string. * @param length2 Length of second source string, or -1 if NUL-terminated. * * @param codePointOrder Choose between code unit order (FALSE) * and code point order (TRUE). * * @return <0 or 0 or >0 as usual for string comparisons * * @stable ICU 2.2 */ U_STABLE int32_t U_EXPORT2 u_strCompare(const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, UBool codePointOrder); /** * Compare two Unicode strings (binary order) * as presented by UCharIterator objects. * Works otherwise just like u_strCompare(). * * Both iterators are reset to their start positions. * When the function returns, it is undefined where the iterators * have stopped. * * @param iter1 First source string iterator. * @param iter2 Second source string iterator. * @param codePointOrder Choose between code unit order (FALSE) * and code point order (TRUE). * * @return <0 or 0 or >0 as usual for string comparisons * * @see u_strCompare * * @stable ICU 2.6 */ U_STABLE int32_t U_EXPORT2 u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder); #ifndef U_COMPARE_CODE_POINT_ORDER /* see also unistr.h and unorm.h */ /** * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc: * Compare strings in code point order instead of code unit order. * @stable ICU 2.2 */ #define U_COMPARE_CODE_POINT_ORDER 0x8000 #endif /** * Compare two strings case-insensitively using full case folding. * This is equivalent to * u_strCompare(u_strFoldCase(s1, options), * u_strFoldCase(s2, options), * (options&U_COMPARE_CODE_POINT_ORDER)!=0). * * The comparison can be done in UTF-16 code unit order or in code point order. * They differ only when comparing supplementary code points (U+10000..U+10ffff) * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). * In code unit order, high BMP code points sort after supplementary code points * because they are stored as pairs of surrogates which are at U+d800..U+dfff. * * This functions works with strings of different explicitly specified lengths * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. * NUL-terminated strings are possible with length arguments of -1. * * @param s1 First source string. * @param length1 Length of first source string, or -1 if NUL-terminated. * * @param s2 Second source string. * @param length2 Length of second source string, or -1 if NUL-terminated. * * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code unit order with default case folding. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * * @return <0 or 0 or >0 as usual for string comparisons * * @stable ICU 2.2 */ U_STABLE int32_t U_EXPORT2 u_strCaseCompare(const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, uint32_t options, UErrorCode *pErrorCode); /** * Compare two ustrings for bitwise equality. * Compares at most <code>n</code> characters. * * @param ucs1 A string to compare. * @param ucs2 A string to compare. * @param n The maximum number of characters to compare. * @return 0 if <code>s1</code> and <code>s2</code> are bitwise equal; a negative * value if <code>s1</code> is bitwise less than <code>s2</code>; a positive * value if <code>s1</code> is bitwise greater than <code>s2</code>. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strncmp(const UChar *ucs1, const UChar *ucs2, int32_t n); /** * Compare two Unicode strings in code point order. * This is different in UTF-16 from u_strncmp() if supplementary characters are present. * For details, see u_strCompare(). * * @param s1 A string to compare. * @param s2 A string to compare. * @param n The maximum number of characters to compare. * @return a negative/zero/positive integer corresponding to whether * the first string is less than/equal to/greater than the second one * in code point order * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n); /** * Compare two strings case-insensitively using full case folding. * This is equivalent to u_strcmp(u_strFoldCase(s1, options), u_strFoldCase(s2, options)). * * @param s1 A string to compare. * @param s2 A string to compare. * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code unit order with default case folding. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options); /** * Compare two strings case-insensitively using full case folding. * This is equivalent to u_strcmp(u_strFoldCase(s1, at most n, options), * u_strFoldCase(s2, at most n, options)). * * @param s1 A string to compare. * @param s2 A string to compare. * @param n The maximum number of characters each string to case-fold and then compare. * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code unit order with default case folding. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options); /** * Compare two strings case-insensitively using full case folding. * This is equivalent to u_strcmp(u_strFoldCase(s1, n, options), * u_strFoldCase(s2, n, options)). * * @param s1 A string to compare. * @param s2 A string to compare. * @param length The number of characters in each string to case-fold and then compare. * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code unit order with default case folding. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options); /** * Copy a ustring. Adds a null terminator. * * @param dst The destination string. * @param src The source string. * @return A pointer to <code>dst</code>. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_strcpy(UChar *dst, const UChar *src); /** * Copy a ustring. * Copies at most <code>n</code> characters. The result will be null terminated * if the length of <code>src</code> is less than <code>n</code>. * * @param dst The destination string. * @param src The source string. * @param n The maximum number of characters to copy. * @return A pointer to <code>dst</code>. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_strncpy(UChar *dst, const UChar *src, int32_t n); #if !UCONFIG_NO_CONVERSION /** * Copy a byte string encoded in the default codepage to a ustring. * Adds a null terminator. * Performs a host byte to UChar conversion * * @param dst The destination string. * @param src The source string. * @return A pointer to <code>dst</code>. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst, const char *src ); /** * Copy a byte string encoded in the default codepage to a ustring. * Copies at most <code>n</code> characters. The result will be null terminated * if the length of <code>src</code> is less than <code>n</code>. * Performs a host byte to UChar conversion * * @param dst The destination string. * @param src The source string. * @param n The maximum number of characters to copy. * @return A pointer to <code>dst</code>. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst, const char *src, int32_t n); /** * Copy ustring to a byte string encoded in the default codepage. * Adds a null terminator. * Performs a UChar to host byte conversion * * @param dst The destination string. * @param src The source string. * @return A pointer to <code>dst</code>. * @stable ICU 2.0 */ U_STABLE char* U_EXPORT2 u_austrcpy(char *dst, const UChar *src ); /** * Copy ustring to a byte string encoded in the default codepage. * Copies at most <code>n</code> characters. The result will be null terminated * if the length of <code>src</code> is less than <code>n</code>. * Performs a UChar to host byte conversion * * @param dst The destination string. * @param src The source string. * @param n The maximum number of characters to copy. * @return A pointer to <code>dst</code>. * @stable ICU 2.0 */ U_STABLE char* U_EXPORT2 u_austrncpy(char *dst, const UChar *src, int32_t n ); #endif /** * Synonym for memcpy(), but with UChars only. * @param dest The destination string * @param src The source string * @param count The number of characters to copy * @return A pointer to <code>dest</code> * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_memcpy(UChar *dest, const UChar *src, int32_t count); /** * Synonym for memmove(), but with UChars only. * @param dest The destination string * @param src The source string * @param count The number of characters to move * @return A pointer to <code>dest</code> * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_memmove(UChar *dest, const UChar *src, int32_t count); /** * Initialize <code>count</code> characters of <code>dest</code> to <code>c</code>. * * @param dest The destination string. * @param c The character to initialize the string. * @param count The maximum number of characters to set. * @return A pointer to <code>dest</code>. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_memset(UChar *dest, UChar c, int32_t count); /** * Compare the first <code>count</code> UChars of each buffer. * * @param buf1 The first string to compare. * @param buf2 The second string to compare. * @param count The maximum number of UChars to compare. * @return When buf1 < buf2, a negative number is returned. * When buf1 == buf2, 0 is returned. * When buf1 > buf2, a positive number is returned. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count); /** * Compare two Unicode strings in code point order. * This is different in UTF-16 from u_memcmp() if supplementary characters are present. * For details, see u_strCompare(). * * @param s1 A string to compare. * @param s2 A string to compare. * @param count The maximum number of characters to compare. * @return a negative/zero/positive integer corresponding to whether * the first string is less than/equal to/greater than the second one * in code point order * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count); /** * Find the first occurrence of a BMP code point in a string. * A surrogate code point is found only if its match in the text is not * part of a surrogate pair. * A NUL character is found at the string terminator. * * @param s The string to search (contains <code>count</code> UChars). * @param c The BMP code point to find. * @param count The length of the string. * @return A pointer to the first occurrence of <code>c</code> in <code>s</code> * or <code>NULL</code> if <code>c</code> is not in <code>s</code>. * @stable ICU 2.0 * * @see u_strchr * @see u_memchr32 * @see u_strFindFirst */ U_STABLE UChar* U_EXPORT2 u_memchr(const UChar *s, UChar c, int32_t count); /** * Find the first occurrence of a code point in a string. * A surrogate code point is found only if its match in the text is not * part of a surrogate pair. * A NUL character is found at the string terminator. * * @param s The string to search (contains <code>count</code> UChars). * @param c The code point to find. * @param count The length of the string. * @return A pointer to the first occurrence of <code>c</code> in <code>s</code> * or <code>NULL</code> if <code>c</code> is not in <code>s</code>. * @stable ICU 2.0 * * @see u_strchr32 * @see u_memchr * @see u_strFindFirst */ U_STABLE UChar* U_EXPORT2 u_memchr32(const UChar *s, UChar32 c, int32_t count); /** * Find the last occurrence of a BMP code point in a string. * A surrogate code point is found only if its match in the text is not * part of a surrogate pair. * A NUL character is found at the string terminator. * * @param s The string to search (contains <code>count</code> UChars). * @param c The BMP code point to find. * @param count The length of the string. * @return A pointer to the last occurrence of <code>c</code> in <code>s</code> * or <code>NULL</code> if <code>c</code> is not in <code>s</code>. * @stable ICU 2.4 * * @see u_strrchr * @see u_memrchr32 * @see u_strFindLast */ U_STABLE UChar* U_EXPORT2 u_memrchr(const UChar *s, UChar c, int32_t count); /** * Find the last occurrence of a code point in a string. * A surrogate code point is found only if its match in the text is not * part of a surrogate pair. * A NUL character is found at the string terminator. * * @param s The string to search (contains <code>count</code> UChars). * @param c The code point to find. * @param count The length of the string. * @return A pointer to the last occurrence of <code>c</code> in <code>s</code> * or <code>NULL</code> if <code>c</code> is not in <code>s</code>. * @stable ICU 2.4 * * @see u_strrchr32 * @see u_memrchr * @see u_strFindLast */ U_STABLE UChar* U_EXPORT2 u_memrchr32(const UChar *s, UChar32 c, int32_t count); /** * Unicode String literals in C. * We need one macro to declare a variable for the string * and to statically preinitialize it if possible, * and a second macro to dynamically intialize such a string variable if necessary. * * The macros are defined for maximum performance. * They work only for strings that contain "invariant characters", i.e., * only latin letters, digits, and some punctuation. * See utypes.h for details. * * A pair of macros for a single string must be used with the same * parameters. * The string parameter must be a C string literal. * The length of the string, not including the terminating * <code>NUL</code>, must be specified as a constant. * The U_STRING_DECL macro should be invoked exactly once for one * such string variable before it is used. * * Usage: * <pre> * &#32; U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11); * &#32; U_STRING_DECL(ustringVar2, "jumps 5%", 8); * &#32; static UBool didInit=FALSE; * &#32; * &#32; int32_t function() { * &#32; if(!didInit) { * &#32; U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11); * &#32; U_STRING_INIT(ustringVar2, "jumps 5%", 8); * &#32; didInit=TRUE; * &#32; } * &#32; return u_strcmp(ustringVar1, ustringVar2); * &#32; } * </pre> * @stable ICU 2.0 */ #if U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && U_CHARSET_FAMILY==U_ASCII_FAMILY # define U_STRING_DECL(var, cs, length) static const wchar_t var[(length)+1]={ L ## cs } /**@stable ICU 2.0 */ # define U_STRING_INIT(var, cs, length) #elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]={ (const UChar *)cs } /**@stable ICU 2.0 */ # define U_STRING_INIT(var, cs, length) #else # define U_STRING_DECL(var, cs, length) static UChar var[(length)+1] /**@stable ICU 2.0 */ # define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1) #endif /** * Unescape a string of characters and write the resulting * Unicode characters to the destination buffer. The following escape * sequences are recognized: * * \\uhhhh 4 hex digits; h in [0-9A-Fa-f] * \\Uhhhhhhhh 8 hex digits * \\xhh 1-2 hex digits * \\x{h...} 1-8 hex digits * \\ooo 1-3 octal digits; o in [0-7] * \\cX control-X; X is masked with 0x1F * * as well as the standard ANSI C escapes: * * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A, * \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B, * \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C * * Anything else following a backslash is generically escaped. For * example, "[a\\-z]" returns "[a-z]". * * If an escape sequence is ill-formed, this method returns an empty * string. An example of an ill-formed sequence is "\\u" followed by * fewer than 4 hex digits. * * The above characters are recognized in the compiler's codepage, * that is, they are coded as 'u', '\\', etc. Characters that are * not parts of escape sequences are converted using u_charsToUChars(). * * This function is similar to UnicodeString::unescape() but not * identical to it. The latter takes a source UnicodeString, so it * does escape recognition but no conversion. * * @param src a zero-terminated string of invariant characters * @param dest pointer to buffer to receive converted and unescaped * text and, if there is room, a zero terminator. May be NULL for * preflighting, in which case no UChars will be written, but the * return value will still be valid. On error, an empty string is * stored here (if possible). * @param destCapacity the number of UChars that may be written at * dest. Ignored if dest == NULL. * @return the length of unescaped string. * @see u_unescapeAt * @see UnicodeString#unescape() * @see UnicodeString#unescapeAt() * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_unescape(const char *src, UChar *dest, int32_t destCapacity); U_CDECL_BEGIN /** * Callback function for u_unescapeAt() that returns a character of * the source text given an offset and a context pointer. The context * pointer will be whatever is passed into u_unescapeAt(). * * @param offset pointer to the offset that will be passed to u_unescapeAt(). * @param context an opaque pointer passed directly into u_unescapeAt() * @return the character represented by the escape sequence at * offset * @see u_unescapeAt * @stable ICU 2.0 */ typedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context); U_CDECL_END /** * Unescape a single sequence. The character at offset-1 is assumed * (without checking) to be a backslash. This method takes a callback * pointer to a function that returns the UChar at a given offset. By * varying this callback, ICU functions are able to unescape char* * strings, UnicodeString objects, and UFILE pointers. * * If offset is out of range, or if the escape sequence is ill-formed, * (UChar32)0xFFFFFFFF is returned. See documentation of u_unescape() * for a list of recognized sequences. * * @param charAt callback function that returns a UChar of the source * text given an offset and a context pointer. * @param offset pointer to the offset that will be passed to charAt. * The offset value will be updated upon return to point after the * last parsed character of the escape sequence. On error the offset * is unchanged. * @param length the number of characters in the source text. The * last character of the source text is considered to be at offset * length-1. * @param context an opaque pointer passed directly into charAt. * @return the character represented by the escape sequence at * offset, or (UChar32)0xFFFFFFFF on error. * @see u_unescape() * @see UnicodeString#unescape() * @see UnicodeString#unescapeAt() * @stable ICU 2.0 */ U_STABLE UChar32 U_EXPORT2 u_unescapeAt(UNESCAPE_CHAR_AT charAt, int32_t *offset, int32_t length, void *context); /** * Uppercase the characters in a string. * Casing is locale-dependent and context-sensitive. * The result may be longer or shorter than the original. * The source string and the destination buffer are allowed to overlap. * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the result * without writing any of the result string. * @param src The original string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The length of the result string. It may be greater than destCapacity. In that case, * only some of the result was written to the destination buffer. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strToUpper(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, const char *locale, UErrorCode *pErrorCode); /** * Lowercase the characters in a string. * Casing is locale-dependent and context-sensitive. * The result may be longer or shorter than the original. * The source string and the destination buffer are allowed to overlap. * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the result * without writing any of the result string. * @param src The original string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The length of the result string. It may be greater than destCapacity. In that case, * only some of the result was written to the destination buffer. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strToLower(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, const char *locale, UErrorCode *pErrorCode); #if !UCONFIG_NO_BREAK_ITERATION /** * Titlecase a string. * Casing is locale-dependent and context-sensitive. * Titlecasing uses a break iterator to find the first characters of words * that are to be titlecased. It titlecases those characters and lowercases * all others. * * The titlecase break iterator can be provided to customize for arbitrary * styles, using rules and dictionaries beyond the standard iterators. * It may be more efficient to always provide an iterator to avoid * opening and closing one for each string. * The standard titlecase iterator for the root locale implements the * algorithm of Unicode TR 21. * * This function uses only the first() and next() methods of the * provided break iterator. * * The result may be longer or shorter than the original. * The source string and the destination buffer are allowed to overlap. * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the result * without writing any of the result string. * @param src The original string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param titleIter A break iterator to find the first characters of words * that are to be titlecased. * If none is provided (NULL), then a standard titlecase * break iterator is opened. * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The length of the result string. It may be greater than destCapacity. In that case, * only some of the result was written to the destination buffer. * @stable ICU 2.1 */ U_STABLE int32_t U_EXPORT2 u_strToTitle(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, UBreakIterator *titleIter, const char *locale, UErrorCode *pErrorCode); #endif /** * Case-fold the characters in a string. * Case-folding is locale-independent and not context-sensitive, * but there is an option for whether to include or exclude mappings for dotted I * and dotless i that are marked with 'I' in CaseFolding.txt. * The result may be longer or shorter than the original. * The source string and the destination buffer are allowed to overlap. * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the result * without writing any of the result string. * @param src The original string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param options Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The length of the result string. It may be greater than destCapacity. In that case, * only some of the result was written to the destination buffer. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strFoldCase(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, uint32_t options, UErrorCode *pErrorCode); /** * Converts a sequence of UChars to wchar_t units. * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of wchar_t's). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param pDestLength A pointer to receive the number of units written to the destination. If * pDestLength!=NULL then *pDestLength is always set to the * number of output units corresponding to the transformation of * all the input units, even in case of a buffer overflow. * @param src The original source string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The pointer to destination buffer. * @stable ICU 2.0 */ U_STABLE wchar_t* U_EXPORT2 u_strToWCS(wchar_t *dest, int32_t destCapacity, int32_t *pDestLength, const UChar *src, int32_t srcLength, UErrorCode *pErrorCode); /** * Converts a sequence of wchar_t units to UChars * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param pDestLength A pointer to receive the number of units written to the destination. If * pDestLength!=NULL then *pDestLength is always set to the * number of output units corresponding to the transformation of * all the input units, even in case of a buffer overflow. * @param src The original source string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The pointer to destination buffer. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_strFromWCS(UChar *dest, int32_t destCapacity, int32_t *pDestLength, const wchar_t *src, int32_t srcLength, UErrorCode *pErrorCode); /** * Converts a sequence of UChars (UTF-16) to UTF-8 bytes * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of chars). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param pDestLength A pointer to receive the number of units written to the destination. If * pDestLength!=NULL then *pDestLength is always set to the * number of output units corresponding to the transformation of * all the input units, even in case of a buffer overflow. * @param src The original source string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The pointer to destination buffer. * @stable ICU 2.0 */ U_STABLE char* U_EXPORT2 u_strToUTF8(char *dest, int32_t destCapacity, int32_t *pDestLength, const UChar *src, int32_t srcLength, UErrorCode *pErrorCode); /** * Converts a sequence of UTF-8 bytes to UChars (UTF-16). * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param pDestLength A pointer to receive the number of units written to the destination. If * pDestLength!=NULL then *pDestLength is always set to the * number of output units corresponding to the transformation of * all the input units, even in case of a buffer overflow. * @param src The original source string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The pointer to destination buffer. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_strFromUTF8(UChar *dest, int32_t destCapacity, int32_t *pDestLength, const char *src, int32_t srcLength, UErrorCode *pErrorCode); /** * Converts a sequence of UChars (UTF-16) to UTF32 units. * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChar32s). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param pDestLength A pointer to receive the number of units written to the destination. If * pDestLength!=NULL then *pDestLength is always set to the * number of output units corresponding to the transformation of * all the input units, even in case of a buffer overflow. * @param src The original source string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The pointer to destination buffer. * @stable ICU 2.0 */ U_STABLE UChar32* U_EXPORT2 u_strToUTF32(UChar32 *dest, int32_t destCapacity, int32_t *pDestLength, const UChar *src, int32_t srcLength, UErrorCode *pErrorCode); /** * Converts a sequence of UTF32 units to UChars (UTF-16) * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param pDestLength A pointer to receive the number of units written to the destination. If * pDestLength!=NULL then *pDestLength is always set to the * number of output units corresponding to the transformation of * all the input units, even in case of a buffer overflow. * @param src The original source string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The pointer to destination buffer. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_strFromUTF32(UChar *dest, int32_t destCapacity, int32_t *pDestLength, const UChar32 *src, int32_t srcLength, UErrorCode *pErrorCode); #endif
53,449
C++
.h
1,256
40.055732
112
0.694278
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
33,940
uconfig.h
supercollider_supercollider/external_libraries/icu/unicode/uconfig.h
/* ********************************************************************** * Copyright (C) 2002-2004, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * file name: uconfig.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2002sep19 * created by: Markus W. Scherer */ #ifndef __UCONFIG_H__ #define __UCONFIG_H__ /*! * \file * \brief Switches for excluding parts of ICU library code modules. * * Allows to build partial, smaller libraries for special purposes. * By default, all modules are built. * The switches are fairly coarse, controlling large modules. * Basic services cannot be turned off. * * @stable ICU 2.4 */ /** * \def UCONFIG_ONLY_COLLATION * This switch turns off modules that are not needed for collation. * * It does not turn off legacy conversion because that is necessary * for ICU to work on EBCDIC platforms (for the default converter). * If you want "only collation" and do not build for EBCDIC, * then you can #define UCONFIG_NO_LEGACY_CONVERSION 1 as well. * * @stable ICU 2.4 */ #ifndef UCONFIG_ONLY_COLLATION # define UCONFIG_ONLY_COLLATION 0 #endif #if UCONFIG_ONLY_COLLATION /* common library */ # define UCONFIG_NO_BREAK_ITERATION 1 # define UCONFIG_NO_IDNA 1 /* i18n library */ # if UCONFIG_NO_COLLATION # error Contradictory collation switches in uconfig.h. # endif # define UCONFIG_NO_FORMATTING 1 # define UCONFIG_NO_TRANSLITERATION 1 # define UCONFIG_NO_REGULAR_EXPRESSIONS 1 #endif /* common library switches -------------------------------------------------- */ /** * \def UCONFIG_NO_CONVERSION * ICU will not completely build with this switch turned on. * This switch turns off all converters. * * @draft ICU 3.2 */ #ifndef UCONFIG_NO_CONVERSION # define UCONFIG_NO_CONVERSION 0 #endif #if UCONFIG_NO_CONVERSION # define UCONFIG_NO_LEGACY_CONVERSION 1 #endif /** * \def UCONFIG_NO_LEGACY_CONVERSION * This switch turns off all converters except for * - Unicode charsets (UTF-7/8/16/32, CESU-8, SCSU, BOCU-1) * - US-ASCII * - ISO-8859-1 * * Turning off legacy conversion is not possible on EBCDIC platforms * because they need ibm-37 or ibm-1047 default converters. * * @stable ICU 2.4 */ #ifndef UCONFIG_NO_LEGACY_CONVERSION # define UCONFIG_NO_LEGACY_CONVERSION 0 #endif /** * \def UCONFIG_NO_NORMALIZATION * This switch turns off normalization. * It implies turning off several other services as well, for example * collation and IDNA. * * @stable ICU 2.6 */ #ifndef UCONFIG_NO_NORMALIZATION # define UCONFIG_NO_NORMALIZATION 0 #elif UCONFIG_NO_NORMALIZATION /* common library */ # define UCONFIG_NO_IDNA 1 /* i18n library */ # if UCONFIG_ONLY_COLLATION # error Contradictory collation switches in uconfig.h. # endif # define UCONFIG_NO_COLLATION 1 # define UCONFIG_NO_TRANSLITERATION 1 #endif /** * \def UCONFIG_NO_BREAK_ITERATION * This switch turns off break iteration. * * @stable ICU 2.4 */ #ifndef UCONFIG_NO_BREAK_ITERATION # define UCONFIG_NO_BREAK_ITERATION 0 #endif /** * \def UCONFIG_NO_IDNA * This switch turns off IDNA. * * @stable ICU 2.6 */ #ifndef UCONFIG_NO_IDNA # define UCONFIG_NO_IDNA 0 #endif /* i18n library switches ---------------------------------------------------- */ /** * \def UCONFIG_NO_COLLATION * This switch turns off collation and collation-based string search. * * @stable ICU 2.4 */ #ifndef UCONFIG_NO_COLLATION # define UCONFIG_NO_COLLATION 0 #endif /** * \def UCONFIG_NO_FORMATTING * This switch turns off formatting and calendar/timezone services. * * @stable ICU 2.4 */ #ifndef UCONFIG_NO_FORMATTING # define UCONFIG_NO_FORMATTING 0 #endif /** * \def UCONFIG_NO_TRANSLITERATION * This switch turns off transliteration. * * @stable ICU 2.4 */ #ifndef UCONFIG_NO_TRANSLITERATION # define UCONFIG_NO_TRANSLITERATION 0 #endif /** * \def UCONFIG_NO_REGULAR_EXPRESSIONS * This switch turns off regular expressions. * * @stable ICU 2.4 */ #ifndef UCONFIG_NO_REGULAR_EXPRESSIONS # define UCONFIG_NO_REGULAR_EXPRESSIONS 0 #endif /** * \def UCONFIG_NO_SERVICE * This switch turns off service registration. * * @draft ICU 3.2 */ #ifndef UCONFIG_NO_SERVICE # define UCONFIG_NO_SERVICE 0 #endif #endif
4,393
C++
.h
166
24.771084
80
0.695507
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
33,941
uregex.h
supercollider_supercollider/external_libraries/icu/unicode/uregex.h
/* ********************************************************************** * Copyright (C) 2004, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * file name: regex.h * encoding: US-ASCII * indentation:4 * * created on: 2004mar09 * created by: Andy Heninger * * ICU Regular Expressions, API for C */ /** * \file * \brief C API: Regular Expressions * * <p>This is a C wrapper around the C++ RegexPattern and RegexMatcher classes.</p> */ #ifndef UREGEX_H #define UREGEX_H #include "utypes.h" #if !UCONFIG_NO_REGULAR_EXPRESSIONS #include "parseerr.h" #ifndef U_HIDE_DRAFT_API struct URegularExpression; /** * Structure represeting a compiled regular rexpression, plus the results * of a match operation. * @draft ICU 3.0 */ typedef struct URegularExpression URegularExpression; #endif /* U_HIDE_DRAFT_API */ /** * Constants for Regular Expression Match Modes. * @stable ICU 2.4 */ typedef enum URegexpFlag{ /** Forces normalization of pattern and strings. @draft ICU 2.4 */ UREGEX_CANON_EQ = 128, /** Enable case insensitive matching. @stable ICU 2.4 */ UREGEX_CASE_INSENSITIVE = 2, /** Allow white space and comments within patterns @stable ICU 2.4 */ UREGEX_COMMENTS = 4, /** If set, '.' matches line terminators, otherwise '.' matching stops at line end. * @stable ICU 2.4 */ UREGEX_DOTALL = 32, /** Control behavior of "$" and "^" * If set, recognize line terminators within string, * otherwise, match only at start and end of input string. * @stable ICU 2.4 */ UREGEX_MULTILINE = 8, /** Unicode word boundaries. * If set, \b uses the Unicode TR 29 definition of word boundaries. * Warning: Unicode word boundaries are quite different from * traditional regular expression word boundaries. See * http://unicode.org/reports/tr29/#Word_Boundaries * @draft ICU 2.8 */ UREGEX_UWORD = 256 } URegexpFlag; /** * Open (compile) an ICU regular expression. Compiles the regular expression in * string form into an internal representation using the specified match mode flags. * The resulting regular expression handle can then be used to perform various * matching operations. * * @param pattern The Regular Expression pattern to be compiled. * @param patternLength The length of the pattern, or -1 if the pattern is * NUL termintated. * @param flags Flags that alter the default matching behavior for * the regular expression, UREGEX_CASE_INSENSITIVE, for * example. For default behavior, set this parameter to zero. * See <code>enum URegexpFlag</code>. All desired flags * are bitwise-ORed together. * @param pe Receives the position (line and column nubers) of any syntax * error within the source regular expression string. If this * information is not wanted, pass NULL for this parameter. * @param status Receives error detected by this function. * @draft ICU 3.0 * */ U_DRAFT URegularExpression * U_EXPORT2 uregex_open( const UChar *pattern, int32_t patternLength, uint32_t flags, UParseError *pe, UErrorCode *status); /** * Open (compile) an ICU regular expression. The resulting regular expression * handle can then be used to perform various matching operations. * <p> * This function is the same as uregex_open, except that the pattern * is supplied as an 8 bit char * string in the default code page. * * @param pattern The Regular Expression pattern to be compiled, * NUL termintated. * @param flags Flags that alter the default matching behavior for * the regular expression, UREGEX_CASE_INSENSITIVE, for * example. For default behavior, set this parameter to zero. * See <code>enum URegexpFlag</code>. All desired flags * are bitwise-ORed together. * @param pe Receives the position (line and column nubers) of any syntax * error within the source regular expression string. If this * information is not wanted, pass NULL for this parameter. * @param status Receives errors detected by this function. * @return The URegularExpression object representing the compiled * pattern. * * @draft ICU 3.0 */ U_DRAFT URegularExpression * U_EXPORT2 uregex_openC( const char *pattern, uint32_t flags, UParseError *pe, UErrorCode *status); /** * Close the regular expression, recovering all resources (memory) it * was holding. * * @param regexp The regular expression to be closed. * @draft ICU 3.0 */ U_DRAFT void U_EXPORT2 uregex_close(URegularExpression *regexp); /** * Make a copy of a compiled regular expression. Cloning a regular * expression is faster than opening a second instance from the source * form of the expression, and requires less memory. * <p> * Note that the current input string and the position of any matched text * within it are not cloned; only the pattern itself and and the * match mode flags are copied. * <p> * Cloning can be particularly useful to threaded applications that perform * multiple match operations in parallel. Each concurrent RE * operation requires its own instance of a URegularExpression. * * @param regexp The compiled regular expression to be cloned. * @param status Receives indication of any errors encountered * @return the cloned copy of the compiled regular expression. * @draft ICU 3.0 */ U_DRAFT URegularExpression * U_EXPORT2 uregex_clone(const URegularExpression *regexp, UErrorCode *status); /** * Return a pointer to the source form of the pattern for this regular expression. * * @param regexp The compiled regular expression. * @param patLength This output parameter will be set to the length of the * pattern string. A NULL pointer may be used here if the * pattern length is not needed, as would be the case if * the pattern is known in advance to be a NUL terminated * string. * @param status Receives errors detected by this function. * @return a pointer to the pattern string. The storage for the string is * owned by the regular expression object, and must not be * altered or deleted by the application. The returned string * will remain valid until the regular expression is closed. * @draft ICU 3.0 */ U_DRAFT const UChar * U_EXPORT2 uregex_pattern(const URegularExpression *regexp, int32_t *patLength, UErrorCode *status); /** * Get the match mode flags that were specified when compiling this regular expression. * @param status Receives errors detected by this function. * @param regexp The compiled regular expression. * @return The match mode flags * @see URegexpFlag * @draft ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 uregex_flags(const URegularExpression *regexp, UErrorCode *status); /** * Set the subject text string upon which the regular expression will look for matches. * This function may be called any number of times, allowing the regular * expression pattern to be applied to different strings. * <p> * Regular expression matching operations work directly on the application's * string data. No copy is made. The subject string data must not be * altered after calling this function until after all regular expression * operations involving this string data are completed. * <p> * Zero length strings are permitted. In this case, no subsequent match * operation will dereference the text string pointer. * * @param regexp The compiled regular expression. * @param text The subject text string. * @param textLength The length of the subject text, or -1 if the string * is NUL terminated. * @param status Receives errors detected by this function. * @draft ICU 3.0 */ U_DRAFT void U_EXPORT2 uregex_setText(URegularExpression *regexp, const UChar *text, int32_t textLength, UErrorCode *status); /** * Get the subject text that is currently associated with this * regular expression object. This simply returns whatever string * pointer was previously supplied via uregex_setText(). * * @param regexp The compiled regular expression. * @param textLength The length of the string is returned in this output parameter. * A NULL pointer may be used here if the * text length is not needed, as would be the case if * the text is known in advance to be a NUL terminated * string. * @param status Receives errors detected by this function. * @return Poiner to the subject text string currently associated with * this regular expression. * @draft ICU 3.0 */ U_DRAFT const UChar * U_EXPORT2 uregex_getText(URegularExpression *regexp, int32_t *textLength, UErrorCode *status); /** * Attempts to match the input string, beginning at startIndex, against the pattern. * To succeed, the match must extend to the end of the input string. * * @param regexp The compiled regular expression. * @param startIndex The input string index at which to begin matching. * @param status Receives errors detected by this function. * @return TRUE if there is a match * @draft ICU 3.0 */ U_DRAFT UBool U_EXPORT2 uregex_matches(URegularExpression *regexp, int32_t startIndex, UErrorCode *status); /** * Attempts to match the input string, starting from the specified index, against the pattern. * The match may be of any length, and is not required to extend to the end * of the input string. Contrast with uregex_matches(). * * <p>If the match succeeds then more information can be obtained via the * <code>uregexp_start()</code>, <code>uregexp_end()</code>, * and <code>uregexp_group()</code> functions.</p> * * @param regexp The compiled regular expression. * @param startIndex The input string index at which to begin matching. * @param status A reference to a UErrorCode to receive any errors. * @return TRUE if there is a match. * @draft ICU 3.0 */ U_DRAFT UBool U_EXPORT2 uregex_lookingAt(URegularExpression *regexp, int32_t startIndex, UErrorCode *status); /** * Find the first matching substring of the input string that matches the pattern. * The search for a match begins at the specified index. * If a match is found, <code>uregex_start(), uregex_end()</code>, and * <code>uregex_group()</code> will provide more information regarding the match. * * @param regexp The compiled regular expression. * @param startIndex The position in the input string to begin the search * @param status A reference to a UErrorCode to receive any errors. * @return TRUE if a match is found. * @draft ICU 3.0 */ U_DRAFT UBool U_EXPORT2 uregex_find(URegularExpression *regexp, int32_t startIndex, UErrorCode *status); /** * Find the next pattern match in the input string. * Begin searching the input at the location following the end of * the previous match, or at the start of the string if there is no previous match. * If a match is found, <code>uregex_start(), uregex_end()</code>, and * <code>uregex_group()</code> will provide more information regarding the match. * * @param regexp The compiled regular expression. * @param status A reference to a UErrorCode to receive any errors. * @return TRUE if a match is found. * @see uregex_reset * @draft ICU 3.0 */ U_DRAFT UBool U_EXPORT2 uregex_findNext(URegularExpression *regexp, UErrorCode *status); /** * Get the number of capturing groups in this regular expression's pattern. * @param regexp The compiled regular expression. * @param status A reference to a UErrorCode to receive any errors. * @return the number of capture groups * @draft ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 uregex_groupCount(URegularExpression *regexp, UErrorCode *status); /** Extract the string for the specified matching expression or subexpression. * Group #0 is the complete string of matched text. * Group #1 is the text matched by the first set of capturing parentheses. * * @param regexp The compiled regular expression. * @param groupNum The capture group to extract. Group 0 is the complete * match. The value of this parameter must be * less than or equal to the number of capture groups in * the pattern. * @param dest Buffer to receive the matching string data * @param destCapacity Capacity of the dest buffer. * @param status A reference to a UErrorCode to receive any errors. * @return Length of matching data, * or -1 if no applicable match. * @draft ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 uregex_group(URegularExpression *regexp, int32_t groupNum, UChar *dest, int32_t destCapacity, UErrorCode *status); /** * Returns the index in the input string of the start of the text matched by the * specified capture group during the previous match operation. Return -1 if * the capture group was not part of the last match. * Group #0 refers to the complete range of matched text. * Group #1 refers to the text matched by the first set of capturing parentheses. * * @param regexp The compiled regular expression. * @param groupNum The capture group number * @param status A reference to a UErrorCode to receive any errors. * @return the starting position in the input of the text matched * by the specified group. * @draft ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 uregex_start(URegularExpression *regexp, int32_t groupNum, UErrorCode *status); /** * Returns the index in the input string of the position following the end * of the text matched by the specified capture group. * Return -1 if the capture group was not part of the last match. * Group #0 refers to the complete range of matched text. * Group #1 refers to the text matched by the first set of capturing parentheses. * * @param regexp The compiled regular expression. * @param groupNum The capture group number * @param status A reference to a UErrorCode to receive any errors. * @return the index of the position following the last matched character. * @draft ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 uregex_end(URegularExpression *regexp, int32_t groupNum, UErrorCode *status); /** * Reset any saved state from the previous match. Has the effect of * causing uregex_findNext to begin at the specified index, and causing * uregex_start(), uregex_end() and uregex_group() to return an error * indicating that there is no match information available. * * @param regexp The compiled regular expression. * @param index The position in the text at which a * uregex_findNext() should begin searching. * @param status A reference to a UErrorCode to receive any errors. * @draft ICU 3.0 */ U_DRAFT void U_EXPORT2 uregex_reset(URegularExpression *regexp, int32_t index, UErrorCode *status); /** * Replaces every substring of the input that matches the pattern * with the given replacement string. This is a convenience function that * provides a complete find-and-replace-all operation. * * This method scans the input string looking for matches of the pattern. * Input that is not part of any match is copied unchanged to the * destination buffer. Matched regions are replaced in the output * buffer by the replacement string. The replacement string may contain * references to capture groups; these take the form of $1, $2, etc. * * @param regexp The compiled regular expression. * @param replacementText A string containing the replacement text. * @param replacementLength The length of the replacement string, or * -1 if it is NUL terminated. * @param destBuf A (UChar *) buffer that will receive the result. * @param destCapacity The capacity of the desitnation buffer. * @param status A reference to a UErrorCode to receive any errors. * @return The length of the string resulting from the find * and replace operation. In the event that the * destination capacity is inadequate, the return value * is still the full length of the untruncated string. * @draft ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 uregex_replaceAll(URegularExpression *regexp, UChar *replacementText, int32_t replacementLength, UChar *destBuf, int32_t destCapacity, UErrorCode *status); /** * Replaces the first substring of the input that matches the pattern * with the given replacement string. This is a convenience function that * provides a complete find-and-replace operation. * * This method scans the input string looking for a match of the pattern. * All input that is not part of the match is copied unchanged to the * destination buffer. The matched region is replaced in the output * buffer by the replacement string. The replacement string may contain * references to capture groups; these take the form of $1, $2, etc. * * @param regexp The compiled regular expression. * @param replacementText A string containing the replacement text. * @param replacementLength The length of the replacement string, or * -1 if it is NUL terminated. * @param destBuf A (UChar *) buffer that will receive the result. * @param destCapacity The capacity of the desitnation buffer. * @param status a reference to a UErrorCode to receive any errors. * @return The length of the string resulting from the find * and replace operation. In the event that the * destination capacity is inadequate, the return value * is still the full length of the untruncated string. * @draft ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 uregex_replaceFirst(URegularExpression *regexp, UChar *replacementText, int32_t replacementLength, UChar *destBuf, int32_t destCapacity, UErrorCode *status); /** * Implements a replace operation intended to be used as part of an * incremental find-and-replace. * * <p>The input string, starting from the end of the previous match and ending at * the start of the current match, is appended to the destination string. Then the * replacement string is appended to the output string, * including handling any substitutions of captured text.</p> * * <p>A note on preflight computation of buffersize and error handling: * Calls to uregex_appendReplacement() and uregex_appendTail() are * designed to be chained, one after another, with the destination * buffer pointer and buffer capacity updated after each in preparation * to for the next. If the destination buffer is exhausted partway through such a * sequence, a U_BUFFER_OVERFLOW_ERROR status will be returned. Normal * ICU conventions are for a function to perform no action if it is * called with an error status, but for this one case, uregex_appendRepacement() * will operate normally so that buffer size computations will complete * correctly. * * <p>For simple, prepackaged, non-incremental find-and-replace * operations, see replaceFirst() or replaceAll().</p> * * @param regexp The regular expression object. * @param replacementText The string that will replace the matched portion of the * input string as it is copied to the destination buffer. * The replacement text may contain references ($1, for * example) to capture groups from the match. * @param replacementLength The length of the replacement text string, * or -1 if the string is NUL terminated. * @param destBuf The buffer into which the results of the * find-and-replace are placed. On return, this pointer * will be updated to refer to the beginning of the * unused portion of buffer, leaving it in position for * a subsequent call to this function. * @param destCapacity The size of the output buffer, On return, this * parameter will be updated to reflect the space remaining * unused in the output buffer. * @param status A reference to a UErrorCode to receive any errors. * @return The length of the result string. In the event that * destCapacity is inadequate, the full length of the * untruncated output string is returned. * * @draft ICU 3.0 * */ U_DRAFT int32_t U_EXPORT2 uregex_appendReplacement(URegularExpression *regexp, UChar *replacementText, int32_t replacementLength, UChar **destBuf, int32_t *destCapacity, UErrorCode *status); /** * As the final step in a find-and-replace operation, append the remainder * of the input string, starting at the position following the last match, * to the destination string. <code>uregex_appendTail()</code> is intended * to be invoked after one or more invocations of the * <code>uregex_appendReplacement()</code> function. * * @param regexp The regular expression object. This is needed to * obtain the input string and with the position * of the last match within it. * @param destBuf The buffer in which the results of the * find-and-replace are placed. On return, the pointer * will be updated to refer to the beginning of the * unused portion of buffer. * @param destCapacity The size of the output buffer, On return, this * value will be updated to reflect the space remaining * unused in the output buffer. * @param status A reference to a UErrorCode to receive any errors. * @return The length of the result string. In the event that * destCapacity is inadequate, the full length of the * untruncated output string is returned. * * @draft ICU 3.0 */ U_DRAFT int32_t U_EXPORT2 uregex_appendTail(URegularExpression *regexp, UChar **destBuf, int32_t *destCapacity, UErrorCode *status); /** * Split a string into fields. Somewhat like split() from Perl. * The pattern matches identify delimiters that separate the input * into fields. The input data between the matches becomes the * fields themselves. * <p> * Each of the fields is copied from the input string to the destination * buffer, and the NUL terminated. The position of each field within * the destination buffer is returned in the destFields array. * * @param regexp The compiled regular expression. * @param destBuf A (UChar *) buffer to receive the fields that * are extracted from the input string. These * field pointers will refer to positions within the * destination buffer supplied by the caller. Any * extra positions within the destFields array will be * set to NULL. * @param destCapacity The capacity of the destBuf. * @param requiredCapacity The actual capacity required of the destBuf. * If destCapacity is too small, requiredCapacity will return * the total capacity required to hold all of the output, and * a U_BUFFER_OVERFLOW_ERROR will be returned. * @param destFields An array to be filled with the position of each * of the extracted fields within destBuf. * @param destFieldsCapacity The number of elements in the destFields array. * If the number of fields found is less than destFieldsCapacity, * the extra destFields elements are set to zero. * If destFieldsCapacity is too small, the trailing part of the * input, including any field delimiters, is treated as if it * were the last field - it is copied to the destBuf, and * its position is in the destBuf is stored in the last element * of destFields. This behavior mimics that of Perl. It is not * an error condition, and no error status is returned when all destField * positions are used. * @param status A reference to a UErrorCode to receive any errors. * @return The number of fields into which the input string was split. * @draft ICU 3.0 * * Note: another choice for the design of this function would be to not * copy the resulting fields at all, but to return indexes and * lengths within the source text. * Advantages would be * o Faster. No Copying. * o Nothing extra needed when field data may contain embedded NUL chars. * o Less memory needed if working on large data. * Disadvantages * o Less consistent with C++ split, which copies into an * array of UnicodeStrings. * o No NUL termination, extracted fields would be less convenient * to use in most cases. * o Possible problems in the future, when support Unicode Normalization * could cause the fields to not correspond exactly to * a range of the source text. */ U_DRAFT int32_t U_EXPORT2 uregex_split( URegularExpression *regexp, UChar *destBuf, int32_t destCapacity, int32_t *requiredCapacity, UChar *destFields[], int32_t destFieldsCapacity, UErrorCode *status); #endif /* !UCONFIG_NO_REGULAR_EXPRESSIONS */ #endif /* UREGEX_H */
29,045
C++
.h
578
45.865052
97
0.623122
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
33,942
utf.h
supercollider_supercollider/external_libraries/icu/unicode/utf.h
/* ******************************************************************************* * * Copyright (C) 1999-2004, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: utf.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 1999sep09 * created by: Markus W. Scherer */ /** * \file * \brief C API: Code point macros * * This file defines macros for checking whether a code point is * a surrogate or a non-character etc. * * The UChar and UChar32 data types for Unicode code units and code points * are defined in umachines.h because they can be machine-dependent. * * utf.h is included by utypes.h and itself includes utf8.h and utf16.h after some * common definitions. Those files define macros for efficiently getting code points * in and out of UTF-8/16 strings. * utf16.h macros have "U16_" prefixes. * utf8.h defines similar macros with "U8_" prefixes for UTF-8 string handling. * * ICU processes 16-bit Unicode strings. * Most of the time, such strings are well-formed UTF-16. * Single, unpaired surrogates must be handled as well, and are treated in ICU * like regular code points where possible. * (Pairs of surrogate code points are indistinguishable from supplementary * code points encoded as pairs of supplementary code units.) * * In fact, almost all Unicode code points in normal text (>99%) * are on the BMP (<=U+ffff) and even <=U+d7ff. * ICU functions handle supplementary code points (U+10000..U+10ffff) * but are optimized for the much more frequently occurring BMP code points. * * utf.h defines UChar to be an unsigned 16-bit integer. If this matches wchar_t, then * UChar is defined to be exactly wchar_t, otherwise uint16_t. * * UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for a 21-bit * Unicode code point (Unicode scalar value, 0..0x10ffff). * Before ICU 2.4, the definition of UChar32 was similarly platform-dependent as * the definition of UChar. For details see the documentation for UChar32 itself. * * utf.h also defines a small number of C macros for single Unicode code points. * These are simple checks for surrogates and non-characters. * For actual Unicode character properties see uchar.h. * * By default, string operations must be done with error checking in case * a string is not well-formed UTF-16. * The macros will detect if a surrogate code unit is unpaired * (lead unit without trail unit or vice versa) and just return the unit itself * as the code point. * (It is an accidental property of Unicode and UTF-16 that all * malformed sequences can be expressed unambiguously with a distinct subrange * of Unicode code points.) * * When it is safe to assume that text is well-formed UTF-16 * (does not contain single, unpaired surrogates), then one can use * U16_..._UNSAFE macros. * These do not check for proper code unit sequences or truncated text and may * yield wrong results or even cause a crash if they are used with "malformed" * text. * In practice, U16_..._UNSAFE macros will produce slightly less code but * should not be faster because the processing is only different when a * surrogate code unit is detected, which will be rare. * * Similarly for UTF-8, there are "safe" macros without a suffix, * and U8_..._UNSAFE versions. * The performance differences are much larger here because UTF-8 provides so * many opportunities for malformed sequences. * The unsafe UTF-8 macros are entirely implemented inside the macro definitions * and are fast, while the safe UTF-8 macros call functions for all but the * trivial (ASCII) cases. * * Unlike with UTF-16, malformed sequences cannot be expressed with distinct * code point values (0..U+10ffff). They are indicated with negative values instead. * * For more information see the ICU User Guide Strings chapter * (http://oss.software.ibm.com/icu/userguide/). * * <em>Usage:</em> * ICU coding guidelines for if() statements should be followed when using these macros. * Compound statements (curly braces {}) must be used for if-else-while... * bodies and all macro statements should be terminated with semicolon. * * @stable ICU 2.4 */ #ifndef __UTF_H__ #define __UTF_H__ #include "utypes.h" /* include the utfXX.h after the following definitions */ /* single-code point definitions -------------------------------------------- */ /** * This value is intended for sentinel values for APIs that * (take or) return single code points (UChar32). * It is outside of the Unicode code point range 0..0x10ffff. * * For example, a "done" or "error" value in a new API * could be indicated with U_SENTINEL. * * ICU APIs designed before ICU 2.4 usually define service-specific "done" * values, mostly 0xffff. * Those may need to be distinguished from * actual U+ffff text contents by calling functions like * CharacterIterator::hasNext() or UnicodeString::length(). * * @return -1 * @see UChar32 * @stable ICU 2.4 */ #define U_SENTINEL (-1) /** * Is this code point a Unicode noncharacter? * @param c 32-bit code point * @return TRUE or FALSE * @stable ICU 2.4 */ #define U_IS_UNICODE_NONCHAR(c) \ ((c)>=0xfdd0 && \ ((uint32_t)(c)<=0xfdef || ((c)&0xfffe)==0xfffe) && \ (uint32_t)(c)<=0x10ffff) /** * Is c a Unicode code point value (0..U+10ffff) * that can be assigned a character? * * Code points that are not characters include: * - single surrogate code points (U+d800..U+dfff, 2048 code points) * - the last two code points on each plane (U+__fffe and U+__ffff, 34 code points) * - U+fdd0..U+fdef (new with Unicode 3.1, 32 code points) * - the highest Unicode code point value is U+10ffff * * This means that all code points below U+d800 are character code points, * and that boundary is tested first for performance. * * @param c 32-bit code point * @return TRUE or FALSE * @stable ICU 2.4 */ #define U_IS_UNICODE_CHAR(c) \ ((uint32_t)(c)<0xd800 || \ ((uint32_t)(c)>0xdfff && \ (uint32_t)(c)<=0x10ffff && \ !U_IS_UNICODE_NONCHAR(c))) #ifndef U_HIDE_DRAFT_API /** * Is this code point a BMP code point (U+0000..U+ffff)? * @param c 32-bit code point * @return TRUE or FALSE * @draft ICU 2.8 */ #define U_IS_BMP(c) ((uint32_t)(c)<=0xffff) /** * Is this code point a supplementary code point (U+10000..U+10ffff)? * @param c 32-bit code point * @return TRUE or FALSE * @draft ICU 2.8 */ #define U_IS_SUPPLEMENTARY(c) ((uint32_t)((c)-0x10000)<=0xfffff) #endif /*U_HIDE_DRAFT_API*/ /** * Is this code point a lead surrogate (U+d800..U+dbff)? * @param c 32-bit code point * @return TRUE or FALSE * @stable ICU 2.4 */ #define U_IS_LEAD(c) (((c)&0xfffffc00)==0xd800) /** * Is this code point a trail surrogate (U+dc00..U+dfff)? * @param c 32-bit code point * @return TRUE or FALSE * @stable ICU 2.4 */ #define U_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00) /** * Is this code point a surrogate (U+d800..U+dfff)? * @param c 32-bit code point * @return TRUE or FALSE * @stable ICU 2.4 */ #define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800) /** * Assuming c is a surrogate code point (U_IS_SURROGATE(c)), * is it a lead surrogate? * @param c 32-bit code point * @return TRUE or FALSE * @stable ICU 2.4 */ #define U_IS_SURROGATE_LEAD(c) (((c)&0x400)==0) /* include the utfXX.h ------------------------------------------------------ */ #include "utf8.h" #include "utf16.h" /* utf_old.h contains deprecated, pre-ICU 2.4 definitions */ #include "utf_old.h" #endif
7,645
C++
.h
202
35.80198
88
0.695717
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
33,943
udraft.h
supercollider_supercollider/external_libraries/icu/unicode/udraft.h
/* ******************************************************************************* * Copyright (C) 2004, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * * file name: udraft.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * Created by: gendraft.pl, a perl script written by Ram Viswanadha * * Contains data for commenting out APIs. * Gets included by umachine.h * * THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT * YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN! */ #ifndef UDRAFT_H #define UDRAFT_H #ifdef U_HIDE_DRAFT_API #define ULineBreakTag_3_2 ULineBreakTag_DRAFT_API_DO_NOT_USE #define USentenceBreakTag_3_2 USentenceBreakTag_DRAFT_API_DO_NOT_USE #define ULineBreakTag_3_2 ULineBreakTag_DRAFT_API_DO_NOT_USE #define USentenceBreakTag_3_2 USentenceBreakTag_DRAFT_API_DO_NOT_USE #define ubrk_getRuleStatusVec_3_2 ubrk_getRuleStatusVec_DRAFT_API_DO_NOT_USE #define ubrk_getLocaleByType_3_2 ubrk_getLocaleByType_DRAFT_API_DO_NOT_USE #define UCAL_EXTENDED_YEAR_3_2 UCAL_EXTENDED_YEAR_DRAFT_API_DO_NOT_USE #define UCAL_JULIAN_DAY_3_2 UCAL_JULIAN_DAY_DRAFT_API_DO_NOT_USE #define UCAL_MILLISECONDS_IN_DAY_3_2 UCAL_MILLISECONDS_IN_DAY_DRAFT_API_DO_NOT_USE #define UCAL_DAY_OF_MONTH_3_2 UCAL_DAY_OF_MONTH_DRAFT_API_DO_NOT_USE #define ucal_getLocaleByType_3_2 ucal_getLocaleByType_DRAFT_API_DO_NOT_USE #define UCHAR_S_TERM_3_2 UCHAR_S_TERM_DRAFT_API_DO_NOT_USE #define UCHAR_VARIATION_SELECTOR_3_2 UCHAR_VARIATION_SELECTOR_DRAFT_API_DO_NOT_USE #define UCHAR_NFD_INERT_3_2 UCHAR_NFD_INERT_DRAFT_API_DO_NOT_USE #define UCHAR_NFKD_INERT_3_2 UCHAR_NFKD_INERT_DRAFT_API_DO_NOT_USE #define UCHAR_NFC_INERT_3_2 UCHAR_NFC_INERT_DRAFT_API_DO_NOT_USE #define UCHAR_NFKC_INERT_3_2 UCHAR_NFKC_INERT_DRAFT_API_DO_NOT_USE #define UCHAR_SEGMENT_STARTER_3_2 UCHAR_SEGMENT_STARTER_DRAFT_API_DO_NOT_USE #define UCHAR_NFD_QUICK_CHECK_3_2 UCHAR_NFD_QUICK_CHECK_DRAFT_API_DO_NOT_USE #define UCHAR_NFKD_QUICK_CHECK_3_2 UCHAR_NFKD_QUICK_CHECK_DRAFT_API_DO_NOT_USE #define UCHAR_NFC_QUICK_CHECK_3_2 UCHAR_NFC_QUICK_CHECK_DRAFT_API_DO_NOT_USE #define UCHAR_NFKC_QUICK_CHECK_3_2 UCHAR_NFKC_QUICK_CHECK_DRAFT_API_DO_NOT_USE #define UCHAR_LEAD_CANONICAL_COMBINING_CLASS_3_2 UCHAR_LEAD_CANONICAL_COMBINING_CLASS_DRAFT_API_DO_NOT_USE #define UCHAR_TRAIL_CANONICAL_COMBINING_CLASS_3_2 UCHAR_TRAIL_CANONICAL_COMBINING_CLASS_DRAFT_API_DO_NOT_USE #define UBLOCK_CYRILLIC_SUPPLEMENT_3_2 UBLOCK_CYRILLIC_SUPPLEMENT_DRAFT_API_DO_NOT_USE #define U_LB_INSEPARABLE_3_2 U_LB_INSEPARABLE_DRAFT_API_DO_NOT_USE #define UCNV_GET_MAX_BYTES_FOR_STRING_3_2 UCNV_GET_MAX_BYTES_FOR_STRING_DRAFT_API_DO_NOT_USE #define ucol_openFromShortString_3_2 ucol_openFromShortString_DRAFT_API_DO_NOT_USE #define ucol_getContractions_3_2 ucol_getContractions_DRAFT_API_DO_NOT_USE #define ucol_openAvailableLocales_3_2 ucol_openAvailableLocales_DRAFT_API_DO_NOT_USE #define ucol_getKeywords_3_2 ucol_getKeywords_DRAFT_API_DO_NOT_USE #define ucol_getKeywordValues_3_2 ucol_getKeywordValues_DRAFT_API_DO_NOT_USE #define ucol_getFunctionalEquivalent_3_2 ucol_getFunctionalEquivalent_DRAFT_API_DO_NOT_USE #define ucol_getShortDefinitionString_3_2 ucol_getShortDefinitionString_DRAFT_API_DO_NOT_USE #define ucol_normalizeShortDefinitionString_3_2 ucol_normalizeShortDefinitionString_DRAFT_API_DO_NOT_USE #define ucol_getUCAVersion_3_2 ucol_getUCAVersion_DRAFT_API_DO_NOT_USE #define ucol_getLocaleByType_3_2 ucol_getLocaleByType_DRAFT_API_DO_NOT_USE #define ucol_cloneBinary_3_2 ucol_cloneBinary_DRAFT_API_DO_NOT_USE #define ucol_openBinary_3_2 ucol_openBinary_DRAFT_API_DO_NOT_USE #define UCONFIG_NO_CONVERSION_3_2 UCONFIG_NO_CONVERSION_DRAFT_API_DO_NOT_USE #define ucurr_forLocale_3_2 ucurr_forLocale_DRAFT_API_DO_NOT_USE #define ucurr_getDefaultFractionDigits_3_2 ucurr_getDefaultFractionDigits_DRAFT_API_DO_NOT_USE #define ucurr_getRoundingIncrement_3_2 ucurr_getRoundingIncrement_DRAFT_API_DO_NOT_USE #define UDateFormatField_3_2 UDateFormatField_DRAFT_API_DO_NOT_USE #define UDAT_ERA_FIELD_3_2 UDAT_ERA_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_YEAR_FIELD_3_2 UDAT_YEAR_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_MONTH_FIELD_3_2 UDAT_MONTH_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_DATE_FIELD_3_2 UDAT_DATE_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_HOUR_OF_DAY1_FIELD_3_2 UDAT_HOUR_OF_DAY1_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_HOUR_OF_DAY0_FIELD_3_2 UDAT_HOUR_OF_DAY0_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_MINUTE_FIELD_3_2 UDAT_MINUTE_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_SECOND_FIELD_3_2 UDAT_SECOND_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_FRACTIONAL_SECOND_FIELD_3_2 UDAT_FRACTIONAL_SECOND_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_DAY_OF_WEEK_FIELD_3_2 UDAT_DAY_OF_WEEK_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_DAY_OF_YEAR_FIELD_3_2 UDAT_DAY_OF_YEAR_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_DAY_OF_WEEK_IN_MONTH_FIELD_3_2 UDAT_DAY_OF_WEEK_IN_MONTH_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_WEEK_OF_YEAR_FIELD_3_2 UDAT_WEEK_OF_YEAR_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_WEEK_OF_MONTH_FIELD_3_2 UDAT_WEEK_OF_MONTH_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_AM_PM_FIELD_3_2 UDAT_AM_PM_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_HOUR1_FIELD_3_2 UDAT_HOUR1_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_HOUR0_FIELD_3_2 UDAT_HOUR0_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_TIMEZONE_FIELD_3_2 UDAT_TIMEZONE_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_YEAR_WOY_FIELD_3_2 UDAT_YEAR_WOY_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_DOW_LOCAL_FIELD_3_2 UDAT_DOW_LOCAL_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_EXTENDED_YEAR_FIELD_3_2 UDAT_EXTENDED_YEAR_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_JULIAN_DAY_FIELD_3_2 UDAT_JULIAN_DAY_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_MILLISECONDS_IN_DAY_FIELD_3_2 UDAT_MILLISECONDS_IN_DAY_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_TIMEZONE_RFC_FIELD_3_2 UDAT_TIMEZONE_RFC_FIELD_DRAFT_API_DO_NOT_USE #define UDAT_FIELD_COUNT_3_2 UDAT_FIELD_COUNT_DRAFT_API_DO_NOT_USE #define UDateFormatField_3_2 UDateFormatField_DRAFT_API_DO_NOT_USE #define udat_getLocaleByType_3_2 udat_getLocaleByType_DRAFT_API_DO_NOT_USE #define ULOC_SCRIPT_CAPACITY_3_2 ULOC_SCRIPT_CAPACITY_DRAFT_API_DO_NOT_USE #define ULOC_KEYWORDS_CAPACITY_3_2 ULOC_KEYWORDS_CAPACITY_DRAFT_API_DO_NOT_USE #define ULOC_KEYWORD_AND_VALUES_CAPACITY_3_2 ULOC_KEYWORD_AND_VALUES_CAPACITY_DRAFT_API_DO_NOT_USE #define ULOC_KEYWORD_SEPARATOR_3_2 ULOC_KEYWORD_SEPARATOR_DRAFT_API_DO_NOT_USE #define ULOC_KEYWORD_ASSIGN_3_2 ULOC_KEYWORD_ASSIGN_DRAFT_API_DO_NOT_USE #define ULOC_KEYWORD_ITEM_SEPARATOR_3_2 ULOC_KEYWORD_ITEM_SEPARATOR_DRAFT_API_DO_NOT_USE #define UAcceptResult_3_2 UAcceptResult_DRAFT_API_DO_NOT_USE #define uloc_getScript_3_2 uloc_getScript_DRAFT_API_DO_NOT_USE #define uloc_canonicalize_3_2 uloc_canonicalize_DRAFT_API_DO_NOT_USE #define uloc_getDisplayScript_3_2 uloc_getDisplayScript_DRAFT_API_DO_NOT_USE #define uloc_getDisplayKeyword_3_2 uloc_getDisplayKeyword_DRAFT_API_DO_NOT_USE #define uloc_getDisplayKeywordValue_3_2 uloc_getDisplayKeywordValue_DRAFT_API_DO_NOT_USE #define uloc_getBaseName_3_2 uloc_getBaseName_DRAFT_API_DO_NOT_USE #define uloc_openKeywords_3_2 uloc_openKeywords_DRAFT_API_DO_NOT_USE #define uloc_getKeywordValue_3_2 uloc_getKeywordValue_DRAFT_API_DO_NOT_USE #define uloc_setKeywordValue_3_2 uloc_setKeywordValue_DRAFT_API_DO_NOT_USE #define uloc_acceptLanguageFromHTTP_3_2 uloc_acceptLanguageFromHTTP_DRAFT_API_DO_NOT_USE #define uloc_acceptLanguage_3_2 uloc_acceptLanguage_DRAFT_API_DO_NOT_USE #define UMeasurementSystem_3_2 UMeasurementSystem_DRAFT_API_DO_NOT_USE #define UMeasurementSystem_3_2 UMeasurementSystem_DRAFT_API_DO_NOT_USE #define ulocdata_getExemplarSet_3_2 ulocdata_getExemplarSet_DRAFT_API_DO_NOT_USE #define ulocdata_getMeasurementSystem_3_2 ulocdata_getMeasurementSystem_DRAFT_API_DO_NOT_USE #define ulocdata_getPaperSize_3_2 ulocdata_getPaperSize_DRAFT_API_DO_NOT_USE #define UINT64_C_3_2 UINT64_C_DRAFT_API_DO_NOT_USE #define umsg_getLocaleByType_3_2 umsg_getLocaleByType_DRAFT_API_DO_NOT_USE #define U_ETHER_3_2 U_ETHER_DRAFT_API_DO_NOT_USE #define US_INV_3_2 US_INV_DRAFT_API_DO_NOT_USE #define UNUM_PATTERN_DECIMAL_3_2 UNUM_PATTERN_DECIMAL_DRAFT_API_DO_NOT_USE #define UNUM_ORDINAL_3_2 UNUM_ORDINAL_DRAFT_API_DO_NOT_USE #define UNUM_DURATION_3_2 UNUM_DURATION_DRAFT_API_DO_NOT_USE #define UNUM_PATTERN_RULEBASED_3_2 UNUM_PATTERN_RULEBASED_DRAFT_API_DO_NOT_USE #define UNUM_SIGNIFICANT_DIGITS_USED_3_2 UNUM_SIGNIFICANT_DIGITS_USED_DRAFT_API_DO_NOT_USE #define UNUM_MIN_SIGNIFICANT_DIGITS_3_2 UNUM_MIN_SIGNIFICANT_DIGITS_DRAFT_API_DO_NOT_USE #define UNUM_MAX_SIGNIFICANT_DIGITS_3_2 UNUM_MAX_SIGNIFICANT_DIGITS_DRAFT_API_DO_NOT_USE #define UNUM_LENIENT_PARSE_3_2 UNUM_LENIENT_PARSE_DRAFT_API_DO_NOT_USE #define UNUM_DEFAULT_RULESET_3_2 UNUM_DEFAULT_RULESET_DRAFT_API_DO_NOT_USE #define UNUM_PUBLIC_RULESETS_3_2 UNUM_PUBLIC_RULESETS_DRAFT_API_DO_NOT_USE #define UNUM_SIGNIFICANT_DIGIT_SYMBOL_3_2 UNUM_SIGNIFICANT_DIGIT_SYMBOL_DRAFT_API_DO_NOT_USE #define unum_formatDoubleCurrency_3_2 unum_formatDoubleCurrency_DRAFT_API_DO_NOT_USE #define unum_parseInt64_3_2 unum_parseInt64_DRAFT_API_DO_NOT_USE #define unum_parseDoubleCurrency_3_2 unum_parseDoubleCurrency_DRAFT_API_DO_NOT_USE #define unum_getLocaleByType_3_2 unum_getLocaleByType_DRAFT_API_DO_NOT_USE #define URegularExpression_3_2 URegularExpression_DRAFT_API_DO_NOT_USE #define UREGEX_CANON_EQ_3_2 UREGEX_CANON_EQ_DRAFT_API_DO_NOT_USE #define UREGEX_UWORD_3_2 UREGEX_UWORD_DRAFT_API_DO_NOT_USE #define uregex_open_3_2 uregex_open_DRAFT_API_DO_NOT_USE #define uregex_openC_3_2 uregex_openC_DRAFT_API_DO_NOT_USE #define uregex_close_3_2 uregex_close_DRAFT_API_DO_NOT_USE #define uregex_clone_3_2 uregex_clone_DRAFT_API_DO_NOT_USE #define uregex_pattern_3_2 uregex_pattern_DRAFT_API_DO_NOT_USE #define uregex_flags_3_2 uregex_flags_DRAFT_API_DO_NOT_USE #define uregex_setText_3_2 uregex_setText_DRAFT_API_DO_NOT_USE #define uregex_getText_3_2 uregex_getText_DRAFT_API_DO_NOT_USE #define uregex_matches_3_2 uregex_matches_DRAFT_API_DO_NOT_USE #define uregex_lookingAt_3_2 uregex_lookingAt_DRAFT_API_DO_NOT_USE #define uregex_find_3_2 uregex_find_DRAFT_API_DO_NOT_USE #define uregex_findNext_3_2 uregex_findNext_DRAFT_API_DO_NOT_USE #define uregex_groupCount_3_2 uregex_groupCount_DRAFT_API_DO_NOT_USE #define uregex_group_3_2 uregex_group_DRAFT_API_DO_NOT_USE #define uregex_start_3_2 uregex_start_DRAFT_API_DO_NOT_USE #define uregex_end_3_2 uregex_end_DRAFT_API_DO_NOT_USE #define uregex_reset_3_2 uregex_reset_DRAFT_API_DO_NOT_USE #define uregex_replaceAll_3_2 uregex_replaceAll_DRAFT_API_DO_NOT_USE #define uregex_replaceFirst_3_2 uregex_replaceFirst_DRAFT_API_DO_NOT_USE #define uregex_appendReplacement_3_2 uregex_appendReplacement_DRAFT_API_DO_NOT_USE #define uregex_appendTail_3_2 uregex_appendTail_DRAFT_API_DO_NOT_USE #define uregex_split_3_2 uregex_split_DRAFT_API_DO_NOT_USE #define ures_getLocaleByType_3_2 ures_getLocaleByType_DRAFT_API_DO_NOT_USE #define ures_openAvailableLocales_3_2 ures_openAvailableLocales_DRAFT_API_DO_NOT_USE #define USCRIPT_KATAKANA_OR_HIRAGANA_3_2 USCRIPT_KATAKANA_OR_HIRAGANA_DRAFT_API_DO_NOT_USE #define USET_ADD_CASE_MAPPINGS_3_2 USET_ADD_CASE_MAPPINGS_DRAFT_API_DO_NOT_USE #define uset_set_3_2 uset_set_DRAFT_API_DO_NOT_USE #define uset_applyPattern_3_2 uset_applyPattern_DRAFT_API_DO_NOT_USE #define uset_applyIntPropertyValue_3_2 uset_applyIntPropertyValue_DRAFT_API_DO_NOT_USE #define uset_applyPropertyAlias_3_2 uset_applyPropertyAlias_DRAFT_API_DO_NOT_USE #define uset_resemblesPattern_3_2 uset_resemblesPattern_DRAFT_API_DO_NOT_USE #define uset_removeAll_3_2 uset_removeAll_DRAFT_API_DO_NOT_USE #define uset_retain_3_2 uset_retain_DRAFT_API_DO_NOT_USE #define uset_retainAll_3_2 uset_retainAll_DRAFT_API_DO_NOT_USE #define uset_compact_3_2 uset_compact_DRAFT_API_DO_NOT_USE #define uset_complementAll_3_2 uset_complementAll_DRAFT_API_DO_NOT_USE #define uset_indexOf_3_2 uset_indexOf_DRAFT_API_DO_NOT_USE #define uset_charAt_3_2 uset_charAt_DRAFT_API_DO_NOT_USE #define uset_containsAll_3_2 uset_containsAll_DRAFT_API_DO_NOT_USE #define uset_containsNone_3_2 uset_containsNone_DRAFT_API_DO_NOT_USE #define uset_containsSome_3_2 uset_containsSome_DRAFT_API_DO_NOT_USE #define uset_equals_3_2 uset_equals_DRAFT_API_DO_NOT_USE #define USPREP_DEFAULT_3_2 USPREP_DEFAULT_DRAFT_API_DO_NOT_USE #define USPREP_ALLOW_UNASSIGNED_3_2 USPREP_ALLOW_UNASSIGNED_DRAFT_API_DO_NOT_USE #define UStringPrepProfile_3_2 UStringPrepProfile_DRAFT_API_DO_NOT_USE #define usprep_open_3_2 usprep_open_DRAFT_API_DO_NOT_USE #define usprep_close_3_2 usprep_close_DRAFT_API_DO_NOT_USE #define usprep_prepare_3_2 usprep_prepare_DRAFT_API_DO_NOT_USE #define U_IS_BMP_3_2 U_IS_BMP_DRAFT_API_DO_NOT_USE #define U_IS_SUPPLEMENTARY_3_2 U_IS_SUPPLEMENTARY_DRAFT_API_DO_NOT_USE #define UDateTimeScale_3_2 UDateTimeScale_DRAFT_API_DO_NOT_USE #define UDTS_JAVA_TIME_3_2 UDTS_JAVA_TIME_DRAFT_API_DO_NOT_USE #define UDTS_UNIX_TIME_3_2 UDTS_UNIX_TIME_DRAFT_API_DO_NOT_USE #define UDTS_ICU4C_TIME_3_2 UDTS_ICU4C_TIME_DRAFT_API_DO_NOT_USE #define UDTS_WINDOWS_FILE_TIME_3_2 UDTS_WINDOWS_FILE_TIME_DRAFT_API_DO_NOT_USE #define UDTS_WINDOWS_DATE_TIME_3_2 UDTS_WINDOWS_DATE_TIME_DRAFT_API_DO_NOT_USE #define UDTS_MAC_OLD_TIME_3_2 UDTS_MAC_OLD_TIME_DRAFT_API_DO_NOT_USE #define UDTS_MAC_TIME_3_2 UDTS_MAC_TIME_DRAFT_API_DO_NOT_USE #define UDTS_EXCEL_TIME_3_2 UDTS_EXCEL_TIME_DRAFT_API_DO_NOT_USE #define UDTS_DB2_TIME_3_2 UDTS_DB2_TIME_DRAFT_API_DO_NOT_USE #define UDTS_MAX_SCALE_3_2 UDTS_MAX_SCALE_DRAFT_API_DO_NOT_USE #define UDateTimeScale_3_2 UDateTimeScale_DRAFT_API_DO_NOT_USE #define UTSV_UNITS_VALUE_3_2 UTSV_UNITS_VALUE_DRAFT_API_DO_NOT_USE #define UTSV_EPOCH_OFFSET_VALUE_3_2 UTSV_EPOCH_OFFSET_VALUE_DRAFT_API_DO_NOT_USE #define UTSV_FROM_MIN_VALUE_3_2 UTSV_FROM_MIN_VALUE_DRAFT_API_DO_NOT_USE #define UTSV_FROM_MAX_VALUE_3_2 UTSV_FROM_MAX_VALUE_DRAFT_API_DO_NOT_USE #define UTSV_TO_MIN_VALUE_3_2 UTSV_TO_MIN_VALUE_DRAFT_API_DO_NOT_USE #define UTSV_TO_MAX_VALUE_3_2 UTSV_TO_MAX_VALUE_DRAFT_API_DO_NOT_USE #define UTSV_EPOCH_OFFSET_PLUS_1_VALUE_3_2 UTSV_EPOCH_OFFSET_PLUS_1_VALUE_DRAFT_API_DO_NOT_USE #define UTSV_EPOCH_OFFSET_MINUS_1_VALUE_3_2 UTSV_EPOCH_OFFSET_MINUS_1_VALUE_DRAFT_API_DO_NOT_USE #define utmscale_getTimeScaleValue_3_2 utmscale_getTimeScaleValue_DRAFT_API_DO_NOT_USE #define utmscale_fromInt64_3_2 utmscale_fromInt64_DRAFT_API_DO_NOT_USE #define utmscale_toInt64_3_2 utmscale_toInt64_DRAFT_API_DO_NOT_USE #define UTraceLevel_3_2 UTraceLevel_DRAFT_API_DO_NOT_USE #define UTraceFunctionNumber_3_2 UTraceFunctionNumber_DRAFT_API_DO_NOT_USE #define UTraceEntry_3_2 UTraceEntry_DRAFT_API_DO_NOT_USE #define UTraceExit_3_2 UTraceExit_DRAFT_API_DO_NOT_USE #define UTraceData_3_2 UTraceData_DRAFT_API_DO_NOT_USE #define UTRACE_OFF_3_2 UTRACE_OFF_DRAFT_API_DO_NOT_USE #define UTRACE_ERROR_3_2 UTRACE_ERROR_DRAFT_API_DO_NOT_USE #define UTRACE_WARNING_3_2 UTRACE_WARNING_DRAFT_API_DO_NOT_USE #define UTRACE_OPEN_CLOSE_3_2 UTRACE_OPEN_CLOSE_DRAFT_API_DO_NOT_USE #define UTRACE_INFO_3_2 UTRACE_INFO_DRAFT_API_DO_NOT_USE #define UTRACE_VERBOSE_3_2 UTRACE_VERBOSE_DRAFT_API_DO_NOT_USE #define UTraceLevel_3_2 UTraceLevel_DRAFT_API_DO_NOT_USE #define UTraceFunctionNumber_3_2 UTraceFunctionNumber_DRAFT_API_DO_NOT_USE #define utrace_setLevel_3_2 utrace_setLevel_DRAFT_API_DO_NOT_USE #define utrace_getLevel_3_2 utrace_getLevel_DRAFT_API_DO_NOT_USE #define utrace_setFunctions_3_2 utrace_setFunctions_DRAFT_API_DO_NOT_USE #define utrace_getFunctions_3_2 utrace_getFunctions_DRAFT_API_DO_NOT_USE #define utrace_vformat_3_2 utrace_vformat_DRAFT_API_DO_NOT_USE #define utrace_format_3_2 utrace_format_DRAFT_API_DO_NOT_USE #define utrace_functionName_3_2 utrace_functionName_DRAFT_API_DO_NOT_USE #define utrans_openU_3_2 utrans_openU_DRAFT_API_DO_NOT_USE #define utrans_getUnicodeID_3_2 utrans_getUnicodeID_DRAFT_API_DO_NOT_USE #define utrans_unregisterID_3_2 utrans_unregisterID_DRAFT_API_DO_NOT_USE #define utrans_openIDs_3_2 utrans_openIDs_DRAFT_API_DO_NOT_USE #define U_DATA_API_3_2 U_DATA_API_DRAFT_API_DO_NOT_USE #define unistr_3_2 unistr_DRAFT_API_DO_NOT_USE #define UnicodeSet_3_2 UnicodeSet_DRAFT_API_DO_NOT_USE #define UnicodeString_3_2 UnicodeString_DRAFT_API_DO_NOT_USE #endif /* U_HIDE_DRAFT_API */ #endif /* UDRAFT_H */
16,227
C++
.h
241
66.311203
108
0.801327
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
33,946
platform.h
supercollider_supercollider/external_libraries/icu/unicode/platform.h
/* ****************************************************************************** * * Copyright (C) 1997-2004, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * * FILE NAME : platform.h * * Date Name Description * 05/13/98 nos Creation (content moved here from ptypes.h). * 03/02/99 stephen Added AS400 support. * 03/30/99 stephen Added Linux support. * 04/13/99 stephen Reworked for autoconf. ****************************************************************************** */ /* Define the platform we're on. */ #ifndef U_DARWIN #define U_DARWIN #endif /* Define whether inttypes.h is available */ #ifndef U_HAVE_INTTYPES_H #define U_HAVE_INTTYPES_H 1 #endif /* * Define what support for C++ streams is available. * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available * (1997711 is the date the ISO/IEC C++ FDIS was published), and then * one should qualify streams using the std namespace in ICU header * files. * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is * available instead (198506 is the date when Stroustrup published * "An Extensible I/O Facility for C++" at the summer USENIX conference). * If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and * support for them will be silently suppressed in ICU. * */ #ifndef U_IOSTREAM_SOURCE #define U_IOSTREAM_SOURCE 199711 #endif /* Determines whether specific types are available */ #ifndef U_HAVE_INT8_T #define U_HAVE_INT8_T 1 #endif #ifndef U_HAVE_UINT8_T #define U_HAVE_UINT8_T 1 #endif #ifndef U_HAVE_INT16_T #define U_HAVE_INT16_T 1 #endif #ifndef U_HAVE_UINT16_T #define U_HAVE_UINT16_T 1 #endif #ifndef U_HAVE_INT32_T #define U_HAVE_INT32_T 1 #endif #ifndef U_HAVE_UINT32_T #define U_HAVE_UINT32_T 1 #endif #ifndef U_HAVE_INT64_T #define U_HAVE_INT64_T 1 #endif #ifndef U_HAVE_UINT64_T #define U_HAVE_UINT64_T 1 #endif /*===========================================================================*/ /* Generic data types */ /*===========================================================================*/ #include <sys/types.h> /* If your platform does not have the <inttypes.h> header, you may need to edit the typedefs below. */ #if U_HAVE_INTTYPES_H /* autoconf 2.13 sometimes can't properly find the data types in <inttypes.h> */ /* os/390 needs <inttypes.h>, but it doesn't have int8_t, and it sometimes */ /* doesn't have uint8_t depending on the OS version. */ /* So we have this work around. */ #ifdef OS390 /* The features header is needed to get (u)int64_t sometimes. */ #include <features.h> #if ! U_HAVE_INT8_T typedef signed char int8_t; #endif #if !defined(__uint8_t) #define __uint8_t 1 typedef unsigned char uint8_t; #endif #endif /* OS390 */ #include <inttypes.h> #else /* U_HAVE_INTTYPES_H */ #if ! U_HAVE_INT8_T typedef signed char int8_t; #endif #if ! U_HAVE_UINT8_T typedef unsigned char uint8_t; #endif #if ! U_HAVE_INT16_T typedef signed short int16_t; #endif #if ! U_HAVE_UINT16_T typedef unsigned short uint16_t; #endif #if ! U_HAVE_INT32_T typedef signed int int32_t; #endif #if ! U_HAVE_UINT32_T typedef unsigned int uint32_t; #endif #if ! U_HAVE_INT64_T typedef signed long long int64_t; /* else we may not have a 64-bit type */ #endif #if ! U_HAVE_UINT64_T typedef unsigned long long uint64_t; /* else we may not have a 64-bit type */ #endif #endif /*===========================================================================*/ /* Compiler and environment features */ /*===========================================================================*/ /* Define whether namespace is supported */ #ifndef U_HAVE_NAMESPACE #define U_HAVE_NAMESPACE 1 #endif /* Determines the endianness of the platform It's done this way in case multiple architectures are being built at once. For example, Darwin supports fat binaries, which can be both PPC and x86 based. */ #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) #define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN) #else #define U_IS_BIG_ENDIAN 1 #endif /* 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */ #define ICU_USE_THREADS 1 #ifndef U_DEBUG #define U_DEBUG 0 #endif #ifndef U_RELEASE #define U_RELEASE 1 #endif /* Determine whether to disable renaming or not. This overrides the setting in umachine.h which is for all platforms. */ #ifndef U_DISABLE_RENAMING #define U_DISABLE_RENAMING 0 #endif /* Determine whether to override new and delete. */ #ifndef U_OVERRIDE_CXX_ALLOCATION #define U_OVERRIDE_CXX_ALLOCATION 1 #endif /* Determine whether to override placement new and delete for STL. */ #ifndef U_HAVE_PLACEMENT_NEW #define U_HAVE_PLACEMENT_NEW 1 #endif /* Determine whether to enable tracing. */ #ifndef U_ENABLE_TRACING #define U_ENABLE_TRACING 1 #endif /* Define the library suffix in a C syntax. */ #define U_HAVE_LIB_SUFFIX 0 #define U_LIB_SUFFIX_C_NAME #define U_LIB_SUFFIX_C_NAME_STRING "" /*===========================================================================*/ /* Character data types */ /*===========================================================================*/ #if ((defined(OS390) && (!defined(__CHARSET_LIB) || !__CHARSET_LIB))) || defined(OS400) # define U_CHARSET_FAMILY 1 #endif /*===========================================================================*/ /* Information about wchar support */ /*===========================================================================*/ #define U_HAVE_WCHAR_H 1 #define U_SIZEOF_WCHAR_T 4 #define U_HAVE_WCSCPY 1 /*===========================================================================*/ /* Information about POSIX support */ /*===========================================================================*/ #define U_HAVE_NL_LANGINFO 1 #define U_HAVE_NL_LANGINFO_CODESET 1 #define U_NL_LANGINFO_CODESET CODESET #if 1 #define U_TZSET tzset #endif #if 0 #define U_TIMEZONE #endif #if 1 #define U_TZNAME tzname #endif #define U_HAVE_MMAP 1 #define U_HAVE_POPEN 1 /*===========================================================================*/ /* Symbol import-export control */ /*===========================================================================*/ #define U_EXPORT /* U_CALLCONV is releated to U_EXPORT2 */ #define U_EXPORT2 /* cygwin needs to export/import data */ #ifdef U_CYGWIN #define U_IMPORT __declspec(dllimport) #else #define U_IMPORT #endif /*===========================================================================*/ /* Code alignment and C function inlining */ /*===========================================================================*/ #ifndef U_INLINE #define U_INLINE inline #endif #define U_ALIGN_CODE(n) /*===========================================================================*/ /* Programs used by ICU code */ /*===========================================================================*/ #define U_MAKE "/usr/bin/gnumake"
7,437
C++
.h
213
33.511737
87
0.545328
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
33,947
parseerr.h
supercollider_supercollider/external_libraries/icu/unicode/parseerr.h
/* ********************************************************************** * Copyright (C) 1999-2004, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Date Name Description * 03/14/00 aliu Creation. * 06/27/00 aliu Change from C++ class to C struct ********************************************************************** */ #ifndef PARSEERR_H #define PARSEERR_H #include "utypes.h" /** * The capacity of the context strings in UParseError. * @stable ICU 2.0 */ enum { U_PARSE_CONTEXT_LEN = 16 }; /** * A UParseError struct is used to returned detailed information about * parsing errors. It is used by ICU parsing engines that parse long * rules, patterns, or programs, where the text being parsed is long * enough that more information than a UErrorCode is needed to * localize the error. * * <p>The line, offset, and context fields are optional; parsing * engines may choose not to use to use them. * * <p>The preContext and postContext strings include some part of the * context surrounding the error. If the source text is "let for=7" * and "for" is the error (e.g., because it is a reserved word), then * some examples of what a parser might produce are the following: * * <pre> * preContext postContext * "" "" The parser does not support context * "let " "=7" Pre- and post-context only * "let " "for=7" Pre- and post-context and error text * "" "for" Error text only * </pre> * * <p>Examples of engines which use UParseError (or may use it in the * future) are Transliterator, RuleBasedBreakIterator, and * RegexPattern. * * @stable ICU 2.0 */ typedef struct UParseError { /** * The line on which the error occured. If the parser uses this * field, it sets it to the line number of the source text line on * which the error appears, which will be be a value >= 1. If the * parse does not support line numbers, the value will be <= 0. * @stable ICU 2.0 */ int32_t line; /** * The character offset to the error. If the line field is >= 1, * then this is the offset from the start of the line. Otherwise, * this is the offset from the start of the text. If the parser * does not support this field, it will have a value < 0. * @stable ICU 2.0 */ int32_t offset; /** * Textual context before the error. Null-terminated. The empty * string if not supported by parser. * @stable ICU 2.0 */ UChar preContext[U_PARSE_CONTEXT_LEN]; /** * The error itself and/or textual context after the error. * Null-terminated. The empty string if not supported by parser. * @stable ICU 2.0 */ UChar postContext[U_PARSE_CONTEXT_LEN]; } UParseError; #endif
2,970
C++
.h
78
34.858974
70
0.609646
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
true
true
false
false
false
false
false
false
33,948
putil.h
supercollider_supercollider/external_libraries/icu/unicode/putil.h
/* ****************************************************************************** * * Copyright (C) 1997-2004, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * * FILE NAME : putil.h * * Date Name Description * 05/14/98 nos Creation (content moved here from utypes.h). * 06/17/99 erm Added IEEE_754 * 07/22/98 stephen Added IEEEremainder, max, min, trunc * 08/13/98 stephen Added isNegativeInfinity, isPositiveInfinity * 08/24/98 stephen Added longBitsFromDouble * 03/02/99 stephen Removed openFile(). Added AS400 support. * 04/15/99 stephen Converted to C * 11/15/99 helena Integrated S/390 changes for IEEE support. * 01/11/00 helena Added u_getVersion. ****************************************************************************** */ #ifndef PUTIL_H #define PUTIL_H #include "utypes.h" /* Define this to 1 if your platform supports IEEE 754 floating point, to 0 if it does not. */ #ifndef IEEE_754 # define IEEE_754 1 #endif /*==========================================================================*/ /* Platform utilities */ /*==========================================================================*/ /** * Platform utilities isolates the platform dependencies of the * libarary. For each platform which this code is ported to, these * functions may have to be re-implemented. */ /** * Return the ICU data directory. * The data directory is where common format ICU data files (.dat files) * are loaded from. Note that normal use of the built-in ICU * facilities does not require loading of an external data file; * unless you are adding custom data to ICU, the data directory * does not need to be set. * * The data directory is determined as follows: * If u_setDataDirectory() has been called, that is it, otherwise * if the ICU_DATA environment variable is set, use that, otherwise * If a data directory was specifed at ICU build time * (#define ICU_DATA_DIR "path"), use that, * otherwise no data directory is available. * * @return the data directory, or an empty string ("") if no data directory has * been specified. * * @stable ICU 2.0 */ U_STABLE const char* U_EXPORT2 u_getDataDirectory(void); /** * Set the ICU data directory. * The data directory is where common format ICU data files (.dat files) * are loaded from. Note that normal use of the built-in ICU * facilities does not require loading of an external data file; * unless you are adding custom data to ICU, the data directory * does not need to be set. * * This function should be called at most once in a process, before the * first ICU operation (e.g., u_init()) that will require the loading of an * ICU data file. * This function is not thread-safe. Use it before calling ICU APIs from * multiple threads. * * @param directory The directory to be set. * * @see u_init * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory); /** * Please use ucnv_getDefaultName() instead. * Return the default codepage for this platform and locale. * This function can call setlocale() on Unix platforms. Please read the * platform documentation on setlocale() before calling this function. * @return the default codepage for this platform * @internal */ U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void); /** * Please use uloc_getDefault() instead. * Return the default locale ID string by querying ths system, or * zero if one cannot be found. * This function can call setlocale() on Unix platforms. Please read the * platform documentation on setlocale() before calling this function. * @return the default locale ID string * @internal */ U_INTERNAL const char* U_EXPORT2 uprv_getDefaultLocaleID(void); /** * Filesystem file and path separator characters. * Example: '/' and ':' on Unix, '\\' and ';' on Windows. * @stable ICU 2.0 */ #ifdef XP_MAC # define U_FILE_SEP_CHAR ':' # define U_FILE_ALT_SEP_CHAR ':' # define U_PATH_SEP_CHAR ';' # define U_FILE_SEP_STRING ":" # define U_FILE_ALT_SEP_STRING ":" # define U_PATH_SEP_STRING ";" #elif defined(WIN32) || defined(OS2) # define U_FILE_SEP_CHAR '\\' # define U_FILE_ALT_SEP_CHAR '/' # define U_PATH_SEP_CHAR ';' # define U_FILE_SEP_STRING "\\" # define U_FILE_ALT_SEP_STRING "/" # define U_PATH_SEP_STRING ";" #else # define U_FILE_SEP_CHAR '/' # define U_FILE_ALT_SEP_CHAR '/' # define U_PATH_SEP_CHAR ':' # define U_FILE_SEP_STRING "/" # define U_FILE_ALT_SEP_STRING "/" # define U_PATH_SEP_STRING ":" #endif /** * Convert char characters to UChar characters. * This utility function is useful only for "invariant characters" * that are encoded in the platform default encoding. * They are a small, constant subset of the encoding and include * just the latin letters, digits, and some punctuation. * For details, see U_CHARSET_FAMILY. * * @param cs Input string, points to <code>length</code> * character bytes from a subset of the platform encoding. * @param us Output string, points to memory for <code>length</code> * Unicode characters. * @param length The number of characters to convert; this may * include the terminating <code>NUL</code>. * * @see U_CHARSET_FAMILY * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 u_charsToUChars(const char *cs, UChar *us, int32_t length); /** * Convert UChar characters to char characters. * This utility function is useful only for "invariant characters" * that can be encoded in the platform default encoding. * They are a small, constant subset of the encoding and include * just the latin letters, digits, and some punctuation. * For details, see U_CHARSET_FAMILY. * * @param us Input string, points to <code>length</code> * Unicode characters that can be encoded with the * codepage-invariant subset of the platform encoding. * @param cs Output string, points to memory for <code>length</code> * character bytes. * @param length The number of characters to convert; this may * include the terminating <code>NUL</code>. * * @see U_CHARSET_FAMILY * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 u_UCharsToChars(const UChar *us, char *cs, int32_t length); #endif
6,530
C++
.h
167
37.437126
79
0.657953
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
33,949
utf16.h
supercollider_supercollider/external_libraries/icu/unicode/utf16.h
/* ******************************************************************************* * * Copyright (C) 1999-2004, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: utf16.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 1999sep09 * created by: Markus W. Scherer */ /** * \file * \brief C API: 16-bit Unicode handling macros * * This file defines macros to deal with 16-bit Unicode (UTF-16) code units and strings. * utf16.h is included by utf.h after unicode/umachine.h * and some common definitions. * * For more information see utf.h and the ICU User Guide Strings chapter * (http://oss.software.ibm.com/icu/userguide/). * * <em>Usage:</em> * ICU coding guidelines for if() statements should be followed when using these macros. * Compound statements (curly braces {}) must be used for if-else-while... * bodies and all macro statements should be terminated with semicolon. */ #ifndef __UTF16_H__ #define __UTF16_H__ /* utf.h must be included first. */ #ifndef __UTF_H__ # include "utf.h" #endif /* single-code point definitions -------------------------------------------- */ /** * Does this code unit alone encode a code point (BMP, not a surrogate)? * @param c 16-bit code unit * @return TRUE or FALSE * @stable ICU 2.4 */ #define U16_IS_SINGLE(c) !U_IS_SURROGATE(c) /** * Is this code unit a lead surrogate (U+d800..U+dbff)? * @param c 16-bit code unit * @return TRUE or FALSE * @stable ICU 2.4 */ #define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800) /** * Is this code unit a trail surrogate (U+dc00..U+dfff)? * @param c 16-bit code unit * @return TRUE or FALSE * @stable ICU 2.4 */ #define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00) /** * Is this code unit a surrogate (U+d800..U+dfff)? * @param c 16-bit code unit * @return TRUE or FALSE * @stable ICU 2.4 */ #define U16_IS_SURROGATE(c) U_IS_SURROGATE(c) /** * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)), * is it a lead surrogate? * @param c 16-bit code unit * @return TRUE or FALSE * @stable ICU 2.4 */ #define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0) /** * Helper constant for U16_GET_SUPPLEMENTARY. * @internal */ #define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000) /** * Get a supplementary code point value (U+10000..U+10ffff) * from its lead and trail surrogates. * The result is undefined if the input values are not * lead and trail surrogates. * * @param lead lead surrogate (U+d800..U+dbff) * @param trail trail surrogate (U+dc00..U+dfff) * @return supplementary code point (U+10000..U+10ffff) * @stable ICU 2.4 */ #define U16_GET_SUPPLEMENTARY(lead, trail) \ (((UChar32)(lead)<<10UL)+(UChar32)(trail)-U16_SURROGATE_OFFSET) /** * Get the lead surrogate (0xd800..0xdbff) for a * supplementary code point (0x10000..0x10ffff). * @param supplementary 32-bit code point (U+10000..U+10ffff) * @return lead surrogate (U+d800..U+dbff) for supplementary * @stable ICU 2.4 */ #define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0) /** * Get the trail surrogate (0xdc00..0xdfff) for a * supplementary code point (0x10000..0x10ffff). * @param supplementary 32-bit code point (U+10000..U+10ffff) * @return trail surrogate (U+dc00..U+dfff) for supplementary * @stable ICU 2.4 */ #define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00) /** * How many 16-bit code units are used to encode this Unicode code point? (1 or 2) * The result is not defined if c is not a Unicode code point (U+0000..U+10ffff). * @param c 32-bit code point * @return 1 or 2 * @stable ICU 2.4 */ #define U16_LENGTH(c) ((uint32_t)(c)<=0xffff ? 1 : 2) /** * The maximum number of 16-bit code units per Unicode code point (U+0000..U+10ffff). * @return 2 * @stable ICU 2.4 */ #define U16_MAX_LENGTH 2 /** * Get a code point from a string at a random-access offset, * without changing the offset. * "Unsafe" macro, assumes well-formed UTF-16. * * The offset may point to either the lead or trail surrogate unit * for a supplementary code point, in which case the macro will read * the adjacent matching surrogate as well. * The result is undefined if the offset points to a single, unpaired surrogate. * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT. * * @param s const UChar * string * @param i string offset * @param c output UChar32 variable * @see U16_GET * @stable ICU 2.4 */ #define U16_GET_UNSAFE(s, i, c) { \ (c)=(s)[i]; \ if(U16_IS_SURROGATE(c)) { \ if(U16_IS_SURROGATE_LEAD(c)) { \ (c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)+1]); \ } else { \ (c)=U16_GET_SUPPLEMENTARY((s)[(i)-1], (c)); \ } \ } \ } /** * Get a code point from a string at a random-access offset, * without changing the offset. * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * The offset may point to either the lead or trail surrogate unit * for a supplementary code point, in which case the macro will read * the adjacent matching surrogate as well. * If the offset points to a single, unpaired surrogate, then that itself * will be returned as the code point. * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT. * * @param s const UChar * string * @param start starting string offset (usually 0) * @param i string offset, start<=i<length * @param length string length * @param c output UChar32 variable * @see U16_GET_UNSAFE * @stable ICU 2.4 */ #define U16_GET(s, start, i, length, c) { \ (c)=(s)[i]; \ if(U16_IS_SURROGATE(c)) { \ uint16_t __c2; \ if(U16_IS_SURROGATE_LEAD(c)) { \ if((i)+1<(length) && U16_IS_TRAIL(__c2=(s)[(i)+1])) { \ (c)=U16_GET_SUPPLEMENTARY((c), __c2); \ } \ } else { \ if((i)-1>=(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \ (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \ } \ } \ } \ } /* definitions with forward iteration --------------------------------------- */ /** * Get a code point from a string at a code point boundary offset, * and advance the offset to the next code point boundary. * (Post-incrementing forward iteration.) * "Unsafe" macro, assumes well-formed UTF-16. * * The offset may point to the lead surrogate unit * for a supplementary code point, in which case the macro will read * the following trail surrogate as well. * If the offset points to a trail surrogate, then that itself * will be returned as the code point. * The result is undefined if the offset points to a single, unpaired lead surrogate. * * @param s const UChar * string * @param i string offset * @param c output UChar32 variable * @see U16_NEXT * @stable ICU 2.4 */ #define U16_NEXT_UNSAFE(s, i, c) { \ (c)=(s)[(i)++]; \ if(U16_IS_LEAD(c)) { \ (c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)++]); \ } \ } /** * Get a code point from a string at a code point boundary offset, * and advance the offset to the next code point boundary. * (Post-incrementing forward iteration.) * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * The offset may point to the lead surrogate unit * for a supplementary code point, in which case the macro will read * the following trail surrogate as well. * If the offset points to a trail surrogate or * to a single, unpaired lead surrogate, then that itself * will be returned as the code point. * * @param s const UChar * string * @param i string offset, i<length * @param length string length * @param c output UChar32 variable * @see U16_NEXT_UNSAFE * @stable ICU 2.4 */ #define U16_NEXT(s, i, length, c) { \ (c)=(s)[(i)++]; \ if(U16_IS_LEAD(c)) { \ uint16_t __c2; \ if((i)<(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \ ++(i); \ (c)=U16_GET_SUPPLEMENTARY((c), __c2); \ } \ } \ } /** * Append a code point to a string, overwriting 1 or 2 code units. * The offset points to the current end of the string contents * and is advanced (post-increment). * "Unsafe" macro, assumes a valid code point and sufficient space in the string. * Otherwise, the result is undefined. * * @param s const UChar * string buffer * @param i string offset * @param c code point to append * @see U16_APPEND * @stable ICU 2.4 */ #define U16_APPEND_UNSAFE(s, i, c) { \ if((uint32_t)(c)<=0xffff) { \ (s)[(i)++]=(uint16_t)(c); \ } else { \ (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \ (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \ } \ } /** * Append a code point to a string, overwriting 1 or 2 code units. * The offset points to the current end of the string contents * and is advanced (post-increment). * "Safe" macro, checks for a valid code point. * If a surrogate pair is written, checks for sufficient space in the string. * If the code point is not valid or a trail surrogate does not fit, * then isError is set to TRUE. * * @param s const UChar * string buffer * @param i string offset, i<length * @param capacity size of the string buffer * @param c code point to append * @param isError output UBool set to TRUE if an error occurs, otherwise not modified * @see U16_APPEND_UNSAFE * @stable ICU 2.4 */ #define U16_APPEND(s, i, capacity, c, isError) { \ if((uint32_t)(c)<=0xffff) { \ (s)[(i)++]=(uint16_t)(c); \ } else if((uint32_t)(c)<=0x10ffff && (i)+1<(capacity)) { \ (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \ (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \ } else /* c>0x10ffff or not enough space */ { \ (isError)=TRUE; \ } \ } /** * Advance the string offset from one code point boundary to the next. * (Post-incrementing iteration.) * "Unsafe" macro, assumes well-formed UTF-16. * * @param s const UChar * string * @param i string offset * @see U16_FWD_1 * @stable ICU 2.4 */ #define U16_FWD_1_UNSAFE(s, i) { \ if(U16_IS_LEAD((s)[(i)++])) { \ ++(i); \ } \ } /** * Advance the string offset from one code point boundary to the next. * (Post-incrementing iteration.) * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * @param s const UChar * string * @param i string offset, i<length * @param length string length * @see U16_FWD_1_UNSAFE * @stable ICU 2.4 */ #define U16_FWD_1(s, i, length) { \ if(U16_IS_LEAD((s)[(i)++]) && (i)<(length) && U16_IS_TRAIL((s)[i])) { \ ++(i); \ } \ } /** * Advance the string offset from one code point boundary to the n-th next one, * i.e., move forward by n code points. * (Post-incrementing iteration.) * "Unsafe" macro, assumes well-formed UTF-16. * * @param s const UChar * string * @param i string offset * @param n number of code points to skip * @see U16_FWD_N * @stable ICU 2.4 */ #define U16_FWD_N_UNSAFE(s, i, n) { \ int32_t __N=(n); \ while(__N>0) { \ U16_FWD_1_UNSAFE(s, i); \ --__N; \ } \ } /** * Advance the string offset from one code point boundary to the n-th next one, * i.e., move forward by n code points. * (Post-incrementing iteration.) * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * @param s const UChar * string * @param i string offset, i<length * @param length string length * @param n number of code points to skip * @see U16_FWD_N_UNSAFE * @stable ICU 2.4 */ #define U16_FWD_N(s, i, length, n) { \ int32_t __N=(n); \ while(__N>0 && (i)<(length)) { \ U16_FWD_1(s, i, length); \ --__N; \ } \ } /** * Adjust a random-access offset to a code point boundary * at the start of a code point. * If the offset points to the trail surrogate of a surrogate pair, * then the offset is decremented. * Otherwise, it is not modified. * "Unsafe" macro, assumes well-formed UTF-16. * * @param s const UChar * string * @param i string offset * @see U16_SET_CP_START * @stable ICU 2.4 */ #define U16_SET_CP_START_UNSAFE(s, i) { \ if(U16_IS_TRAIL((s)[i])) { \ --(i); \ } \ } /** * Adjust a random-access offset to a code point boundary * at the start of a code point. * If the offset points to the trail surrogate of a surrogate pair, * then the offset is decremented. * Otherwise, it is not modified. * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * @param s const UChar * string * @param start starting string offset (usually 0) * @param i string offset, start<=i * @see U16_SET_CP_START_UNSAFE * @stable ICU 2.4 */ #define U16_SET_CP_START(s, start, i) { \ if(U16_IS_TRAIL((s)[i]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \ --(i); \ } \ } /* definitions with backward iteration -------------------------------------- */ /** * Move the string offset from one code point boundary to the previous one * and get the code point between them. * (Pre-decrementing backward iteration.) * "Unsafe" macro, assumes well-formed UTF-16. * * The input offset may be the same as the string length. * If the offset is behind a trail surrogate unit * for a supplementary code point, then the macro will read * the preceding lead surrogate as well. * If the offset is behind a lead surrogate, then that itself * will be returned as the code point. * The result is undefined if the offset is behind a single, unpaired trail surrogate. * * @param s const UChar * string * @param i string offset * @param c output UChar32 variable * @see U16_PREV * @stable ICU 2.4 */ #define U16_PREV_UNSAFE(s, i, c) { \ (c)=(s)[--(i)]; \ if(U16_IS_TRAIL(c)) { \ (c)=U16_GET_SUPPLEMENTARY((s)[--(i)], (c)); \ } \ } /** * Move the string offset from one code point boundary to the previous one * and get the code point between them. * (Pre-decrementing backward iteration.) * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * The input offset may be the same as the string length. * If the offset is behind a trail surrogate unit * for a supplementary code point, then the macro will read * the preceding lead surrogate as well. * If the offset is behind a lead surrogate or behind a single, unpaired * trail surrogate, then that itself * will be returned as the code point. * * @param s const UChar * string * @param start starting string offset (usually 0) * @param i string offset, start<=i * @param c output UChar32 variable * @see U16_PREV_UNSAFE * @stable ICU 2.4 */ #define U16_PREV(s, start, i, c) { \ (c)=(s)[--(i)]; \ if(U16_IS_TRAIL(c)) { \ uint16_t __c2; \ if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \ --(i); \ (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \ } \ } \ } /** * Move the string offset from one code point boundary to the previous one. * (Pre-decrementing backward iteration.) * The input offset may be the same as the string length. * "Unsafe" macro, assumes well-formed UTF-16. * * @param s const UChar * string * @param i string offset * @see U16_BACK_1 * @stable ICU 2.4 */ #define U16_BACK_1_UNSAFE(s, i) { \ if(U16_IS_TRAIL((s)[--(i)])) { \ --(i); \ } \ } /** * Move the string offset from one code point boundary to the previous one. * (Pre-decrementing backward iteration.) * The input offset may be the same as the string length. * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * @param s const UChar * string * @param start starting string offset (usually 0) * @param i string offset, start<=i * @see U16_BACK_1_UNSAFE * @stable ICU 2.4 */ #define U16_BACK_1(s, start, i) { \ if(U16_IS_TRAIL((s)[--(i)]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \ --(i); \ } \ } /** * Move the string offset from one code point boundary to the n-th one before it, * i.e., move backward by n code points. * (Pre-decrementing backward iteration.) * The input offset may be the same as the string length. * "Unsafe" macro, assumes well-formed UTF-16. * * @param s const UChar * string * @param i string offset * @param n number of code points to skip * @see U16_BACK_N * @stable ICU 2.4 */ #define U16_BACK_N_UNSAFE(s, i, n) { \ int32_t __N=(n); \ while(__N>0) { \ U16_BACK_1_UNSAFE(s, i); \ --__N; \ } \ } /** * Move the string offset from one code point boundary to the n-th one before it, * i.e., move backward by n code points. * (Pre-decrementing backward iteration.) * The input offset may be the same as the string length. * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * @param s const UChar * string * @param start start of string * @param i string offset, i<length * @param n number of code points to skip * @see U16_BACK_N_UNSAFE * @stable ICU 2.4 */ #define U16_BACK_N(s, start, i, n) { \ int32_t __N=(n); \ while(__N>0 && (i)>(start)) { \ U16_BACK_1(s, start, i); \ --__N; \ } \ } /** * Adjust a random-access offset to a code point boundary after a code point. * If the offset is behind the lead surrogate of a surrogate pair, * then the offset is incremented. * Otherwise, it is not modified. * The input offset may be the same as the string length. * "Unsafe" macro, assumes well-formed UTF-16. * * @param s const UChar * string * @param i string offset * @see U16_SET_CP_LIMIT * @stable ICU 2.4 */ #define U16_SET_CP_LIMIT_UNSAFE(s, i) { \ if(U16_IS_LEAD((s)[(i)-1])) { \ ++(i); \ } \ } /** * Adjust a random-access offset to a code point boundary after a code point. * If the offset is behind the lead surrogate of a surrogate pair, * then the offset is incremented. * Otherwise, it is not modified. * The input offset may be the same as the string length. * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * @param s const UChar * string * @param start starting string offset (usually 0) * @param i string offset, start<=i<=length * @param length string length * @see U16_SET_CP_LIMIT_UNSAFE * @stable ICU 2.4 */ #define U16_SET_CP_LIMIT(s, start, i, length) { \ if((start)<(i) && (i)<(length) && U16_IS_LEAD((s)[(i)-1]) && U16_IS_TRAIL((s)[i])) { \ ++(i); \ } \ } #endif
18,469
C++
.h
566
29.749117
90
0.648007
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
33,950
umachine.h
supercollider_supercollider/external_libraries/icu/unicode/umachine.h
/* ****************************************************************************** * * Copyright (C) 1999-2004, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * file name: umachine.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 1999sep13 * created by: Markus W. Scherer * * This file defines basic types and constants for utf.h to be * platform-independent. umachine.h and utf.h are included into * utypes.h to provide all the general definitions for ICU. * All of these definitions used to be in utypes.h before * the UTF-handling macros made this unmaintainable. */ #ifndef __UMACHINE_H__ #define __UMACHINE_H__ /** * \file * \brief Basic types and constants for UTF * * <h2> Basic types and constants for UTF </h2> * This file defines basic types and constants for utf.h to be * platform-independent. umachine.h and utf.h are included into * utypes.h to provide all the general definitions for ICU. * All of these definitions used to be in utypes.h before * the UTF-handling macros made this unmaintainable. * */ /*==========================================================================*/ /* Include platform-dependent definitions */ /* which are contained in the platform-specific file platform.h */ /*==========================================================================*/ #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) # include "pwin32.h" #else # include "platform.h" #endif /* * ANSI C headers: * stddef.h defines wchar_t */ #include <stddef.h> /*==========================================================================*/ /* XP_CPLUSPLUS is a cross-platform symbol which should be defined when */ /* using C++. It should not be defined when compiling under C. */ /*==========================================================================*/ #ifdef __cplusplus # ifndef XP_CPLUSPLUS # define XP_CPLUSPLUS # endif #else # undef XP_CPLUSPLUS #endif /*==========================================================================*/ /* For C wrappers, we use the symbol U_STABLE. */ /* This works properly if the includer is C or C++. */ /* Functions are declared U_STABLE return-type U_EXPORT2 function-name()... */ /*==========================================================================*/ /** * \def U_CFUNC * This is used in a declaration of a library private ICU C function. * @stable ICU 2.4 */ /** * \def U_CDECL_BEGIN * This is used to begin a declaration of a library private ICU C API. * @stable ICU 2.4 */ /** * \def U_CDECL_END * This is used to end a declaration of a library private ICU C API * @stable ICU 2.4 */ #ifdef XP_CPLUSPLUS # define U_CFUNC extern "C" # define U_CDECL_BEGIN extern "C" { # define U_CDECL_END } #else # define U_CFUNC extern # define U_CDECL_BEGIN # define U_CDECL_END #endif /** * \def U_NAMESPACE_BEGIN * This is used to begin a declaration of a public ICU C++ API. * If the compiler doesn't support namespaces, this does nothing. * @stable ICU 2.4 */ /** * \def U_NAMESPACE_END * This is used to end a declaration of a public ICU C++ API * If the compiler doesn't support namespaces, this does nothing. * @stable ICU 2.4 */ /** * \def U_NAMESPACE_USE * This is used to specify that the rest of the code uses the * public ICU C++ API namespace. * If the compiler doesn't support namespaces, this does nothing. * @stable ICU 2.4 */ /** * \def U_NAMESPACE_QUALIFIER * This is used to qualify that a function or class is part of * the public ICU C++ API namespace. * If the compiler doesn't support namespaces, this does nothing. * @stable ICU 2.4 */ /* Define namespace symbols if the compiler supports it. */ #if U_HAVE_NAMESPACE # define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE { # define U_NAMESPACE_END } # define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE; # define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE:: #else # define U_NAMESPACE_BEGIN # define U_NAMESPACE_END # define U_NAMESPACE_USE # define U_NAMESPACE_QUALIFIER #endif /** This is used to declare a function as a public ICU C API @stable ICU 2.0*/ #define U_CAPI U_CFUNC U_EXPORT #define U_STABLE U_CAPI #define U_DRAFT U_CAPI #define U_DEPRECATED U_CAPI #define U_OBSOLETE U_CAPI #define U_INTERNAL U_CAPI /*==========================================================================*/ /* limits for int32_t etc., like in POSIX inttypes.h */ /*==========================================================================*/ #ifndef INT8_MIN /** The smallest value an 8 bit signed integer can hold @stable ICU 2.0 */ # define INT8_MIN ((int8_t)(-128)) #endif #ifndef INT16_MIN /** The smallest value a 16 bit signed integer can hold @stable ICU 2.0 */ # define INT16_MIN ((int16_t)(-32767-1)) #endif #ifndef INT32_MIN /** The smallest value a 32 bit signed integer can hold @stable ICU 2.0 */ # define INT32_MIN ((int32_t)(-2147483647-1)) #endif #ifndef INT8_MAX /** The largest value an 8 bit signed integer can hold @stable ICU 2.0 */ # define INT8_MAX ((int8_t)(127)) #endif #ifndef INT16_MAX /** The largest value a 16 bit signed integer can hold @stable ICU 2.0 */ # define INT16_MAX ((int16_t)(32767)) #endif #ifndef INT32_MAX /** The largest value a 32 bit signed integer can hold @stable ICU 2.0 */ # define INT32_MAX ((int32_t)(2147483647)) #endif #ifndef UINT8_MAX /** The largest value an 8 bit unsigned integer can hold @stable ICU 2.0 */ # define UINT8_MAX ((uint8_t)(255U)) #endif #ifndef UINT16_MAX /** The largest value a 16 bit unsigned integer can hold @stable ICU 2.0 */ # define UINT16_MAX ((uint16_t)(65535U)) #endif #ifndef UINT32_MAX /** The largest value a 32 bit unsigned integer can hold @stable ICU 2.0 */ # define UINT32_MAX ((uint32_t)(4294967295U)) #endif #if defined(U_INT64_T_UNAVAILABLE) # error int64_t is required for decimal format and rule-based number format. #else # ifndef INT64_C /** * Provides a platform independent way to specify a signed 64-bit integer constant. * note: may be wrong for some 64 bit platforms - ensure your compiler provides INT64_C * @draft ICU 2.8 */ # define INT64_C(c) c ## LL # endif # ifndef UINT64_C /** * Provides a platform independent way to specify an unsigned 64-bit integer constant. * note: may be wrong for some 64 bit platforms - ensure your compiler provides UINT64_C * @draft ICU 2.8 */ # define UINT64_C(c) c ## ULL # endif # ifndef U_INT64_MIN /** The smallest value a 64 bit signed integer can hold @stable ICU 2.8 */ # define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1)) # endif # ifndef U_INT64_MAX /** The largest value a 64 bit signed integer can hold @stable ICU 2.8 */ # define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807))) # endif # ifndef U_UINT64_MAX /** The largest value a 64 bit unsigned integer can hold @stable ICU 2.8 */ # define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615))) # endif #endif /*==========================================================================*/ /* Boolean data type */ /*==========================================================================*/ /** The ICU boolean type @stable ICU 2.0 */ typedef int8_t UBool; #ifndef TRUE /** The TRUE value of a UBool @stable ICU 2.0 */ # define TRUE 1 #endif #ifndef FALSE /** The FALSE value of a UBool @stable ICU 2.0 */ # define FALSE 0 #endif /*==========================================================================*/ /* Unicode data types */ /*==========================================================================*/ /* wchar_t-related definitions -------------------------------------------- */ /** * \def U_HAVE_WCHAR_H * Indicates whether <wchar.h> is available (1) or not (0). Set to 1 by default. * * @stable ICU 2.0 */ #ifndef U_HAVE_WCHAR_H # define U_HAVE_WCHAR_H 1 #endif /** * \def U_SIZEOF_WCHAR_T * U_SIZEOF_WCHAR_T==sizeof(wchar_t) (0 means it is not defined or autoconf could not set it) * * @stable ICU 2.0 */ #if U_SIZEOF_WCHAR_T==0 # undef U_SIZEOF_WCHAR_T # define U_SIZEOF_WCHAR_T 4 #endif /* * \def U_WCHAR_IS_UTF16 * Defined if wchar_t uses UTF-16. * * @stable ICU 2.0 */ /* * \def U_WCHAR_IS_UTF32 * Defined if wchar_t uses UTF-32. * * @stable ICU 2.0 */ #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32) # ifdef __STDC_ISO_10646__ # if (U_SIZEOF_WCHAR_T==2) # define U_WCHAR_IS_UTF16 # elif (U_SIZEOF_WCHAR_T==4) # define U_WCHAR_IS_UTF32 # endif # elif defined __UCS2__ # if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2) # define U_WCHAR_IS_UTF16 # endif # elif defined __UCS4__ # if (U_SIZEOF_WCHAR_T==4) # define U_WCHAR_IS_UTF32 # endif # elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) # define U_WCHAR_IS_UTF16 # endif #endif /* UChar and UChar32 definitions -------------------------------------------- */ /** Number of bytes in a UChar. @stable ICU 2.0 */ #define U_SIZEOF_UCHAR 2 /** * \var UChar * Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned. * If wchar_t is not 16 bits wide, then define UChar to be uint16_t. * This makes the definition of UChar platform-dependent * but allows direct string type compatibility with platforms with * 16-bit wchar_t types. * * @stable ICU 2.0 */ /* Define UChar to be compatible with wchar_t if possible. */ #if U_SIZEOF_WCHAR_T==2 typedef wchar_t UChar; #else typedef uint16_t UChar; #endif /** * Define UChar32 as a type for single Unicode code points. * UChar32 is a signed 32-bit integer (same as int32_t). * * The Unicode code point range is 0..0x10ffff. * All other values (negative or >=0x110000) are illegal as Unicode code points. * They may be used as sentinel values to indicate "done", "error" * or similar non-code point conditions. * * Before ICU 2.4 (Jitterbug 2146), UChar32 was defined * to be wchar_t if that is 32 bits wide (wchar_t may be signed or unsigned) * or else to be uint32_t. * That is, the definition of UChar32 was platform-dependent. * * @see U_SENTINEL * @stable ICU 2.4 */ typedef int32_t UChar32; /*==========================================================================*/ /* U_INLINE and U_ALIGN_CODE Set default values if these are not already */ /* defined. Definitions normally are in */ /* platform.h or the corresponding file for */ /* the OS in use. */ /*==========================================================================*/ /** * \def U_ALIGN_CODE * This is used to align code fragments to a specific byte boundary. * This is useful for getting consistent performance test results. * @internal */ #ifndef U_ALIGN_CODE # define U_ALIGN_CODE(n) #endif #ifndef U_INLINE # define U_INLINE #endif #include "urename.h" #endif
11,471
C++
.h
329
33.392097
93
0.592252
supercollider/supercollider
5,424
745
915
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false