CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
94 lines
3.4 KiB
C++
94 lines
3.4 KiB
C++
// -*- C++ -*-
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef _LIBCPP___FILESYSTEM_U8PATH_H
|
|
#define _LIBCPP___FILESYSTEM_U8PATH_H
|
|
|
|
#include <__algorithm/unwrap_iter.h>
|
|
#include <__config>
|
|
#include <__filesystem/path.h>
|
|
#include <__locale>
|
|
#include <string>
|
|
|
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
|
# pragma GCC system_header
|
|
#endif
|
|
|
|
#if _LIBCPP_STD_VER >= 17
|
|
|
|
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
|
|
|
# if !defined(_LIBCPP_WIN32API) || _LIBCPP_HAS_LOCALIZATION
|
|
template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
|
|
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _InputIt __l) {
|
|
static_assert(
|
|
# if _LIBCPP_HAS_CHAR8_T
|
|
is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
|
|
# endif
|
|
is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
|
|
"u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
|
|
" or 'char8_t'");
|
|
# if defined(_LIBCPP_WIN32API)
|
|
string __tmp(__f, __l);
|
|
using _CVT = __widen_from_utf8<sizeof(wchar_t) * __CHAR_BIT__>;
|
|
std::wstring __w;
|
|
__w.reserve(__tmp.size());
|
|
_CVT()(back_inserter(__w), __tmp.data(), __tmp.data() + __tmp.size());
|
|
return path(__w);
|
|
# else
|
|
return path(__f, __l);
|
|
# endif // defined(_LIBCPP_WIN32API)
|
|
}
|
|
# endif // !defined(_LIBCPP_WIN32API) || _LIBCPP_HAS_LOCALIZATION
|
|
|
|
# if defined(_LIBCPP_WIN32API) && _LIBCPP_HAS_LOCALIZATION
|
|
template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
|
|
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _NullSentinel) {
|
|
static_assert(
|
|
# if _LIBCPP_HAS_CHAR8_T
|
|
is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
|
|
# endif
|
|
is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
|
|
"u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
|
|
" or 'char8_t'");
|
|
string __tmp;
|
|
const char __sentinel = char{};
|
|
for (; *__f != __sentinel; ++__f)
|
|
__tmp.push_back(*__f);
|
|
using _CVT = __widen_from_utf8<sizeof(wchar_t) * __CHAR_BIT__>;
|
|
std::wstring __w;
|
|
__w.reserve(__tmp.size());
|
|
_CVT()(back_inserter(__w), __tmp.data(), __tmp.data() + __tmp.size());
|
|
return path(__w);
|
|
}
|
|
# endif // defined(_LIBCPP_WIN32API) && _LIBCPP_HAS_LOCALIZATION
|
|
|
|
template <class _Source, __enable_if_t<__is_pathable<_Source>::value, int> = 0>
|
|
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(const _Source& __s) {
|
|
static_assert(
|
|
# if _LIBCPP_HAS_CHAR8_T
|
|
is_same<typename __is_pathable<_Source>::__char_type, char8_t>::value ||
|
|
# endif
|
|
is_same<typename __is_pathable<_Source>::__char_type, char>::value,
|
|
"u8path(Source const&) requires Source have a character type of type "
|
|
"'char' or 'char8_t'");
|
|
# if defined(_LIBCPP_WIN32API)
|
|
using _Traits = __is_pathable<_Source>;
|
|
return u8path(std::__unwrap_iter(_Traits::__range_begin(__s)), std::__unwrap_iter(_Traits::__range_end(__s)));
|
|
# else
|
|
return path(__s);
|
|
# endif
|
|
}
|
|
|
|
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
|
|
|
#endif // _LIBCPP_STD_VER >= 17
|
|
|
|
#endif // _LIBCPP___FILESYSTEM_U8PATH_H
|