| 715 | # endif |
| 716 | |
| 717 | Value::Int |
| 718 | Value::asInt() const |
| 719 | { |
| 720 | switch ( type_ ) |
| 721 | { |
| 722 | case nullValue: |
| 723 | return 0; |
| 724 | case intValue: |
| 725 | return value_.int_; |
| 726 | case uintValue: |
| 727 | //JSON_ASSERT_MESSAGE( value_.uint_ < (unsigned)maxInt, "integer out of signed integer range" ); |
| 728 | JSON_ASSERT( value_.uint_ < (unsigned)maxInt ); |
| 729 | return value_.uint_; |
| 730 | case realValue: |
| 731 | //JSON_ASSERT_MESSAGE( value_.real_ >= minInt && value_.real_ <= maxInt, "Real out of signed integer range" ); |
| 732 | JSON_ASSERT( value_.real_ >= minInt && value_.real_ <= maxInt ); |
| 733 | return Int( value_.real_ ); |
| 734 | case booleanValue: |
| 735 | return value_.bool_ ? 1 : 0; |
| 736 | case stringValue: |
| 737 | case arrayValue: |
| 738 | case objectValue: |
| 739 | //JSON_ASSERT_MESSAGE( false, "Type is not convertible to int" ); |
| 740 | JSON_ASSERT( false ); |
| 741 | default: |
| 742 | JSON_ASSERT_UNREACHABLE; |
| 743 | } |
| 744 | return 0; // unreachable; |
| 745 | } |
| 746 | |
| 747 | Value::UInt |
| 748 | Value::asUInt() const |
no outgoing calls
no test coverage detected