MCPcopy Create free account
hub / github.com/alibaba/CicadaPlayer / getDouble

Method getDouble

framework/utils/CicadaJSON.cpp:108–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108double CicadaJSONItem::getDouble(const std::string &name, double defaultValue) const
109{
110 if (nullptr == mJSON) {
111 return defaultValue;
112 }
113
114 if (cJSON_HasObjectItem(mJSON, name.c_str())) {
115 return cJSON_GetObjectItem(mJSON, name.c_str())->valuedouble;
116 }
117
118 if (cJSON_HasObjectItem(mJSON, name.c_str())) {
119 return cJSON_GetObjectItem(mJSON, name.c_str())->valueint;
120 }
121
122 return defaultValue;
123}
124
125bool CicadaJSONItem::getBool(const std::string &name, bool defaultValue) const
126{

Callers

nothing calls this directly

Calls 2

cJSON_HasObjectItemFunction · 0.85
cJSON_GetObjectItemFunction · 0.85

Tested by

no test coverage detected