Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===---------------------------------------------------------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===---------------------------------------------------------------------===//
0008 
0009 #ifndef _LIBCPP___OSTREAM_PUT_CHARACTER_SEQUENCE_H
0010 #define _LIBCPP___OSTREAM_PUT_CHARACTER_SEQUENCE_H
0011 
0012 #include <__config>
0013 
0014 #if _LIBCPP_HAS_LOCALIZATION
0015 
0016 #  include <__cstddef/size_t.h>
0017 #  include <__fwd/ostream.h>
0018 #  include <__iterator/ostreambuf_iterator.h>
0019 #  include <__locale_dir/pad_and_output.h>
0020 #  include <ios>
0021 
0022 #  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0023 #    pragma GCC system_header
0024 #  endif
0025 
0026 _LIBCPP_BEGIN_NAMESPACE_STD
0027 
0028 template <class _CharT, class _Traits>
0029 _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
0030 __put_character_sequence(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str, size_t __len) {
0031 #  if _LIBCPP_HAS_EXCEPTIONS
0032   try {
0033 #  endif // _LIBCPP_HAS_EXCEPTIONS
0034     typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
0035     if (__s) {
0036       typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
0037       if (std::__pad_and_output(
0038               _Ip(__os),
0039               __str,
0040               (__os.flags() & ios_base::adjustfield) == ios_base::left ? __str + __len : __str,
0041               __str + __len,
0042               __os,
0043               __os.fill())
0044               .failed())
0045         __os.setstate(ios_base::badbit | ios_base::failbit);
0046     }
0047 #  if _LIBCPP_HAS_EXCEPTIONS
0048   } catch (...) {
0049     __os.__set_badbit_and_consider_rethrow();
0050   }
0051 #  endif // _LIBCPP_HAS_EXCEPTIONS
0052   return __os;
0053 }
0054 
0055 _LIBCPP_END_NAMESPACE_STD
0056 
0057 #endif // _LIBCPP_HAS_LOCALIZATION
0058 
0059 #endif // _LIBCPP___OSTREAM_PUT_CHARACTER_SEQUENCE_H