MCPcopy Create free account
hub / github.com/THUDM/AgentTuning / asInt

Method asInt

AgentBench.old/src/tasks/card_game/logic/src/jsoncpp/jsoncpp.cpp:3143–3163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3141#endif
3142
3143Value::Int Value::asInt() const {
3144 switch (type_) {
3145 case intValue:
3146 JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range");
3147 return Int(value_.int_);
3148 case uintValue:
3149 JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range");
3150 return Int(value_.uint_);
3151 case realValue:
3152 JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt),
3153 "double out of Int range");
3154 return Int(value_.real_);
3155 case nullValue:
3156 return 0;
3157 case booleanValue:
3158 return value_.bool_ ? 1 : 0;
3159 default:
3160 break;
3161 }
3162 JSON_FAIL_MESSAGE("Value is not convertible to Int.");
3163}
3164
3165Value::UInt Value::asUInt() const {
3166 switch (type_) {

Callers 6

receive_player_listMethod · 0.45
pick_msg_checkerMethod · 0.45
assert_msg_checkerMethod · 0.45
action_msg_checkerMethod · 0.45
read_jsonMethod · 0.45
newCharReaderMethod · 0.45

Calls 1

InRangeFunction · 0.70

Tested by

no test coverage detected