4.6.0
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
fcppt.string

Description

String-related functions and types.

Motivation

In C++ there are two main character types: char and wchar_t. char is always 1 byte long, the size of wchar_t is implementation-defined. In Windows, it's 2, in Linux, it's often 4. Consequently, there are two types of character literals: narrow and wide literals, i.e.

char const chars[] = "foobar";
wchar_t const wchars[] = L"foobar";

Depending on the operating system, one of these character types is the "native" one. System functions like CreateFile in Windows accept wchar_t. In Linux, calls like open accept char. Along with the different types go different encodings. Windows uses UTF-16 for (wchar_t) strings such as the file name given to CreateFile. Linux uses whatever encoding the current locale specifies. On most systems, this is UTF-8 for char strings.

When you're designing a library that frequently calls system functions, it's most efficient to use a string format that suits the current operating system. With that in mind, fcppt has a typedef called fcppt::char_type. This typedef is wchar_t on Windows systems and char on POSIX systems. It's configurable, however, so using wchar_t on POSIX is possible, too (see the ENABLE_NARROW_STRING CMake option). Based on that, there's fcppt::string which is a std::basic_string of fcppt::char_type.

Unfortunately, making the character type configurable has some ramifications. For example, you cannot simply write:

fcppt::string s("foo");

This will break if fcppt::string is a wide string. To portably wrap literals, use the FCPPT_TEXT macro:

fcppt::string const s{FCPPT_TEXT("foo")};

There are other standard library structures such as cout,clog,cin which you cannot reliably use together with fcppt::string. fcppt provides alternatives for these (see the members of the string module in the documentation for a list of all related functions and structures).

Conversions

The following functions can be used to convert from and to strings:

Function Conversion description
fcppt::from_std_string std::string → fcppt::string
fcppt::from_std_wstring std::wstring → fcppt::optional::object<fcppt::string>
fcppt::to_std_string fcppt::string → fcppt::optional::object<std::string>
fcppt::to_std_wstring fcppt::string → std::string

Each of the above functions uses fcppt::string_conv_locale, which returns std::locale(""). The semantics of this locale are described, for example, in the setlocale manpage. Under Linux, this leads to the inspection of the locale environment variables (LC_ALL, LANG etc.). The default locale for an application is the (rather unlocalized) "C" locale. We feel that using the "native" locale as the default makes more sense, since the C locale has no information about the system's native encoding. Converting std::string to std::wstring on a typical Linux machine means converting UTF-8 to UTF-32. The C locale, however, has no information about these encodings. If you need to use a different locale, you can use the locale-variants: fcppt::from_std_string_locale, fcppt::from_std_wstring_locale, fcppt::to_std_string_locale and fcppt::to_std_wstring_locale.

Finally, here is a small example:

#include <fcppt/from_std_string.hpp>
#include <fcppt/string.hpp>
#include <fcppt/text.hpp>
#include <fcppt/to_std_string.hpp>
#include <fcppt/to_std_wstring.hpp>
#include <fcppt/io/cerr.hpp>
#include <fcppt/io/cout.hpp>
#include <fcppt/optional/maybe.hpp>
#include <fcppt/config/external_begin.hpp>
#include <cstdlib>
#include <exception>
#include <iostream>
#include <string>
#include <fcppt/config/external_end.hpp>
int main()
try
{
[&string] {
fcppt::io::cerr() << FCPPT_TEXT("Failed to convert ") << string << FCPPT_TEXT('\n');
},
[](std::string const &converted) {
std::cout << converted << '\n';
});
std::wcout << fcppt::to_std_wstring(string) << L'\n';
}
catch(std::exception const &_error)
{
std::cerr << _error.what() << '\n';
return EXIT_FAILURE;
}

IO streams and other adaptors

To read in or write out files using the system's native character type, you can use the typedefs in the fcppt::io namespace, namely fcppt::filesystem::ifstream, fcppt::filesystem::ofstream , and so on.

There are also preprocessor macros, currently FCPPT_PP_STRINGIZE and FCPPT_PP_FILE to provide compatibility with fcppt::string. FCPPT_PP_STRINGIZE stringizes its argument to an fcppt::string literal. In the same fashion, FCPPT_PP_FILE adapts the standard macro FILE to return an fcppt::string literal.

Lexical Conversions

Lexical conversions deal with conversions from and to strings. In C++ this is done using operator<< and operator>>. fcppt wraps these into the following functions:

Function Description
fcppt::extract_from_string basic_string<CharT> → fcppt::optional::object<T>
fcppt::output_to_std_string T → std::string
fcppt::output_to_std_wstring T → std::wstring
fcppt::output_to_fcppt_string T → fcppt::string
fcppt::output_to_string T → basic_string<CharT>

Exceptions

C++ offers standard exceptions in the <stdexcept> header. All of them use std::string which does not go well together with fcppt::string. fcppt instead defines its own exception base class: fcppt::exception. Although it derives from std::exception, its what() function returns a default message only. To get the error message of an fcppt::exception, use fcppt::exception::string.

try
{
something();
}
catch (fcppt::exception const &_error)
{
fcppt::io::cerr() << _error.string() << FCPPT_TEXT('\n');
}

Classes

class  fcppt::exception
 The base class for all exceptions. More...
 

Macros

#define FCPPT_TEXT(x)
 A macro to wrap a narrow character literal so it results in a fcppt::char_type[] array.
 

Typedefs

using fcppt::char_type = fcppt::detail::char_type
 The char_type used for text.
 
using fcppt::io::istream = std::basic_istream<fcppt::char_type>
 Typedef to either std::istream or std::wistream, depending on fcppt::char_type.
 
using fcppt::io::istringstream = std::basic_istringstream<fcppt::char_type>
 Typedef to either std::istringstream or std::wistringstream, depending on fcppt::char_type.
 
using fcppt::io::ostream = std::basic_ostream<fcppt::char_type>
 Typedef to either std::ostream or std::wostream, depending on fcppt::char_type.
 
using fcppt::io::ostringstream = std::basic_ostringstream<fcppt::char_type>
 Typedef to either std::ostringstream or std::wostringstream, depending on fcppt::char_type.
 
using fcppt::io::stringstream = std::basic_stringstream<fcppt::char_type>
 Typedef to either std::stringstream or std::wstringstream, depending on fcppt::char_type.
 
using fcppt::optional_std_string = fcppt::optional::object<std::string>
 An optional std string.
 
using fcppt::optional_string = fcppt::optional::object<fcppt::string>
 An optional string.
 
using fcppt::string = std::basic_string<fcppt::char_type>
 The string type used for text.
 
using fcppt::string_view = std::basic_string_view<fcppt::char_type>
 The string view type used for text.
 
using fcppt::filesystem::fstream = std::basic_fstream<fcppt::char_type>
 Typedef to basic_fstream, depending on fcppt::char_type.
 
using fcppt::filesystem::ifstream = std::basic_ifstream<fcppt::char_type>
 Typedef to basic_ifstream, depending on fcppt::char_type.
 
using fcppt::filesystem::ofstream = std::basic_ofstream<fcppt::char_type>
 Typedef to basic_ofstream, depending on fcppt::char_type.
 

Functions

FCPPT_DETAIL_SYMBOL fcppt::string fcppt::error::strerrno ()
 A wrapper around std::strerror(strerrno)
 
FCPPT_DETAIL_SYMBOL fcppt::string fcppt::error::strerror (int errnum)
 A wrapper around std::strerror
 
FCPPT_DETAIL_SYMBOL fcppt::string fcppt::error_code_to_string (std::error_code const &)
 Converts an error code to an fcppt::string.
 
template<typename Dest , fcppt::concepts::string Source>
fcppt::optional::object< Dest > fcppt::extract_from_string (Source &&_source)
 Convert a string to a different type using fcppt::insert_extract_locale.
 
template<typename Dest , fcppt::concepts::string Source>
fcppt::optional::object< Dest > fcppt::extract_from_string_fmt (Source &&_source, std::ios_base::fmtflags const _flags)
 Convert a string to a different type using fcppt::insert_extract_locale and format flags.
 
template<typename Dest , fcppt::concepts::string Source>
fcppt::optional::object< Dest > fcppt::extract_from_string_locale_fmt (Source &&_source, std::locale const &_locale, fcppt::optional::object< std::ios_base::fmtflags > const _flags)
 Convert a string to a different type using a locale.
 
FCPPT_DETAIL_SYMBOL fcppt::string fcppt::from_std_string (std::string_view)
 Convert from std::string to fcppt::string using fcppt::string_conv_locale.
 
FCPPT_DETAIL_SYMBOL fcppt::string fcppt::from_std_string_locale (std::string_view, std::locale const &)
 Convert from std::string to fcppt::string using a custom locale.
 
FCPPT_DETAIL_SYMBOL fcppt::optional_string fcppt::from_std_wstring (std::wstring_view)
 Convert from std::wstring to fcppt::string using fcppt::string_conv_locale.
 
FCPPT_DETAIL_SYMBOL fcppt::optional_string fcppt::from_std_wstring_locale (std::wstring_view, std::locale const &)
 Convert from std::wstring to fcppt::string using a custom locale.
 
FCPPT_DETAIL_SYMBOL std::locale fcppt::insert_extract_locale ()
 Returns the default locale to use when converting from or to strings.
 
FCPPT_DETAIL_SYMBOL fcppt::io::ostreamfcppt::io::cerr ()
 Returns either std::cerr or std::wcerr, depending on fcppt::char_type.
 
FCPPT_DETAIL_SYMBOL fcppt::io::istreamfcppt::io::cin ()
 Returns either std::cin or std::wcin, depending on fcppt::char_type.
 
FCPPT_DETAIL_SYMBOL fcppt::io::ostreamfcppt::io::clog ()
 Returns either std::clog or std::wclog, depending on fcppt::char_type.
 
FCPPT_DETAIL_SYMBOL fcppt::io::ostreamfcppt::io::cout ()
 Returns either std::cout or std::wcout, depending on fcppt::char_type.
 
template<typename Ch , typename Traits >
fcppt::optional::object< std::basic_string< Ch, Traits > > fcppt::io::stream_to_string (std::basic_istream< Ch, Traits > &_input)
 Reads the contents of a stream into a string.
 
FCPPT_DETAIL_SYMBOL fcppt::optional_std_string fcppt::narrow (std::wstring_view _string)
 Converts a std::wstring to std::string, using fcppt::string_conv_locale.
 
FCPPT_DETAIL_SYMBOL fcppt::optional_std_string fcppt::narrow_locale (std::wstring_view _string, std::locale const &_locale)
 Converts a std::wstring to std::string, using a locale.
 
template<typename Source >
fcppt::string fcppt::output_to_fcppt_string (Source const &_source)
 Converts an arbitrary type to a fcppt::string, using fcppt::insert_extract_locale.
 
template<typename Source >
fcppt::string fcppt::output_to_fcppt_string_locale (Source const &_source, std::locale const &_locale)
 Converts an arbitrary type to a fcppt::string, using a custom locale.
 
template<typename Source >
std::string fcppt::output_to_std_string (Source const &_source)
 Convert an arbitrary type to a std::string, using fcppt::insert_extract_locale.
 
template<typename Source >
std::string fcppt::output_to_std_string_locale (Source const &_source, std::locale const &_locale)
 Convert an arbitrary type to a std::string, using a custom locale.
 
template<typename Source >
std::wstring fcppt::output_to_std_wstring (Source const &_source)
 Convert an arbitrary type to a std::wstring, using fcppt::insert_extract_locale.
 
template<typename Source >
std::wstring fcppt::output_to_std_wstring_locale (Source const &_source, std::locale const &_locale)
 Convert an arbitrary type to a std::wstring, using a custom locale.
 
template<typename Dest , typename Source >
Dest fcppt::output_to_string (Source const &_source)
 Convert an arbitrary type to a string, using fcppt::insert_extract_locale.
 
template<typename Dest , typename Source >
Dest fcppt::output_to_string_locale (Source const &_source, std::locale const &_locale)
 Convert an arbitrary type to a string, using a custom locale.
 
FCPPT_DETAIL_SYMBOL std::locale fcppt::string_conv_locale ()
 Returns the default locale to use when converting between strings.
 
FCPPT_DETAIL_SYMBOL fcppt::optional::object< int > fcppt::system (fcppt::string const &)
 Calls std::system.
 
FCPPT_DETAIL_SYMBOL fcppt::optional_std_string fcppt::to_std_string (fcppt::string_view)
 Convert from fcppt::string to std::string using fcppt::string_conv_locale.
 
FCPPT_DETAIL_SYMBOL fcppt::optional_std_string fcppt::to_std_string_locale (fcppt::string_view, std::locale const &)
 Convert from fcppt::string to std::string using a custom locale.
 
FCPPT_DETAIL_SYMBOL std::wstring fcppt::to_std_wstring (fcppt::string_view)
 Convert from fcppt::string to std::wstring using fcppt::string_conv_locale.
 
FCPPT_DETAIL_SYMBOL std::wstring fcppt::to_std_wstring_locale (fcppt::string_view, std::locale const &)
 Convert from fcppt::string to std::wstring using a custom locale.
 
FCPPT_DETAIL_SYMBOL std::wstring fcppt::widen (std::string_view)
 Converts a std::string to std::wstring, using fcppt::string_conv_locale.
 
FCPPT_DETAIL_SYMBOL std::wstring fcppt::widen_locale (std::string_view, std::locale const &)
 Converts a std::string to std::wstring, using a locale.
 

Macro Definition Documentation

◆ FCPPT_TEXT

#define FCPPT_TEXT ( x)
Value:
FCPPT_DETAIL_TEXT(x)

A macro to wrap a narrow character literal so it results in a fcppt::char_type[] array.

See fcppt.string for more information.

Typedef Documentation

◆ char_type

using fcppt::char_type = fcppt::detail::char_type

The char_type used for text.

See fcppt.string for more information.

◆ fstream

using fcppt::filesystem::fstream = std::basic_fstream<fcppt::char_type>

Typedef to basic_fstream, depending on fcppt::char_type.

◆ ifstream

using fcppt::filesystem::ifstream = std::basic_ifstream<fcppt::char_type>

Typedef to basic_ifstream, depending on fcppt::char_type.

◆ istream

using fcppt::io::istream = std::basic_istream<fcppt::char_type>

Typedef to either std::istream or std::wistream, depending on fcppt::char_type.

See fcppt.string for a motivation for this.

◆ istringstream

using fcppt::io::istringstream = std::basic_istringstream<fcppt::char_type>

Typedef to either std::istringstream or std::wistringstream, depending on fcppt::char_type.

See fcppt.string for a motivation for this.

◆ ofstream

using fcppt::filesystem::ofstream = std::basic_ofstream<fcppt::char_type>

Typedef to basic_ofstream, depending on fcppt::char_type.

◆ optional_std_string

An optional std string.

◆ optional_string

◆ ostream

using fcppt::io::ostream = std::basic_ostream<fcppt::char_type>

Typedef to either std::ostream or std::wostream, depending on fcppt::char_type.

See fcppt.string for a motivation for this.

◆ ostringstream

using fcppt::io::ostringstream = std::basic_ostringstream<fcppt::char_type>

Typedef to either std::ostringstream or std::wostringstream, depending on fcppt::char_type.

See fcppt.string for a motivation for this.

◆ string

using fcppt::string = std::basic_string<fcppt::char_type>

The string type used for text.

See fcppt.string for more information about this type.

◆ string_view

using fcppt::string_view = std::basic_string_view<fcppt::char_type>

The string view type used for text.

See fcppt.string for more information about this type.

◆ stringstream

using fcppt::io::stringstream = std::basic_stringstream<fcppt::char_type>

Typedef to either std::stringstream or std::wstringstream, depending on fcppt::char_type.

See fcppt.string for a motivation for this.

Function Documentation

◆ cerr()

FCPPT_DETAIL_SYMBOL fcppt::io::ostream & fcppt::io::cerr ( )

Returns either std::cerr or std::wcerr, depending on fcppt::char_type.

See fcppt.string for a motivation for this.

◆ cin()

FCPPT_DETAIL_SYMBOL fcppt::io::istream & fcppt::io::cin ( )

Returns either std::cin or std::wcin, depending on fcppt::char_type.

See fcppt.string for a motivation for this.

◆ clog()

FCPPT_DETAIL_SYMBOL fcppt::io::ostream & fcppt::io::clog ( )

Returns either std::clog or std::wclog, depending on fcppt::char_type.

See fcppt.string for a motivation for this.

◆ cout()

FCPPT_DETAIL_SYMBOL fcppt::io::ostream & fcppt::io::cout ( )

Returns either std::cout or std::wcout, depending on fcppt::char_type.

See fcppt.string for a motivation for this.

◆ error_code_to_string()

FCPPT_DETAIL_SYMBOL fcppt::string fcppt::error_code_to_string ( std::error_code const & )

Converts an error code to an fcppt::string.

◆ extract_from_string()

template<typename Dest , fcppt::concepts::string Source>
fcppt::optional::object< Dest > fcppt::extract_from_string ( Source && _source)
inline

Convert a string to a different type using fcppt::insert_extract_locale.

Template Parameters
DestThe destination type, has to have an operator>> defined. Must have either a default constructor or must be constructible from fcppt::no_init.
Parameters
_sourceThe string to extract from
Note
The string has to be consumed completely.

◆ extract_from_string_fmt()

template<typename Dest , fcppt::concepts::string Source>
fcppt::optional::object< Dest > fcppt::extract_from_string_fmt ( Source && _source,
std::ios_base::fmtflags const _flags )
inline

Convert a string to a different type using fcppt::insert_extract_locale and format flags.

Template Parameters
DestThe destination type, has to have an operator>> defined. Must have either a default constructor or must be constructible from fcppt::no_init.
Note
The string has to be consumed completely.

◆ extract_from_string_locale_fmt()

template<typename Dest , fcppt::concepts::string Source>
fcppt::optional::object< Dest > fcppt::extract_from_string_locale_fmt ( Source && _source,
std::locale const & _locale,
fcppt::optional::object< std::ios_base::fmtflags > const _flags )

Convert a string to a different type using a locale.

Template Parameters
DestThe destination type, has to have an operator>> defined. Must have either a default constructor or must be constructible from fcppt::no_init.
SourceA string type (see fcppt::type_traits::is_string)
Note
The string has to be consumed completely.

◆ from_std_string()

FCPPT_DETAIL_SYMBOL fcppt::string fcppt::from_std_string ( std::string_view )

Convert from std::string to fcppt::string using fcppt::string_conv_locale.

See fcppt.string for more information about this function.

◆ from_std_string_locale()

FCPPT_DETAIL_SYMBOL fcppt::string fcppt::from_std_string_locale ( std::string_view ,
std::locale const &  )

Convert from std::string to fcppt::string using a custom locale.

See fcppt.string for more information about this function.

◆ from_std_wstring()

FCPPT_DETAIL_SYMBOL fcppt::optional_string fcppt::from_std_wstring ( std::wstring_view )

Convert from std::wstring to fcppt::string using fcppt::string_conv_locale.

See fcppt.string for more information about this function.

◆ from_std_wstring_locale()

FCPPT_DETAIL_SYMBOL fcppt::optional_string fcppt::from_std_wstring_locale ( std::wstring_view ,
std::locale const &  )

Convert from std::wstring to fcppt::string using a custom locale.

See fcppt.string for more information about this function.

◆ insert_extract_locale()

FCPPT_DETAIL_SYMBOL std::locale fcppt::insert_extract_locale ( )

Returns the default locale to use when converting from or to strings.

This locale is the C locale. This was chosen to avoid confusion when converting, for example, "300,100" to int. Using the C locale, this will fail, since the string isn't completely consumed. Using a German locale, however, this will return "300100", since ',' is the thousand separator for this locale.

◆ narrow()

FCPPT_DETAIL_SYMBOL fcppt::optional_std_string fcppt::narrow ( std::wstring_view _string)

Converts a std::wstring to std::string, using fcppt::string_conv_locale.

Converts _string to std::string.

◆ narrow_locale()

FCPPT_DETAIL_SYMBOL fcppt::optional_std_string fcppt::narrow_locale ( std::wstring_view _string,
std::locale const & _locale )

Converts a std::wstring to std::string, using a locale.

Converts _string to std::string using _locale.

◆ output_to_fcppt_string()

template<typename Source >
fcppt::string fcppt::output_to_fcppt_string ( Source const & _source)
inline

Converts an arbitrary type to a fcppt::string, using fcppt::insert_extract_locale.

Template Parameters
SourceThe type to make into a string. Has to have an operator<< defined.
See also
fcppt::extract_from_string
fcppt::output_to_string
fcppt::output_to_std_string
fcppt::output_to_std_wstring

◆ output_to_fcppt_string_locale()

template<typename Source >
fcppt::string fcppt::output_to_fcppt_string_locale ( Source const & _source,
std::locale const & _locale )

Converts an arbitrary type to a fcppt::string, using a custom locale.

Template Parameters
SourceThe type to make into a string. Has to have an operator<< defined.
See also
fcppt::extract_from_string
fcppt::output_to_string
fcppt::output_to_std_string
fcppt::output_to_std_wstring

◆ output_to_std_string()

template<typename Source >
std::string fcppt::output_to_std_string ( Source const & _source)
inline

Convert an arbitrary type to a std::string, using fcppt::insert_extract_locale.

Template Parameters
SourceThe type to make into a string. Has to have an operator<< defined.
See also
fcppt::extract_from_string
fcppt::output_to_string
fcppt::output_to_fcppt_string
fcppt::output_to_std_wstring

◆ output_to_std_string_locale()

template<typename Source >
std::string fcppt::output_to_std_string_locale ( Source const & _source,
std::locale const & _locale )
inline

Convert an arbitrary type to a std::string, using a custom locale.

Template Parameters
SourceThe type to make into a string. Has to have an operator<< defined.
See also
fcppt::extract_from_string
fcppt::output_to_string
fcppt::output_to_fcppt_string
fcppt::output_to_std_wstring

◆ output_to_std_wstring()

template<typename Source >
std::wstring fcppt::output_to_std_wstring ( Source const & _source)
inline

◆ output_to_std_wstring_locale()

template<typename Source >
std::wstring fcppt::output_to_std_wstring_locale ( Source const & _source,
std::locale const & _locale )

Convert an arbitrary type to a std::wstring, using a custom locale.

See also
fcppt::extract_from_string
fcppt::output_to_string
fcppt::output_to_fcppt_string
fcppt::output_to_std_string

◆ output_to_string()

template<typename Dest , typename Source >
Dest fcppt::output_to_string ( Source const & _source)
inline

Convert an arbitrary type to a string, using fcppt::insert_extract_locale.

Template Parameters
DestA string type, see fcppt::type_traits::is_string
SourceThe type to make into a string. Has to have an operator<< defined.
See also
fcppt::extract_from_string
fcppt::output_to_std_string
fcppt::output_to_std_wstring
fcppt::output_to_fcppt_string

◆ output_to_string_locale()

template<typename Dest , typename Source >
Dest fcppt::output_to_string_locale ( Source const & _source,
std::locale const & _locale )

Convert an arbitrary type to a string, using a custom locale.

Template Parameters
DestA string type, see fcppt::type_traits::is_string.
SourceThe type to make into a string. Has to have an operator<< defined.
See also
fcppt::extract_from_string
fcppt::output_to_std_string
fcppt::output_to_std_wstring
fcppt::output_to_fcppt_string

◆ stream_to_string()

template<typename Ch , typename Traits >
fcppt::optional::object< std::basic_string< Ch, Traits > > fcppt::io::stream_to_string ( std::basic_istream< Ch, Traits > & _input)

Reads the contents of a stream into a string.

◆ strerrno()

FCPPT_DETAIL_SYMBOL fcppt::string fcppt::error::strerrno ( )

A wrapper around std::strerror(strerrno)

A wrapper around std::strerror(strerrno) returning the message for the current global error number.

◆ strerror()

FCPPT_DETAIL_SYMBOL fcppt::string fcppt::error::strerror ( int errnum)

A wrapper around std::strerror

A wrapper around std::strerror returning the message for the error code given by errnum.

errnum The error code to return the message for

◆ string_conv_locale()

FCPPT_DETAIL_SYMBOL std::locale fcppt::string_conv_locale ( )

Returns the default locale to use when converting between strings.

◆ system()

FCPPT_DETAIL_SYMBOL fcppt::optional::object< int > fcppt::system ( fcppt::string const & )

Calls std::system.

Warning
std::system may not be thread-safe because it may change signal settings.

◆ to_std_string()

FCPPT_DETAIL_SYMBOL fcppt::optional_std_string fcppt::to_std_string ( fcppt::string_view )

Convert from fcppt::string to std::string using fcppt::string_conv_locale.

See fcppt.string for more information about this function.

◆ to_std_string_locale()

FCPPT_DETAIL_SYMBOL fcppt::optional_std_string fcppt::to_std_string_locale ( fcppt::string_view ,
std::locale const &  )

Convert from fcppt::string to std::string using a custom locale.

See fcppt.string for more information about this function.

◆ to_std_wstring()

FCPPT_DETAIL_SYMBOL std::wstring fcppt::to_std_wstring ( fcppt::string_view )

Convert from fcppt::string to std::wstring using fcppt::string_conv_locale.

See fcppt.string for more information about this function.

◆ to_std_wstring_locale()

FCPPT_DETAIL_SYMBOL std::wstring fcppt::to_std_wstring_locale ( fcppt::string_view ,
std::locale const &  )

Convert from fcppt::string to std::wstring using a custom locale.

See fcppt.string for more information about this function.

◆ widen()

FCPPT_DETAIL_SYMBOL std::wstring fcppt::widen ( std::string_view )

Converts a std::string to std::wstring, using fcppt::string_conv_locale.

Converts _string to std::wstring using _locale.

◆ widen_locale()

FCPPT_DETAIL_SYMBOL std::wstring fcppt::widen_locale ( std::string_view ,
std::locale const &  )

Converts a std::string to std::wstring, using a locale.

Converts _string to std::wstring using _locale.

Exceptions
std::runtime_errorIf the conversion fails (which should not happen).