diff --git a/database/notes.cpp b/database/notes.cpp index 2d295a0c6..259a3925c 100644 --- a/database/notes.cpp +++ b/database/notes.cpp @@ -41,7 +41,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #include #include using namespace std; -using namespace jsonxx; // Database resilience. @@ -568,7 +567,7 @@ int Database_Notes::store_new_note (const string& bible, int book, int chapter, string path = note_file (identifier); string folder = filter_url_dirname (path); filter_url_mkdir (folder); - Object note; + jsonxx::Object note; note << bible_key () << bible; note << passage_key () << passage; note << status_key () << status; @@ -1833,11 +1832,11 @@ string Database_Notes::notes_order_by_relevance_statement () string Database_Notes::get_bulk (vector identifiers) { // JSON container for the bulk notes. - Array bulk; + jsonxx::Array bulk; // Go through all the notes. for (auto identifier : identifiers) { // JSON object for the note. - Object note; + jsonxx::Object note; // Add all the fields of the note. string assigned = get_field (identifier, assigned_key ()); note << "a" << assigned; @@ -1875,24 +1874,24 @@ vector Database_Notes::set_bulk (string json) vector summaries; // Parse the incoming JSON. - Array bulk; + jsonxx::Array bulk; bulk.parse (json); // Go through the notes the JSON contains. for (size_t i = 0; i < bulk.size (); i++) { // Get all the different fields for this note. - Object note = bulk.get(static_cast(i)); - string assigned = note.get ("a"); - string bible = note.get ("b"); - string contents = note.get ("c"); - int identifier = static_cast(note.get ("i")); - int modified = static_cast(note.get ("m")); - string passage = note.get ("p"); - string subscriptions = note.get ("sb"); - string summary = note.get ("sm"); - string status = note.get ("st"); - int severity = static_cast(note.get ("sv")); + jsonxx::Object note = bulk.get(static_cast(i)); + string assigned = note.get ("a"); + string bible = note.get ("b"); + string contents = note.get ("c"); + int identifier = static_cast(note.get ("i")); + int modified = static_cast(note.get ("m")); + string passage = note.get ("p"); + string subscriptions = note.get ("sb"); + string summary = note.get ("sm"); + string status = note.get ("st"); + int severity = static_cast(note.get ("sv")); // Feedback about which note it received in bulk. summaries.push_back (summary); @@ -1901,7 +1900,7 @@ vector Database_Notes::set_bulk (string json) string path = note_file (identifier); string folder = filter_url_dirname (path); filter_url_mkdir (folder); - Object note2; + jsonxx::Object note2; note2 << assigned_key () << assigned; note2 << bible_key () << bible; note2 << contents_key () << contents; @@ -1930,10 +1929,10 @@ string Database_Notes::get_field (int identifier, string key) { string file = note_file (identifier); string json = filter_url_file_get_contents (file); - Object note; + jsonxx::Object note; note.parse (json); string value; - if (note.has (key)) value = note.get (key); + if (note.has (key)) value = note.get (key); return value; } @@ -1943,7 +1942,7 @@ void Database_Notes::set_field (int identifier, string key, string value) { string file = note_file (identifier); string json = filter_url_file_get_contents (file); - Object note; + jsonxx::Object note; note.parse (json); note << key << value; json = note.json (); diff --git a/filter/google.cpp b/filter/google.cpp index a4b63e73a..5471057f0 100644 --- a/filter/google.cpp +++ b/filter/google.cpp @@ -30,7 +30,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #include #pragma GCC diagnostic pop using namespace std; -using namespace jsonxx; namespace filter::google { @@ -121,7 +120,7 @@ tuple translate (const string text, const char * source, const string url { "https://translation.googleapis.com/language/translate/v2" }; // Create the JSON data to post. - Object translation_data; + jsonxx::Object translation_data; translation_data << "q" << text; translation_data << "source" << string (source); translation_data << "target" << string (target); @@ -151,12 +150,12 @@ tuple translate (const string text, const char * source, // } if (error.empty()) { try { - Object json_object; + jsonxx::Object json_object; json_object.parse (translation); - Object data = json_object.get ("data"); - Array translations = data.get ("translations"); - Object translated = translations.get(0); - translation = translated.get ("translatedText"); + jsonxx::Object data = json_object.get ("data"); + jsonxx::Array translations = data.get ("translations"); + jsonxx::Object translated = translations.get(0); + translation = translated.get ("translatedText"); } catch (const exception & exception) { error = exception.what(); error.append (" - "); @@ -189,7 +188,7 @@ vector > get_languages (const string & target) const string url { "https://translation.googleapis.com/language/translate/v2/languages" }; // Create the JSON data to post. - Object request_data; + jsonxx::Object request_data; request_data << "target" << target; string postdata = request_data.json (); @@ -225,14 +224,14 @@ vector > get_languages (const string & target) vector > language_codes_names; if (error.empty()) { try { - Object json_object; + jsonxx::Object json_object; json_object.parse (result_json); - Object data = json_object.get ("data"); - Array languages = data.get ("languages"); + jsonxx::Object data = json_object.get ("data"); + jsonxx::Array languages = data.get ("languages"); for (size_t i = 0; i < languages.size(); i++) { - Object language_name = languages.get(static_cast(i)); - string language = language_name.get("language"); - string name = language_name.get("name"); + jsonxx::Object language_name = languages.get(static_cast(i)); + string language = language_name.get("language"); + string name = language_name.get("name"); language_codes_names.push_back({language, name}); } } catch (const exception & exception) { diff --git a/resource/external.cpp b/resource/external.cpp index 026da9afb..6da04d054 100644 --- a/resource/external.cpp +++ b/resource/external.cpp @@ -38,7 +38,6 @@ #endif #pragma GCC diagnostic pop using namespace std; -using namespace jsonxx; // Tpdo // Local forward declarations: