Skip to content

Commit

Permalink
create_if_missing -> add_if_missing
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaparker committed Nov 17, 2023
1 parent cc3953d commit 859ba7e
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 69 deletions.
2 changes: 1 addition & 1 deletion doc/Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -3080,7 +3080,7 @@ int main()
}

json j;
jsonpointer::add(j, location, "str", true); // create_if_missing set to true
jsonpointer::add(j, location, "str", true); // add_if_missing set to true

std::cout << pretty_print(j) << "\n\n";
}
Expand Down
10 changes: 5 additions & 5 deletions doc/ref/jsonpointer/add.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ template<class Json, class T>
void add(Json& target,
const basic_json_pointer<Json::char_type>& location,
T&& value,
bool create_if_missing = false); (1) (since 0.167.0)
bool add_if_missing = false); (1) (since 0.167.0)

template<class Json, class T>
void add(Json& target,
Expand All @@ -22,14 +22,14 @@ template<class Json, class T>
void add(Json& target,
const basic_json_pointer<Json::char_type>& location,
T&& value,
bool create_if_missing,
bool add_if_missing,
std::error_code& ec); (3) (since 0.167.0)

template<class Json, class StringSource, class T>
void add(Json& target,
const StringSource& location_str,
T&& value,
bool create_if_missing = false); (4)
bool add_if_missing = false); (4)

template<class Json, class StringSource, class T>
void add(Json& target,
Expand All @@ -41,7 +41,7 @@ template<class Json, class StringSource, class T>
void add(Json& target,
const StringSource& location_str,
T&& value,
bool create_if_missing,
bool add_if_missing,
std::error_code& ec); (6) (since 0.162.0)
```
Expand Down Expand Up @@ -72,7 +72,7 @@ Inserts a value into the target at the specified location, or if the location sp
<td>New or replacement value</td>
</tr>
<tr>
<td><code>create_if_missing</code> (since 0.162.0)</td>
<td><code>add_if_missing</code> (since 0.162.0)</td>
<td>Create key-object pairs when object key is missing</td>
</tr>
<tr>
Expand Down
10 changes: 5 additions & 5 deletions doc/ref/jsonpointer/add_if_absent.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ template<class Json, class T>
void add_if_absent(Json& target,
const basic_json_pointer<Json::char_type>& location,
T&& value,
bool create_if_missing = false); (1)
bool add_if_missing = false); (1)

template<class Json, class T>
void add_if_absent(Json& target,
Expand All @@ -22,14 +22,14 @@ template<class Json, class T>
void add_if_absent(Json& target,
const basic_json_pointer<Json::char_type>& location,
T&& value,
bool create_if_missing,
bool add_if_missing,
std::error_code& ec); (3)

template<class Json, class StringSource, class T>
void add_if_absent(Json& target,
const StringSource& location_str,
T&& value,
bool create_if_missing = false); (4)
bool add_if_missing = false); (4)

template<class Json, class StringSource, class T>
void add_if_absent(Json& target,
Expand All @@ -41,7 +41,7 @@ template<class Json, class StringSource, class T>
void add_if_absent(Json& target,
const StringSource& location_str,
T&& value,
bool create_if_missing,
bool add_if_missing,
std::error_code& ec); (6)
```
Expand Down Expand Up @@ -70,7 +70,7 @@ Inserts a value into the target at the specified location, if the location doesn
<td>New value</td>
</tr>
<tr>
<td><code>create_if_missing</code> (since 0.162.0)</td>
<td><code>add_if_missing</code> (since 0.162.0)</td>
<td>Create key-object pairs when object key is missing</td>
</tr>
<tr>
Expand Down
10 changes: 5 additions & 5 deletions doc/ref/jsonpointer/get.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Selects a value.
template<class Json>
Json& get(Json& root,
const basic_json_pointer<Json::char_type>& location,
bool create_if_missing = false); (1)
bool add_if_missing = false); (1)

template<class Json>
const Json& get(const Json& root,
Expand All @@ -27,13 +27,13 @@ const Json& get(const Json& root,
template<class Json>
Json& get(Json& root,
const basic_json_pointer<Json::char_type>& location,
bool create_if_missing,
bool add_if_missing,
std::error_code& ec); (5)

template<class Json, class StringSource>
Json& get(Json& root,
const StringSource& location_str,
bool create_if_missing = false); (6)
bool add_if_missing = false); (6)

template<class Json, class StringSource>
const Json& get(const Json& root,
Expand All @@ -52,7 +52,7 @@ const Json& get(const Json& root,
template<class Json, class StringSource>
Json& get(Json& root,
const StringSource& location_str,
bool create_if_missing,
bool add_if_missing,
std::error_code& ec); (10)
```
Expand All @@ -71,7 +71,7 @@ Json& get(Json& root,
<td>A JSON Pointer provided as a string, string view, or C-string</td>
</tr>
<tr>
<td><code>create_if_missing</code> (since 0.162.0)</td>
<td><code>add_if_missing</code> (since 0.162.0)</td>
<td>Create key-object pairs when object key is missing</td>
</tr>
<tr>
Expand Down
10 changes: 5 additions & 5 deletions doc/ref/jsonpointer/replace.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ template<class Json, class T>
void replace(Json& target,
const basic_json_pointer<Json::char_type>& location,
T&& value,
bool create_if_missing = false); (1)
bool add_if_missing = false); (1)

template<class Json, class T>
void replace(Json& target,
Expand All @@ -21,14 +21,14 @@ template<class Json, class T>
void replace(Json& target,
const basic_json_pointer<Json::char_type>& location,
T&& value,
bool create_if_missing,
bool add_if_missing,
std::error_code& ec); (3)

template<class Json, class StringSource, class T>
void replace(Json& target,
const StringSource& location_str,
T&& value,
bool create_if_missing = false); (4)
bool add_if_missing = false); (4)

template<class Json, class StringSource, class T>
void replace(Json& target,
Expand All @@ -40,7 +40,7 @@ template<class Json, class StringSource, class T>
void replace(Json& target,
const StringSource& location_str,
T&& value,
bool create_if_missing,
bool add_if_missing,
std::error_code& ec); (6)
```
Expand All @@ -65,7 +65,7 @@ Replaces the value at the location specified by `location` with a new value.
<td>Replacement value</td>
</tr>
<tr>
<td><code>create_if_missing</code> (since 0.162.0)</td>
<td><code>add_if_missing</code> (since 0.162.0)</td>
<td>Create key-object pairs when object key is missing</td>
</tr>
<tr>
Expand Down
16 changes: 8 additions & 8 deletions examples/src/jsonpointer_examples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ void flatten_and_unflatten2()
std::cout << "(3)\n" << pretty_print(unflattened2) << "\n";
}

void get_with_create_if_missing()
void get_and_add_if_missing()
{
std::vector<std::string> keys = {"foo","bar","baz"};

Expand All @@ -518,7 +518,7 @@ void get_with_create_if_missing()
std::cout << pretty_print(doc) << "\n\n";
}

void add_with_create_if_missing()
void add_and_add_if_missing()
{
std::vector<std::string> keys = {"foo","bar","baz"};

Expand All @@ -534,7 +534,7 @@ void add_with_create_if_missing()
std::cout << pretty_print(doc) << "\n\n";
}

void add_if_absent_with_create_if_missing()
void add_if_absent_and_add_if_missing()
{
std::vector<std::string> keys = { "foo","bar","baz" };

Expand All @@ -550,7 +550,7 @@ void add_if_absent_with_create_if_missing()
std::cout << pretty_print(doc) << "\n\n";
}

void replace_with_create_if_missing()
void replace_and_add_if_missing()
{
std::vector<std::string> keys = {"foo","bar","baz"};

Expand Down Expand Up @@ -590,9 +590,9 @@ int main()
jsonpointer_address_concatenate();
flatten_and_unflatten();
flatten_and_unflatten2();
get_with_create_if_missing();
add_with_create_if_missing();
add_if_absent_with_create_if_missing();
replace_with_create_if_missing();
get_and_add_if_missing();
add_and_add_if_missing();
add_if_absent_and_add_if_missing();
replace_and_add_if_missing();
}

Loading

0 comments on commit 859ba7e

Please sign in to comment.