Path: blob/main/contrib/llvm-project/libcxx/include/__ostream/put_character_sequence.h
213766 views
//===---------------------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===---------------------------------------------------------------------===//78#ifndef _LIBCPP___OSTREAM_PUT_CHARACTER_SEQUENCE_H9#define _LIBCPP___OSTREAM_PUT_CHARACTER_SEQUENCE_H1011#include <__config>1213#if _LIBCPP_HAS_LOCALIZATION1415# include <__cstddef/size_t.h>16# include <__fwd/ostream.h>17# include <__iterator/ostreambuf_iterator.h>18# include <__locale_dir/pad_and_output.h>19# include <ios>2021# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)22# pragma GCC system_header23# endif2425_LIBCPP_BEGIN_NAMESPACE_STD2627template <class _CharT, class _Traits>28_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&29__put_character_sequence(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str, size_t __len) {30# if _LIBCPP_HAS_EXCEPTIONS31try {32# endif // _LIBCPP_HAS_EXCEPTIONS33typename basic_ostream<_CharT, _Traits>::sentry __s(__os);34if (__s) {35typedef ostreambuf_iterator<_CharT, _Traits> _Ip;36if (std::__pad_and_output(37_Ip(__os),38__str,39(__os.flags() & ios_base::adjustfield) == ios_base::left ? __str + __len : __str,40__str + __len,41__os,42__os.fill())43.failed())44__os.setstate(ios_base::badbit | ios_base::failbit);45}46# if _LIBCPP_HAS_EXCEPTIONS47} catch (...) {48__os.__set_badbit_and_consider_rethrow();49}50# endif // _LIBCPP_HAS_EXCEPTIONS51return __os;52}5354_LIBCPP_END_NAMESPACE_STD5556#endif // _LIBCPP_HAS_LOCALIZATION5758#endif // _LIBCPP___OSTREAM_PUT_CHARACTER_SEQUENCE_H596061