51 using mapping_type = yaml;
62 yaml(
const nodes_collection& nodes);
63 yaml(nodes_collection&& nodes);
64 yaml(
const yaml&) =
default;
65 yaml(yaml&&) =
default;
66 yaml& operator =(
const yaml&) =
default;
67 yaml& operator =(yaml&&) =
default;
73 auto nodes()
const noexcept ->
const nodes_collection&;
74 auto nodes()
noexcept -> nodes_collection&;
75 auto nodes(
const nodes_collection& nodes)
noexcept -> void;
81 template<
class type_t>
83 if constexpr (std::floating_point<type_t>)
return xtd::as<type_t>(as_floating_point(key));
85 else if constexpr (std::same_as<type_t, null_type>)
return nullptr;
93 auto as_boolean(
const xtd::string& key)
const -> boolean_type;
95 auto as_floating_point(
const xtd::string& key)
const -> floating_point_type;
96 auto as_mapping(
const xtd::string& key)
const -> mapping_type;
97 auto as_null(
const xtd::string& key)
const -> null_type;
98 auto as_sequence(
const xtd::string& key)
const -> sequence_type;
99 auto as_string(
const xtd::string& key)
const -> string_type;
101 auto contains_key(
const xtd::string& key)
const noexcept -> bool;
103 template<
class type_t>
105 if (!contains_key(key))
return false;
108 else if constexpr (std::same_as<type_t, null_type>)
return contains_key(key) &&
xtd::is<xtd::null_ptr>(nodes_[key]);
109 else if constexpr (std::same_as<type_t, boolean_type>)
return contains_key(key) &&
xtd::is<boolean_type>(nodes_[key]);
111 else if constexpr (std::same_as<type_t, mapping_type>)
return contains_key(key) &&
xtd::is<mapping_type>(nodes_[key]);
112 else if constexpr (std::same_as<type_t, sequence_type>)
return contains_key(key) &&
xtd::is<sequence_type>(nodes_[key]);
116 auto is_boolean(
const xtd::string& key)
const noexcept -> bool;
117 auto is_integer(
const xtd::string& key)
const noexcept -> bool;
118 auto is_floating_point(
const xtd::string& key)
const noexcept -> bool;
119 auto is_mapping(
const xtd::string& key)
const -> bool;
120 auto is_null(
const xtd::string& key)
const noexcept -> bool;
121 auto is_sequence(
const xtd::string& key)
const -> bool;
122 auto is_string(
const xtd::string& key)
const noexcept -> bool;
133 nodes_collection nodes_;
Contains xtd::any_object class.
Contains xtd::collections::array_list alias.
Represent a polymorphic wrapper capable of holding any type.
Definition any_object.hpp:29
static bool is_valid(std::floating_point auto value) noexcept
Determines whether the specified floating point value is within the range of type_t.
Definition box_floating_point.hpp:100
static bool is_valid(std::signed_integral auto value) noexcept
Determines whether the specified signed integral value is within the range of type_t.
Definition box_integer.hpp:89
Represents a collection of keys and values.
Definition dictionary.hpp:67
static auto throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current()) -> void
Throws an exption with specified exception case.
object()=default
Create a new instance of the ultimate base class object.
Represent a string literal concept.
Definition is_string_literal.hpp:26
Contains xtd::collections::generic::dictionary <key_t, value_t> class.
generic::list< xtd::any_object > array_list
Represents a collection of xtd::any_object.
Definition array_list.hpp:31
@ invalid_cast
The cast is not valid.
Definition exception_case.hpp:63
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.hpp:43
std::int64_t int64
Represents a 64-bit signed integer.
Definition int64.hpp:23
std::nullptr_t null_ptr
Represents the null_opt alias on std::nullptr_t.
Definition null_ptr.hpp:19
bool boolean
Represents a boolean.
Definition boolean.hpp:23
long double decimal
Represents a decimal-precision floating-point number.
Definition decimal.hpp:23
auto as(any_object &o) -> type_t
Casts a type into another type.
Definition __as_any_object.hpp:60
bool is(xtd::any value)
Checks if the result of an expression is compatible with a given type.
Definition is.hpp:484
Contains xtd::is_string_literal struct and is_string_literal_v struct.
Contains classes that can be used for serializing and deserializing objects. Serialization is the pro...
Definition yaml.hpp:17
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::string alias.
Contains xtd::helpers::throw_helper class.