| 675 | |
| 676 | |
| 677 | double JSON::toDouble() const |
| 678 | { |
| 679 | ElementType type = getType(); |
| 680 | |
| 681 | if (type == TYPE_NUMBER) |
| 682 | return getDouble(); |
| 683 | if (type == TYPE_STRING) |
| 684 | return JSON(ptr_begin + 1, ptr_end, level + 1).getDouble(); |
| 685 | throw JSONException("JSON: cannot convert value to double."); |
| 686 | } |
| 687 | |
| 688 | Int64 JSON::toInt() const |
| 689 | { |