CLI11 2.4.0
Loading...
Searching...
No Matches
Encoding.hpp
Go to the documentation of this file.
1// Copyright (c) 2017-2024, University of Cincinnati, developed by Henry Schreiner
2// under NSF AWARD 1414736 and by the respective contributors.
3// All rights reserved.
4//
5// SPDX-License-Identifier: BSD-3-Clause
6
7#pragma once
8
9#include <CLI/Macros.hpp>
10
11// [CLI11:public_includes:set]
12#include <string>
13// [CLI11:public_includes:end]
14
15// [CLI11:encoding_includes:verbatim]
16#ifdef CLI11_CPP17
17#include <string_view>
18#endif // CLI11_CPP17
19
20#if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0
21#include <filesystem>
22#include <string_view> // NOLINT(build/include)
23#endif // CLI11_HAS_FILESYSTEM
24// [CLI11:encoding_includes:end]
25
26namespace CLI {
27// [CLI11:encoding_hpp:verbatim]
28
30CLI11_INLINE std::string narrow(const std::wstring &str);
31CLI11_INLINE std::string narrow(const wchar_t *str);
32CLI11_INLINE std::string narrow(const wchar_t *str, std::size_t size);
33
35CLI11_INLINE std::wstring widen(const std::string &str);
36CLI11_INLINE std::wstring widen(const char *str);
37CLI11_INLINE std::wstring widen(const char *str, std::size_t size);
38
39#ifdef CLI11_CPP17
40CLI11_INLINE std::string narrow(std::wstring_view str);
41CLI11_INLINE std::wstring widen(std::string_view str);
42#endif // CLI11_CPP17
43
44#if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0
46CLI11_INLINE std::filesystem::path to_path(std::string_view str);
47#endif // CLI11_HAS_FILESYSTEM
48
49// [CLI11:encoding_hpp:end]
50} // namespace CLI
51
52#ifndef CLI11_COMPILE
53#include "impl/Encoding_inl.hpp"
54#endif
#define CLI11_INLINE
Definition Macros.hpp:129
Definition App.hpp:34
CLI11_INLINE std::wstring widen(const std::string &str)
Convert a narrow string to a wide string.
CLI11_INLINE std::string narrow(const std::wstring &str)
Convert a wide string to a narrow string.