@@ -642,6 +642,70 @@ namespace json
642
642
~json_exception () _noexcept {}
643
643
};
644
644
645
+ namespace details
646
+ {
647
+ enum json_error
648
+ {
649
+ left_over_character_in_stream = 1 ,
650
+ malformed_array_literal,
651
+ malformed_comment,
652
+ malformed_literal,
653
+ malformed_object_literal,
654
+ malformed_numeric_literal,
655
+ malformed_string_literal,
656
+ malformed_token,
657
+ mismatched_brances,
658
+ nesting,
659
+ unexpected_token
660
+ };
661
+
662
+ class json_error_category_impl : public std ::error_category
663
+ {
664
+ public:
665
+ virtual const char * json_error_category_impl::name () const
666
+ {
667
+ return " json" ;
668
+ }
669
+
670
+ virtual std::string json_error_category_impl::message (int ev) const
671
+ {
672
+ switch (ev)
673
+ {
674
+ case json_error::left_over_character_in_stream:
675
+ return " Left-over characters in stream after parsing a JSON value" ;
676
+ case json_error::malformed_array_literal:
677
+ return " Malformed array literal" ;
678
+ case json_error::malformed_comment:
679
+ return " Malformed comment" ;
680
+ case json_error::malformed_literal:
681
+ return " Malformed literal" ;
682
+ case json_error::malformed_object_literal:
683
+ return " Malformed object literal" ;
684
+ case json_error::malformed_numeric_literal:
685
+ return " Malformed numeric literal" ;
686
+ case json_error::malformed_string_literal:
687
+ return " Malformed string literal" ;
688
+ case json_error::malformed_token:
689
+ return " Malformed token" ;
690
+ case json_error::mismatched_brances:
691
+ return " Mismatched braces" ;
692
+ case json_error::nesting:
693
+ return " Nesting too deep" ;
694
+ case json_error::unexpected_token:
695
+ return " Unexpected token" ;
696
+ default :
697
+ return " Unknown json error" ;
698
+ }
699
+ }
700
+ };
701
+
702
+ inline const json_error_category_impl& json_error_category ()
703
+ {
704
+ static json_error_category_impl instance;
705
+ return instance;
706
+ }
707
+ }
708
+
645
709
// / <summary>
646
710
// / A JSON array represented as a C++ class.
647
711
// / </summary>
0 commit comments