MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / write_hexfloat_value

Function write_hexfloat_value

include/jsoncons_ext/cbor/cbor_encoder.hpp:745–918  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

743 }
744
745 void write_hexfloat_value(const string_view_type& sv, const ser_context& context, std::error_code& ec)
746 {
747 hexfloat_parse_state state = hexfloat_parse_state::start;
748 std::basic_string<char> s;
749 std::basic_string<char> exponent;
750 int64_t scale = 0;
751
752 for (auto c : sv)
753 {
754 switch (state)
755 {
756 case hexfloat_parse_state::start:
757 {
758 switch (c)
759 {
760 case '-':
761 s.push_back(c);
762 state = hexfloat_parse_state::expect_0;
763 break;
764 case '0':
765 state = hexfloat_parse_state::expect_x;
766 break;
767 default:
768 {
769 ec = cbor_errc::invalid_bigfloat;
770 return;
771 }
772 }
773 break;
774 }
775 case hexfloat_parse_state::expect_0:
776 {
777 switch (c)
778 {
779 case '0':
780 state = hexfloat_parse_state::expect_x;
781 break;
782 default:
783 {
784 ec = cbor_errc::invalid_bigfloat;
785 return;
786 }
787 }
788 break;
789 }
790 case hexfloat_parse_state::expect_x:
791 {
792 switch (c)
793 {
794 case 'x':
795 case 'X':
796 state = hexfloat_parse_state::integer;
797 break;
798 default:
799 {
800 ec = cbor_errc::invalid_bigfloat;
801 return;
802 }

Callers 1

visit_stringFunction · 0.85

Calls 11

write_tagFunction · 0.85
hex_to_integerFunction · 0.85
write_bignumFunction · 0.85
visit_begin_arrayFunction · 0.70
visit_int64Function · 0.70
end_valueFunction · 0.70
visit_end_arrayFunction · 0.70
push_backMethod · 0.45
lengthMethod · 0.45
dataMethod · 0.45
error_codeMethod · 0.45

Tested by

no test coverage detected