MCPcopy Create free account
hub / github.com/arun11299/cpp-jwt / clear

Function clear

include/jwt/json/json.hpp:21636–21691  ·  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

21634 @since version 1.0.0
21635 */
21636 void clear() noexcept
21637 {
21638 switch (m_type)
21639 {
21640 case value_t::number_integer:
21641 {
21642 m_value.number_integer = 0;
21643 break;
21644 }
21645
21646 case value_t::number_unsigned:
21647 {
21648 m_value.number_unsigned = 0;
21649 break;
21650 }
21651
21652 case value_t::number_float:
21653 {
21654 m_value.number_float = 0.0;
21655 break;
21656 }
21657
21658 case value_t::boolean:
21659 {
21660 m_value.boolean = false;
21661 break;
21662 }
21663
21664 case value_t::string:
21665 {
21666 m_value.string->clear();
21667 break;
21668 }
21669
21670 case value_t::binary:
21671 {
21672 m_value.binary->clear();
21673 break;
21674 }
21675
21676 case value_t::array:
21677 {
21678 m_value.array->clear();
21679 break;
21680 }
21681
21682 case value_t::object:
21683 {
21684 m_value.object->clear();
21685 break;
21686 }
21687
21688 default:
21689 break;
21690 }
21691 }
21692
21693 /*!

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected