コード例 #1
0
ファイル: json.cpp プロジェクト: Doffeh/Cataclysm-DDA
bool JsonIn::read(JsonDeserializer &j)
{
    // can't know what type of json object it will deserialize from,
    // so just try to deserialize, catching any error.
    // TODO: non-verbose flag for JsonIn errors so try/catch is faster here
    try {
        j.deserialize(*this);
        return true;
    } catch (std::string e) {
        return false;
    }
}
コード例 #2
0
ファイル: cata_utility.cpp プロジェクト: Wuzzy2/Cataclysm-DDA
bool read_from_file_optional( const std::string &path, JsonDeserializer &reader )
{
    return read_from_file_optional_json( path, [&reader]( JsonIn & jsin ) {
        reader.deserialize( jsin );
    } );
}