Skip to content

Commit

Permalink
State used namespace clearly with each type
Browse files Browse the repository at this point in the history
  • Loading branch information
teusbenschop committed Apr 20, 2024
1 parent a7a1f4d commit 183c79c
Show file tree
Hide file tree
Showing 108 changed files with 331 additions and 414 deletions.
2 changes: 1 addition & 1 deletion assets/header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ std::string Assets_Header::run ()
for (const auto& crumb : m_bread_crumbs) {
track << " » ";
if (!crumb.first.empty ()) {
track << "<a href=" << quoted("/" + menu_logic_menu_url (crumb.first)) << ">";
track << "<a href=" << std::quoted("/" + menu_logic_menu_url (crumb.first)) << ">";
}
track << crumb.second;
if (!crumb.first.empty ()) {
Expand Down
2 changes: 1 addition & 1 deletion changes/changes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ std::string changes_changes (Webserver_Request& webserver_request)


std::stringstream loading {};
loading << "var loading = " << quoted(translate("Loading ...")) << ";";
loading << "var loading = " << std::quoted(translate("Loading ...")) << ";";
std::string script = loading.str();
config::logic::swipe_enabled (webserver_request, script);
view.set_variable ("script", script);
Expand Down
4 changes: 2 additions & 2 deletions checks/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ std::string checks_index (Webserver_Request& webserver_request)
const std::string link = filter_passage_link_for_opening_editor_at (book, chapter, filter::strings::convert_to_string (verse));
const std::string information = filter::strings::escape_special_xml_characters (hit.data);
resultblock << "<p>\n";
resultblock << "<a href=" << quoted("index?approve=" + filter::strings::convert_to_string (id)) << "> ✔ </a>\n";
resultblock << "<a href=" << quoted ("index?delete=" + filter::strings::convert_to_string (id)) << ">" << filter::strings::emoji_wastebasket () << "</a>\n";
resultblock << "<a href=" << std::quoted("index?approve=" + filter::strings::convert_to_string (id)) << "> ✔ </a>\n";
resultblock << "<a href=" << std::quoted ("index?delete=" + filter::strings::convert_to_string (id)) << ">" << filter::strings::emoji_wastebasket () << "</a>\n";
resultblock << bible;
resultblock << " ";
resultblock << link;
Expand Down
4 changes: 2 additions & 2 deletions checks/pairs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void checks_pairs::run (const std::string& bible, int book, int chapter,
const std::string fragment1 = translate ("Closing character");
const std::string fragment2 = translate ("without its matching opening character");
std::stringstream message {};
message << fragment1 << " " << quoted(character) << " " << fragment2 << " " << quoted(opener);
message << fragment1 << " " << std::quoted(character) << " " << fragment2 << " " << std::quoted(opener);
database_check.recordOutput (bible, book, chapter, verse, message.str());
}
}
Expand All @@ -96,7 +96,7 @@ void checks_pairs::run (const std::string& bible, int book, int chapter,
const std::string fragment1 = translate ("Opening character");
const std::string fragment2 = translate ("without its matching closing character");
std::stringstream message {};
message << fragment1 << " " << quoted(opener) << " " << fragment2 << " " << quoted(closer);
message << fragment1 << " " << std::quoted(opener) << " " << fragment2 << " " << std::quoted(closer);
database_check.recordOutput (bible, book, chapter, verse, message.str());
}
}
Expand Down
4 changes: 2 additions & 2 deletions checks/run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,10 @@ void checks_run (std::string bible)
Webserver_Request webserver_request;
const std::string siteUrl = config::logic::site_url (webserver_request);
std::stringstream body1 {};
body1 << "<p><a href=" << quoted (siteUrl + checks_index_url ()) << ">" << translate("Checking results online") << "</a></p>";
body1 << "<p><a href=" << std::quoted (siteUrl + checks_index_url ()) << ">" << translate("Checking results online") << "</a></p>";
emailBody.push_back (body1.str());
std::stringstream body2 {};
body2 << "<p><a href=" << quoted(siteUrl + checks_settings_url ()) << ">" << translate ("Settings") << "</a></p>";
body2 << "<p><a href=" << std::quoted(siteUrl + checks_settings_url ()) << ">" << translate ("Settings") << "</a></p>";
emailBody.push_back (body2.str());
}

Expand Down
2 changes: 1 addition & 1 deletion client/logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ std::string client_logic_link_to_cloud (std::string path, std::string linktext)
}

std::stringstream link {};
link << "<a href=" << quoted(url) << external << ">" << linktext << "</a>";
link << "<a href=" << std::quoted(url) << external << ">" << linktext << "</a>";
return link.str();
}

Expand Down
2 changes: 1 addition & 1 deletion consistency/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ std::string consistency_index (Webserver_Request& webserver_request)
for (auto resource : resources) {
resourceblock << resource;
resourceblock << "\n";
resourceblock << "<a href=" << quoted("?remove=" + resource) << ">[" << translate("remove") << "]</a>";
resourceblock << "<a href=" << std::quoted("?remove=" + resource) << ">[" << translate("remove") << "]</a>";
resourceblock << " | ";
}
view.set_variable ("resourceblock", resourceblock.str());
Expand Down
2 changes: 1 addition & 1 deletion dialog/books.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ std::string Dialog_Books::run ()
std::stringstream book_block;
for (const auto & id : book_ids) {
book_block << "<a href=";
book_block << quoted(filter_url_build_http_query (base_url, selection_action, filter::strings::convert_to_string (id)));
book_block << std::quoted(filter_url_build_http_query (base_url, selection_action, filter::strings::convert_to_string (id)));
book_block << ">" << database::books::get_english_from_id (static_cast<book_id>(id)) << "</a>\n";
}
assets_view.set_variable ("book_block", book_block.str());
Expand Down
18 changes: 9 additions & 9 deletions edit/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,16 @@ std::string edit_index (Webserver_Request& webserver_request)
// Quote the text to be sure it's a legal Javascript string.
// https://github.com/bibledit/cloud/issues/900
std::stringstream script_stream {};
script_stream << "var editorChapterLoaded = " << quoted(locale_logic_text_loaded ()) << ";\n";
script_stream << "var editorChapterUpdating = " << quoted(locale_logic_text_updating ()) << ";\n";
script_stream << "var editorChapterUpdated = " << quoted(locale_logic_text_updated ()) << ";\n";
script_stream << "var editorWillSave = " << quoted(locale_logic_text_will_save ()) << ";\n";
script_stream << "var editorChapterSaving = " << quoted(locale_logic_text_saving ()) << ";\n";
script_stream << "var editorChapterSaved = " << quoted(locale_logic_text_saved ()) << ";\n";
script_stream << "var editorChapterRetrying = " << quoted(locale_logic_text_retrying ()) << ";\n";
script_stream << "var editorChapterVerseUpdatedLoaded = " << quoted(locale_logic_text_reload ()) << ";\n";
script_stream << "var editorChapterLoaded = " << std::quoted(locale_logic_text_loaded ()) << ";\n";
script_stream << "var editorChapterUpdating = " << std::quoted(locale_logic_text_updating ()) << ";\n";
script_stream << "var editorChapterUpdated = " << std::quoted(locale_logic_text_updated ()) << ";\n";
script_stream << "var editorWillSave = " << std::quoted(locale_logic_text_will_save ()) << ";\n";
script_stream << "var editorChapterSaving = " << std::quoted(locale_logic_text_saving ()) << ";\n";
script_stream << "var editorChapterSaved = " << std::quoted(locale_logic_text_saved ()) << ";\n";
script_stream << "var editorChapterRetrying = " << std::quoted(locale_logic_text_retrying ()) << ";\n";
script_stream << "var editorChapterVerseUpdatedLoaded = " << std::quoted(locale_logic_text_reload ()) << ";\n";
script_stream << "var verticalCaretPosition = " << webserver_request.database_config_user ()->getVerticalCaretPosition () << ";\n";
script_stream << "var verseSeparator = " << quoted(Database_Config_General::getNotesVerseSeparator ()) << ";\n";
script_stream << "var verseSeparator = " << std::quoted(Database_Config_General::getNotesVerseSeparator ()) << ";\n";
std::string script = script_stream.str();
config::logic::swipe_enabled (webserver_request, script);
view.set_variable ("script", script);
Expand Down
18 changes: 9 additions & 9 deletions editone2/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,17 @@ std::string editone2_index (Webserver_Request& webserver_request)

// Create the script, quote the strings to ensure it's legal Javascript.
std::stringstream script_stream {};
script_stream << "var oneverseEditorVerseLoaded = " << quoted(locale_logic_text_loaded ()) << ";\n";
script_stream << "var oneverseEditorVerseUpdating = " << quoted(locale_logic_text_updating ()) << ";\n";
script_stream << "var oneverseEditorVerseUpdated = " << quoted(locale_logic_text_updated ()) << ";\n";
script_stream << "var oneverseEditorWillSave = " << quoted(locale_logic_text_will_save ()) << ";\n";
script_stream << "var oneverseEditorVerseSaving = " << quoted(locale_logic_text_saving ()) << ";\n";
script_stream << "var oneverseEditorVerseSaved = " << quoted(locale_logic_text_saved ()) << ";\n";
script_stream << "var oneverseEditorVerseRetrying = " << quoted(locale_logic_text_retrying ()) << ";\n";
script_stream << "var oneverseEditorVerseUpdatedLoaded = " << quoted(locale_logic_text_reload ()) << ";\n";
script_stream << "var oneverseEditorVerseLoaded = " << std::quoted(locale_logic_text_loaded ()) << ";\n";
script_stream << "var oneverseEditorVerseUpdating = " << std::quoted(locale_logic_text_updating ()) << ";\n";
script_stream << "var oneverseEditorVerseUpdated = " << std::quoted(locale_logic_text_updated ()) << ";\n";
script_stream << "var oneverseEditorWillSave = " << std::quoted(locale_logic_text_will_save ()) << ";\n";
script_stream << "var oneverseEditorVerseSaving = " << std::quoted(locale_logic_text_saving ()) << ";\n";
script_stream << "var oneverseEditorVerseSaved = " << std::quoted(locale_logic_text_saved ()) << ";\n";
script_stream << "var oneverseEditorVerseRetrying = " << std::quoted(locale_logic_text_retrying ()) << ";\n";
script_stream << "var oneverseEditorVerseUpdatedLoaded = " << std::quoted(locale_logic_text_reload ()) << ";\n";
int verticalCaretPosition = webserver_request.database_config_user ()->getVerticalCaretPosition ();
script_stream << "var verticalCaretPosition = " << verticalCaretPosition << ";\n";
script_stream << "var verseSeparator = " << quoted(Database_Config_General::getNotesVerseSeparator ()) << ";\n";
script_stream << "var verseSeparator = " << std::quoted(Database_Config_General::getNotesVerseSeparator ()) << ";\n";
std::string script {script_stream.str()};
config::logic::swipe_enabled (webserver_request, script);
view.set_variable ("script", script);
Expand Down
12 changes: 6 additions & 6 deletions editusfm/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ std::string editusfm_index (Webserver_Request& webserver_request)

const int verticalCaretPosition = webserver_request.database_config_user ()->getVerticalCaretPosition ();
std::stringstream ss{};
ss << "var usfmEditorChapterLoaded = " << quoted(locale_logic_text_loaded ()) << ";" << std::endl;
ss << "var usfmEditorWillSave = " << quoted(locale_logic_text_will_save ()) << ";" << std::endl;
ss << "var usfmEditorChapterSaving = " << quoted(locale_logic_text_saving ()) << ";" << std::endl;
ss << "var usfmEditorChapterSaved = " << quoted(locale_logic_text_saved ()) << ";" << std::endl;
ss << "var usfmEditorChapterRetrying = " << quoted(locale_logic_text_retrying ()) << ";" << std::endl;
ss << "var usfmEditorVerseUpdatedLoaded = " << quoted(locale_logic_text_reload ()) << ";" << std::endl;
ss << "var usfmEditorChapterLoaded = " << std::quoted(locale_logic_text_loaded ()) << ";" << std::endl;
ss << "var usfmEditorWillSave = " << std::quoted(locale_logic_text_will_save ()) << ";" << std::endl;
ss << "var usfmEditorChapterSaving = " << std::quoted(locale_logic_text_saving ()) << ";" << std::endl;
ss << "var usfmEditorChapterSaved = " << std::quoted(locale_logic_text_saved ()) << ";" << std::endl;
ss << "var usfmEditorChapterRetrying = " << std::quoted(locale_logic_text_retrying ()) << ";" << std::endl;
ss << "var usfmEditorVerseUpdatedLoaded = " << std::quoted(locale_logic_text_reload ()) << ";" << std::endl;
ss << "var usfmEditorWriteAccess = true;" << std::endl;
ss << "var verticalCaretPosition = " << verticalCaretPosition << ";" << std::endl;
std::string script = ss.str();
Expand Down
2 changes: 1 addition & 1 deletion email/send.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void email_send ()
if (result.empty ()) {
database_mail.erase (id);
std::stringstream ss;
ss << "Email to " << email << " with subject " << quoted(subject) << " was ";
ss << "Email to " << email << " with subject " << std::quoted(subject) << " was ";
result = ss.str();
#ifdef HAVE_CLOUD
result.append ("sent successfully");
Expand Down
2 changes: 1 addition & 1 deletion filter/git.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ bool filter_git_commit (std::string repository, std::string user, std::string me
user = filter_git_user (user);
std::string email = filter_git_email (user);
std::stringstream author;
author << "--author=" << quoted(user + " <" + email + ">");
author << "--author=" << std::quoted(user + " <" + email + ">");
std::string out, err;
int result = filter_shell_run (repository, "git",
{"commit",
Expand Down
2 changes: 1 addition & 1 deletion filter/google.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ std::tuple <bool, std::string> activate_service_account ()
{
std::stringstream command;
command << "gcloud auth activate-service-account --quiet --key-file=";
command << quoted(config::logic::google_translate_json_key_path ());
command << std::quoted(config::logic::google_translate_json_key_path ());
std::string out_err;
int result = filter_shell_run (command.str(), out_err);
return { (result == 0), out_err };
Expand Down
1 change: 0 additions & 1 deletion filter/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#ifdef HAVE_EXECINFO
#include <execinfo.h>
#endif
using namespace std;


// Returns the memory available as a percentage of the total system memory.
Expand Down
1 change: 0 additions & 1 deletion filter/webview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <filter/webview.h>
#include <database/logs.h>
using namespace std;


void filter_webview_log_user_agent (std::string user_agent)
Expand Down
3 changes: 1 addition & 2 deletions flate/flate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <filter/string.h>
#include <database/logs.h>
#include <locale/translate.h>
using namespace std;


// Sets a variable (key and value) for the html template.
Expand All @@ -49,7 +48,7 @@ void Flate::add_iteration (std::string key, std::map <std::string, std::string>


// Renders the html template.
string Flate::render (std::string html)
std::string Flate::render (std::string html)
{
std::string rendering;
try {
Expand Down
3 changes: 1 addition & 2 deletions html/header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <pugixml.hpp>
#endif
#pragma GCC diagnostic pop
using namespace std;


// Class for creating a html Bible header with breadcrumbs and search box.
Expand All @@ -53,7 +52,7 @@ void Html_Header::search_back_link (std::string url, std::string text)
}


void Html_Header::create (const std::vector <std::pair <string, std::string> > & breadcrumbs)
void Html_Header::create (const std::vector <std::pair <std::string, std::string> > & breadcrumbs)
{
pugi::xml_node table_element = m_html_text.new_table ();
pugi::xml_node table_row_element = m_html_text.new_table_row (table_element);
Expand Down
1 change: 0 additions & 1 deletion i18n/logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <filter/url.h>
#include <filter/google.h>
#include <filter/string.h>
using namespace std;


void i18n_logic_augment_via_google_translate ()
Expand Down
5 changes: 2 additions & 3 deletions images/fetch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@
#include <filter/url.h>
#include <webserver/request.h>
#include <database/bibleimages.h>
using namespace std;


string images_fetch_url ()
std::string images_fetch_url ()
{
return "images/fetch";
}
Expand All @@ -38,7 +37,7 @@ bool images_fetch_acl (Webserver_Request& webserver_request)
}


string images_fetch (Webserver_Request& webserver_request)
std::string images_fetch (Webserver_Request& webserver_request)
{
// Image name.
std::string image = webserver_request.query ["image"];
Expand Down
7 changes: 3 additions & 4 deletions images/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
#include <journal/logic.h>
#include <menu/logic.h>
#include <database/bibleimages.h>
using namespace std;


string images_index_url ()
std::string images_index_url ()
{
return "images/index";
}
Expand All @@ -48,7 +47,7 @@ bool images_index_acl (Webserver_Request& webserver_request)
}


string images_index (Webserver_Request& webserver_request)
std::string images_index (Webserver_Request& webserver_request)
{
Database_BibleImages database_bibleimages;

Expand Down Expand Up @@ -106,7 +105,7 @@ string images_index (Webserver_Request& webserver_request)
std::vector <std::string> images = database_bibleimages.get();
for (auto image : images) {
view.add_iteration ("images", {
pair ("image", image),
std::pair ("image", image),
} );
}

Expand Down
1 change: 0 additions & 1 deletion images/logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <locale/translate.h>
#include <database/bibleimages.h>
#include <database/logs.h>
using namespace std;


void images_logic_import_images (std::string path)
Expand Down
5 changes: 2 additions & 3 deletions images/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@
#include <journal/logic.h>
#include <menu/logic.h>
#include <database/bibleimages.h>
using namespace std;


string images_view_url ()
std::string images_view_url ()
{
return "images/view";
}
Expand All @@ -47,7 +46,7 @@ bool images_view_acl (Webserver_Request& webserver_request)
}


string images_view (Webserver_Request& webserver_request)
std::string images_view (Webserver_Request& webserver_request)
{
std::string page;
Assets_Header header = Assets_Header (translate("Bible image"), webserver_request);
Expand Down
1 change: 0 additions & 1 deletion ipc/focus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <webserver/request.h>
#include <database/cache.h>
#include <filter/string.h>
using namespace std;


// Sets the focus.
Expand Down
1 change: 0 additions & 1 deletion ipc/notes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <filter/usfm.h>
#include <database/navigation.h>
#include <webserver/request.h>
using namespace std;


// Deals with the consultation notes stuff.
Expand Down
5 changes: 2 additions & 3 deletions jobs/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
#include <access/bible.h>
#include <tasks/logic.h>
#include <database/jobs.h>
using namespace std;


string jobs_index_url ()
std::string jobs_index_url ()
{
return "jobs/index";
}
Expand All @@ -44,7 +43,7 @@ bool jobs_index_acl (Webserver_Request& webserver_request)
}


string jobs_index (Webserver_Request& webserver_request)
std::string jobs_index (Webserver_Request& webserver_request)
{
std::string page;

Expand Down
Loading

0 comments on commit 183c79c

Please sign in to comment.