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

Function clear

3rd/nlohmann_json/include/nlohmann/json.hpp:5372–5429  ·  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

5370 @since version 1.0.0
5371 */
5372 void clear() noexcept
5373 {
5374 switch (m_type)
5375 {
5376 case value_t::number_integer:
5377 {
5378 m_value.number_integer = 0;
5379 break;
5380 }
5381
5382 case value_t::number_unsigned:
5383 {
5384 m_value.number_unsigned = 0;
5385 break;
5386 }
5387
5388 case value_t::number_float:
5389 {
5390 m_value.number_float = 0.0;
5391 break;
5392 }
5393
5394 case value_t::boolean:
5395 {
5396 m_value.boolean = false;
5397 break;
5398 }
5399
5400 case value_t::string:
5401 {
5402 m_value.string->clear();
5403 break;
5404 }
5405
5406 case value_t::binary:
5407 {
5408 m_value.binary->clear();
5409 break;
5410 }
5411
5412 case value_t::array:
5413 {
5414 m_value.array->clear();
5415 break;
5416 }
5417
5418 case value_t::object:
5419 {
5420 m_value.object->clear();
5421 break;
5422 }
5423
5424 case value_t::null:
5425 case value_t::discarded:
5426 default:
5427 break;
5428 }
5429 }

Callers

nothing calls this directly

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected