Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:33

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___CXX03___ITERATOR_OSTREAMBUF_ITERATOR_H
0011 #define _LIBCPP___CXX03___ITERATOR_OSTREAMBUF_ITERATOR_H
0012 
0013 #include <__cxx03/__config>
0014 #include <__cxx03/__iterator/iterator.h>
0015 #include <__cxx03/__iterator/iterator_traits.h>
0016 #include <__cxx03/cstddef>
0017 #include <__cxx03/iosfwd> // for forward declaration of basic_streambuf
0018 
0019 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0020 #  pragma GCC system_header
0021 #endif
0022 
0023 _LIBCPP_BEGIN_NAMESPACE_STD
0024 
0025 _LIBCPP_SUPPRESS_DEPRECATED_PUSH
0026 template <class _CharT, class _Traits>
0027 class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator
0028 #if _LIBCPP_STD_VER <= 14 || !defined(_LIBCPP_ABI_NO_ITERATOR_BASES)
0029     : public iterator<output_iterator_tag, void, void, void, void>
0030 #endif
0031 {
0032   _LIBCPP_SUPPRESS_DEPRECATED_POP
0033 
0034 public:
0035   typedef output_iterator_tag iterator_category;
0036   typedef void value_type;
0037 #if _LIBCPP_STD_VER >= 20
0038   typedef ptrdiff_t difference_type;
0039 #else
0040   typedef void difference_type;
0041 #endif
0042   typedef void pointer;
0043   typedef void reference;
0044   typedef _CharT char_type;
0045   typedef _Traits traits_type;
0046   typedef basic_streambuf<_CharT, _Traits> streambuf_type;
0047   typedef basic_ostream<_CharT, _Traits> ostream_type;
0048 
0049 private:
0050   streambuf_type* __sbuf_;
0051 
0052 public:
0053   _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator(ostream_type& __s) _NOEXCEPT : __sbuf_(__s.rdbuf()) {}
0054   _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator(streambuf_type* __s) _NOEXCEPT : __sbuf_(__s) {}
0055   _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator=(_CharT __c) {
0056     if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sputc(__c), traits_type::eof()))
0057       __sbuf_ = nullptr;
0058     return *this;
0059   }
0060   _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator*() { return *this; }
0061   _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++() { return *this; }
0062   _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator& operator++(int) { return *this; }
0063   _LIBCPP_HIDE_FROM_ABI bool failed() const _NOEXCEPT { return __sbuf_ == nullptr; }
0064 
0065   template <class _Ch, class _Tr>
0066   friend _LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_Ch, _Tr> __pad_and_output(
0067       ostreambuf_iterator<_Ch, _Tr> __s, const _Ch* __ob, const _Ch* __op, const _Ch* __oe, ios_base& __iob, _Ch __fl);
0068 };
0069 
0070 _LIBCPP_END_NAMESPACE_STD
0071 
0072 #endif // _LIBCPP___CXX03___ITERATOR_OSTREAMBUF_ITERATOR_H