| 62 | } |
| 63 | |
| 64 | std::string CicadaJSONItem::getString(const std::string &name, const std::string &defaultString) const |
| 65 | { |
| 66 | if (nullptr == mJSON) { |
| 67 | return defaultString; |
| 68 | } |
| 69 | |
| 70 | if (cJSON_HasObjectItem(mJSON, name.c_str())) { |
| 71 | char *str = cJSON_GetObjectItem(mJSON, name.c_str())->valuestring; |
| 72 | |
| 73 | if (str) { |
| 74 | return str; |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | return defaultString; |
| 79 | } |
| 80 | |
| 81 | std::string CicadaJSONItem::getString(const std::string &name) const |
| 82 | { |