MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / clear

Function clear

3rd/nlohmann_json/single_include/nlohmann/json.hpp:22873–22930  ·  view source on GitHub ↗

! @brief clears the contents Clears the content of a JSON value and resets it to the default value as if @ref basic_json(value_t) would have been called with the current value type from @ref type(): Value type | initial value ----------- | ------------- null | `null` boolean | `false` string | `""` number | `0` binary | An em

Source from the content-addressed store, hash-verified

22871 @since version 1.0.0
22872 */
22873 void clear() noexcept
22874 {
22875 switch (m_type)
22876 {
22877 case value_t::number_integer:
22878 {
22879 m_value.number_integer = 0;
22880 break;
22881 }
22882
22883 case value_t::number_unsigned:
22884 {
22885 m_value.number_unsigned = 0;
22886 break;
22887 }
22888
22889 case value_t::number_float:
22890 {
22891 m_value.number_float = 0.0;
22892 break;
22893 }
22894
22895 case value_t::boolean:
22896 {
22897 m_value.boolean = false;
22898 break;
22899 }
22900
22901 case value_t::string:
22902 {
22903 m_value.string->clear();
22904 break;
22905 }
22906
22907 case value_t::binary:
22908 {
22909 m_value.binary->clear();
22910 break;
22911 }
22912
22913 case value_t::array:
22914 {
22915 m_value.array->clear();
22916 break;
22917 }
22918
22919 case value_t::object:
22920 {
22921 m_value.object->clear();
22922 break;
22923 }
22924
22925 case value_t::null:
22926 case value_t::discarded:
22927 default:
22928 break;
22929 }
22930 }

Callers

nothing calls this directly

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected