Skip to content

Commit

Permalink
improved migration guide from get_value_ref
Browse files Browse the repository at this point in the history
  • Loading branch information
fktn-k committed Feb 5, 2025
1 parent 10980f8 commit ddae4e6
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions docs/docs/api/basic_node/get_value_ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ReferenceType get_value_ref() const;

!!! warning "Deprecation"

This function has been deprecated in version 0.4.3 and replaced with the following functions since it offers too verbose interface and that may confuse library users, given that only non-/const reference types to [`sequence_type`](sequence_type.md), [`mapping_type`](mapping_type.md), [`boolean_type`](boolean_type.md), [`integer_type`](integer_type.md), [`float_number_type`](float_number_type.md) and [`string_type`](string_type.md) are accepted.
This function has been deprecated in version 0.4.3 and replaced with the following functions since it offers too verbose interface and that may confuse library users, given that only non-/const reference types to [`sequence_type`](sequence_type.md), [`mapping_type`](mapping_type.md), [`boolean_type`](boolean_type.md), [`integer_type`](integer_type.md), [`float_number_type`](float_number_type.md) and [`string_type`](string_type.md) are accepted and that violating the limitation is not clear from error messages during compilation.

* [as_seq](as_seq.md)
* [as_map](as_map.md)
Expand All @@ -21,7 +21,16 @@ ReferenceType get_value_ref() const;
* [as_float](as_float.md)
* [as_str](as_str.md)

It will be removed in a future version. Please replace usages with the above new functions.
It will be removed in a future version. Please replace usages according to the following table.

| from | to |
| -------------------------------------------------------------------------------- | ---------- |
| get_value_ref<sequence_type&>(),<br>get_value_ref<const sequence_type&>() | as_seq() |
| get_value_ref<mapping_type&>(),<br>get_value_ref<const mapping_type&>() | as_map() |
| get_value_ref<boolean_type&>(),<br>get_value_ref<const boolean_type&>() | as_bool() |
| get_value_ref<integer_type&>(),<br>get_value_ref<const integer_type&>() | as_int() |
| get_value_ref<float_number_type&>(),<br>get_value_ref<const float_number_type&>() | as_float() |
| get_value_ref<string_type&>(),<br>get_value_ref<const string_type&>() | as_str() |

Explicit reference access to the internally stored YAML node value.
If the requested reference type does not match the current node value, a [`fkyaml::type_error`](../exception/type_error.md) will be thrown.
Expand Down Expand Up @@ -63,3 +72,9 @@ Reference to the internally stored YAML node value.
## **See Also**

* [basic_node](index.md)
* [as_seq](as_seq.md)
* [as_map](as_map.md)
* [as_bool](as_bool.md)
* [as_int](as_int.md)
* [as_float](as_float.md)
* [as_str](as_str.md)

0 comments on commit ddae4e6

Please # to comment.