5#if !defined(__XTD_CORE_INTERNAL__)
6#error "Do not include this file: Internal use only"
21[[nodiscard]]
auto __to_string_iformatable_to_string(
const xtd::iformatable* obj,
const std::string& fmt,
const std::locale& loc) -> std::string;
24[[nodiscard]]
auto __to_string_object_to_string(
const xtd::object* obj) -> std::string;
26template<
class value_t>
27[[nodiscard]]
inline static auto __to_string_polymorphic(
const value_t& value,
const std::string& fmt,
const std::locale& loc) -> std::string {
28 if constexpr(std::derived_from<xtd::raw_type<value_t>,
xtd::iformatable>)
return __to_string_iformatable_to_string(
static_cast<const xtd::iformatable*
>(&value), fmt, loc);
30 else if constexpr(std::derived_from<xtd::raw_type<value_t>,
xtd::object>)
return __to_string_object_to_string(
static_cast<const xtd::object*
>(&value));
31 else if constexpr(std::derived_from<xtd::raw_type<value_t>, std::exception>)
return std::string {
"exception: "} +
static_cast<const std::exception&
>(value).what();
static auto throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current()) -> void
Throws an exption with specified exception case.
Provides a way to represent the current object as a string.
Definition istringable.hpp:26
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
@ format_not_iformatable
The object is not iformatable.
Definition exception_case.hpp:59
Contains xtd::istringable interface.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::raw_type alias.
Contains xtd::helpers::throw_helper class.