Exemplo n.º 1
0
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;
    }
}
Exemplo n.º 2
0
bool read_from_file_optional( const std::string &path, JsonDeserializer &reader )
{
    return read_from_file_optional_json( path, [&reader]( JsonIn & jsin ) {
        reader.deserialize( jsin );
    } );
}