xtd 0.2.0
Loading...
Searching...
No Matches
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
12#include "enum_object.hpp"
13
15template < class enum_t >
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 }
36}
bool is_empty() const noexcept
Definition basic_string.hpp:3534
Provides information about a specific culture (called a locale for unmanaged code development)....
Definition culture_info.hpp:43
static void throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current())
Throws an exption with specified exception case.
Contains xtd::globalization::culture_info class.
Contains xtd::enum_object struct.
xtd::string format(const xtd::string &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
Definition format.hpp:21
@ format
The format is not valid.
Definition exception_case.hpp:51
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
xtd::string to_string() const noexcept override
Returns a xtd::string that represents the current object.
Definition enum_object.hpp:172