• Petr Lapukhov's avatar
    Introduce try_get_ptr() method to query elements by JSON pointer · 5824119b
    Petr Lapukhov authored
    Summary: Previously `get_ptr(json_pointer const&)` would return nullptr or throw. The new try_get_ptr version provides richer facilities: points which token caused resolution error, if any, and also provides pointer to last-known properly resolved element. This allows, for example, implementing append logic with pointers like "/foo/bar/-" if "bar" is an array. The error would return `dynamic*` for the array, allowing caller to immediately perform push operation. Consequently, the get_ptr() is now implemented in terms of `try_get_ptr`.
    
    Reviewed By: yfeldblum
    
    Differential Revision: D10098092
    
    fbshipit-source-id: 620996a66823be661d64d39661837cedf3c24493
    5824119b
dynamic-inl.h 35.8 KB