xtd
1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
xtd.core
include
xtd
enum_object_.hpp
Go to the documentation of this file.
1
4
#pragma once
6
#if !defined(__XTD_ENUM_OBJECT_INTERNAL__)
7
#error "Do not include this file: Internal use only. Include <xtd/enum_object> or <xtd/enum_object.hpp> instead."
8
#endif
10
11
#include "
globalization/culture_info.hpp
"
12
#include "
enum_object.hpp
"
13
15
template
<
class
enum_t >
16
xtd::string
xtd::enum_object < enum_t >::to_string
(
const
xtd::string
&
format
,
const
xtd::globalization::culture_info
& culture)
const
{
17
init();
18
auto
fmt =
format
;
19
if
(
xtd::string::is_empty
(fmt)) fmt =
"G"
;
20
21
switch
(fmt[0]) {
22
case
'b'
:
23
case
'B'
:
24
case
'd'
:
25
case
'D'
:
26
case
'o'
:
27
case
'O'
:
28
case
'x'
:
29
case
'X'
:
return
__numeric_formatter(fmt.chars(),
static_cast <
long
long
int
>
(value), culture);
30
case
'f'
:
31
case
'F'
:
32
case
'g'
:
33
case
'G'
:
return
xtd::enum_object < >::get_name(
value
);
34
}
35
xtd::helpers::throw_helper::throws
(
xtd::helpers::exception_case::format
);
36
}
xtd::basic_string< char >::is_empty
static auto is_empty(const xtd::basic_string< value_type, traits_type, allocator_type > &string) noexcept -> bool
Definition
basic_string.hpp:1249
xtd::globalization::culture_info
Provides information about a specific culture (called a locale for unmanaged code development)....
Definition
culture_info.hpp:42
xtd::helpers::throw_helper::throws
static auto throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current()) -> void
Throws an exption with specified exception case.
xtd::object::to_string
virtual auto to_string() const -> xtd::string
Returns a xtd::string that represents the current object.
culture_info.hpp
Contains xtd::globalization::culture_info class.
enum_object.hpp
Contains xtd::enum_object struct.
xtd::expressions::operator_precedence::value
@ value
Represnets the constant operator precedence (42).
Definition
operator_precedence.hpp:30
xtd::format
auto format(const xtd::string &fmt, args_t &&... args) -> xtd::string
Writes the text representation of the specified arguments list, to string using the specified format ...
Definition
format.hpp:21
xtd::helpers::exception_case::format
@ format
The format is not valid.
Definition
exception_case.hpp:51
xtd::string
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition
__string_definitions.hpp:43
Generated on
for xtd by
Gammasoft
. All rights reserved.