@@ -15,35 +15,35 @@ namespace tao
1515 namespace json
1616 {
1717 template < template < typename ... > class Traits >
18- void patch_inplace ( basic_value< Traits >& value , const basic_value< Traits >& patch )
18+ void patch_inplace ( basic_value< Traits >& v , const basic_value< Traits >& patch )
1919 {
2020 for ( const auto & entry : patch.get_array () ) {
2121 const auto & op = entry.at ( " op" ).get_string ();
2222 const auto & path = entry.at ( " path" ).get_string ();
2323 const pointer path_pointer ( path );
2424 if ( op == " test" ) {
25- if ( value .at ( path_pointer ) != entry.at ( " value" ) ) {
25+ if ( v .at ( path_pointer ) != entry.at ( " value" ) ) {
2626 throw std::runtime_error ( " test failed for: " + path );
2727 }
2828 }
2929 else if ( op == " remove" ) {
30- value .erase ( path_pointer );
30+ v .erase ( path_pointer );
3131 }
3232 else if ( op == " add" ) {
33- value .insert ( path_pointer, entry.at ( " value" ) );
33+ v .insert ( path_pointer, entry.at ( " value" ) );
3434 }
3535 else if ( op == " replace" ) {
36- value .at ( path_pointer ) = entry.at ( " value" );
36+ v .at ( path_pointer ) = entry.at ( " value" );
3737 }
3838 else if ( op == " move" ) {
3939 const pointer from ( entry.at ( " from" ).get_string () );
40- auto v = std::move ( value .at ( from ) );
41- value .erase ( from );
42- value .insert ( path_pointer, std::move ( v ) );
40+ auto t = std::move ( v .at ( from ) );
41+ v .erase ( from );
42+ v .insert ( path_pointer, std::move ( t ) );
4343 }
4444 else if ( op == " copy" ) {
4545 const pointer from ( entry.at ( " from" ).get_string () );
46- value .insert ( path_pointer, value .at ( from ) );
46+ v .insert ( path_pointer, v .at ( from ) );
4747 }
4848 else {
4949 throw std::runtime_error ( " unknown patch operation: '" + op + ' \' ' );
@@ -52,35 +52,35 @@ namespace tao
5252 }
5353
5454 template < template < typename ... > class Traits >
55- void patch_inplace ( basic_value< Traits >& value , basic_value< Traits >&& patch )
55+ void patch_inplace ( basic_value< Traits >& v , basic_value< Traits >&& patch )
5656 {
5757 for ( const auto & entry : patch.get_array () ) {
5858 const auto & op = entry.at ( " op" ).get_string ();
5959 const auto & path = entry.at ( " path" ).get_string ();
6060 const pointer path_pointer ( path );
6161 if ( op == " test" ) {
62- if ( value .at ( path_pointer ) != entry.at ( " value" ) ) {
62+ if ( v .at ( path_pointer ) != entry.at ( " value" ) ) {
6363 throw std::runtime_error ( " test failed for: " + path );
6464 }
6565 }
6666 else if ( op == " remove" ) {
67- value .erase ( path_pointer );
67+ v .erase ( path_pointer );
6868 }
6969 else if ( op == " add" ) {
70- value .insert ( path_pointer, std::move ( entry.at ( " value" ) ) );
70+ v .insert ( path_pointer, std::move ( entry.at ( " value" ) ) );
7171 }
7272 else if ( op == " replace" ) {
73- value .at ( path_pointer ) = std::move ( entry.at ( " value" ) );
73+ v .at ( path_pointer ) = std::move ( entry.at ( " value" ) );
7474 }
7575 else if ( op == " move" ) {
7676 const pointer from ( entry.at ( " from" ).get_string () );
77- auto v = std::move ( value .at ( from ) );
78- value .erase ( from );
79- value .insert ( path_pointer, std::move ( v ) );
77+ auto t = std::move ( v .at ( from ) );
78+ v .erase ( from );
79+ v .insert ( path_pointer, std::move ( t ) );
8080 }
8181 else if ( op == " copy" ) {
8282 const pointer from ( entry.at ( " from" ).get_string () );
83- value .insert ( path_pointer, value .at ( from ) );
83+ v .insert ( path_pointer, v .at ( from ) );
8484 }
8585 else {
8686 throw std::runtime_error ( " unknown patch operation: '" + op + ' \' ' );
@@ -89,17 +89,17 @@ namespace tao
8989 }
9090
9191 template < template < typename ... > class Traits >
92- basic_value< Traits > patch ( basic_value< Traits > value , const basic_value< Traits >& patch )
92+ basic_value< Traits > patch ( basic_value< Traits > v , const basic_value< Traits >& patch )
9393 {
94- patch_inplace ( value , patch );
95- return std::move ( value );
94+ patch_inplace ( v , patch );
95+ return std::move ( v );
9696 }
9797
9898 template < template < typename ... > class Traits >
99- basic_value< Traits > patch ( basic_value< Traits > value , basic_value< Traits >&& patch )
99+ basic_value< Traits > patch ( basic_value< Traits > v , basic_value< Traits >&& patch )
100100 {
101- patch_inplace ( value , std::move ( patch ) );
102- return std::move ( value );
101+ patch_inplace ( v , std::move ( patch ) );
102+ return std::move ( v );
103103 }
104104
105105 } // namespace json
0 commit comments