doc: add note about is|as_float to README

This commit is contained in:
ToruNiina
2019-06-07 13:40:21 +09:00
parent 897aecf5d4
commit 46047c48bf

View File

@@ -516,20 +516,27 @@ if(v.is_integer())
The complete list of the functions is below. The complete list of the functions is below.
```cpp ```cpp
const toml::value v(/*...*/); namespace toml {
v.is_boolean(); class value {
v.is_integer(); // ...
v.is_float(); bool is_boolean() const noexcept;
v.is_string(); bool is_integer() const noexcept;
v.is_offset_datetime(); bool is_floating() const noexcept;
v.is_local_datetime(); bool is_string() const noexcept;
v.is_local_date(); bool is_offset_datetime() const noexcept;
v.is_local_time(); bool is_local_datetime() const noexcept;
v.is_array(); bool is_local_date() const noexcept;
v.is_table(); bool is_local_time() const noexcept;
v.is_uninitialized(); bool is_array() const noexcept;
bool is_table() const noexcept;
bool is_uninitialized() const noexcept;
// ...
};
} // toml
``` ```
__NOTE__: `is_float` is marked as deprecated since v2.4.0 to make the function names consistent with snake case typenames. Please use `is_floating` instead.
Also, you can get `enum class` value from `toml::value`. Also, you can get `enum class` value from `toml::value`.
```cpp ```cpp
@@ -569,20 +576,33 @@ if(v.is_integer() && v.as_integer() == 42)
The complete list of the functions is below. The complete list of the functions is below.
```cpp ```cpp
const toml::value v(/*...*/); namespace toml {
v.as_boolean(); class value {
v.as_integer(); // ...
v.as_float(); const boolean& as_boolean() const& noexcept;
v.as_string(); const integer& as_integer() const& noexcept;
v.as_offset_datetime(); const floating& as_floating() const& noexcept;
v.as_local_datetime(); const string& as_string() const& noexcept;
v.as_local_date(); const offset_datetime& as_offset_datetime() const& noexcept;
v.as_local_time(); const local_datetime& as_local_datetime() const& noexcept;
v.as_array(); const local_date& as_local_date() const& noexcept;
v.as_table(); const local_time& as_local_time() const& noexcept;
v.as_uninitialized(); const array& as_array() const& noexcept;
const table& as_table() const& noexcept;
// --------------------------------------------------------
// non-const version
boolean& as_boolean() & noexcept;
// ditto...
// --------------------------------------------------------
// rvalue version
boolean&& as_boolean() && noexcept;
// ditto...
};
} // toml
``` ```
__NOTE__: `as_float` is marked as deprecated since v2.4.0 to make the function names consistent with snake case typenames. Please use `as_floating` instead.
## Visiting a toml::value ## Visiting a toml::value
toml11 provides `toml::visit` to apply a function to `toml::value` in the toml11 provides `toml::visit` to apply a function to `toml::value` in the