PNG  IHDR  8] PLTE S =tRNS   PNG  IHDR  8] PLTE S =tRNS   REDROOM
PHP 7.4.33
Preview: syncstream Size: 8.18 KB
/opt/rh/gcc-toolset-14/root/usr/include/c++/14/syncstream

// <syncstream> -*- C++ -*-

// Copyright (C) 2020-2024 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file include/syncstream
 *  This is a Standard C++ Library header.
 */

#ifndef _GLIBCXX_SYNCSTREAM
#define _GLIBCXX_SYNCSTREAM 1

#pragma GCC system_header

#include <bits/requires_hosted.h> // iostreams

#include <bits/c++config.h>

#define __glibcxx_want_syncbuf
#include <bits/version.h>

#ifdef __cpp_lib_syncbuf // C++ >= 20 && HOSTED && CXX11ABI
#include <sstream>

#include <bits/alloc_traits.h>
#include <bits/allocator.h>
#include <bits/functexcept.h>
#include <bits/functional_hash.h>
#include <bits/std_mutex.h>

namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION

  template<typename _CharT, typename _Traits, typename _Alloc>
    class basic_syncbuf : public __syncbuf_base<_CharT, _Traits>
    {
    public:
      using char_type = _CharT;
      using int_type = typename _Traits::int_type;
      using pos_type = typename _Traits::pos_type;
      using off_type = typename _Traits::off_type;
      using traits_type = _Traits;
      using allocator_type = _Alloc;
      using streambuf_type = basic_streambuf<_CharT, _Traits>;

      basic_syncbuf()
      : basic_syncbuf(nullptr, allocator_type{})
      { }

      explicit
      basic_syncbuf(streambuf_type* __obuf)
      : basic_syncbuf(__obuf, allocator_type{})
      { }

      basic_syncbuf(streambuf_type* __obuf, const allocator_type& __alloc)
      : __syncbuf_base<_CharT, _Traits>(__obuf)
      , _M_impl(__alloc)
      , _M_mtx(__obuf)
      { }

      basic_syncbuf(basic_syncbuf&& __other)
      : __syncbuf_base<_CharT, _Traits>(__other._M_wrapped)
      , _M_impl(std::move(__other._M_impl))
      , _M_mtx(std::move(__other._M_mtx))
      {
	this->_M_emit_on_sync = __other._M_emit_on_sync;
	this->_M_needs_sync = __other._M_needs_sync;
	__other._M_wrapped = nullptr;
      }

      ~basic_syncbuf()
      {
	__try
	  {
	    emit();
	  }
	__catch (...)
	  { }
      }

      basic_syncbuf&
      operator=(basic_syncbuf&& __other)
      {
	emit();

	_M_impl = std::move(__other._M_impl);
	this->_M_emit_on_sync = __other._M_emit_on_sync;
	this->_M_needs_sync = __other._M_needs_sync;
	this->_M_wrapped = __other._M_wrapped;
	__other._M_wrapped = nullptr;
	_M_mtx = std::move(__other._M_mtx);

	return *this;
      }

      void
      swap(basic_syncbuf& __other)
      {
	using _ATr = allocator_traits<_Alloc>;
	if constexpr (!_ATr::propagate_on_container_swap::value)
	  __glibcxx_assert(get_allocator() == __other.get_allocator());

	std::swap(_M_impl, __other._M_impl);
	std::swap(this->_M_emit_on_sync, __other._M_emit_on_sync);
	std::swap(this->_M_needs_sync, __other._M_needs_sync);
	std::swap(this->_M_wrapped, __other._M_wrapped);
	std::swap(_M_mtx, __other._M_mtx);
      }

      bool
      emit()
      {
	if (!this->_M_wrapped)
	  return false;

	auto __s = std::move(_M_impl).str();

	const lock_guard<__mutex> __l(_M_mtx);
	if (auto __size = __s.size())
	  {
	    auto __n = this->_M_wrapped->sputn(__s.data(), __size);
	    if (__n != __size)
	      {
		__s.erase(0, __n);
		_M_impl.str(std::move(__s));
		return false;
	      }
	  }

	if (this->_M_needs_sync)
	  {
	    this->_M_needs_sync = false;
	    if (this->_M_wrapped->pubsync() != 0)
	      return false;
	  }
	return true;
      }

      streambuf_type*
      get_wrapped() const noexcept
      { return this->_M_wrapped; }

      allocator_type
      get_allocator() const noexcept
      { return _M_impl.get_allocator(); }

      void
      set_emit_on_sync(bool __b) noexcept
      { this->_M_emit_on_sync = __b; }

    protected:
      int
      sync() override
      {
	this->_M_needs_sync = true;
	if (this->_M_emit_on_sync && !emit())
	  return -1;
	return 0;
      }

      int_type
      overflow(int_type __c) override
      {
	int_type __eof = traits_type::eof();
	if (__builtin_expect(!traits_type::eq_int_type(__c, __eof), true))
	  return _M_impl.sputc(__c);
	return __eof;
      }

      streamsize
      xsputn(const char_type* __s, streamsize __n) override
      { return _M_impl.sputn(__s, __n); }

    private:
      basic_stringbuf<char_type, traits_type, allocator_type> _M_impl;

      struct __mutex
      {
#if _GLIBCXX_HAS_GTHREADS
	mutex* _M_mtx;

	__mutex(void* __t)
	  : _M_mtx(__t ? &_S_get_mutex(__t) : nullptr)
	{ }

	void
	swap(__mutex& __other) noexcept
	{ std::swap(_M_mtx, __other._M_mtx); }

	void
	lock()
	{
	  _M_mtx->lock();
	}

	void
	unlock()
	{
	  _M_mtx->unlock();
	}

	// FIXME: This should be put in the .so
	static mutex&
	_S_get_mutex(void* __t)
	{
	  const unsigned char __mask = 0xf;
	  static mutex __m[__mask + 1];

	  auto __key = _Hash_impl::hash(__t) & __mask;
	  return __m[__key];
	}
#else
	__mutex(void*) { }
	void swap(__mutex&&) noexcept { }
	void lock() { }
	void unlock() { }
#endif
	__mutex(__mutex&&) = default;
	__mutex& operator=(__mutex&&) = default;
      };
      __mutex _M_mtx;
    };

  template <typename _CharT, typename _Traits, typename _Alloc>
    class basic_osyncstream : public basic_ostream<_CharT, _Traits>
    {
      using __ostream_type = basic_ostream<_CharT, _Traits>;

    public:
      // Types:
      using char_type = _CharT;
      using traits_type = _Traits;
      using allocator_type = _Alloc;
      using int_type = typename traits_type::int_type;
      using pos_type = typename traits_type::pos_type;
      using off_type = typename traits_type::off_type;
      using syncbuf_type = basic_syncbuf<_CharT, _Traits, _Alloc>;
      using streambuf_type = typename syncbuf_type::streambuf_type;

    private:
      syncbuf_type _M_syncbuf;

    public:
      basic_osyncstream(streambuf_type* __buf, const allocator_type& __a)
	: _M_syncbuf(__buf, __a)
      { this->init(std::__addressof(_M_syncbuf)); }

      explicit basic_osyncstream(streambuf_type* __buf)
	: _M_syncbuf(__buf)
      { this->init(std::__addressof(_M_syncbuf)); }

      basic_osyncstream(basic_ostream<char_type, traits_type>& __os,
		        const allocator_type& __a)
	: basic_osyncstream(__os.rdbuf(), __a)
      { this->init(std::__addressof(_M_syncbuf)); }

      explicit basic_osyncstream(basic_ostream<char_type, traits_type>& __os)
	: basic_osyncstream(__os.rdbuf())
      { this->init(std::__addressof(_M_syncbuf)); }

      basic_osyncstream(basic_osyncstream&& __rhs) noexcept
	: __ostream_type(std::move(__rhs)),
	_M_syncbuf(std::move(__rhs._M_syncbuf))
      { __ostream_type::set_rdbuf(std::__addressof(_M_syncbuf)); }

      ~basic_osyncstream() = default;

      basic_osyncstream& operator=(basic_osyncstream&&) = default;

      syncbuf_type* rdbuf() const noexcept
      { return const_cast<syncbuf_type*>(&_M_syncbuf); }

      streambuf_type* get_wrapped() const noexcept
      { return _M_syncbuf.get_wrapped(); }

      void emit()
      {
	if (!_M_syncbuf.emit())
	  this->setstate(ios_base::failbit);
      }
    };

  template <class _CharT, class _Traits, class _Allocator>
    inline void
    swap(basic_syncbuf<_CharT, _Traits, _Allocator>& __x,
	 basic_syncbuf<_CharT, _Traits, _Allocator>& __y) noexcept
    { __x.swap(__y); }

  using syncbuf = basic_syncbuf<char>;
  using wsyncbuf = basic_syncbuf<wchar_t>;

  using osyncstream = basic_osyncstream<char>;
  using wosyncstream = basic_osyncstream<wchar_t>;
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // __cpp_lib_syncbuf

#endif	/* _GLIBCXX_SYNCSTREAM */

Directory Contents

Dirs: 11 × Files: 116

Name Size Perms Modified Actions
backward DIR
- drwxr-xr-x 2026-04-30 11:58:47
Edit Download
bits DIR
- drwxr-xr-x 2026-04-30 11:58:47
Edit Download
debug DIR
- drwxr-xr-x 2026-04-30 11:58:47
Edit Download
decimal DIR
- drwxr-xr-x 2026-04-30 11:58:47
Edit Download
- drwxr-xr-x 2026-04-30 11:58:47
Edit Download
ext DIR
- drwxr-xr-x 2026-04-30 11:58:47
Edit Download
parallel DIR
- drwxr-xr-x 2026-04-30 11:58:47
Edit Download
pstl DIR
- drwxr-xr-x 2026-04-30 11:58:47
Edit Download
tr1 DIR
- drwxr-xr-x 2026-04-30 11:58:47
Edit Download
tr2 DIR
- drwxr-xr-x 2026-04-30 11:58:47
Edit Download
- drwxr-xr-x 2026-04-30 11:58:47
Edit Download
3.31 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
18.71 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
15.40 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
51.16 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
7.87 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
14.00 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
49.19 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.61 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.30 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
2.34 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.73 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
2.00 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.84 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
29.13 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
94.45 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
2.09 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.43 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.87 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.86 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
94.84 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
5.15 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
37.25 KB lrw-r--r-- 2025-11-11 11:26:46
Edit Download
74.84 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.56 KB lrw-r--r-- 2025-11-11 11:26:45
Edit Download
12.72 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
12.59 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
9.39 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.90 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.81 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.37 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.82 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.37 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
6.54 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
3.75 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
4.33 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
6.66 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
3.17 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.33 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
2.24 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
2.84 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
6.39 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
2.73 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
21.77 KB lrw-r--r-- 2025-11-11 11:26:46
Edit Download
4.56 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
5.31 KB lrw-r--r-- 2025-11-11 11:26:46
Edit Download
1.87 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
49.81 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.96 KB lrw-r--r-- 2025-11-11 11:26:45
Edit Download
1.72 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
128.31 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
2.91 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
41.58 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
47.31 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
52.04 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
22.16 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
2.93 KB lrw-r--r-- 2025-11-11 11:26:46
Edit Download
16.40 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.67 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
8.21 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
3.02 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
35.52 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
3.02 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
2.70 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
82.01 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
3.86 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.50 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
4.37 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
4.47 KB lrw-r--r-- 2025-11-11 11:26:45
Edit Download
5.26 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
14.15 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
26.99 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
8.48 KB lrw-r--r-- 2025-11-11 11:26:46
Edit Download
6.91 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
25.50 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
44.03 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
30.45 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
4.73 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
2.54 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.63 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
271.83 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
22.26 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
3.16 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
17.41 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
3.04 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
4.16 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
24.60 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
2.70 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
14.12 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
12.20 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
38.83 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
2.46 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
21.82 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
4.02 KB lrw-r--r-- 2025-11-11 11:26:45
Edit Download
9.65 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.72 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
2.25 KB lrw-r--r-- 2025-11-11 11:26:45
Edit Download
15.72 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
29.24 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
4.23 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
27.46 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
8.18 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
17.96 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
16.26 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.33 KB lrw-r--r-- 2025-11-11 11:26:45
Edit Download
9.77 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
99.67 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
3.43 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
8.10 KB lrw-r--r-- 2025-11-11 11:26:46
Edit Download
118.15 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
3.69 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
3.48 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
7.38 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
40.20 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
64.81 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
4.98 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download
1.42 KB lrw-r--r-- 2025-11-11 11:26:44
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).
 !"#$%&'(()*+,-./00123456789 t\ wIDATx ]ys  47Y ƒ -  "  Rv  < f{Ɛ $k l L > L  ~h^ 1  [  r G t& h  l F z3O Y ! p A(_g̷ E8 )S 8 c  Kb"z ~ 5 J xAL WU <  *  5 m;W a pB h ~P J 2 3 6 ҙ .Ƹ P i  4g F R L P ΪK/D  M v (a3 k J Œ4N5* SH ` SdJ z  O J Xՠ V>u ߱ BE&L b2 ?2` tX+  c CB A$ i b C ĀMB E : /  # Dx &l =q Ty  0 \p I ( L Ǎ { e 4k ;`u^ヲ eP!( d {  )T A 8 O;Ě n >;s6 !  :Nx `[S D HU ~ q›J F} a g*D 49 / pn k h (t 8NxƐF _!r չ7 ZR R׷ q/5") Ӎ NY 0 x sZ!   o  fu  ,  K"$ ? pg  㕣=  1» {h " fh7    y  } € +7  $ y " X —ą - G P u 4 m >J 5 L =V ' ^@I p ?MS xЌ XV P ! h "C NS9B8̢ ]!K  e   zA , ӏkbY  !< XQ ٿyS| *" f { w  4@[S <  # 0 ! js [m  =,~ o "ݎ DHf Wo $ g ! Vԅ t mB /y Wf V4񺍸 c+@x?  B ~u " xUN e 0 BĂ) ~J pz! 7y6]l Ԥ@ P a< O /DHC `≻  N m"$  0ObB }{ x AO FCG D R ^ "B  { WDH  UR l@ T #  +"d T ; 0 i  D}. 7 ` ' ] w rE &S i ƕiTD EL P _ u h $ Ա FG wVD G L R Zf ' .!] J /ZR oGЍs Mr Ĥ ʬ 3 Q [3 cL ` ^ p + ( F;# B 5 '  2Y f [  ϶R0e }  E 7 6M aۮ H <& n % L] E}Up x紉, Uw' Q  Ǯշo k ވۙ 0N94 VX5 xEDE l D #֤ } C o )W :  ^ s 9  bRf iX5u ཱི 4 :[  T 1. | [E 2ؽ Iy\ : o x K G 5 ylP ' uK E ftb/i[3 .g _  [3M n G, #NwQ5~  ؚ) | n =Ц"x qg gB ` 듘 ~ x w ? ? R~  _ u. &VQ K˻   H C ( TN˄+ `C dA nB׭ D 3"Z G ê ^k H_ /- ~ " R_  .8 Z_ 6@ o  xg  uP ? 3լ @7AM!  E7^ - =V L  x  g-D0  CtmW 7  O  G _ WD0 g C  w1 r d w : a | \  *" f nֳ ^ H# f L ` Z ۽hV  }S F r0Ù Bć5r] @! NL iQ]{s^=4 d  WD  "  "   M; t" 8 5 e dL| "-*st" ) SWD ?R[S e ooF  20.D ? bo =) A i o d ģ ZҰaO @E =) i D a &ܟa CϞ y6 ,<%{^x%{f8? `iw^ ?/ M * IEND B`