diff options
author | alexv-smirnov <alex@ydb.tech> | 2023-03-15 19:59:12 +0300 |
---|---|---|
committer | alexv-smirnov <alex@ydb.tech> | 2023-03-15 19:59:12 +0300 |
commit | 056bb284ccf8dd6793ec3a54ffa36c4fb2b9ad11 (patch) | |
tree | 4740980126f32e3af7937ba0ca5f83e59baa4ab0 /contrib/restricted/boost/io | |
parent | 269126dcced1cc8b53eb4398b4a33e5142f10290 (diff) | |
download | ydb-056bb284ccf8dd6793ec3a54ffa36c4fb2b9ad11.tar.gz |
add library/cpp/actors, ymake build to ydb oss export
Diffstat (limited to 'contrib/restricted/boost/io')
10 files changed, 826 insertions, 0 deletions
diff --git a/contrib/restricted/boost/io/.yandex_meta/devtools.copyrights.report b/contrib/restricted/boost/io/.yandex_meta/devtools.copyrights.report new file mode 100644 index 0000000000..c0c786e40b --- /dev/null +++ b/contrib/restricted/boost/io/.yandex_meta/devtools.copyrights.report @@ -0,0 +1,106 @@ +# File format ($ symbol means the beginning of a line): +# +# $ # this message +# $ # ======================= +# $ # comments (all commentaries should starts with some number of spaces and # symbol) +# $ IGNORE_FILES {file1.ext1} {file2.ext2} - (optional) ignore listed files when generating license macro and credits +# $ RENAME {original license id} TO {new license id} # user comments - (optional) use {new license id} instead {original license id} in ya.make files +# $ # user comments +# $ +# ${action} {license id} {license text hash} +# $BELONGS ./ya/make/file/relative/path/1/ya.make ./ya/make/2/ya.make +# ${all_file_action} filename +# $ # user commentaries (many lines) +# $ generated description - files with this license, license text... (some number of lines that starts with some number of spaces, do not modify) +# ${action} {license spdx} {license text hash} +# $BELONGS ./ya/make/file/relative/path/3/ya.make +# ${all_file_action} filename +# $ # user commentaries +# $ generated description +# $ ... +# +# You can modify action, all_file_action and add commentaries +# Available actions: +# keep - keep license in contrib and use in credits +# skip - skip license +# remove - remove all files with this license +# rename - save license text/links into licenses texts file, but not store SPDX into LINCENSE macro. You should store correct license id into devtools.license.spdx.txt file +# +# {all file action} records will be generated when license text contains filename that exists on filesystem (in contrib directory) +# We suppose that that files can contain some license info +# Available all file actions: +# FILE_IGNORE - ignore file (do nothing) +# FILE_INCLUDE - include all file data into licenses text file +# ======================= + +KEEP COPYRIGHT_SERVICE_LABEL 00ae35254742b57ae9f1a89afd6ec4ff +BELONGS ya.make + License text: + Copyright 2010 Beman Dawes + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + include/boost/io/quoted.hpp [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 06270473adb0db5611666795418a7a03 +BELONGS ya.make + License text: + Copyright 2002 Daryle Walker + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + include/boost/io_fwd.hpp [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL 3977b26967e38078e93a471d462eefa9 +BELONGS ya.make + License text: + Copyright 2019-2020 Glen Joseph Fernandes + (glenjofe@gmail.com) + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + include/boost/io/detail/buffer_fill.hpp [2:3] + include/boost/io/detail/ostream_guard.hpp [2:3] + include/boost/io/quoted.hpp [4:5] + +KEEP COPYRIGHT_SERVICE_LABEL 9efac63295490759e6d24cbbd00922ff +BELONGS ya.make + License text: + Copyright 2019 Glen Joseph Fernandes + (glenjofe@gmail.com) + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + include/boost/io/ostream_joiner.hpp [2:3] + include/boost/io/ostream_put.hpp [2:3] + +KEEP COPYRIGHT_SERVICE_LABEL b8264448f2302918d52d12ed19e342eb +BELONGS ya.make + License text: + Copyright 2002, 2005 Daryle Walker + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + include/boost/io/ios_state.hpp [2:2] + +KEEP COPYRIGHT_SERVICE_LABEL c3129e89abfa402d1988f810c83e0703 +BELONGS ya.make + License text: + Copyright 2021-2022 Glen Joseph Fernandes + (glenjofe@gmail.com) + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + include/boost/io/nullstream.hpp [2:3] diff --git a/contrib/restricted/boost/io/.yandex_meta/devtools.licenses.report b/contrib/restricted/boost/io/.yandex_meta/devtools.licenses.report new file mode 100644 index 0000000000..6cd3e771c1 --- /dev/null +++ b/contrib/restricted/boost/io/.yandex_meta/devtools.licenses.report @@ -0,0 +1,110 @@ +# File format ($ symbol means the beginning of a line): +# +# $ # this message +# $ # ======================= +# $ # comments (all commentaries should starts with some number of spaces and # symbol) +# $ IGNORE_FILES {file1.ext1} {file2.ext2} - (optional) ignore listed files when generating license macro and credits +# $ RENAME {original license id} TO {new license id} # user comments - (optional) use {new license id} instead {original license id} in ya.make files +# $ # user comments +# $ +# ${action} {license id} {license text hash} +# $BELONGS ./ya/make/file/relative/path/1/ya.make ./ya/make/2/ya.make +# ${all_file_action} filename +# $ # user commentaries (many lines) +# $ generated description - files with this license, license text... (some number of lines that starts with some number of spaces, do not modify) +# ${action} {license spdx} {license text hash} +# $BELONGS ./ya/make/file/relative/path/3/ya.make +# ${all_file_action} filename +# $ # user commentaries +# $ generated description +# $ ... +# +# You can modify action, all_file_action and add commentaries +# Available actions: +# keep - keep license in contrib and use in credits +# skip - skip license +# remove - remove all files with this license +# rename - save license text/links into licenses texts file, but not store SPDX into LINCENSE macro. You should store correct license id into devtools.license.spdx.txt file +# +# {all file action} records will be generated when license text contains filename that exists on filesystem (in contrib directory) +# We suppose that that files can contain some license info +# Available all file actions: +# FILE_IGNORE - ignore file (do nothing) +# FILE_INCLUDE - include all file data into licenses text file +# ======================= + +KEEP BSL-1.0 2ac08ebacc39848d7b4f214b7dd403eb +BELONGS ya.make + License text: + \### License + Distributed under the + [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). + Scancode info: + Original SPDX id: BSL-1.0 + Score : 60.00 + Match type : NOTICE + Links : http://www.boost.org/LICENSE_1_0.txt, http://www.boost.org/users/license.html, https://spdx.org/licenses/BSL-1.0 + Files with this license: + README.md [6:9] + +KEEP BSL-1.0 3a9fe8c6f3dc56da59da6bb70a0cef2c +BELONGS ya.make + License text: + Distributed under the Boost Software License, Version 1.0. + (http://www.boost.org/LICENSE_1_0.txt) + Scancode info: + Original SPDX id: BSL-1.0 + Score : 94.44 + Match type : NOTICE + Links : http://www.boost.org/LICENSE_1_0.txt, http://www.boost.org/users/license.html, https://spdx.org/licenses/BSL-1.0 + Files with this license: + include/boost/io/nullstream.hpp [5:6] + include/boost/io/ostream_joiner.hpp [5:6] + +KEEP BSL-1.0 403b611490a4cc0b196a04a68ce4b4e5 +BELONGS ya.make + # Distributed under the + # [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). + License text: + Distributed under the + Scancode info: + Original SPDX id: LicenseRef-scancode-unknown-license-reference + Score : 11.00 + Match type : INTRO + Links : https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/unknown-license-reference.LICENSE + Files with this license: + README.md [8:8] + +KEEP BSL-1.0 5cd4044c79f85aa40c2edd653c1d76f4 +BELONGS ya.make + License text: + (http://www.boost.org/LICENSE_1_0.txt) + Scancode info: + Original SPDX id: BSL-1.0 + Score : 44.00 + Match type : REFERENCE + Links : http://www.boost.org/LICENSE_1_0.txt, http://www.boost.org/users/license.html, https://spdx.org/licenses/BSL-1.0 + Files with this license: + include/boost/io/detail/buffer_fill.hpp [6:6] + include/boost/io/detail/ostream_guard.hpp [6:6] + include/boost/io/ios_state.hpp [5:5] + include/boost/io/ostream_put.hpp [6:6] + include/boost/io/quoted.hpp [8:8] + include/boost/io_fwd.hpp [5:5] + +KEEP BSL-1.0 eeda69591b5957fb1dbf0286c30acb85 +BELONGS ya.make + License text: + Distributed under the Boost Software License, Version 1.0. + Scancode info: + Original SPDX id: BSL-1.0 + Score : 100.00 + Match type : NOTICE + Links : http://www.boost.org/LICENSE_1_0.txt, http://www.boost.org/users/license.html, https://spdx.org/licenses/BSL-1.0 + Files with this license: + include/boost/io/detail/buffer_fill.hpp [5:5] + include/boost/io/detail/ostream_guard.hpp [5:5] + include/boost/io/ios_state.hpp [4:4] + include/boost/io/ostream_put.hpp [5:5] + include/boost/io/quoted.hpp [7:7] + include/boost/io_fwd.hpp [4:4] diff --git a/contrib/restricted/boost/io/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/io/.yandex_meta/licenses.list.txt new file mode 100644 index 0000000000..1279940900 --- /dev/null +++ b/contrib/restricted/boost/io/.yandex_meta/licenses.list.txt @@ -0,0 +1,48 @@ +====================BSL-1.0==================== +### License + +Distributed under the +[Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). + +====================BSL-1.0==================== +(http://www.boost.org/LICENSE_1_0.txt) + + +====================BSL-1.0==================== +Distributed under the + + +====================BSL-1.0==================== +Distributed under the Boost Software License, Version 1.0. + + +====================BSL-1.0==================== +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) + + +====================COPYRIGHT==================== +Copyright 2002 Daryle Walker + + +====================COPYRIGHT==================== +Copyright 2002, 2005 Daryle Walker + + +====================COPYRIGHT==================== +Copyright 2010 Beman Dawes + + +====================COPYRIGHT==================== +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + + +====================COPYRIGHT==================== +Copyright 2019-2020 Glen Joseph Fernandes +(glenjofe@gmail.com) + + +====================COPYRIGHT==================== +Copyright 2021-2022 Glen Joseph Fernandes +(glenjofe@gmail.com) diff --git a/contrib/restricted/boost/io/include/boost/io/detail/buffer_fill.hpp b/contrib/restricted/boost/io/include/boost/io/detail/buffer_fill.hpp new file mode 100644 index 0000000000..b25a884473 --- /dev/null +++ b/contrib/restricted/boost/io/include/boost/io/detail/buffer_fill.hpp @@ -0,0 +1,39 @@ +/* +Copyright 2019-2020 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_IO_DETAIL_BUFFER_FILL_HPP +#define BOOST_IO_DETAIL_BUFFER_FILL_HPP + +#include <iosfwd> +#include <cstddef> + +namespace boost { +namespace io { +namespace detail { + +template<class charT, class traits> +inline bool +buffer_fill(std::basic_streambuf<charT, traits>& buf, charT ch, + std::size_t size) +{ + charT fill[] = { ch, ch, ch, ch, ch, ch, ch, ch }; + enum { + chunk = sizeof fill / sizeof(charT) + }; + for (; size > chunk; size -= chunk) { + if (static_cast<std::size_t>(buf.sputn(fill, chunk)) != chunk) { + return false; + } + } + return static_cast<std::size_t>(buf.sputn(fill, size)) == size; +} + +} /* detail */ +} /* io */ +} /* boost */ + +#endif diff --git a/contrib/restricted/boost/io/include/boost/io/detail/ostream_guard.hpp b/contrib/restricted/boost/io/include/boost/io/detail/ostream_guard.hpp new file mode 100644 index 0000000000..6999d81344 --- /dev/null +++ b/contrib/restricted/boost/io/include/boost/io/detail/ostream_guard.hpp @@ -0,0 +1,45 @@ +/* +Copyright 2019-2020 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_IO_DETAIL_OSTREAM_GUARD_HPP +#define BOOST_IO_DETAIL_OSTREAM_GUARD_HPP + +#include <boost/config.hpp> +#include <iosfwd> + +namespace boost { +namespace io { +namespace detail { + +template<class Char, class Traits> +class ostream_guard { +public: + explicit ostream_guard(std::basic_ostream<Char, Traits>& os) BOOST_NOEXCEPT + : os_(&os) { } + + ~ostream_guard() BOOST_NOEXCEPT_IF(false) { + if (os_) { + os_->setstate(std::basic_ostream<Char, Traits>::badbit); + } + } + + void release() BOOST_NOEXCEPT { + os_ = 0; + } + +private: + ostream_guard(const ostream_guard&); + ostream_guard& operator=(const ostream_guard&); + + std::basic_ostream<Char, Traits>* os_; +}; + +} /* detail */ +} /* io */ +} /* boost */ + +#endif diff --git a/contrib/restricted/boost/io/include/boost/io/nullstream.hpp b/contrib/restricted/boost/io/include/boost/io/nullstream.hpp new file mode 100644 index 0000000000..bd98f5a352 --- /dev/null +++ b/contrib/restricted/boost/io/include/boost/io/nullstream.hpp @@ -0,0 +1,63 @@ +/* +Copyright 2021-2022 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_IO_NULLSTREAM_HPP +#define BOOST_IO_NULLSTREAM_HPP + +#include <boost/config.hpp> +#include <ostream> +#include <streambuf> + +namespace boost { +namespace io { + +template<class CharT, class Traits = std::char_traits<CharT> > +class basic_nullbuf + : public std::basic_streambuf<CharT, Traits> { +protected: + typename Traits::int_type overflow(typename Traits::int_type c) + BOOST_OVERRIDE { + return Traits::not_eof(c); + } + + std::streamsize xsputn(const CharT*, std::streamsize n) BOOST_OVERRIDE { + return n; + } +}; + +namespace detail { + +template<class CharT, class Traits> +class nullbuf { +public: + boost::io::basic_nullbuf<CharT, Traits>* buf() { + return &buf_; + } + +private: + boost::io::basic_nullbuf<CharT, Traits> buf_; +}; + +} /* detail */ + +template<class CharT, class Traits = std::char_traits<CharT> > +class basic_onullstream + : detail::nullbuf<CharT, Traits> + , public std::basic_ostream<CharT, Traits> { +public: + basic_onullstream() + : std::basic_ostream<CharT, Traits>(detail::nullbuf<CharT, + Traits>::buf()) { } +}; + +typedef basic_onullstream<char> onullstream; +typedef basic_onullstream<wchar_t> wonullstream; + +} /* io */ +} /* boost */ + +#endif diff --git a/contrib/restricted/boost/io/include/boost/io/ostream_joiner.hpp b/contrib/restricted/boost/io/include/boost/io/ostream_joiner.hpp new file mode 100644 index 0000000000..a771521397 --- /dev/null +++ b/contrib/restricted/boost/io/include/boost/io/ostream_joiner.hpp @@ -0,0 +1,118 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_IO_OSTREAM_JOINER_HPP +#define BOOST_IO_OSTREAM_JOINER_HPP + +#include <boost/config.hpp> +#include <ostream> +#include <string> +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) +#include <type_traits> +#endif +#include <utility> +#endif + +namespace boost { +namespace io { +namespace detail { + +#if !defined(BOOST_NO_CXX11_ADDRESSOF) +template<class T> +inline T* +osj_address(T& o) +{ + return std::addressof(o); +} +#else +template<class T> +inline T* +osj_address(T& obj) +{ + return &obj; +} +#endif + +} /* detail */ + +template<class Delim, class Char = char, + class Traits = std::char_traits<Char> > +class ostream_joiner { +public: + typedef Char char_type; + typedef Traits traits_type; + typedef std::basic_ostream<Char, Traits> ostream_type; + typedef std::output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + ostream_joiner(ostream_type& output, const Delim& delim) + : output_(detail::osj_address(output)) + , delim_(delim) + , first_(true) { } + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + ostream_joiner(ostream_type& output, Delim&& delim) + : output_(detail::osj_address(output)) + , delim_(std::move(delim)) + , first_(true) { } +#endif + + template<class T> + ostream_joiner& operator=(const T& value) { + if (!first_) { + *output_ << delim_; + } + first_ = false; + *output_ << value; + return *this; + } + + ostream_joiner& operator*() BOOST_NOEXCEPT { + return *this; + } + + ostream_joiner& operator++() BOOST_NOEXCEPT { + return *this; + } + + ostream_joiner& operator++(int) BOOST_NOEXCEPT { + return *this; + } + +private: + ostream_type* output_; + Delim delim_; + bool first_; +}; + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \ + !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) +template<class Char, class Traits, class Delim> +inline ostream_joiner<typename std::decay<Delim>::type, Char, Traits> +make_ostream_joiner(std::basic_ostream<Char, Traits>& output, Delim&& delim) +{ + return ostream_joiner<typename std::decay<Delim>::type, Char, + Traits>(output, std::forward<Delim>(delim)); +} +#else +template<class Char, class Traits, class Delim> +inline ostream_joiner<Delim, Char, Traits> +make_ostream_joiner(std::basic_ostream<Char, Traits>& output, + const Delim& delim) +{ + return ostream_joiner<Delim, Char, Traits>(output, delim); +} +#endif + +} /* io */ +} /* boost */ + +#endif diff --git a/contrib/restricted/boost/io/include/boost/io/ostream_put.hpp b/contrib/restricted/boost/io/include/boost/io/ostream_put.hpp new file mode 100644 index 0000000000..97627f8e81 --- /dev/null +++ b/contrib/restricted/boost/io/include/boost/io/ostream_put.hpp @@ -0,0 +1,50 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_IO_OSTREAM_PUT_HPP +#define BOOST_IO_OSTREAM_PUT_HPP + +#include <boost/io/detail/buffer_fill.hpp> +#include <boost/io/detail/ostream_guard.hpp> + +namespace boost { +namespace io { + +template<class charT, class traits> +inline std::basic_ostream<charT, traits>& +ostream_put(std::basic_ostream<charT, traits>& os, const charT* data, + std::size_t size) +{ + typedef std::basic_ostream<charT, traits> stream; + detail::ostream_guard<charT, traits> guard(os); + typename stream::sentry entry(os); + if (entry) { + std::basic_streambuf<charT, traits>& buf = *os.rdbuf(); + std::size_t width = static_cast<std::size_t>(os.width()); + if (width <= size) { + if (static_cast<std::size_t>(buf.sputn(data, size)) != size) { + return os; + } + } else if ((os.flags() & stream::adjustfield) == stream::left) { + if (static_cast<std::size_t>(buf.sputn(data, size)) != size || + !detail::buffer_fill(buf, os.fill(), width - size)) { + return os; + } + } else if (!detail::buffer_fill(buf, os.fill(), width - size) || + static_cast<std::size_t>(buf.sputn(data, size)) != size) { + return os; + } + os.width(0); + } + guard.release(); + return os; +} + +} /* io */ +} /* boost */ + +#endif diff --git a/contrib/restricted/boost/io/include/boost/io/quoted.hpp b/contrib/restricted/boost/io/include/boost/io/quoted.hpp new file mode 100644 index 0000000000..fc7d205e82 --- /dev/null +++ b/contrib/restricted/boost/io/include/boost/io/quoted.hpp @@ -0,0 +1,217 @@ +/* +Copyright 2010 Beman Dawes + +Copyright 2019-2020 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_IO_QUOTED_HPP +#define BOOST_IO_QUOTED_HPP + +#include <boost/io/detail/buffer_fill.hpp> +#include <boost/io/detail/ostream_guard.hpp> +#include <boost/io/ios_state.hpp> + +namespace boost { +namespace io { +namespace detail { + +template<class String, class Char> +struct quoted_proxy { + String string; + Char escape; + Char delim; +}; + +template<class Char> +struct quoted_state { + const Char* string; + std::size_t size; + std::size_t count; +}; + +template<class Char> +inline quoted_state<Char> +quoted_start(const Char* string, Char escape, Char delim) +{ + const Char* end = string; + std::size_t count = 2; + for (Char ch; (ch = *end) != 0; ++end) { + count += 1 + (ch == escape || ch == delim); + } + quoted_state<Char> state = { string, + static_cast<std::size_t>(end - string), count }; + return state; +} + +template<class Char, class String> +inline quoted_state<Char> +quoted_start(const String* string, Char escape, Char delim) +{ + const Char* begin = string->data(); + std::size_t size = string->size(); + std::size_t count = 2; + for (const Char *it = begin, *end = begin + size; it != end; ++it) { + Char ch = *it; + count += 1 + (ch == escape || ch == delim); + } + quoted_state<Char> state = { begin, size, count }; + return state; +} + +template<class Char, class Traits> +inline bool +quoted_put(std::basic_streambuf<Char, Traits>& buf, const Char* string, + std::size_t size, std::size_t count, Char escape, Char delim) +{ + if (buf.sputc(delim) == Traits::eof()) { + return false; + } + if (size == count) { + if (static_cast<std::size_t>(buf.sputn(string, size)) != size) { + return false; + } + } else { + for (const Char* end = string + size; string != end; ++string) { + Char ch = *string; + if ((ch == escape || ch == delim) && + buf.sputc(escape) == Traits::eof()) { + return false; + } + if (buf.sputc(ch) == Traits::eof()) { + return false; + } + } + } + return buf.sputc(delim) != Traits::eof(); +} + +template<class Char, class Traits, class String> +inline std::basic_ostream<Char, Traits>& +quoted_out(std::basic_ostream<Char, Traits>& os, String* string, Char escape, + Char delim) +{ + typedef std::basic_ostream<Char, Traits> stream; + ostream_guard<Char, Traits> guard(os); + typename stream::sentry entry(os); + if (entry) { + quoted_state<Char> state = boost::io::detail::quoted_start(string, + escape, delim); + std::basic_streambuf<Char, Traits>& buf = *os.rdbuf(); + std::size_t width = static_cast<std::size_t>(os.width()); + if (width <= state.count) { + if (!boost::io::detail::quoted_put(buf, state.string, state.size, + state.count, escape, delim)) { + return os; + } + } else if ((os.flags() & stream::adjustfield) == stream::left) { + if (!boost::io::detail::quoted_put(buf, state.string, state.size, + state.count, escape, delim) || + !boost::io::detail::buffer_fill(buf, os.fill(), + width - state.count)) { + return os; + } + } else if (!boost::io::detail::buffer_fill(buf, os.fill(), + width - state.count) || + !boost::io::detail::quoted_put(buf, state.string, state.size, + state.count, escape, delim)) { + return os; + } + os.width(0); + } + guard.release(); + return os; +} + +template<class Char, class Traits> +inline std::basic_ostream<Char, Traits>& +operator<<(std::basic_ostream<Char, Traits>& os, + const quoted_proxy<const Char*, Char>& proxy) +{ + return boost::io::detail::quoted_out(os, proxy.string, proxy.escape, + proxy.delim); +} + +template <class Char, class Traits, class Alloc> +inline std::basic_ostream<Char, Traits>& +operator<<(std::basic_ostream<Char, Traits>& os, + const quoted_proxy<const std::basic_string<Char, Traits, Alloc>*, + Char>& proxy) +{ + return boost::io::detail::quoted_out(os, proxy.string, proxy.escape, + proxy.delim); +} + +template<class Char, class Traits, class Alloc> +inline std::basic_ostream<Char, Traits>& +operator<<(std::basic_ostream<Char, Traits>& os, + const quoted_proxy<std::basic_string<Char, Traits, Alloc>*, Char>& proxy) +{ + return boost::io::detail::quoted_out(os, proxy.string, proxy.escape, + proxy.delim); +} + +template<class Char, class Traits, class Alloc> +inline std::basic_istream<Char, Traits>& +operator>>(std::basic_istream<Char, Traits>& is, + const quoted_proxy<std::basic_string<Char, Traits, Alloc>*, Char>& proxy) +{ + Char ch; + if (!(is >> ch)) { + return is; + } + if (ch != proxy.delim) { + is.unget(); + return is >> *proxy.string; + } + { + boost::io::ios_flags_saver ifs(is); + std::noskipws(is); + proxy.string->clear(); + while ((is >> ch) && ch != proxy.delim) { + if (ch == proxy.escape && !(is >> ch)) { + break; + } + proxy.string->push_back(ch); + } + } + return is; +} + +} /* detail */ + +template<class Char, class Traits, class Alloc> +inline detail::quoted_proxy<const std::basic_string<Char, Traits, Alloc>*, + Char> +quoted(const std::basic_string<Char, Traits, Alloc>& s, Char escape='\\', + Char delim='\"') +{ + detail::quoted_proxy<const std::basic_string<Char, Traits, Alloc>*, + Char> proxy = { &s, escape, delim }; + return proxy; +} + +template<class Char, class Traits, class Alloc> +inline detail::quoted_proxy<std::basic_string<Char, Traits, Alloc>*, Char> +quoted(std::basic_string<Char, Traits, Alloc>& s, Char escape='\\', + Char delim='\"') +{ + detail::quoted_proxy<std::basic_string<Char, Traits, Alloc>*, + Char> proxy = { &s, escape, delim }; + return proxy; +} + +template<class Char> +inline detail::quoted_proxy<const Char*, Char> +quoted(const Char* s, Char escape='\\', Char delim='\"') +{ + detail::quoted_proxy<const Char*, Char> proxy = { s, escape, delim }; + return proxy; +} + +} /* io */ +} /* boost */ + +#endif diff --git a/contrib/restricted/boost/io/ya.make b/contrib/restricted/boost/io/ya.make new file mode 100644 index 0000000000..70da54e38c --- /dev/null +++ b/contrib/restricted/boost/io/ya.make @@ -0,0 +1,30 @@ +# Generated by devtools/yamaker from nixpkgs 22.05. + +LIBRARY() + +LICENSE(BSL-1.0) + +LICENSE_TEXTS(.yandex_meta/licenses.list.txt) + +OWNER( + g:cpp-contrib + g:taxi-common +) + +VERSION(1.81.0) + +ORIGINAL_SOURCE(https://github.com/boostorg/io/archive/boost-1.81.0.tar.gz) + +PEERDIR( + contrib/restricted/boost/config +) + +ADDINCL( + GLOBAL contrib/restricted/boost/io/include +) + +NO_COMPILER_WARNINGS() + +NO_UTIL() + +END() |