diff --git a/checks/versification.cpp b/checks/versification.cpp index 403eec70d..400e5fc21 100644 --- a/checks/versification.cpp +++ b/checks/versification.cpp @@ -23,7 +23,6 @@ #include #include #include -using namespace std; void checks_versification::books (const std::string& bible, const std::vector & books) diff --git a/checksum/logic.cpp b/checksum/logic.cpp index 07416ae51..765e83c60 100644 --- a/checksum/logic.cpp +++ b/checksum/logic.cpp @@ -22,7 +22,6 @@ #include #include #include -using namespace std; // This function reads $data, @@ -32,7 +31,7 @@ using namespace std; // The first line contains the checksum. // The second line contains the readwrite as 0 or 1. // The rest contains the $data. -string checksum_logic::send (const std::string& data, bool readwrite) +std::string checksum_logic::send (const std::string& data, bool readwrite) { std::string checksum = get (data); checksum.append ("\n"); @@ -45,7 +44,7 @@ string checksum_logic::send (const std::string& data, bool readwrite) // This function gets the checksum for $data, and returns it. // It calculates the length of 'data' in bytes. -string checksum_logic::get (const std::string& data) +std::string checksum_logic::get (const std::string& data) { return filter::strings::convert_to_string (data.length ()); } @@ -53,7 +52,7 @@ string checksum_logic::get (const std::string& data) // This function gets the checksum for $data, and returns it. // It calculates the length of vector 'data' in bytes. -string checksum_logic::get (const std::vector & data) +std::string checksum_logic::get (const std::vector & data) { int length = 0; for (auto & bit : data) length += static_cast(bit.length ()); @@ -62,7 +61,7 @@ string checksum_logic::get (const std::vector & data) // Returns a proper checksum for the USFM in the chapter. -string checksum_logic::get_chapter (Webserver_Request& webserver_request, const std::string& bible, int book, int chapter) +std::string checksum_logic::get_chapter (Webserver_Request& webserver_request, const std::string& bible, int book, int chapter) { std::string usfm = webserver_request.database_bibles()->get_chapter (bible, book, chapter); std::string checksum = md5 (filter::strings::trim (usfm)); @@ -71,7 +70,7 @@ string checksum_logic::get_chapter (Webserver_Request& webserver_request, const // Returns a proper checksum for the USFM in the book. -string checksum_logic::get_book (Webserver_Request& webserver_request, const std::string& bible, int book) +std::string checksum_logic::get_book (Webserver_Request& webserver_request, const std::string& bible, int book) { std::vector chapters = webserver_request.database_bibles()->get_chapters (bible, book); std::vector checksums; @@ -85,7 +84,7 @@ string checksum_logic::get_book (Webserver_Request& webserver_request, const std // Returns a proper checksum for the USFM in the $bible. -string checksum_logic::get_bible (Webserver_Request& webserver_request, const std::string& bible) +std::string checksum_logic::get_bible (Webserver_Request& webserver_request, const std::string& bible) { std::vector books = webserver_request.database_bibles()->get_books (bible); std::vector checksums; @@ -99,7 +98,7 @@ string checksum_logic::get_bible (Webserver_Request& webserver_request, const st // Returns a proper checksum for the USFM in the array of $bibles. -string checksum_logic::get_bibles (Webserver_Request& webserver_request, const std::vector & bibles) +std::string checksum_logic::get_bibles (Webserver_Request& webserver_request, const std::vector & bibles) { std::vector checksums; for (const auto & bible : bibles) { @@ -109,4 +108,3 @@ string checksum_logic::get_bibles (Webserver_Request& webserver_request, const s checksum = md5 (checksum); return checksum; } - diff --git a/client/logic.cpp b/client/logic.cpp index 0f682f3a0..4d09a66ba 100644 --- a/client/logic.cpp +++ b/client/logic.cpp @@ -31,7 +31,6 @@ #include #include #include -using namespace std; // Returns whether Client mode is enabled. @@ -56,7 +55,7 @@ void client_logic_enable_client (bool enable) // $address is the website. // $port is the port number. // $path is the path after the website. -string client_logic_url (const std::string& address, int port, const std::string& path) +std::string client_logic_url (const std::string& address, int port, const std::string& path) { return address + ":" + filter::strings::convert_to_string (port) + "/" + path; } @@ -66,7 +65,7 @@ string client_logic_url (const std::string& address, int port, const std::string // It receives settings from the server and applies them to the client. // It returns the level of the user. // It returns an empty string in case of failure or the response from the server. -string client_logic_connection_setup (string user, string hash) +std::string client_logic_connection_setup (std::string user, std::string hash) { Database_Users database_users {}; @@ -118,8 +117,8 @@ string client_logic_connection_setup (string user, string hash) } -string client_logic_create_note_encode (const std::string& bible, int book, int chapter, int verse, - const std::string& summary, const std::string& contents, bool raw) +std::string client_logic_create_note_encode (const std::string& bible, int book, int chapter, int verse, + const std::string& summary, const std::string& contents, bool raw) { std::vector data {}; data.push_back (bible); @@ -134,8 +133,8 @@ string client_logic_create_note_encode (const std::string& bible, int book, int void client_logic_create_note_decode (const std::string& data, - string& bible, int& book, int& chapter, int& verse, - string& summary, string& contents, bool& raw) + std::string& bible, int& book, int& chapter, int& verse, + std::string& summary, std::string& contents, bool& raw) { std::vector lines = filter::strings::explode (data, '\n'); if (!lines.empty ()) { @@ -168,7 +167,7 @@ void client_logic_create_note_decode (const std::string& data, // This provides a html link to Bibledit Cloud / $path. // It displays the $linktext. -string client_logic_link_to_cloud (string path, string linktext) +std::string client_logic_link_to_cloud (std::string path, std::string linktext) { std::string url {}; std::string external {}; @@ -195,14 +194,14 @@ string client_logic_link_to_cloud (string path, string linktext) linktext = url; } - stringstream link {}; + std::stringstream link {}; link << "" << linktext << ""; return link.str(); } // Path to the file in the client files area that contains a list of USFM resources on the server. -string client_logic_usfm_resources_path () +std::string client_logic_usfm_resources_path () { return filter_url_create_root_path ({database_logic_databases (), "client", "usfm_resources.txt"}); } @@ -220,14 +219,14 @@ void client_logic_usfm_resources_update () } -vector client_logic_usfm_resources_get () +std::vector client_logic_usfm_resources_get () { std::string contents = filter_url_file_get_contents (client_logic_usfm_resources_path ()); return filter::strings::explode (contents, '\n'); } -string client_logic_get_username () +std::string client_logic_get_username () { // Set the user name to the first one in the database. // Or if the database has no users, make the user admin. @@ -240,13 +239,13 @@ string client_logic_get_username () } -string client_logic_no_cache_resources_path () +std::string client_logic_no_cache_resources_path () { return filter_url_create_root_path ({database_logic_databases (), "client", "no_cache_resources.txt"}); } -void client_logic_no_cache_resources_save (vector resources) +void client_logic_no_cache_resources_save (std::vector resources) { std::string contents = filter::strings::implode(resources, "\n"); std::string path = client_logic_no_cache_resources_path (); @@ -254,7 +253,7 @@ void client_logic_no_cache_resources_save (vector resources) } -void client_logic_no_cache_resource_add (string name) +void client_logic_no_cache_resource_add (std::string name) { std::vector resources = client_logic_no_cache_resources_get(); if (in_array(name, resources)) return; @@ -263,7 +262,7 @@ void client_logic_no_cache_resource_add (string name) } -void client_logic_no_cache_resource_remove (string name) +void client_logic_no_cache_resource_remove (std::string name) { std::vector resources = client_logic_no_cache_resources_get(); if (!in_array(name, resources)) return; @@ -272,9 +271,9 @@ void client_logic_no_cache_resource_remove (string name) } -vector client_logic_no_cache_resources_get () +std::vector client_logic_no_cache_resources_get () { std::string contents = filter_url_file_get_contents (client_logic_no_cache_resources_path()); - vector resources = filter::strings::explode(contents, "\n"); + std::vector resources = filter::strings::explode(contents, "\n"); return resources; } diff --git a/compare/compare.cpp b/compare/compare.cpp index 363a788b1..e4acc4456 100644 --- a/compare/compare.cpp +++ b/compare/compare.cpp @@ -39,7 +39,7 @@ using namespace std; -void compare_compare (string bible, string compare, int jobId) +void compare_compare (std::string bible, std::string compare, int jobId) { Database_Logs::log (translate("Comparing Bibles") + " " + bible + " " + translate ("and") + " " + compare, Filter_Roles::consultant ()); diff --git a/confirm/worker.cpp b/confirm/worker.cpp index 2e033a252..146a46c42 100644 --- a/confirm/worker.cpp +++ b/confirm/worker.cpp @@ -59,10 +59,10 @@ m_webserver_request (webserver_request) // query : The query to be executed on the database if the user confirms the email successfully. // subsequent_subject: The subject of the email to send upon user confirmation. // subsequent_body : The body of the email to send upon user confirmation. -void Confirm_Worker::setup (string mailto, string username, - std::string initial_subject, string initial_body, +void Confirm_Worker::setup (std::string mailto, std::string username, + std::string initial_subject, std::string initial_body, std::string query, - std::string subsequent_subject, string subsequent_body) + std::string subsequent_subject, std::string subsequent_body) { Database_Confirm database_confirm; unsigned int confirmation_id = database_confirm.get_new_id (); @@ -77,7 +77,7 @@ void Confirm_Worker::setup (string mailto, string username, std::string siteUrl = config::logic::site_url (m_webserver_request); std::string confirmation_url = filter_url_build_http_query (siteUrl + session_confirm_url (), "id", to_string(confirmation_id)); node.text ().set (confirmation_url.c_str()); - stringstream output; + std::stringstream output; document.print (output, "", pugi::format_raw); initial_body += output.str (); email_schedule (mailto, initial_subject, initial_body); @@ -87,7 +87,7 @@ void Confirm_Worker::setup (string mailto, string username, // Handles a confirmation email received "from" with "subject" and "body". // Returns true if the mail was handled, else false. -bool Confirm_Worker::handleEmail ([[maybe_unused]]string from, string subject, string body) +bool Confirm_Worker::handleEmail ([[maybe_unused]]string from, std::string subject, std::string body) { // Find out in the confirmation database whether the subject line contains an active ID. // If not, bail out. @@ -115,7 +115,7 @@ bool Confirm_Worker::handleEmail ([[maybe_unused]]string from, string subject, s // Handles a confirmation link clicked with a confirmation ID. // Returns true if link was valid, else false. -bool Confirm_Worker::handleLink (string & email) +bool Confirm_Worker::handleLink (std::string & email) { // Get the confirmation identifier from the link that was clicked. std::string web_id = m_webserver_request.query["id"]; @@ -156,7 +156,7 @@ bool Confirm_Worker::handleLink (string & email) // Inform the managers about an account change. -void Confirm_Worker::informManagers (string email, string body) +void Confirm_Worker::informManagers (std::string email, std::string body) { Database_Users database_users; std::vector users = database_users.get_users (); diff --git a/consistency/index.cpp b/consistency/index.cpp index e3d6639e0..16e6b00a3 100644 --- a/consistency/index.cpp +++ b/consistency/index.cpp @@ -75,7 +75,7 @@ string consistency_index (Webserver_Request& webserver_request) } - stringstream resourceblock; + std::stringstream resourceblock; std::vector resources = webserver_request.database_config_user()->getConsistencyResources (); for (auto resource : resources) { resourceblock << resource; diff --git a/consistency/logic.cpp b/consistency/logic.cpp index 63622dacf..c78ab7220 100644 --- a/consistency/logic.cpp +++ b/consistency/logic.cpp @@ -134,14 +134,14 @@ string Consistency_Logic::response () } -string Consistency_Logic::verseText (string resource, int book, int chapter, int verse) +string Consistency_Logic::verseText (std::string resource, int book, int chapter, int verse) { return resource_logic_get_html (m_webserver_request, resource, book, chapter, verse, false); } // This function omits the verse text from a line of text from the search results. -string Consistency_Logic::omit_verse_text (string input) +string Consistency_Logic::omit_verse_text (std::string input) { // Imagine the following $input: // 1 Peter 4:17 For the time has come for judgment to begin with the household of God. If it begins first with us, what will happen to those who don’t obey the Good News of God? diff --git a/database/abbottsmith.cpp b/database/abbottsmith.cpp index 9fc1a8f6f..bd0601bbe 100644 --- a/database/abbottsmith.cpp +++ b/database/abbottsmith.cpp @@ -55,7 +55,7 @@ void Database_AbbottSmith::optimize () } -void Database_AbbottSmith::store (string lemma, string lemma_casefold, string strong, string contents) +void Database_AbbottSmith::store (std::string lemma, std::string lemma_casefold, std::string strong, std::string contents) { SqliteDatabase sql = SqliteDatabase (filename ()); sql.add ("PRAGMA temp_store = MEMORY;"); @@ -80,7 +80,7 @@ void Database_AbbottSmith::store (string lemma, string lemma_casefold, string st } -string Database_AbbottSmith::get (string lemma, string strong) +string Database_AbbottSmith::get (std::string lemma, std::string strong) { std::string contents; SqliteDatabase sql = SqliteDatabase (filename ()); diff --git a/database/bibleactions.cpp b/database/bibleactions.cpp index e5b6e65e1..dc69e3aac 100644 --- a/database/bibleactions.cpp +++ b/database/bibleactions.cpp @@ -60,7 +60,7 @@ void Database_BibleActions::optimize () } -void Database_BibleActions::record (string bible, int book, int chapter, string usfm) +void Database_BibleActions::record (std::string bible, int book, int chapter, std::string usfm) { if (getUsfm (bible, book, chapter).empty ()) { SqliteDatabase sql (filename ()); @@ -87,7 +87,7 @@ vector Database_BibleActions::getBibles () } -vector Database_BibleActions::getBooks (string bible) +vector Database_BibleActions::getBooks (std::string bible) { SqliteDatabase sql (filename ()); sql.add ("SELECT DISTINCT book FROM bibleactions WHERE bible ="); @@ -100,7 +100,7 @@ vector Database_BibleActions::getBooks (string bible) } -vector Database_BibleActions::getChapters (string bible, int book) +vector Database_BibleActions::getChapters (std::string bible, int book) { SqliteDatabase sql (filename ()); sql.add ("SELECT DISTINCT chapter FROM bibleactions WHERE bible ="); @@ -115,7 +115,7 @@ vector Database_BibleActions::getChapters (string bible, int book) } -string Database_BibleActions::getUsfm (string bible, int book, int chapter) +string Database_BibleActions::getUsfm (std::string bible, int book, int chapter) { SqliteDatabase sql (filename ()); sql.add ("SELECT usfm FROM bibleactions WHERE bible ="); @@ -134,7 +134,7 @@ string Database_BibleActions::getUsfm (string bible, int book, int chapter) } -void Database_BibleActions::erase (string bible, int book, int chapter) +void Database_BibleActions::erase (std::string bible, int book, int chapter) { SqliteDatabase sql (filename ()); sql.add ("DELETE FROM bibleactions WHERE bible ="); diff --git a/database/bibleimages.cpp b/database/bibleimages.cpp index 14c6160fc..0135351ca 100644 --- a/database/bibleimages.cpp +++ b/database/bibleimages.cpp @@ -46,21 +46,21 @@ vector Database_BibleImages::get () } -void Database_BibleImages::store (string file) +void Database_BibleImages::store (std::string file) { std::string image = filter_url_basename (file); filter_url_file_cp (file, path (image)); } -string Database_BibleImages::get (string image) +string Database_BibleImages::get (std::string image) { std::string contents = filter_url_file_get_contents (path(image)); return contents; } -void Database_BibleImages::erase (string image) +void Database_BibleImages::erase (std::string image) { std::string filepath = path(image); filter_url_unlink (filepath); @@ -73,7 +73,7 @@ string Database_BibleImages::folder () } -string Database_BibleImages::path (string image) +string Database_BibleImages::path (std::string image) { return filter_url_create_path ({folder (), image}); } diff --git a/database/cache.cpp b/database/cache.cpp index 8c92eea5e..690349b12 100644 --- a/database/cache.cpp +++ b/database/cache.cpp @@ -41,13 +41,13 @@ string Database_Cache::fragment () } -string Database_Cache::path (string resource, int book) +string Database_Cache::path (std::string resource, int book) { return filter_url_create_path ({database_logic_databases (), filename (filter_url_urlencode (resource), book) + database_sqlite_suffix ()}); } -string Database_Cache::filename (string resource, int book) +string Database_Cache::filename (std::string resource, int book) { // Name of the database for this resource. resource = filter_url_clean_filename (resource); @@ -59,7 +59,7 @@ string Database_Cache::filename (string resource, int book) } -void Database_Cache::create (string resource, int book) +void Database_Cache::create (std::string resource, int book) { SqliteDatabase sql = SqliteDatabase (filename (resource, book)); @@ -73,7 +73,7 @@ void Database_Cache::create (string resource, int book) } -void Database_Cache::remove (string resource) +void Database_Cache::remove (std::string resource) { for (int book = 0; book < 100; book++) { remove (resource, book); @@ -81,7 +81,7 @@ void Database_Cache::remove (string resource) } -void Database_Cache::remove (string resource, int book) +void Database_Cache::remove (std::string resource, int book) { std::string file = database_sqlite_file (filename (resource, book)); if (file_or_dir_exists (file)) { @@ -91,7 +91,7 @@ void Database_Cache::remove (string resource, int book) // Returns true if the cache for the $resource exists. -bool Database_Cache::exists (string resource) +bool Database_Cache::exists (std::string resource) { for (int book = 0; book < 100; book++) { if (exists (resource, book)) return true; @@ -101,7 +101,7 @@ bool Database_Cache::exists (string resource) // Returns true if the cache for the $resource $book exists. -bool Database_Cache::exists (string resource, int book) +bool Database_Cache::exists (std::string resource, int book) { std::string file = database_sqlite_file (filename (resource, book)); return file_or_dir_exists (file); @@ -109,7 +109,7 @@ bool Database_Cache::exists (string resource, int book) // Returns true if a cached value for $resource/book/chapter/verse exists. -bool Database_Cache::exists (string resource, int book, int chapter, int verse) +bool Database_Cache::exists (std::string resource, int book, int chapter, int verse) { // If the the book-based cache exists, check existence from there. if (exists (resource, book)) { @@ -145,7 +145,7 @@ bool Database_Cache::exists (string resource, int book, int chapter, int verse) // Caches a value. -void Database_Cache::cache (string resource, int book, int chapter, int verse, string value) +void Database_Cache::cache (std::string resource, int book, int chapter, int verse, std::string value) { SqliteDatabase sql = SqliteDatabase (filename (resource, book)); @@ -170,7 +170,7 @@ void Database_Cache::cache (string resource, int book, int chapter, int verse, s // Retrieves a cached value. -string Database_Cache::retrieve (string resource, int book, int chapter, int verse) +string Database_Cache::retrieve (std::string resource, int book, int chapter, int verse) { // If the the book-based cache exists, retrieve it from there. if (exists (resource, book)) { @@ -203,7 +203,7 @@ string Database_Cache::retrieve (string resource, int book, int chapter, int ver // Returns how many element are in cache $resource. -int Database_Cache::count (string resource) +int Database_Cache::count (std::string resource) { int count = 0; // Book 0 is for the old layout. Book 1++ is for the new layout. @@ -217,7 +217,7 @@ int Database_Cache::count (string resource) // Return true if the database has loaded all its expected content. -bool Database_Cache::ready (string resource, int book) +bool Database_Cache::ready (std::string resource, int book) { SqliteDatabase sql = SqliteDatabase (filename (resource, book)); sql.add ("SELECT ready FROM ready;"); @@ -231,7 +231,7 @@ bool Database_Cache::ready (string resource, int book) // Sets the 'ready' flag in the database. -void Database_Cache::ready (string resource, int book, bool ready) +void Database_Cache::ready (std::string resource, int book, bool ready) { SqliteDatabase sql = SqliteDatabase (filename (resource, book)); @@ -247,14 +247,14 @@ void Database_Cache::ready (string resource, int book, bool ready) } -int Database_Cache::size (string resource, int book) +int Database_Cache::size (std::string resource, int book) { std::string file = database_sqlite_file (filename (resource, book)); return filter_url_filesize (file); } -string database_cache_full_path (string file) +string database_cache_full_path (std::string file) { return filter_url_create_root_path ({database_logic_databases (), "cache", file}); } @@ -263,7 +263,7 @@ string database_cache_full_path (string file) // The purpose of splitting the file up into paths is // to avoid that the cache folder would contain too many files // and so would become slow. -string database_cache_split_file (string file) +string database_cache_split_file (std::string file) { if (file.size () > 9) file.insert (9, "/"); if (file.size () > 18) file.insert (18, "/"); @@ -273,7 +273,7 @@ string database_cache_split_file (string file) } -bool database_filebased_cache_exists (string schema) +bool database_filebased_cache_exists (std::string schema) { schema = filter_url_clean_filename (schema); schema = database_cache_split_file (schema); @@ -282,7 +282,7 @@ bool database_filebased_cache_exists (string schema) } -void database_filebased_cache_put (string schema, string contents) +void database_filebased_cache_put (std::string schema, std::string contents) { schema = filter_url_clean_filename (schema); schema = database_cache_split_file (schema); @@ -293,7 +293,7 @@ void database_filebased_cache_put (string schema, string contents) } -string database_filebased_cache_get (string schema) +string database_filebased_cache_get (std::string schema) { schema = filter_url_clean_filename (schema); schema = database_cache_split_file (schema); @@ -302,7 +302,7 @@ string database_filebased_cache_get (string schema) } -void database_filebased_cache_remove (string schema) +void database_filebased_cache_remove (std::string schema) { schema = filter_url_clean_filename (schema); schema = database_cache_split_file (schema); @@ -312,7 +312,7 @@ void database_filebased_cache_remove (string schema) // Create a file name based on the client's IPv4 and a unique data identifier. -string database_filebased_cache_name_by_ip (string address, string id) +string database_filebased_cache_name_by_ip (std::string address, std::string id) { id = "_" + id; std::string ipv4_sp = "::ffff:"; @@ -325,7 +325,7 @@ string database_filebased_cache_name_by_ip (string address, string id) // Create a file name based on the client's session id and a unique // data identifier. -string database_filebased_cache_name_by_session_id (string sid, string id) +string database_filebased_cache_name_by_session_id (std::string sid, std::string id) { id = "_" + id; if (sid.find (id) == std::string::npos) sid.append (id); @@ -335,7 +335,7 @@ string database_filebased_cache_name_by_session_id (string sid, string id) // File name for focused book file based database cache by session id // plus abbreviation. -string focused_book_filebased_cache_filename (string sid) +string focused_book_filebased_cache_filename (std::string sid) { return database_filebased_cache_name_by_session_id (sid, "focbo"); } @@ -343,7 +343,7 @@ string focused_book_filebased_cache_filename (string sid) // File name for focused chapter file based database cache by session // id plus abbreviation. -string focused_chapter_filebased_cache_filename (string sid) +string focused_chapter_filebased_cache_filename (std::string sid) { return database_filebased_cache_name_by_session_id (sid, "focch"); } @@ -351,7 +351,7 @@ string focused_chapter_filebased_cache_filename (string sid) // File name for focused verse file based database cache by session id // plus abbreviation. -string focused_verse_filebased_cache_filename (string sid) +string focused_verse_filebased_cache_filename (std::string sid) { return database_filebased_cache_name_by_session_id (sid, "focve"); } @@ -359,7 +359,7 @@ string focused_verse_filebased_cache_filename (string sid) // File name for general font size file based database cache by // session id plus abbreviation. -string general_font_size_filebased_cache_filename (string sid) +string general_font_size_filebased_cache_filename (std::string sid) { return database_filebased_cache_name_by_session_id (sid, "genfs"); } @@ -367,7 +367,7 @@ string general_font_size_filebased_cache_filename (string sid) // File name for menu font size file based database cache by session // id plus abbreviation. -string menu_font_size_filebased_cache_filename (string sid) +string menu_font_size_filebased_cache_filename (std::string sid) { return database_filebased_cache_name_by_session_id (sid, "menfs"); } @@ -375,7 +375,7 @@ string menu_font_size_filebased_cache_filename (string sid) // File name for resource font size file based database cache by // session id plus abbreviation. -string resource_font_size_filebased_cache_filename (string sid) +string resource_font_size_filebased_cache_filename (std::string sid) { return database_filebased_cache_name_by_session_id (sid, "resfs"); } @@ -383,7 +383,7 @@ string resource_font_size_filebased_cache_filename (string sid) // File name for hebrew font size file based database cache by // session id plus abbreviation. -string hebrew_font_size_filebased_cache_filename (string sid) +string hebrew_font_size_filebased_cache_filename (std::string sid) { return database_filebased_cache_name_by_session_id (sid, "hebfs"); } @@ -391,7 +391,7 @@ string hebrew_font_size_filebased_cache_filename (string sid) // File name for greek font size file based database cache by session // id plus abbreviation. -string greek_font_size_filebased_cache_filename (string sid) +string greek_font_size_filebased_cache_filename (std::string sid) { return database_filebased_cache_name_by_session_id (sid, "grefs"); } @@ -399,7 +399,7 @@ string greek_font_size_filebased_cache_filename (string sid) // File name for current theme file based database cache by session // id plus abbreviation. -string current_theme_filebased_cache_filename (string sid) +string current_theme_filebased_cache_filename (std::string sid) { return database_filebased_cache_name_by_session_id (sid, "curth"); } @@ -422,7 +422,7 @@ void database_cache_trim (bool clear) if (!error.empty ()) Database_Logs::log (error); int percentage_disk_in_use = 0; { - vector bits = filter::strings::explode(output, ' '); + vector bits = filter::strings::explode(output, ' '); for (auto bit : bits) { if (bit.find ("%") != std::string::npos) { percentage_disk_in_use = filter::strings::convert_to_int(bit); diff --git a/database/check.cpp b/database/check.cpp index 085456ee7..6f13194d8 100644 --- a/database/check.cpp +++ b/database/check.cpp @@ -85,7 +85,7 @@ void Database_Check::optimize () } -void Database_Check::truncateOutput (string bible) +void Database_Check::truncateOutput (std::string bible) { SqliteDatabase sql (filename ()); if (bible == "") { @@ -99,7 +99,7 @@ void Database_Check::truncateOutput (string bible) } -void Database_Check::recordOutput (string bible, int book, int chapter, int verse, string data) +void Database_Check::recordOutput (std::string bible, int book, int chapter, int verse, std::string data) { SqliteDatabase sql (filename ()); int count = 0; diff --git a/database/config/bible.cpp b/database/config/bible.cpp index 74469164f..e2920bf2e 100644 --- a/database/config/bible.cpp +++ b/database/config/bible.cpp @@ -35,27 +35,27 @@ map database_config_bible_cache; // The path to the folder for storing the settings for the $bible. -string Database_Config_Bible::file (string bible) +string Database_Config_Bible::file (std::string bible) { return filter_url_create_root_path ({database_logic_databases (), "config", "bible", bible}); } // The path to the file that contains this setting. -string Database_Config_Bible::file (string bible, const char * key) +string Database_Config_Bible::file (std::string bible, const char * key) { return filter_url_create_path ({file (bible), key}); } // The key in the cache for this setting. -string Database_Config_Bible::mapkey (string bible, const char * key) +string Database_Config_Bible::mapkey (std::string bible, const char * key) { return bible + key; } -string Database_Config_Bible::getValue (string bible, const char * key, const char * default_value) +string Database_Config_Bible::getValue (std::string bible, const char * key, const char * default_value) { // Check the memory cache. std::string cachekey = mapkey (bible, key); @@ -74,7 +74,7 @@ string Database_Config_Bible::getValue (string bible, const char * key, const ch } -void Database_Config_Bible::setValue (string bible, const char * key, string value) +void Database_Config_Bible::setValue (std::string bible, const char * key, std::string value) { if (bible.empty ()) return; // Store in memory cache. @@ -87,31 +87,31 @@ void Database_Config_Bible::setValue (string bible, const char * key, string val } -bool Database_Config_Bible::getBValue (string bible, const char * key, bool default_value) +bool Database_Config_Bible::getBValue (std::string bible, const char * key, bool default_value) { return filter::strings::convert_to_bool (getValue (bible, key, filter::strings::convert_to_string (default_value).c_str())); } -void Database_Config_Bible::setBValue (string bible, const char * key, bool value) +void Database_Config_Bible::setBValue (std::string bible, const char * key, bool value) { setValue (bible, key, filter::strings::convert_to_string (value)); } -int Database_Config_Bible::getIValue (string bible, const char * key, int default_value) +int Database_Config_Bible::getIValue (std::string bible, const char * key, int default_value) { return filter::strings::convert_to_int (getValue (bible, key, filter::strings::convert_to_string (default_value).c_str())); } -void Database_Config_Bible::setIValue (string bible, const char * key, int value) +void Database_Config_Bible::setIValue (std::string bible, const char * key, int value) { setValue (bible, key, filter::strings::convert_to_string (value)); } -void Database_Config_Bible::remove (string bible) +void Database_Config_Bible::remove (std::string bible) { // Remove from disk. std::string folder = file (bible); @@ -124,17 +124,17 @@ void Database_Config_Bible::remove (string bible) // Named configuration functions. -string Database_Config_Bible::getRemoteRepositoryUrl (string bible) +string Database_Config_Bible::getRemoteRepositoryUrl (std::string bible) { return getValue (bible, "remote-repo-url", ""); } -void Database_Config_Bible::setRemoteRepositoryUrl (string bible, string url) +void Database_Config_Bible::setRemoteRepositoryUrl (std::string bible, std::string url) { setValue (bible, "remote-repo-url", url); } -bool Database_Config_Bible::getCheckDoubleSpacesUsfm (string bible) +bool Database_Config_Bible::getCheckDoubleSpacesUsfm (std::string bible) { // Check is on by default in the Cloud, and off on a client. #ifdef HAVE_CLIENT @@ -144,27 +144,27 @@ bool Database_Config_Bible::getCheckDoubleSpacesUsfm (string bible) #endif return getBValue (bible, "double-spaces-usfm", standard); } -void Database_Config_Bible::setCheckDoubleSpacesUsfm (string bible, bool value) +void Database_Config_Bible::setCheckDoubleSpacesUsfm (std::string bible, bool value) { setBValue (bible, "double-spaces-usfm", value); } -bool Database_Config_Bible::getCheckFullStopInHeadings (string bible) +bool Database_Config_Bible::getCheckFullStopInHeadings (std::string bible) { return getBValue (bible, "full-stop-headings", false); } -void Database_Config_Bible::setCheckFullStopInHeadings (string bible, bool value) +void Database_Config_Bible::setCheckFullStopInHeadings (std::string bible, bool value) { setBValue (bible, "full-stop-headings", value); } -bool Database_Config_Bible::getCheckSpaceBeforePunctuation (string bible) +bool Database_Config_Bible::getCheckSpaceBeforePunctuation (std::string bible) { return getBValue (bible, "space-before-punctuation", false); } -void Database_Config_Bible::setCheckSpaceBeforePunctuation (string bible, bool value) +void Database_Config_Bible::setCheckSpaceBeforePunctuation (std::string bible, bool value) { setBValue (bible, "space-before-punctuation", value); } @@ -174,57 +174,57 @@ const char * space_before_final_note_marker_key () { return "space-before-final-note-marker"; } -bool Database_Config_Bible::getCheckSpaceBeforeFinalNoteMarker (string bible) +bool Database_Config_Bible::getCheckSpaceBeforeFinalNoteMarker (std::string bible) { return getBValue (bible, space_before_final_note_marker_key (), false); } -void Database_Config_Bible::setCheckSpaceBeforeFinalNoteMarker (string bible, bool value) +void Database_Config_Bible::setCheckSpaceBeforeFinalNoteMarker (std::string bible, bool value) { setBValue (bible, space_before_final_note_marker_key (), value); } -bool Database_Config_Bible::getCheckSentenceStructure (string bible) +bool Database_Config_Bible::getCheckSentenceStructure (std::string bible) { return getBValue (bible, "sentence-structure", false); } -void Database_Config_Bible::setCheckSentenceStructure (string bible, bool value) +void Database_Config_Bible::setCheckSentenceStructure (std::string bible, bool value) { setBValue (bible, "sentence-structure", value); } -bool Database_Config_Bible::getCheckParagraphStructure (string bible) +bool Database_Config_Bible::getCheckParagraphStructure (std::string bible) { return getBValue (bible, "paragraph-structure", false); } -void Database_Config_Bible::setCheckParagraphStructure (string bible, bool value) +void Database_Config_Bible::setCheckParagraphStructure (std::string bible, bool value) { setBValue (bible, "paragraph-structure", value); } -bool Database_Config_Bible::getCheckBooksVersification (string bible) +bool Database_Config_Bible::getCheckBooksVersification (std::string bible) { return getBValue (bible, "check-books-versification", false); } -void Database_Config_Bible::setCheckBooksVersification (string bible, bool value) +void Database_Config_Bible::setCheckBooksVersification (std::string bible, bool value) { setBValue (bible, "check-books-versification", value); } -bool Database_Config_Bible::getCheckChaptesVersesVersification (string bible) +bool Database_Config_Bible::getCheckChaptesVersesVersification (std::string bible) { return getBValue (bible, "check-chapters-verses-versification", false); } -void Database_Config_Bible::setCheckChaptesVersesVersification (string bible, bool value) +void Database_Config_Bible::setCheckChaptesVersesVersification (std::string bible, bool value) { setBValue (bible, "check-chapters-verses-versification", value); } -bool Database_Config_Bible::getCheckWellFormedUsfm (string bible) +bool Database_Config_Bible::getCheckWellFormedUsfm (std::string bible) { // Check is on by default in the Cloud, and off on a client. #ifdef HAVE_CLIENT @@ -234,147 +234,147 @@ bool Database_Config_Bible::getCheckWellFormedUsfm (string bible) #endif return getBValue (bible, "check-well-formed-usfm", standard); } -void Database_Config_Bible::setCheckWellFormedUsfm (string bible, bool value) +void Database_Config_Bible::setCheckWellFormedUsfm (std::string bible, bool value) { setBValue (bible, "check-well-formed-usfm", value); } -bool Database_Config_Bible::getCheckMissingPunctuationEndVerse (string bible) +bool Database_Config_Bible::getCheckMissingPunctuationEndVerse (std::string bible) { return getBValue (bible, "missing-punctuation-end-verse", false); } -void Database_Config_Bible::setCheckMissingPunctuationEndVerse (string bible, bool value) +void Database_Config_Bible::setCheckMissingPunctuationEndVerse (std::string bible, bool value) { setBValue (bible, "missing-punctuation-end-verse", value); } -bool Database_Config_Bible::getCheckPatterns (string bible) +bool Database_Config_Bible::getCheckPatterns (std::string bible) { return getBValue (bible, "check_patterns", false); } -void Database_Config_Bible::setCheckPatterns (string bible, bool value) +void Database_Config_Bible::setCheckPatterns (std::string bible, bool value) { setBValue (bible, "check_patterns", value); } -string Database_Config_Bible::getCheckingPatterns (string bible) +string Database_Config_Bible::getCheckingPatterns (std::string bible) { return getValue (bible, "checking-patterns", ""); } -void Database_Config_Bible::setCheckingPatterns (string bible, string value) +void Database_Config_Bible::setCheckingPatterns (std::string bible, std::string value) { setValue (bible, "checking-patterns", value); } -string Database_Config_Bible::getSentenceStructureCapitals (string bible) +string Database_Config_Bible::getSentenceStructureCapitals (std::string bible) { return getValue (bible, "sentence-structure-capitals", "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"); } -void Database_Config_Bible::setSentenceStructureCapitals (string bible, string value) +void Database_Config_Bible::setSentenceStructureCapitals (std::string bible, std::string value) { setValue (bible, "sentence-structure-capitals", value); } -string Database_Config_Bible::getSentenceStructureSmallLetters (string bible) +string Database_Config_Bible::getSentenceStructureSmallLetters (std::string bible) { return getValue (bible, "sentence-structure-small-letters", "a b c d e f g h i j k l m n o p q r s t u v w x y z"); } -void Database_Config_Bible::setSentenceStructureSmallLetters (string bible, string value) +void Database_Config_Bible::setSentenceStructureSmallLetters (std::string bible, std::string value) { setValue (bible, "sentence-structure-small-letters", value); } -string Database_Config_Bible::getSentenceStructureEndPunctuation (string bible) +string Database_Config_Bible::getSentenceStructureEndPunctuation (std::string bible) { return getValue (bible, "sentence-structure-end-punctuation", ". ! ? :"); } -void Database_Config_Bible::setSentenceStructureEndPunctuation (string bible, string value) +void Database_Config_Bible::setSentenceStructureEndPunctuation (std::string bible, std::string value) { setValue (bible, "sentence-structure-end-punctuation", value); } -string Database_Config_Bible::getSentenceStructureMiddlePunctuation (string bible) +string Database_Config_Bible::getSentenceStructureMiddlePunctuation (std::string bible) { return getValue (bible, "sentence-structure-middle-punctuation", ", ;"); } -void Database_Config_Bible::setSentenceStructureMiddlePunctuation (string bible, string value) +void Database_Config_Bible::setSentenceStructureMiddlePunctuation (std::string bible, std::string value) { setValue (bible, "sentence-structure-middle-punctuation", value); } -string Database_Config_Bible::getSentenceStructureDisregards (string bible) +string Database_Config_Bible::getSentenceStructureDisregards (std::string bible) { return getValue (bible, "sentence-structure-disregards", "( ) [ ] { } ' \" * - 0 1 2 3 4 5 6 7 8 9"); } -void Database_Config_Bible::setSentenceStructureDisregards (string bible, string value) +void Database_Config_Bible::setSentenceStructureDisregards (std::string bible, std::string value) { setValue (bible, "sentence-structure-disregards", value); } -string Database_Config_Bible::getSentenceStructureNames (string bible) +string Database_Config_Bible::getSentenceStructureNames (std::string bible) { return getValue (bible, "sentence-structure-names", ""); } -void Database_Config_Bible::setSentenceStructureNames (string bible, string value) +void Database_Config_Bible::setSentenceStructureNames (std::string bible, std::string value) { setValue (bible, "sentence-structure-names", value); } -string Database_Config_Bible::getSentenceStructureWithinSentenceMarkers (string bible) +string Database_Config_Bible::getSentenceStructureWithinSentenceMarkers (std::string bible) { return getValue (bible, "sentence-structure-within_sentence-markers", "q q1 q2 q3"); } -void Database_Config_Bible::setSentenceStructureWithinSentenceMarkers (string bible, string value) +void Database_Config_Bible::setSentenceStructureWithinSentenceMarkers (std::string bible, std::string value) { setValue (bible, "sentence-structure-within_sentence-markers", value); } -bool Database_Config_Bible::getCheckMatchingPairs (string bible) +bool Database_Config_Bible::getCheckMatchingPairs (std::string bible) { return getBValue (bible, "check-matching-pairs", false); } -void Database_Config_Bible::setCheckMatchingPairs (string bible, bool value) +void Database_Config_Bible::setCheckMatchingPairs (std::string bible, bool value) { setBValue (bible, "check-matching-pairs", value); } -string Database_Config_Bible::getMatchingPairs (string bible) +string Database_Config_Bible::getMatchingPairs (std::string bible) { return getValue (bible, "matching-pairs", "[] () {} “” ‘’ «» ‹›"); } -void Database_Config_Bible::setMatchingPairs (string bible, string value) +void Database_Config_Bible::setMatchingPairs (std::string bible, std::string value) { setValue (bible, "matching-pairs", value); } -bool Database_Config_Bible::getCheckSpaceEndVerse (string bible) +bool Database_Config_Bible::getCheckSpaceEndVerse (std::string bible) { return getBValue (bible, "check-space-end-verse", true); } -void Database_Config_Bible::setCheckSpaceEndVerse (string bible, bool value) +void Database_Config_Bible::setCheckSpaceEndVerse (std::string bible, bool value) { setBValue (bible, "check-space-end-verse", value); } -bool Database_Config_Bible::getCheckFrenchPunctuation (string bible) +bool Database_Config_Bible::getCheckFrenchPunctuation (std::string bible) { return getBValue (bible, "check-french-punctuation", false); } -void Database_Config_Bible::setCheckFrenchPunctuation (string bible, bool value) +void Database_Config_Bible::setCheckFrenchPunctuation (std::string bible, bool value) { setBValue (bible, "check-french-punctuation", value); } @@ -384,11 +384,11 @@ const char * check_french_citation_style_key () { return "check-french-citation-style"; } -bool Database_Config_Bible::getCheckFrenchCitationStyle (string bible) +bool Database_Config_Bible::getCheckFrenchCitationStyle (std::string bible) { return getBValue (bible, check_french_citation_style_key (), false); } -void Database_Config_Bible::setCheckFrenchCitationStyle (string bible, bool value) +void Database_Config_Bible::setCheckFrenchCitationStyle (std::string bible, bool value) { setBValue (bible, check_french_citation_style_key (), value); } @@ -398,11 +398,11 @@ const char * transpose_fix_spaces_notes_key () { return "transpose-fix-spaces-notes"; } -bool Database_Config_Bible::getTransposeFixSpacesNotes (string bible) +bool Database_Config_Bible::getTransposeFixSpacesNotes (std::string bible) { return getBValue (bible, transpose_fix_spaces_notes_key (), false); } -void Database_Config_Bible::setTransposeFixSpacesNotes (string bible, bool value) +void Database_Config_Bible::setTransposeFixSpacesNotes (std::string bible, bool value) { setBValue (bible, transpose_fix_spaces_notes_key (), value); } @@ -412,181 +412,181 @@ const char * check_valid_utf8_text_key () { return "check-valid-utf8-text"; } -bool Database_Config_Bible::getCheckValidUTF8Text (string bible) +bool Database_Config_Bible::getCheckValidUTF8Text (std::string bible) { return getBValue (bible, check_valid_utf8_text_key (), false); } -void Database_Config_Bible::setCheckValidUTF8Text (string bible, bool value) +void Database_Config_Bible::setCheckValidUTF8Text (std::string bible, bool value) { setBValue (bible, check_valid_utf8_text_key (), value); } -string Database_Config_Bible::getSprintTaskCompletionCategories (string bible) +string Database_Config_Bible::getSprintTaskCompletionCategories (std::string bible) { return getValue (bible, "sprint-task-completion-categories", "Translate\nCheck\nHebrew/Greek\nDiscussions"); } -void Database_Config_Bible::setSprintTaskCompletionCategories (string bible, string value) +void Database_Config_Bible::setSprintTaskCompletionCategories (std::string bible, std::string value) { setValue (bible, "sprint-task-completion-categories", value); } -int Database_Config_Bible::getRepeatSendReceive (string bible) +int Database_Config_Bible::getRepeatSendReceive (std::string bible) { return getIValue (bible, "repeat-send-receive", 0); } -void Database_Config_Bible::setRepeatSendReceive (string bible, int value) +void Database_Config_Bible::setRepeatSendReceive (std::string bible, int value) { setIValue (bible, "repeat-send-receive", value); } -bool Database_Config_Bible::getExportChapterDropCapsFrames (string bible) +bool Database_Config_Bible::getExportChapterDropCapsFrames (std::string bible) { return getBValue (bible, "export-chapter-drop-caps-frames", false); } -void Database_Config_Bible::setExportChapterDropCapsFrames (string bible, bool value) +void Database_Config_Bible::setExportChapterDropCapsFrames (std::string bible, bool value) { setBValue (bible, "export-chapter-drop-caps-frames", value); } -string Database_Config_Bible::getPageWidth (string bible) +string Database_Config_Bible::getPageWidth (std::string bible) { return getValue (bible, "page-width", "210"); } -void Database_Config_Bible::setPageWidth (string bible, string value) +void Database_Config_Bible::setPageWidth (std::string bible, std::string value) { setValue (bible, "page-width", value); } -string Database_Config_Bible::getPageHeight (string bible) +string Database_Config_Bible::getPageHeight (std::string bible) { return getValue (bible, "page-height", "297"); } -void Database_Config_Bible::setPageHeight (string bible, string value) +void Database_Config_Bible::setPageHeight (std::string bible, std::string value) { setValue (bible, "page-height", value); } -string Database_Config_Bible::getInnerMargin (string bible) +string Database_Config_Bible::getInnerMargin (std::string bible) { return getValue (bible, "inner-margin", "20"); } -void Database_Config_Bible::setInnerMargin (string bible, string value) +void Database_Config_Bible::setInnerMargin (std::string bible, std::string value) { setValue (bible, "inner-margin", value); } -string Database_Config_Bible::getOuterMargin (string bible) +string Database_Config_Bible::getOuterMargin (std::string bible) { return getValue (bible, "outer-margin", "10"); } -void Database_Config_Bible::setOuterMargin (string bible, string value) +void Database_Config_Bible::setOuterMargin (std::string bible, std::string value) { setValue (bible, "outer-margin", value); } -string Database_Config_Bible::getTopMargin (string bible) +string Database_Config_Bible::getTopMargin (std::string bible) { return getValue (bible, "top-margin", "10"); } -void Database_Config_Bible::setTopMargin (string bible, string value) +void Database_Config_Bible::setTopMargin (std::string bible, std::string value) { setValue (bible, "top-margin", value); } -string Database_Config_Bible::getBottomMargin (string bible) +string Database_Config_Bible::getBottomMargin (std::string bible) { return getValue (bible, "bottom-margin", "10"); } -void Database_Config_Bible::setBottomMargin (string bible, string value) +void Database_Config_Bible::setBottomMargin (std::string bible, std::string value) { setValue (bible, "bottom-margin", value); } -bool Database_Config_Bible::getDateInHeader (string bible) +bool Database_Config_Bible::getDateInHeader (std::string bible) { return getBValue (bible, "date-in-header", false); } -void Database_Config_Bible::setDateInHeader (string bible, bool value) +void Database_Config_Bible::setDateInHeader (std::string bible, bool value) { setBValue (bible, "date-in-header", value); } -string Database_Config_Bible::getHyphenationFirstSet (string bible) +string Database_Config_Bible::getHyphenationFirstSet (std::string bible) { return getValue (bible, "hyphenation-first-set", ""); } -void Database_Config_Bible::setHyphenationFirstSet (string bible, string value) +void Database_Config_Bible::setHyphenationFirstSet (std::string bible, std::string value) { setValue (bible, "hyphenation-first-set", value); } -string Database_Config_Bible::getHyphenationSecondSet (string bible) +string Database_Config_Bible::getHyphenationSecondSet (std::string bible) { return getValue (bible, "hyphenation-second-set", ""); } -void Database_Config_Bible::setHyphenationSecondSet (string bible, string value) +void Database_Config_Bible::setHyphenationSecondSet (std::string bible, std::string value) { setValue (bible, "hyphenation-second-set", value); } -string Database_Config_Bible::getEditorStylesheet (string bible) +string Database_Config_Bible::getEditorStylesheet (std::string bible) { return getValue (bible, "editor-stylesheet", styles_logic_standard_sheet ().c_str()); } -void Database_Config_Bible::setEditorStylesheet (string bible, string value) +void Database_Config_Bible::setEditorStylesheet (std::string bible, std::string value) { setValue (bible, "editor-stylesheet", value); } -string Database_Config_Bible::getExportStylesheet (string bible) +string Database_Config_Bible::getExportStylesheet (std::string bible) { return getValue (bible, "export-stylesheet", styles_logic_standard_sheet ().c_str()); } -void Database_Config_Bible::setExportStylesheet (string bible, string value) +void Database_Config_Bible::setExportStylesheet (std::string bible, std::string value) { setValue (bible, "export-stylesheet", value); } -string Database_Config_Bible::getVersificationSystem (string bible) +string Database_Config_Bible::getVersificationSystem (std::string bible) { return getValue (bible, "versification-system", filter::strings::english ()); } -void Database_Config_Bible::setVersificationSystem (string bible, string value) +void Database_Config_Bible::setVersificationSystem (std::string bible, std::string value) { setValue (bible, "versification-system", value); } -bool Database_Config_Bible::getExportWebDuringNight (string bible) +bool Database_Config_Bible::getExportWebDuringNight (std::string bible) { return getBValue (bible, "export-web-during-night", false); } -void Database_Config_Bible::setExportWebDuringNight (string bible, bool value) +void Database_Config_Bible::setExportWebDuringNight (std::string bible, bool value) { setBValue (bible, "export-web-during-night", value); } -bool Database_Config_Bible::getExportHtmlDuringNight (string bible) +bool Database_Config_Bible::getExportHtmlDuringNight (std::string bible) { return getBValue (bible, "export-html-during-night", false); } -void Database_Config_Bible::setExportHtmlDuringNight (string bible, bool value) +void Database_Config_Bible::setExportHtmlDuringNight (std::string bible, bool value) { setBValue (bible, "export-html-during-night", value); } @@ -596,101 +596,101 @@ const char * export_html_notes_on_hover_key () { return "export-html-notes-on-hover"; } -bool Database_Config_Bible::getExportHtmlNotesOnHover (string bible) +bool Database_Config_Bible::getExportHtmlNotesOnHover (std::string bible) { return getBValue (bible, export_html_notes_on_hover_key (), false); } -void Database_Config_Bible::setExportHtmlNotesOnHover (string bible, bool value) +void Database_Config_Bible::setExportHtmlNotesOnHover (std::string bible, bool value) { setBValue (bible, export_html_notes_on_hover_key (), value); } -bool Database_Config_Bible::getExportUsfmDuringNight (string bible) +bool Database_Config_Bible::getExportUsfmDuringNight (std::string bible) { return getBValue (bible, "export-usfm-during-night", false); } -void Database_Config_Bible::setExportUsfmDuringNight (string bible, bool value) +void Database_Config_Bible::setExportUsfmDuringNight (std::string bible, bool value) { setBValue (bible, "export-usfm-during-night", value); } -bool Database_Config_Bible::getExportTextDuringNight (string bible) +bool Database_Config_Bible::getExportTextDuringNight (std::string bible) { return getBValue (bible, "export-text-during-night", false); } -void Database_Config_Bible::setExportTextDuringNight (string bible, bool value) +void Database_Config_Bible::setExportTextDuringNight (std::string bible, bool value) { setBValue (bible, "export-text-during-night", value); } -bool Database_Config_Bible::getExportOdtDuringNight (string bible) +bool Database_Config_Bible::getExportOdtDuringNight (std::string bible) { return getBValue (bible, "export-odt-during-night", false); } -void Database_Config_Bible::setExportOdtDuringNight (string bible, bool value) +void Database_Config_Bible::setExportOdtDuringNight (std::string bible, bool value) { setBValue (bible, "export-odt-during-night", value); } -bool Database_Config_Bible::getGenerateInfoDuringNight (string bible) +bool Database_Config_Bible::getGenerateInfoDuringNight (std::string bible) { return getBValue (bible, "generate-info-during-night", false); } -void Database_Config_Bible::setGenerateInfoDuringNight (string bible, bool value) +void Database_Config_Bible::setGenerateInfoDuringNight (std::string bible, bool value) { setBValue (bible, "generate-info-during-night", value); } -bool Database_Config_Bible::getExportESwordDuringNight (string bible) +bool Database_Config_Bible::getExportESwordDuringNight (std::string bible) { return getBValue (bible, "export-esword-during-night", false); } -void Database_Config_Bible::setExportESwordDuringNight (string bible, bool value) +void Database_Config_Bible::setExportESwordDuringNight (std::string bible, bool value) { setBValue (bible, "export-esword-during-night", value); } -bool Database_Config_Bible::getExportOnlineBibleDuringNight (string bible) +bool Database_Config_Bible::getExportOnlineBibleDuringNight (std::string bible) { return getBValue (bible, "export-onlinebible-during-night", false); } -void Database_Config_Bible::setExportOnlineBibleDuringNight (string bible, bool value) +void Database_Config_Bible::setExportOnlineBibleDuringNight (std::string bible, bool value) { setBValue (bible, "export-onlinebible-during-night", value); } -string Database_Config_Bible::getExportPassword (string bible) +string Database_Config_Bible::getExportPassword (std::string bible) { return getValue (bible, "export-password", ""); } -void Database_Config_Bible::setExportPassword (string bible, string value) +void Database_Config_Bible::setExportPassword (std::string bible, std::string value) { setValue (bible, "export-password", value); } -bool Database_Config_Bible::getSecureUsfmExport (string bible) +bool Database_Config_Bible::getSecureUsfmExport (std::string bible) { return getBValue (bible, "secure-usfm-export", false); } -void Database_Config_Bible::setSecureUsfmExport (string bible, bool value) +void Database_Config_Bible::setSecureUsfmExport (std::string bible, bool value) { setBValue (bible, "secure-usfm-export", value); } -bool Database_Config_Bible::getSecureOdtExport (string bible) +bool Database_Config_Bible::getSecureOdtExport (std::string bible) { return getBValue (bible, "secure-odt-export", false); } -void Database_Config_Bible::setSecureOdtExport (string bible, bool value) +void Database_Config_Bible::setSecureOdtExport (std::string bible, bool value) { setBValue (bible, "secure-odt-export", value); } @@ -700,11 +700,11 @@ const char * export_font_key () { return "export-font"; } -string Database_Config_Bible::getExportFont (string bible) +string Database_Config_Bible::getExportFont (std::string bible) { return getValue (bible, export_font_key (), ""); } -void Database_Config_Bible::setExportFont (string bible, string value) +void Database_Config_Bible::setExportFont (std::string bible, std::string value) { setValue (bible, export_font_key (), value); } @@ -714,111 +714,111 @@ const char * export_feedback_email_key () { return "export-feedback-email"; } -string Database_Config_Bible::getExportFeedbackEmail (string bible) +string Database_Config_Bible::getExportFeedbackEmail (std::string bible) { return getValue (bible, export_feedback_email_key (), ""); } -void Database_Config_Bible::setExportFeedbackEmail (string bible, string value) +void Database_Config_Bible::setExportFeedbackEmail (std::string bible, std::string value) { setValue (bible, export_feedback_email_key (), value); } -string Database_Config_Bible::getBookOrder (string bible) +string Database_Config_Bible::getBookOrder (std::string bible) { return getValue (bible, "book-order", ""); } -void Database_Config_Bible::setBookOrder (string bible, string value) +void Database_Config_Bible::setBookOrder (std::string bible, std::string value) { setValue (bible, "book-order", value); } -int Database_Config_Bible::getTextDirection (string bible) +int Database_Config_Bible::getTextDirection (std::string bible) { return getIValue (bible, "text-direction", 0); } -void Database_Config_Bible::setTextDirection (string bible, int value) +void Database_Config_Bible::setTextDirection (std::string bible, int value) { setIValue (bible, "text-direction", value); } -string Database_Config_Bible::getTextFont (string bible) +string Database_Config_Bible::getTextFont (std::string bible) { return getValue (bible, "text-font", ""); } -void Database_Config_Bible::setTextFont (string bible, string value) +void Database_Config_Bible::setTextFont (std::string bible, std::string value) { setValue (bible, "text-font", value); } -string Database_Config_Bible::getTextFontClient (string bible) +string Database_Config_Bible::getTextFontClient (std::string bible) { return getValue (bible, "text-font-client", ""); } -void Database_Config_Bible::setTextFontClient (string bible, string value) +void Database_Config_Bible::setTextFontClient (std::string bible, std::string value) { setValue (bible, "text-font-client", value); } -string Database_Config_Bible::getParatextProject (string bible) +string Database_Config_Bible::getParatextProject (std::string bible) { return getValue (bible, "paratext-project", ""); } -void Database_Config_Bible::setParatextProject (string bible, string value) +void Database_Config_Bible::setParatextProject (std::string bible, std::string value) { setValue (bible, "paratext-project", value); } -bool Database_Config_Bible::getParatextCollaborationEnabled (string bible) +bool Database_Config_Bible::getParatextCollaborationEnabled (std::string bible) { return getBValue (bible, "paratext-collaboration-enabled", false); } -void Database_Config_Bible::setParatextCollaborationEnabled (string bible, bool value) +void Database_Config_Bible::setParatextCollaborationEnabled (std::string bible, bool value) { setBValue (bible, "paratext-collaboration-enabled", value); } -int Database_Config_Bible::getLineHeight (string bible) +int Database_Config_Bible::getLineHeight (std::string bible) { return getIValue (bible, "line-height", 100); } -void Database_Config_Bible::setLineHeight (string bible, int value) +void Database_Config_Bible::setLineHeight (std::string bible, int value) { setIValue (bible, "line-height", value); } -int Database_Config_Bible::getLetterSpacing (string bible) +int Database_Config_Bible::getLetterSpacing (std::string bible) { return getIValue (bible, "letter-spacing", 0); } -void Database_Config_Bible::setLetterSpacing (string bible, int value) +void Database_Config_Bible::setLetterSpacing (std::string bible, int value) { setIValue (bible, "letter-spacing", value); } -bool Database_Config_Bible::getPublicFeedbackEnabled (string bible) +bool Database_Config_Bible::getPublicFeedbackEnabled (std::string bible) { return getBValue (bible, "public-feedback-enabled", true); } -void Database_Config_Bible::setPublicFeedbackEnabled (string bible, bool value) +void Database_Config_Bible::setPublicFeedbackEnabled (std::string bible, bool value) { setBValue (bible, "public-feedback-enabled", value); } -bool Database_Config_Bible::getReadFromGit (string bible) +bool Database_Config_Bible::getReadFromGit (std::string bible) { return getBValue (bible, "read-from-git", false); } -void Database_Config_Bible::setReadFromGit (string bible, bool value) +void Database_Config_Bible::setReadFromGit (std::string bible, bool value) { setBValue (bible, "read-from-git", value); } @@ -828,11 +828,11 @@ const char * send_changes_to_rss_key () { return "send-changes-to-rss"; } -bool Database_Config_Bible::getSendChangesToRSS (string bible) +bool Database_Config_Bible::getSendChangesToRSS (std::string bible) { return getBValue (bible, send_changes_to_rss_key (), false); } -void Database_Config_Bible::setSendChangesToRSS (string bible, bool value) +void Database_Config_Bible::setSendChangesToRSS (std::string bible, bool value) { setBValue (bible, send_changes_to_rss_key (), value); } @@ -842,11 +842,11 @@ const char * odt_space_after_verse_key () { return "odt-space-after-verse"; } -string Database_Config_Bible::getOdtSpaceAfterVerse (string bible) +string Database_Config_Bible::getOdtSpaceAfterVerse (std::string bible) { return getValue (bible, odt_space_after_verse_key (), " "); } -void Database_Config_Bible::setOdtSpaceAfterVerse (string bible, string value) +void Database_Config_Bible::setOdtSpaceAfterVerse (std::string bible, std::string value) { setValue (bible, odt_space_after_verse_key (), value); } @@ -856,11 +856,11 @@ const char * daily_checks_enabled_key () { return "daily-checks-enabled"; } -bool Database_Config_Bible::getDailyChecksEnabled (string bible) +bool Database_Config_Bible::getDailyChecksEnabled (std::string bible) { return getBValue (bible, daily_checks_enabled_key (), true); } -void Database_Config_Bible::setDailyChecksEnabled (string bible, bool value) +void Database_Config_Bible::setDailyChecksEnabled (std::string bible, bool value) { setBValue (bible, daily_checks_enabled_key (), value); } @@ -870,11 +870,11 @@ const char * odt_poetry_verses_left_key () { return "odt-poetry-verses-left"; } -bool Database_Config_Bible::getOdtPoetryVersesLeft (string bible) +bool Database_Config_Bible::getOdtPoetryVersesLeft (std::string bible) { return getBValue (bible, odt_poetry_verses_left_key(), false); } -void Database_Config_Bible::setOdtPoetryVersesLeft (string bible, bool value) +void Database_Config_Bible::setOdtPoetryVersesLeft (std::string bible, bool value) { setBValue (bible, odt_poetry_verses_left_key(), value); } @@ -884,11 +884,11 @@ const char * odt_automatic_note_caller_key () { return "odt-automatic-note-caller"; } -bool Database_Config_Bible::getOdtAutomaticNoteCaller (string bible) +bool Database_Config_Bible::getOdtAutomaticNoteCaller (std::string bible) { return getBValue (bible, odt_automatic_note_caller_key(), false); } -void Database_Config_Bible::setOdtAutomaticNoteCaller (string bible, bool value) +void Database_Config_Bible::setOdtAutomaticNoteCaller (std::string bible, bool value) { setBValue (bible, odt_automatic_note_caller_key(), value); } diff --git a/database/config/general.cpp b/database/config/general.cpp index dfd35efd5..a9e643c22 100644 --- a/database/config/general.cpp +++ b/database/config/general.cpp @@ -60,7 +60,7 @@ string Database_Config_General::getValue (const char * key, const char * default } -void Database_Config_General::setValue (const char * key, string value) +void Database_Config_General::setValue (const char * key, std::string value) { // Store in memory cache. database_config_general_cache [key] = value; @@ -117,7 +117,7 @@ string Database_Config_General::getSiteMailName () { return getValue ("site-mail-name", "Cloud"); } -void Database_Config_General::setSiteMailName (string value) +void Database_Config_General::setSiteMailName (std::string value) { setValue ("site-mail-name", value); } @@ -127,7 +127,7 @@ string Database_Config_General::getSiteMailAddress () { return getValue ("site-mail-address", ""); } -void Database_Config_General::setSiteMailAddress (string value) +void Database_Config_General::setSiteMailAddress (std::string value) { setValue ("site-mail-address", value); } @@ -137,7 +137,7 @@ string Database_Config_General::getMailStorageHost () { return getValue ("mail-storage-host", ""); } -void Database_Config_General::setMailStorageHost (string value) +void Database_Config_General::setMailStorageHost (std::string value) { setValue ("mail-storage-host", value); } @@ -147,7 +147,7 @@ string Database_Config_General::getMailStorageUsername () { return getValue ("mail-storage-username", ""); } -void Database_Config_General::setMailStorageUsername (string value) +void Database_Config_General::setMailStorageUsername (std::string value) { setValue ("mail-storage-username", value); } @@ -159,7 +159,7 @@ string Database_Config_General::getMailStoragePassword () } -void Database_Config_General::setMailStoragePassword (string value) +void Database_Config_General::setMailStoragePassword (std::string value) { setValue ("mail-storage-password", value); } @@ -169,7 +169,7 @@ string Database_Config_General::getMailStorageProtocol () { return getValue ("mail-storage-protocol", ""); } -void Database_Config_General::setMailStorageProtocol (string value) +void Database_Config_General::setMailStorageProtocol (std::string value) { setValue ("mail-storage-protocol", value); } @@ -179,7 +179,7 @@ string Database_Config_General::getMailStoragePort () { return getValue ("mail-storage-port", ""); } -void Database_Config_General::setMailStoragePort (string value) +void Database_Config_General::setMailStoragePort (std::string value) { setValue ("mail-storage-port", value); } @@ -189,7 +189,7 @@ string Database_Config_General::getMailSendHost () { return getValue ("mail-send-host", ""); } -void Database_Config_General::setMailSendHost (string value) +void Database_Config_General::setMailSendHost (std::string value) { setValue ("mail-send-host", value); } @@ -199,7 +199,7 @@ string Database_Config_General::getMailSendUsername () { return getValue ("mail-send-username", ""); } -void Database_Config_General::setMailSendUsername (string value) +void Database_Config_General::setMailSendUsername (std::string value) { setValue ("mail-send-username", value); } @@ -209,7 +209,7 @@ string Database_Config_General::getMailSendPassword () { return getValue ("mail-send-password", ""); } -void Database_Config_General::setMailSendPassword (string value) +void Database_Config_General::setMailSendPassword (std::string value) { setValue ("mail-send-password", value); } @@ -219,7 +219,7 @@ string Database_Config_General::getMailSendPort () { return getValue ("mail-send-port", ""); } -void Database_Config_General::setMailSendPort (string value) +void Database_Config_General::setMailSendPort (std::string value) { setValue ("mail-send-port", value); } @@ -229,7 +229,7 @@ string Database_Config_General::getTimerMinute () { return getValue ("timer-minute", ""); } -void Database_Config_General::setTimerMinute (string value) +void Database_Config_General::setTimerMinute (std::string value) { setValue ("timer-minute", value); } @@ -268,7 +268,7 @@ string Database_Config_General::getSiteURL () return getValue ("site-url", ""); #endif } -void Database_Config_General::setSiteURL (string value) +void Database_Config_General::setSiteURL (std::string value) { setValue ("site-url", value); } @@ -283,7 +283,7 @@ string Database_Config_General::getSiteLanguage () // the default language for the interface will be English. return getValue (general_site_language_key, ""); } -void Database_Config_General::setSiteLanguage (string value) +void Database_Config_General::setSiteLanguage (std::string value) { setValue (general_site_language_key, value); } @@ -303,7 +303,7 @@ string Database_Config_General::getServerAddress () { return getValue ("server-address", ""); } -void Database_Config_General::setServerAddress (string value) +void Database_Config_General::setServerAddress (std::string value) { setValue ("server-address", value); } @@ -343,7 +343,7 @@ string Database_Config_General::getInstalledInterfaceVersion () { return getValue ("installed-interface-version", ""); } -void Database_Config_General::setInstalledInterfaceVersion (string value) +void Database_Config_General::setInstalledInterfaceVersion (std::string value) { setValue ("installed-interface-version", value); } @@ -353,7 +353,7 @@ string Database_Config_General::getInstalledDatabaseVersion () { return getValue ("installed-database-version", ""); } -void Database_Config_General::setInstalledDatabaseVersion (string value) +void Database_Config_General::setInstalledDatabaseVersion (std::string value) { setValue ("installed-database-version", value); } @@ -373,7 +373,7 @@ string Database_Config_General::getParatextProjectsFolder () { return getValue ("paratext-projects-folder", ""); } -void Database_Config_General::setParatextProjectsFolder (string value) +void Database_Config_General::setParatextProjectsFolder (std::string value) { setValue ("paratext-projects-folder", value); } @@ -384,7 +384,7 @@ string Database_Config_General::getSyncKey () { return getValue ("sync-key", ""); } -void Database_Config_General::setSyncKey (string key) +void Database_Config_General::setSyncKey (std::string key) { setValue ("sync-key", key); } @@ -394,7 +394,7 @@ string Database_Config_General::getLastMenuClick () { return getValue ("last-menu-click", ""); } -void Database_Config_General::setLastMenuClick (string url) +void Database_Config_General::setLastMenuClick (std::string url) { setValue ("last-menu-click", url); } @@ -491,7 +491,7 @@ string Database_Config_General::getMenuInTabbedViewJSON () { return getValue (menu_in_tabbed_view_json_key, ""); } -void Database_Config_General::setMenuInTabbedViewJSON (string value) +void Database_Config_General::setMenuInTabbedViewJSON (std::string value) { setValue (menu_in_tabbed_view_json_key, value); } @@ -514,7 +514,7 @@ string Database_Config_General::getNotesVerseSeparator () // The colon is the default value. See https://github.com/bibledit/cloud/issues/509 return getValue (notes_verse_separator_key, ":"); } -void Database_Config_General::setNotesVerseSeparator (string value) +void Database_Config_General::setNotesVerseSeparator (std::string value) { setValue (notes_verse_separator_key, value); } diff --git a/database/config/user.cpp b/database/config/user.cpp index 2e1a053ba..67b77519f 100644 --- a/database/config/user.cpp +++ b/database/config/user.cpp @@ -49,20 +49,20 @@ map database_config_user_cache; // Functions for getting and setting values or lists of values follow here: -string Database_Config_User::file (string user) +string Database_Config_User::file (std::string user) { return filter_url_create_root_path ({database_logic_databases (), "config", "user", user}); } -string Database_Config_User::file (string user, const char * key) +string Database_Config_User::file (std::string user, const char * key) { return filter_url_create_path ({file (user), key}); } // The key in the cache for this setting. -string Database_Config_User::mapkey (string user, const char * key) +string Database_Config_User::mapkey (std::string user, const char * key) { return user + key; } @@ -89,7 +89,7 @@ int Database_Config_User::getIValue (const char * key, int default_value) } -string Database_Config_User::getValueForUser (string user, const char * key, const char * default_value) +string Database_Config_User::getValueForUser (std::string user, const char * key, const char * default_value) { // Check the memory cache. std::string cachekey = mapkey (user, key); @@ -108,21 +108,21 @@ string Database_Config_User::getValueForUser (string user, const char * key, con } -bool Database_Config_User::getBValueForUser (string user, const char * key, bool default_value) +bool Database_Config_User::getBValueForUser (std::string user, const char * key, bool default_value) { std::string value = getValueForUser (user, key, filter::strings::convert_to_string (default_value).c_str()); return filter::strings::convert_to_bool (value); } -int Database_Config_User::getIValueForUser (string user, const char * key, int default_value) +int Database_Config_User::getIValueForUser (std::string user, const char * key, int default_value) { std::string value = getValueForUser (user, key, filter::strings::convert_to_string (default_value).c_str()); return filter::strings::convert_to_int (value); } -void Database_Config_User::setValue (const char * key, string value) +void Database_Config_User::setValue (const char * key, std::string value) { std::string user = m_webserver_request.session_logic ()->currentUser (); setValueForUser (user, key, value); @@ -141,7 +141,7 @@ void Database_Config_User::setIValue (const char * key, int value) } -void Database_Config_User::setValueForUser (string user, const char * key, string value) +void Database_Config_User::setValueForUser (std::string user, const char * key, std::string value) { // Store in memory cache. database_config_user_cache [mapkey (user, key)] = value; @@ -153,7 +153,7 @@ void Database_Config_User::setValueForUser (string user, const char * key, strin } -void Database_Config_User::setBValueForUser (string user, const char * key, bool value) +void Database_Config_User::setBValueForUser (std::string user, const char * key, bool value) { setValueForUser (user, key, filter::strings::convert_to_string (value)); } @@ -166,7 +166,7 @@ vector Database_Config_User::getList (const char * key) } -vector Database_Config_User::getListForUser (string user, const char * key) +vector Database_Config_User::getListForUser (std::string user, const char * key) { // Check whether value is in cache. std::string cachekey = mapkey (user, key); @@ -195,7 +195,7 @@ void Database_Config_User::setList (const char * key, std::vector } -void Database_Config_User::setListForUser (string user, const char * key, std::vector values) +void Database_Config_User::setListForUser (std::string user, const char * key, std::vector values) { // Store it on disk. std::string filename = file (user, key); @@ -255,7 +255,7 @@ void Database_Config_User::trim () // Remove any configuration setting of $username. -void Database_Config_User::remove (string username) +void Database_Config_User::remove (std::string username) { // Remove from disk. std::string folder = file (username); @@ -294,7 +294,7 @@ string Database_Config_User::getBible () } return bible; } -void Database_Config_User::setBible (string bible) +void Database_Config_User::setBible (std::string bible) { setValue ("bible", bible); } @@ -314,7 +314,7 @@ bool Database_Config_User::getNotifyMeOfAnyConsultationNotesEdits () { return getBValue ("notify-me-of-any-consultation-notes-edits", false); } -bool Database_Config_User::getNotifyUserOfAnyConsultationNotesEdits (string username) +bool Database_Config_User::getNotifyUserOfAnyConsultationNotesEdits (std::string username) { return getBValueForUser (username, "notify-me-of-any-consultation-notes-edits", false); } @@ -327,7 +327,7 @@ bool Database_Config_User::getSubscribedConsultationNoteNotification () { return getBValue ("subscribed-consultation-note-notification", true); } -bool Database_Config_User::getUserSubscribedConsultationNoteNotification (string username) +bool Database_Config_User::getUserSubscribedConsultationNoteNotification (std::string username) { return getBValueForUser (username, "subscribed-consultation-note-notification", true); } @@ -341,7 +341,7 @@ bool Database_Config_User::getAssignedToConsultationNotesChanges () { return getBValue ("get-assigned-to-consultation-notes-changes", false); } -bool Database_Config_User::getUserAssignedToConsultationNotesChanges (string username) +bool Database_Config_User::getUserAssignedToConsultationNotesChanges (std::string username) { return getBValueForUser (username, "get-assigned-to-consultation-notes-changes", false); } @@ -355,7 +355,7 @@ bool Database_Config_User::getGenerateChangeNotifications () { return getBValue ("generate-change-notifications", false); } -bool Database_Config_User::getUserGenerateChangeNotifications (string username) +bool Database_Config_User::getUserGenerateChangeNotifications (std::string username) { return getBValueForUser (username, "generate-change-notifications", false); } @@ -369,7 +369,7 @@ bool Database_Config_User::getAssignedConsultationNoteNotification () { return getBValue ("assigned-consultation-note-notification", true); } -bool Database_Config_User::getUserAssignedConsultationNoteNotification (string username) +bool Database_Config_User::getUserAssignedConsultationNoteNotification (std::string username) { return getBValueForUser (username, "assigned-consultation-note-notification", true); } @@ -423,7 +423,7 @@ string Database_Config_User::getConsultationNotesStatusSelector () { return getValue ("consultation-notes-status-selector", ""); } -void Database_Config_User::setConsultationNotesStatusSelector (string value) +void Database_Config_User::setConsultationNotesStatusSelector (std::string value) { setValue ("consultation-notes-status-selector", value); } @@ -434,7 +434,7 @@ string Database_Config_User::getConsultationNotesBibleSelector () { return getValue ("consultation-notes-bible-selector", ""); } -void Database_Config_User::setConsultationNotesBibleSelector (string value) +void Database_Config_User::setConsultationNotesBibleSelector (std::string value) { setValue ("consultation-notes-bible-selector", value); } @@ -445,7 +445,7 @@ string Database_Config_User::getConsultationNotesAssignmentSelector () { return getValue ("consultation-notes-assignment-selector", ""); } -void Database_Config_User::setConsultationNotesAssignmentSelector (string value) +void Database_Config_User::setConsultationNotesAssignmentSelector (std::string value) { setValue ("consultation-notes-assignment-selector", value); } @@ -486,7 +486,7 @@ string Database_Config_User::getConsultationNotesSearchText () { return getValue ("consultation-notes-search-text", ""); } -void Database_Config_User::setConsultationNotesSearchText (string value) +void Database_Config_User::setConsultationNotesSearchText (std::string value) { setValue ("consultation-notes-search-text", value); } @@ -516,7 +516,7 @@ bool Database_Config_User::getBibleChangesNotification () { return getBValue ("bible-changes-notification", false); } -bool Database_Config_User::getUserBibleChangesNotification (string username) +bool Database_Config_User::getUserBibleChangesNotification (std::string username) { return getBValueForUser (username, "bible-changes-notification", false); } @@ -530,7 +530,7 @@ bool Database_Config_User::getDeletedConsultationNoteNotification () { return getBValue ("deleted-consultation-note-notification", false); } -bool Database_Config_User::getUserDeletedConsultationNoteNotification (string username) +bool Database_Config_User::getUserDeletedConsultationNoteNotification (std::string username) { return getBValueForUser (username, "deleted-consultation-note-notification", false); } @@ -553,7 +553,7 @@ bool Database_Config_User::getBibleChecksNotification () { return getBValue ("bible-checks-notification", defaultBibleChecksNotification ()); } -bool Database_Config_User::getUserBibleChecksNotification (string username) +bool Database_Config_User::getUserBibleChecksNotification (std::string username) { return getBValueForUser (username, "bible-checks-notification", defaultBibleChecksNotification ()); } @@ -567,7 +567,7 @@ bool Database_Config_User::getPendingChangesNotification () { return getBValue ("pending-changes-notification", false); } -bool Database_Config_User::getUserPendingChangesNotification (string username) +bool Database_Config_User::getUserPendingChangesNotification (std::string username) { return getBValueForUser (username, "pending-changes-notification", false); } @@ -581,7 +581,7 @@ bool Database_Config_User::getUserChangesNotification () { return getBValue ("user-changes-notification", false); } -bool Database_Config_User::getUserUserChangesNotification (string username) +bool Database_Config_User::getUserUserChangesNotification (std::string username) { return getBValueForUser (username, "user-changes-notification", false); } @@ -595,7 +595,7 @@ bool Database_Config_User::getAssignedNotesStatisticsNotification () { return getBValue ("assigned-notes-statistics-notification", false); } -bool Database_Config_User::getUserAssignedNotesStatisticsNotification (string username) +bool Database_Config_User::getUserAssignedNotesStatisticsNotification (std::string username) { return getBValueForUser (username, "assigned-notes-statistics-notification", false); } @@ -609,7 +609,7 @@ bool Database_Config_User::getSubscribedNotesStatisticsNotification () { return getBValue ("subscribed-notes-statistics-notification", false); } -bool Database_Config_User::getUserSubscribedNotesStatisticsNotification (string username) +bool Database_Config_User::getUserSubscribedNotesStatisticsNotification (std::string username) { return getBValueForUser (username, "subscribed-notes-statistics-notification", false); } @@ -623,7 +623,7 @@ bool Database_Config_User::getNotifyMeOfMyPosts () { return getBValue ("notify-me-of-my-posts", true); } -bool Database_Config_User::getUserNotifyMeOfMyPosts (string username) +bool Database_Config_User::getUserNotifyMeOfMyPosts (std::string username) { return getBValueForUser (username, "notify-me-of-my-posts", true); } @@ -637,7 +637,7 @@ bool Database_Config_User::getSuppressMailFromYourUpdatesNotes () { return getBValue ("suppress-mail-my-updated-notes", false); } -bool Database_Config_User::getUserSuppressMailFromYourUpdatesNotes (string username) +bool Database_Config_User::getUserSuppressMailFromYourUpdatesNotes (std::string username) { return getBValueForUser (username, "suppress-mail-my-updated-notes", false); } @@ -700,7 +700,7 @@ bool Database_Config_User::getSprintProgressNotification () { return getBValue ("sprint-progress-notification", false); } -bool Database_Config_User::getUserSprintProgressNotification (string username) +bool Database_Config_User::getUserSprintProgressNotification (std::string username) { return getBValueForUser (username, "sprint-progress-notification", false); } @@ -714,7 +714,7 @@ bool Database_Config_User::getUserChangesNotificationsOnline () { return getBValue ("user-changes-notifications-online", false); } -bool Database_Config_User::getUserUserChangesNotificationsOnline (string username) +bool Database_Config_User::getUserUserChangesNotificationsOnline (std::string username) { return getBValueForUser (username, "user-changes-notifications-online", false); } @@ -728,7 +728,7 @@ bool Database_Config_User::getContributorChangesNotificationsOnline () { return getBValue ("contributor-changes-notifications-online", false); } -bool Database_Config_User::getContributorChangesNotificationsOnline (string username) +bool Database_Config_User::getContributorChangesNotificationsOnline (std::string username) { return getBValueForUser (username, "contributor-changes-notifications-online", false); } @@ -742,7 +742,7 @@ string Database_Config_User::getWorkspaceURLs () { return getValue ("workbench-urls", ""); } -void Database_Config_User::setWorkspaceURLs (string value) +void Database_Config_User::setWorkspaceURLs (std::string value) { setValue ("workbench-urls", value); } @@ -752,7 +752,7 @@ string Database_Config_User::getWorkspaceWidths () { return getValue ("workbench-widths", ""); } -void Database_Config_User::setWorkspaceWidths (string value) +void Database_Config_User::setWorkspaceWidths (std::string value) { setValue ("workbench-widths", value); } @@ -762,7 +762,7 @@ string Database_Config_User::getWorkspaceHeights () { return getValue ("workbench-heights", ""); } -void Database_Config_User::setWorkspaceHeights (string value) +void Database_Config_User::setWorkspaceHeights (std::string value) { setValue ("workbench-heights", value); } @@ -772,7 +772,7 @@ string Database_Config_User::getEntireWorkspaceWidths () { return getValue ("entire-workbench-widths", ""); } -void Database_Config_User::setEntireWorkspaceWidths (string value) +void Database_Config_User::setEntireWorkspaceWidths (std::string value) { setValue ("entire-workbench-widths", value); } @@ -782,7 +782,7 @@ string Database_Config_User::getActiveWorkspace () { return getValue ("active-workbench", ""); } -void Database_Config_User::setActiveWorkspace (string value) +void Database_Config_User::setActiveWorkspace (std::string value) { setValue ("active-workbench", value); } @@ -802,7 +802,7 @@ string Database_Config_User::getRecentlyAppliedStyles () { return getValue ("recently-applied-styles", "p s add nd f x v"); } -void Database_Config_User::setRecentlyAppliedStyles (string values) +void Database_Config_User::setRecentlyAppliedStyles (std::string values) { setValue ("recently-applied-styles", values); } @@ -812,7 +812,7 @@ vector Database_Config_User::getPrintResources () { return getList ("print-resources"); } -vector Database_Config_User::getPrintResourcesForUser (string user) +vector Database_Config_User::getPrintResourcesForUser (std::string user) { return getListForUser (user, "print-resources"); } @@ -822,7 +822,7 @@ void Database_Config_User::setPrintResources (vector values) } -Passage database_config_user_fix_passage (string value, const char * fallback) +Passage database_config_user_fix_passage (std::string value, const char * fallback) { std::vector values = filter::strings::explode (value, '.'); if (values.size () != 3) values = filter::strings::explode (fallback, '.'); @@ -835,7 +835,7 @@ Passage Database_Config_User::getPrintPassageFrom () { return database_config_user_fix_passage (getValue ("print-passage-from", ""), "1.1.1"); } -Passage Database_Config_User::getPrintPassageFromForUser (string user) +Passage Database_Config_User::getPrintPassageFromForUser (std::string user) { return database_config_user_fix_passage (getValueForUser (user, "print-passage-from", ""), "1.1.1"); } @@ -850,7 +850,7 @@ Passage Database_Config_User::getPrintPassageTo () { return database_config_user_fix_passage (getValue ("print-passage-to", ""), "1.1.31"); } -Passage Database_Config_User::getPrintPassageToForUser (string user) +Passage Database_Config_User::getPrintPassageToForUser (std::string user) { return database_config_user_fix_passage (getValueForUser (user, "print-passage-to", ""), "1.1.31"); } @@ -945,11 +945,11 @@ string Database_Config_User::getChangeNotificationsChecksum () { return getValue ("change-notifications-checksum", ""); } -void Database_Config_User::setChangeNotificationsChecksum (string value) +void Database_Config_User::setChangeNotificationsChecksum (std::string value) { setValue ("change-notifications-checksum", value); } -void Database_Config_User::setUserChangeNotificationsChecksum (string user, string value) +void Database_Config_User::setUserChangeNotificationsChecksum (std::string user, std::string value) { setValueForUser (user, "change-notifications-checksum", value); } @@ -990,7 +990,7 @@ string Database_Config_User::getSyncKey () { return getValue ("sync-key", ""); } -void Database_Config_User::setSyncKey (string key) +void Database_Config_User::setSyncKey (std::string key) { setValue ("sync-key", key); } @@ -1007,7 +1007,7 @@ void Database_Config_User::setSyncKey (string key) // // That means: Take the system setting. The user has no language preference. // return getValue (site_language_key (), ""); //} -//void Database_Config_User::setSiteLanguage (string value) +//void Database_Config_User::setSiteLanguage (std::string value) //{ // setValue (site_language_key (), value); //} @@ -1281,11 +1281,11 @@ bool Database_Config_User::getPrivilegeUseAdvancedMode () { return getBValue (privilege_use_advanced_mode_key (), true); } -bool Database_Config_User::getPrivilegeUseAdvancedModeForUser (string username) +bool Database_Config_User::getPrivilegeUseAdvancedModeForUser (std::string username) { return getBValueForUser (username, privilege_use_advanced_mode_key (), true); } -void Database_Config_User::setPrivilegeUseAdvancedModeForUser (string username, bool value) +void Database_Config_User::setPrivilegeUseAdvancedModeForUser (std::string username, bool value) { setBValueForUser (username, privilege_use_advanced_mode_key (), value); } @@ -1303,11 +1303,11 @@ void Database_Config_User::setPrivilegeDeleteConsultationNotes (bool value) { setBValue (privilege_delete_consultation_notes_key (), value); } -bool Database_Config_User::getPrivilegeDeleteConsultationNotesForUser (string username) +bool Database_Config_User::getPrivilegeDeleteConsultationNotesForUser (std::string username) { return getBValueForUser (username, privilege_delete_consultation_notes_key (), false); } -void Database_Config_User::setPrivilegeDeleteConsultationNotesForUser (string username, bool value) +void Database_Config_User::setPrivilegeDeleteConsultationNotesForUser (std::string username, bool value) { setBValueForUser (username, privilege_delete_consultation_notes_key (), value); } @@ -1321,11 +1321,11 @@ bool Database_Config_User::getPrivilegeSetStylesheets () { return getBValue (privilege_set_stylesheets_key (), false); } -bool Database_Config_User::getPrivilegeSetStylesheetsForUser (string username) +bool Database_Config_User::getPrivilegeSetStylesheetsForUser (std::string username) { return getBValueForUser (username, privilege_set_stylesheets_key (), false); } -void Database_Config_User::setPrivilegeSetStylesheetsForUser (string username, bool value) +void Database_Config_User::setPrivilegeSetStylesheetsForUser (std::string username, bool value) { setBValueForUser (username, privilege_set_stylesheets_key (), value); } diff --git a/database/confirm.cpp b/database/confirm.cpp index 8906ff86e..b924614b6 100644 --- a/database/confirm.cpp +++ b/database/confirm.cpp @@ -103,8 +103,8 @@ bool Database_Confirm::id_exists (unsigned int id) // Store a confirmation cycle -void Database_Confirm::store (unsigned int id, string query, - std::string to, string subject, string body, +void Database_Confirm::store (unsigned int id, std::string query, + std::string to, std::string subject, std::string body, std::string username) { SqliteDatabase sql (filename ()); @@ -129,12 +129,12 @@ void Database_Confirm::store (unsigned int id, string query, // Search the database for an existing ID in $subject. // If it exists, it returns the ID number, else it returns 0. -unsigned int Database_Confirm::search_id (string subject) +unsigned int Database_Confirm::search_id (std::string subject) { SqliteDatabase sql (filename ()); sql.add ("SELECT id FROM confirm;"); std::vector ids = sql.query () ["id"]; - for (string id : ids) { + for (std::string id : ids) { size_t pos = subject.find (id); if (pos != std::string::npos) { return static_cast(filter::strings::convert_to_int (id)); diff --git a/database/etcbc4.cpp b/database/etcbc4.cpp index 5fe9c05b3..f8ac741da 100644 --- a/database/etcbc4.cpp +++ b/database/etcbc4.cpp @@ -214,7 +214,7 @@ string Database_Etcbc4::raw (int book, int chapter, int verse) } -void Database_Etcbc4::store (int book, int chapter, int verse, string data) +void Database_Etcbc4::store (int book, int chapter, int verse, std::string data) { sqlite3 * db = connect (); { @@ -246,12 +246,12 @@ void Database_Etcbc4::store (int book, int chapter, int verse, string data) void Database_Etcbc4::store (int book, int chapter, int verse, - std::string word, string vocalized_lexeme, string consonantal_lexeme, - std::string gloss, string pos, string subpos, - std::string gender, string number, string person, - std::string state, string tense, string stem, - std::string phrase_function, string phrase_type, string phrase_relation, - std::string phrase_a_relation, string clause_text_type, string clause_type, string clause_relation) + std::string word, std::string vocalized_lexeme, std::string consonantal_lexeme, + std::string gloss, std::string pos, std::string subpos, + std::string gender, std::string number, std::string person, + std::string state, std::string tense, std::string stem, + std::string phrase_function, std::string phrase_type, std::string phrase_relation, + std::string phrase_a_relation, std::string clause_text_type, std::string clause_type, std::string clause_relation) { sqlite3 * db = connect (); SqliteSQL sql = SqliteSQL (); @@ -483,7 +483,7 @@ string Database_Etcbc4::clause_relation (int rowid) } -int Database_Etcbc4::get_id (sqlite3 * db, const char * table_row, string item) +int Database_Etcbc4::get_id (sqlite3 * db, const char * table_row, std::string item) { // Two iterations to be sure a rowid can be returned. for (unsigned int i = 0; i < 2; i++) { diff --git a/database/git.cpp b/database/git.cpp index bc7651f76..e3a4ac735 100644 --- a/database/git.cpp +++ b/database/git.cpp @@ -78,8 +78,8 @@ void Database_Git::optimize () } -void Database_Git::store_chapter (string user, string bible, int book, int chapter, - std::string oldusfm, string newusfm) +void Database_Git::store_chapter (std::string user, std::string bible, int book, int chapter, + std::string oldusfm, std::string newusfm) { SqliteDatabase sql = SqliteDatabase (name ()); sql.add ("INSERT INTO changes VALUES ("); @@ -102,7 +102,7 @@ void Database_Git::store_chapter (string user, string bible, int book, int chapt // Fetches the distinct users from the database for $bible. -vector Database_Git::get_users (string bible) +vector Database_Git::get_users (std::string bible) { SqliteDatabase sql = SqliteDatabase (name ()); sql.add ("SELECT DISTINCT user FROM changes WHERE bible ="); @@ -114,7 +114,7 @@ vector Database_Git::get_users (string bible) // Fetches the rowids from the database for $user and $bible. -vector Database_Git::get_rowids (string user, string bible) +vector Database_Git::get_rowids (std::string user, std::string bible) { SqliteDatabase sql = SqliteDatabase (name ()); sql.add ("SELECT rowid FROM changes WHERE user ="); @@ -132,8 +132,8 @@ vector Database_Git::get_rowids (string user, string bible) bool Database_Git::get_chapter (int rowid, - std::string & user, string & bible, int & book, int & chapter, - std::string & oldusfm, string & newusfm) + std::string & user, std::string & bible, int & book, int & chapter, + std::string & oldusfm, std::string & newusfm) { SqliteDatabase sql = SqliteDatabase (name ()); sql.add ("SELECT * FROM changes WHERE rowid ="); diff --git a/database/hebrewlexicon.cpp b/database/hebrewlexicon.cpp index 71459aa9b..06bd1eb4a 100644 --- a/database/hebrewlexicon.cpp +++ b/database/hebrewlexicon.cpp @@ -71,7 +71,7 @@ void Database_HebrewLexicon::optimize () } -void Database_HebrewLexicon::setaug (string aug, string target) +void Database_HebrewLexicon::setaug (std::string aug, std::string target) { SqliteDatabase sql = SqliteDatabase (filename ()); sql.add ("INSERT INTO aug VALUES ("); @@ -83,7 +83,7 @@ void Database_HebrewLexicon::setaug (string aug, string target) } -void Database_HebrewLexicon::setbdb (string id, string definition) +void Database_HebrewLexicon::setbdb (std::string id, std::string definition) { SqliteDatabase sql = SqliteDatabase (filename ()); sql.add ("INSERT INTO bdb VALUES ("); @@ -95,7 +95,7 @@ void Database_HebrewLexicon::setbdb (string id, string definition) } -void Database_HebrewLexicon::setmap (string id, string bdb) +void Database_HebrewLexicon::setmap (std::string id, std::string bdb) { SqliteDatabase sql = SqliteDatabase (filename ()); sql.add ("INSERT INTO map VALUES ("); @@ -107,7 +107,7 @@ void Database_HebrewLexicon::setmap (string id, string bdb) } -void Database_HebrewLexicon::setpos (string code, string name) +void Database_HebrewLexicon::setpos (std::string code, std::string name) { SqliteDatabase sql = SqliteDatabase (filename ()); sql.add ("INSERT INTO pos VALUES ("); @@ -119,7 +119,7 @@ void Database_HebrewLexicon::setpos (string code, string name) } -void Database_HebrewLexicon::setstrong (string strong, string definition) +void Database_HebrewLexicon::setstrong (std::string strong, std::string definition) { SqliteDatabase sql = SqliteDatabase (filename ()); sql.add ("INSERT INTO strong VALUES ("); @@ -131,7 +131,7 @@ void Database_HebrewLexicon::setstrong (string strong, string definition) } -string Database_HebrewLexicon::getaug (string aug) +string Database_HebrewLexicon::getaug (std::string aug) { SqliteDatabase sql = SqliteDatabase (filename ()); sql.add ("SELECT target FROM aug WHERE aug ="); @@ -143,7 +143,7 @@ string Database_HebrewLexicon::getaug (string aug) } -string Database_HebrewLexicon::getbdb (string id) +string Database_HebrewLexicon::getbdb (std::string id) { SqliteDatabase sql = SqliteDatabase (filename ()); sql.add ("SELECT definition FROM bdb WHERE id ="); @@ -155,7 +155,7 @@ string Database_HebrewLexicon::getbdb (string id) } -string Database_HebrewLexicon::getmap (string id) +string Database_HebrewLexicon::getmap (std::string id) { SqliteDatabase sql = SqliteDatabase (filename ()); sql.add ("SELECT bdb FROM map WHERE id ="); @@ -167,7 +167,7 @@ string Database_HebrewLexicon::getmap (string id) } -string Database_HebrewLexicon::getpos (string code) +string Database_HebrewLexicon::getpos (std::string code) { SqliteDatabase sql = SqliteDatabase (filename ()); sql.add ("SELECT name FROM pos WHERE code ="); @@ -179,7 +179,7 @@ string Database_HebrewLexicon::getpos (string code) } -string Database_HebrewLexicon::getstrong (string strong) +string Database_HebrewLexicon::getstrong (std::string strong) { SqliteDatabase sql = SqliteDatabase (filename ()); sql.add ("SELECT definition FROM strong WHERE strong ="); diff --git a/database/imageresources.cpp b/database/imageresources.cpp index 956d730ac..2be520e27 100644 --- a/database/imageresources.cpp +++ b/database/imageresources.cpp @@ -43,7 +43,7 @@ string Database_ImageResources::resourceFolder (const std::string& name) } -string Database_ImageResources::imagePath (string name, string image) +string Database_ImageResources::imagePath (std::string name, std::string image) { return filter_url_create_path ({resourceFolder (name), image}); } @@ -55,7 +55,7 @@ string Database_ImageResources::databaseFile () } -sqlite3 * Database_ImageResources::connect (string name) +sqlite3 * Database_ImageResources::connect (std::string name) { std::string path = filter_url_create_path ({resourceFolder (name), databaseFile ()}); return database_sqlite_connect (path); @@ -68,7 +68,7 @@ vector Database_ImageResources::names () } -void Database_ImageResources::create (string name) +void Database_ImageResources::create (std::string name) { // Create folder to store the images. std::string path = resourceFolder (name); @@ -88,7 +88,7 @@ void Database_ImageResources::create (string name) } -void Database_ImageResources::erase (string name) +void Database_ImageResources::erase (std::string name) { std::string path = resourceFolder (name); // If a folder: Delete it. @@ -98,7 +98,7 @@ void Database_ImageResources::erase (string name) } -void Database_ImageResources::erase (string name, string image) +void Database_ImageResources::erase (std::string name, std::string image) { filter_url_unlink (imagePath (name, image)); sqlite3 * db = connect (name); @@ -114,7 +114,7 @@ void Database_ImageResources::erase (string name, string image) // Moves $file (path to an image file) into the database. -string Database_ImageResources::store (string name, string file) +string Database_ImageResources::store (std::string name, std::string file) { std::string folder = resourceFolder (name); std::string image = filter_url_basename (file); @@ -132,7 +132,7 @@ string Database_ImageResources::store (string name, string file) // Assign a passage range to the $image. // It means that this image contains text for the passage range. -void Database_ImageResources::assign (string name, string image, +void Database_ImageResources::assign (std::string name, std::string image, int book1, int chapter1, int verse1, int book2, int chapter2, int verse2) { @@ -159,7 +159,7 @@ void Database_ImageResources::assign (string name, string image, } -vector Database_ImageResources::get (string name, int book, int chapter, int verse) +vector Database_ImageResources::get (std::string name, int book, int chapter, int verse) { int passage = filter_passage_to_integer (Passage ("", book, chapter, filter::strings::convert_to_string (verse))); SqliteSQL sql = SqliteSQL (); @@ -175,7 +175,7 @@ vector Database_ImageResources::get (string name, int book, int ch } -vector Database_ImageResources::get (string name) +vector Database_ImageResources::get (std::string name) { // Get images from database, sorted on passage. SqliteSQL sql = SqliteSQL (); @@ -201,7 +201,7 @@ vector Database_ImageResources::get (string name) } -void Database_ImageResources::get (string name, string image, +void Database_ImageResources::get (std::string name, std::string image, int & book1, int & chapter1, int & verse1, int & book2, int & chapter2, int & verse2) { @@ -238,7 +238,7 @@ void Database_ImageResources::get (string name, string image, } -string Database_ImageResources::get (string name, string image) +string Database_ImageResources::get (std::string name, std::string image) { std::string path = imagePath (name, image); return filter_url_file_get_contents (path); diff --git a/database/ipc.cpp b/database/ipc.cpp index 43e2b7abb..3133a2ff9 100644 --- a/database/ipc.cpp +++ b/database/ipc.cpp @@ -46,7 +46,7 @@ void Database_Ipc::trim () } int now = filter::date::seconds_since_epoch (); std::vector files = filter_url_scandir (folder ()); - for (string item : files) { + for (std::string item : files) { std::string path = file(item); int time = filter_url_file_modification_time (path); int age_seconds = now - time; @@ -57,7 +57,7 @@ void Database_Ipc::trim () } -void Database_Ipc::storeMessage (string user, string channel, string command, string message) +void Database_Ipc::storeMessage (std::string user, std::string channel, std::string command, std::string message) { // Load entire database into memory. std::vector data = readData (); @@ -88,7 +88,7 @@ void Database_Ipc::storeMessage (string user, string channel, string command, st // Returns an object with the data. // The rowid is 0 if there was nothing, // Else the object's properties are set properly. -Database_Ipc_Message Database_Ipc::retrieveMessage (int id, string user, string channel, string command) +Database_Ipc_Message Database_Ipc::retrieveMessage (int id, std::string user, std::string channel, std::string command) { int highestId = 0; std::string hitChannel = ""; @@ -232,7 +232,7 @@ string Database_Ipc::folder () } -string Database_Ipc::file (string file) +string Database_Ipc::file (std::string file) { return filter_url_create_path ({folder (), file}); } @@ -247,7 +247,7 @@ vector Database_Ipc::readData () { std::vector data; std::vector files = filter_url_scandir (folder ()); - for (string file : files) { + for (std::string file : files) { std::vector explosion = filter::strings::explode (file, '_'); if (explosion.size () == 7) { Database_Ipc_Item item = Database_Ipc_Item (); @@ -263,7 +263,7 @@ vector Database_Ipc::readData () } -void Database_Ipc::writeRecord (int rowid, string user, string channel, string command, string message) +void Database_Ipc::writeRecord (int rowid, std::string user, std::string channel, std::string command, std::string message) { std::string filename = filter::strings::convert_to_string (rowid) + "__" + user + "__" + channel + "__" + command; filename = file (filename); diff --git a/database/jobs.cpp b/database/jobs.cpp index 25c7fc3e5..e128d0e5b 100644 --- a/database/jobs.cpp +++ b/database/jobs.cpp @@ -144,7 +144,7 @@ int Database_Jobs::get_level (int id) } -void Database_Jobs::set_start (int id, string start) +void Database_Jobs::set_start (int id, std::string start) { SqliteSQL sql = SqliteSQL (); sql.add ("UPDATE jobs SET start ="); @@ -205,7 +205,7 @@ string Database_Jobs::get_percentage (int id) } -void Database_Jobs::set_progress (int id, string progress) +void Database_Jobs::set_progress (int id, std::string progress) { SqliteSQL sql = SqliteSQL (); sql.add ("UPDATE jobs SET progress ="); @@ -235,7 +235,7 @@ string Database_Jobs::get_progress (int id) } -void Database_Jobs::set_result (int id, string result) +void Database_Jobs::set_result (int id, std::string result) { SqliteSQL sql = SqliteSQL (); sql.add ("UPDATE jobs SET result ="); diff --git a/database/kjv.cpp b/database/kjv.cpp index 64923125a..1a0d65c34 100644 --- a/database/kjv.cpp +++ b/database/kjv.cpp @@ -92,7 +92,7 @@ vector Database_Kjv::getVerse (int book, int chapter, int ve // Get all passages that contain a strong's number. -vector Database_Kjv::searchStrong (string strong) +vector Database_Kjv::searchStrong (std::string strong) { int strongid = get_id ("strong", strong); SqliteDatabase sql = SqliteDatabase (filename ()); @@ -115,7 +115,7 @@ vector Database_Kjv::searchStrong (string strong) } -void Database_Kjv::store (int book, int chapter, int verse, string strong, string english) +void Database_Kjv::store (int book, int chapter, int verse, std::string strong, std::string english) { int strongid = get_id ("strong", strong); int englishid = get_id ("english", english); @@ -173,7 +173,7 @@ string Database_Kjv::english (int rowid) } -int Database_Kjv::get_id (const char * table_row, string item) +int Database_Kjv::get_id (const char * table_row, std::string item) { SqliteDatabase sql = SqliteDatabase (filename ()); // Two iterations to be sure a rowid can be returned. diff --git a/database/localization.cpp b/database/localization.cpp index 56e69d5bb..059c79282 100644 --- a/database/localization.cpp +++ b/database/localization.cpp @@ -44,7 +44,7 @@ sqlite3 * Database_Localization::connect () } -void Database_Localization::create (string po) +void Database_Localization::create (std::string po) { sqlite3 * db = connect (); database_sqlite_exec (db, "PRAGMA temp_store = MEMORY;"); diff --git a/database/login.cpp b/database/login.cpp index 0b84ebdfb..56a33619e 100644 --- a/database/login.cpp +++ b/database/login.cpp @@ -94,7 +94,7 @@ bool Database_Login::healthy () // Sets the login security tokens for a user. // Also store whether the device is touch-enabled. // It only writes to the table if the combination of username and tokens differs from what the table already contains. -void Database_Login::setTokens (string username, string address, string agent, string fingerprint, string cookie, bool touch) +void Database_Login::setTokens (std::string username, std::string address, std::string agent, std::string fingerprint, std::string cookie, bool touch) { bool daily; if (username == getUsername (cookie, daily)) return; @@ -122,7 +122,7 @@ void Database_Login::setTokens (string username, string address, string agent, s // Remove the login security tokens for a user. -void Database_Login::removeTokens (string username) +void Database_Login::removeTokens (std::string username) { SqliteDatabase sql (database ()); sql.add ("DELETE FROM logins WHERE username ="); @@ -133,7 +133,7 @@ void Database_Login::removeTokens (string username) // Remove the login security tokens for a user based on the cookie. -void Database_Login::removeTokens (string username, string cookie) +void Database_Login::removeTokens (std::string username, std::string cookie) { //address = md5 (address); //agent = md5 (agent); @@ -148,7 +148,7 @@ void Database_Login::removeTokens (string username, string cookie) } -void Database_Login::renameTokens (string username_existing, string username_new, string cookie) +void Database_Login::renameTokens (std::string username_existing, std::string username_new, std::string cookie) { SqliteDatabase sql (database ()); sql.add ("UPDATE logins SET username ="); @@ -164,7 +164,7 @@ void Database_Login::renameTokens (string username_existing, string username_new // Returns the username that matches the cookie sent by the browser. // Once a day, $daily will be set true. -string Database_Login::getUsername (string cookie, bool & daily) +string Database_Login::getUsername (std::string cookie, bool & daily) { SqliteDatabase sql (database ()); sql.add ("SELECT rowid, timestamp, username FROM logins WHERE cookie ="); @@ -192,7 +192,7 @@ string Database_Login::getUsername (string cookie, bool & daily) // Returns whether the device, that matches the cookie it sent, is touch-enabled. -bool Database_Login::getTouchEnabled (string cookie) +bool Database_Login::getTouchEnabled (std::string cookie) { SqliteDatabase sql (database ()); sql.add ("SELECT touch FROM logins WHERE cookie ="); diff --git a/database/logs.cpp b/database/logs.cpp index ab1be4139..2da9b6839 100644 --- a/database/logs.cpp +++ b/database/logs.cpp @@ -34,7 +34,7 @@ using namespace std; // Records a journal entry. -void Database_Logs::log (string description, int level) +void Database_Logs::log (std::string description, int level) { // Trim spaces. description = filter::strings::trim (description); @@ -68,7 +68,7 @@ void Database_Logs::log (string description, int level) // Records an extended journal entry. -void Database_Logs::log (string subject, string body, int level) +void Database_Logs::log (std::string subject, std::string body, int level) { std::string description (subject); description.append ("\n"); @@ -141,7 +141,7 @@ void Database_Logs::rotate () // Get the logbook entries. -vector Database_Logs::get (string & lastfilename) +vector Database_Logs::get (std::string & lastfilename) { lastfilename = "0"; @@ -159,7 +159,7 @@ vector Database_Logs::get (string & lastfilename) // Gets journal entry more recent than "filename". // Updates "filename" to the item it got. -string Database_Logs::next (string &filename) +string Database_Logs::next (std::string &filename) { std::vector files = filter_url_scandir (folder ()); for (unsigned int i = 0; i < files.size (); i++) { diff --git a/database/mail.cpp b/database/mail.cpp index 06b586a89..d910b89e0 100644 --- a/database/mail.cpp +++ b/database/mail.cpp @@ -92,7 +92,7 @@ void Database_Mail::trim () // subject: The subject. // body: The body. // time: Normally not given, but if given, it indicates the time stamp for sending this email. -void Database_Mail::send (string to, string subject, string body, int time) +void Database_Mail::send (std::string to, std::string subject, std::string body, int time) { if (time == 0) time = filter::date::seconds_since_epoch (); SqliteSQL sql = SqliteSQL (); diff --git a/database/mappings.cpp b/database/mappings.cpp index 442eb78a5..fe730e1bb 100644 --- a/database/mappings.cpp +++ b/database/mappings.cpp @@ -116,7 +116,7 @@ void Database_Mappings::import (const std::string& name, const std::string& data database_sqlite_exec (db, "BEGIN;"); std::vector lines = filter::strings::explode (data, '\n'); - for (string line : lines) { + for (std::string line : lines) { // Each line looks like this: // Haggai 2:15 = Haggai 2:14 diff --git a/database/modifications.cpp b/database/modifications.cpp index ee18fc868..154e0f242 100644 --- a/database/modifications.cpp +++ b/database/modifications.cpp @@ -688,7 +688,7 @@ void Database_Modifications::indexTrimAllNotifications () } -vector Database_Modifications::getNotificationIdentifiers (string username, string bible, bool sort_on_category) +vector Database_Modifications::getNotificationIdentifiers (std::string username, std::string bible, bool sort_on_category) { std::vector ids; @@ -721,7 +721,7 @@ vector Database_Modifications::getNotificationIdentifiers (string username // This gets the identifiers of the team's changes. -vector Database_Modifications::getNotificationTeamIdentifiers (const std::string& username, const std::string& category, string bible) +vector Database_Modifications::getNotificationTeamIdentifiers (const std::string& username, const std::string& category, std::string bible) { std::vector ids; SqliteSQL sql = SqliteSQL (); @@ -745,7 +745,7 @@ vector Database_Modifications::getNotificationTeamIdentifiers (const std:: // This gets the distinct Bibles in the user's notifications. -vector Database_Modifications::getNotificationDistinctBibles (string username) +vector Database_Modifications::getNotificationDistinctBibles (std::string username) { SqliteSQL sql = SqliteSQL (); sql.add ("SELECT DISTINCT bible FROM notifications WHERE 1"); @@ -917,7 +917,7 @@ int Database_Modifications::clearNotificationsUser (const std::string& username) // This function deletes personal changes and their matching change notifications. // It returns the deleted identifiers. -vector Database_Modifications::clearNotificationMatches (string username, string personal, string team, string bible) +vector Database_Modifications::clearNotificationMatches (std::string username, std::string personal, std::string team, std::string bible) { sqlite3 * db = connect (); @@ -1018,7 +1018,7 @@ vector Database_Modifications::clearNotificationMatches (string username, // Store a change notification on the client, as received from the server. -void Database_Modifications::storeClientNotification (int id, string username, string category, string bible, int book, int chapter, int verse, string oldtext, string modification, string newtext) +void Database_Modifications::storeClientNotification (int id, std::string username, std::string category, std::string bible, int book, int chapter, int verse, std::string oldtext, std::string modification, std::string newtext) { // Erase any existing database. deleteNotificationFile (id); diff --git a/database/morphgnt.cpp b/database/morphgnt.cpp index 4055f72a9..61497d5d5 100644 --- a/database/morphgnt.cpp +++ b/database/morphgnt.cpp @@ -72,7 +72,7 @@ void Database_MorphGnt::optimize () void Database_MorphGnt::store (int book, int chapter, int verse, - std::string pos, string parsing, string word, string lemma) + std::string pos, std::string parsing, std::string word, std::string lemma) { int pos_id = get_id ("pos", pos); int parsing_id = get_id ("parsing", parsing); @@ -148,7 +148,7 @@ string Database_MorphGnt::lemma (int rowid) } -int Database_MorphGnt::get_id (const char * table_row, string item) +int Database_MorphGnt::get_id (const char * table_row, std::string item) { SqliteDatabase sql = SqliteDatabase (filename ()); // Two iterations to be sure a rowid can be returned. diff --git a/database/navigation.cpp b/database/navigation.cpp index 5f65d6ce3..de74d2987 100644 --- a/database/navigation.cpp +++ b/database/navigation.cpp @@ -67,7 +67,7 @@ void Database_Navigation::trim () } -void Database_Navigation::record (int time, string user, int book, int chapter, int verse) +void Database_Navigation::record (int time, std::string user, int book, int chapter, int verse) { // Clear any 'active' flags. SqliteSQL sql1 = SqliteSQL (); diff --git a/database/noteassignment.cpp b/database/noteassignment.cpp index cd1737def..26f7eff4e 100644 --- a/database/noteassignment.cpp +++ b/database/noteassignment.cpp @@ -29,39 +29,39 @@ using namespace std; // Data is stored in multiple text files. -string Database_NoteAssignment::path (string user) +string Database_NoteAssignment::path (std::string user) { return filter_url_create_root_path ({database_logic_databases (), "client", "noteassignment_" + user + ".txt"}); } -bool Database_NoteAssignment::exists (string user) +bool Database_NoteAssignment::exists (std::string user) { return file_or_dir_exists (path (user)); } -void Database_NoteAssignment::assignees (string user, std::vector assignees) +void Database_NoteAssignment::assignees (std::string user, std::vector assignees) { filter_url_file_put_contents (path (user), filter::strings::implode (assignees, "\n")); } -vector Database_NoteAssignment::assignees (string user) +vector Database_NoteAssignment::assignees (std::string user) { std::string contents = filter_url_file_get_contents (path (user)); return filter::strings::explode (contents, '\n'); } -bool Database_NoteAssignment::exists (string user, string assignee) +bool Database_NoteAssignment::exists (std::string user, std::string assignee) { std::vector users = assignees (user); return in_array (assignee, users); } -void Database_NoteAssignment::remove (string user) +void Database_NoteAssignment::remove (std::string user) { filter_url_unlink (path (user)); } diff --git a/database/notes.cpp b/database/notes.cpp index 2390511a2..9560b3ed2 100644 --- a/database/notes.cpp +++ b/database/notes.cpp @@ -333,7 +333,7 @@ void Database_Notes::update_database (int identifier) } -void Database_Notes::update_database_internal (int identifier, int modified, string assigned, string subscriptions, string bible, string passage, string status, int severity, string summary, string contents) +void Database_Notes::update_database_internal (int identifier, int modified, std::string assigned, std::string subscriptions, std::string bible, std::string passage, std::string status, int severity, std::string summary, std::string contents) { // Read the relevant values from the database. // If all the values in the database are the same as the values in the filesystem, @@ -503,7 +503,7 @@ vector Database_Notes::get_identifiers () } -string Database_Notes::assemble_contents (int identifier, string contents) +string Database_Notes::assemble_contents (int identifier, std::string contents) { std::string new_contents = get_contents (identifier); std::string datetime = filter::date::localized_date_format (m_webserver_request); @@ -540,7 +540,7 @@ string Database_Notes::assemble_contents (int identifier, string contents) // contents: The note's contents. // raw: Import contents as it is. // It returns the identifier of this new note. -int Database_Notes::store_new_note (const std::string& bible, int book, int chapter, int verse, string summary, string contents, bool raw) +int Database_Notes::store_new_note (const std::string& bible, int book, int chapter, int verse, std::string summary, std::string contents, bool raw) { // Create a new identifier. int identifier = get_new_unique_identifier (); @@ -620,7 +620,7 @@ int Database_Notes::store_new_note (const std::string& bible, int book, int chap // text_selector: Optionally limits the selection to notes that contains certain text. Used for searching notes. // search_text: Works with text_selector, contains the text to search for. // limit: If >= 0, it indicates the starting limit for the selection. -vector Database_Notes::select_notes (vector bibles, int book, int chapter, int verse, int passage_selector, int edit_selector, int non_edit_selector, const std::string& status_selector, string bible_selector, string assignment_selector, bool subscription_selector, int severity_selector, int text_selector, const std::string& search_text, int limit) +vector Database_Notes::select_notes (vector bibles, int book, int chapter, int verse, int passage_selector, int edit_selector, int non_edit_selector, const std::string& status_selector, std::string bible_selector, std::string assignment_selector, bool subscription_selector, int severity_selector, int text_selector, const std::string& search_text, int limit) { std::string username = m_webserver_request.session_logic ()->currentUser (); std::vector identifiers; @@ -1070,7 +1070,7 @@ vector Database_Notes::get_assignees (int identifier) } -vector Database_Notes::get_assignees_internal (string assignees) +vector Database_Notes::get_assignees_internal (std::string assignees) { if (assignees.empty ()) return {}; std::vector assignees_vector = filter::strings::explode (assignees, '\n'); @@ -1198,7 +1198,7 @@ string Database_Notes::encode_passage (int book, int chapter, int verse) // Takes the passage as a string, and returns an object with book, chapter, and verse. -Passage Database_Notes::decode_passage (string passage) +Passage Database_Notes::decode_passage (std::string passage) { passage = filter::strings::trim (passage); Passage decodedpassage = Passage (); @@ -1523,7 +1523,7 @@ string Database_Notes::get_search_field (int identifier) // Returns an array of note identifiers. // search: Contains the text to search for. // bibles: Array of Bibles the notes should refer to. -vector Database_Notes::search_notes (string search, const std::vector & bibles) +vector Database_Notes::search_notes (std::string search, const std::vector & bibles) { std::vector identifiers; @@ -1547,7 +1547,7 @@ vector Database_Notes::search_notes (string search, const std::vector > database_sqlite_query (sqlite3 * db, string sql) +map > database_sqlite_query (sqlite3 * db, std::string sql) { char * error = nullptr; SqliteReader reader (0); @@ -178,7 +178,7 @@ void database_sqlite_disconnect (sqlite3 * database) // Does an integrity check on the database. // Returns true if healthy, false otherwise. -bool database_sqlite_healthy (string database) +bool database_sqlite_healthy (std::string database) { std::string file = database_sqlite_file (database); bool ok = false; @@ -257,7 +257,7 @@ void SqliteSQL::add (int value) sql.append (" "); } -void SqliteSQL::add (string value) +void SqliteSQL::add (std::string value) { sql.append (" '"); value = database_sqlite_no_sql_injection (value); @@ -289,7 +289,7 @@ int SqliteReader::callback (void *userdata, int argc, char **argv, char **column } -SqliteDatabase::SqliteDatabase (string filename) +SqliteDatabase::SqliteDatabase (std::string filename) { db = database_sqlite_connect (filename); } @@ -323,7 +323,7 @@ void SqliteDatabase::add (int value) } -void SqliteDatabase::add (string value) +void SqliteDatabase::add (std::string value) { sql.append (" '"); value = database_sqlite_no_sql_injection (value); diff --git a/database/statistics.cpp b/database/statistics.cpp index a26a60970..edf9188fd 100644 --- a/database/statistics.cpp +++ b/database/statistics.cpp @@ -50,7 +50,7 @@ void Database_Statistics::optimize () } -void Database_Statistics::store_changes (int timestamp, string user, int count) +void Database_Statistics::store_changes (int timestamp, std::string user, int count) { SqliteDatabase sql = SqliteDatabase (name ()); sql.add ("INSERT INTO changes VALUES ("); @@ -77,7 +77,7 @@ vector Database_Statistics::get_users () // Fetches the change statistics from the database for $user for no more than a year ago. -vector > Database_Statistics::get_changes (string user) +vector > Database_Statistics::get_changes (std::string user) { std::vector > changes; SqliteDatabase sql = SqliteDatabase (name ()); diff --git a/database/strong.cpp b/database/strong.cpp index 35750231c..3399fb147 100644 --- a/database/strong.cpp +++ b/database/strong.cpp @@ -30,7 +30,7 @@ using namespace std; // Get Strong's definition for the $strong's number. -string Database_Strong::definition (string strong) +string Database_Strong::definition (std::string strong) { sqlite3 * db; { @@ -51,7 +51,7 @@ string Database_Strong::definition (string strong) // Get Strong's number(s) for the $lemma. // Most lemma's refer to one Strong's number, but some lemma's refer to more than one. -vector Database_Strong::strong (string lemma) +vector Database_Strong::strong (std::string lemma) { sqlite3 * db; { diff --git a/database/styles.cpp b/database/styles.cpp index 948fa6408..bc43350f1 100644 --- a/database/styles.cpp +++ b/database/styles.cpp @@ -70,7 +70,7 @@ void Database_Styles::create () // Creates a stylesheet. -void Database_Styles::createSheet (string sheet) +void Database_Styles::createSheet (std::string sheet) { // Folder for storing the stylesheet. filter_url_mkdir (sheetfolder (sheet)); @@ -97,7 +97,7 @@ vector Database_Styles::getSheets () // Deletes a stylesheet. -void Database_Styles::deleteSheet (string sheet) +void Database_Styles::deleteSheet (std::string sheet) { if (!sheet.empty ()) filter_url_rmdir (sheetfolder (sheet)); database_styles_cache_mutex.lock (); @@ -107,7 +107,7 @@ void Database_Styles::deleteSheet (string sheet) // Adds a marker to the stylesheet. -void Database_Styles::addMarker (string sheet, string marker) +void Database_Styles::addMarker (std::string sheet, std::string marker) { Database_Styles_Item item = read_item (sheet, marker); write_item (sheet, item); @@ -115,7 +115,7 @@ void Database_Styles::addMarker (string sheet, string marker) // Deletes a marker from a stylesheet. -void Database_Styles::deleteMarker (string sheet, string marker) +void Database_Styles::deleteMarker (std::string sheet, std::string marker) { filter_url_unlink (stylefile (sheet, marker)); database_styles_cache_mutex.lock (); @@ -125,7 +125,7 @@ void Database_Styles::deleteMarker (string sheet, string marker) // Returns a map with all the markers and the names of the styles in the stylesheet. -map Database_Styles::getMarkersAndNames (string sheet) +map Database_Styles::getMarkersAndNames (std::string sheet) { std::map markers_names; std::vector markers = getMarkers (sheet); @@ -138,7 +138,7 @@ map Database_Styles::getMarkersAndNames (string sheet) // Returns an array with all the markers of the styles in the stylesheet. -vector Database_Styles::getMarkers (string sheet) +vector Database_Styles::getMarkers (std::string sheet) { // The markers for this stylesheet. std::vector markers = filter_url_scandir (sheetfolder (sheet)); @@ -157,14 +157,14 @@ vector Database_Styles::getMarkers (string sheet) // Returns an object with all data belonging to a marker. -Database_Styles_Item Database_Styles::getMarkerData (string sheet, string marker) +Database_Styles_Item Database_Styles::getMarkerData (std::string sheet, std::string marker) { return read_item (sheet, marker); } // Updates a style's name. -void Database_Styles::updateName (string sheet, string marker, string name) +void Database_Styles::updateName (std::string sheet, std::string marker, std::string name) { Database_Styles_Item item = read_item (sheet, marker); item.name = name; @@ -173,7 +173,7 @@ void Database_Styles::updateName (string sheet, string marker, string name) // Updates a style's info. -void Database_Styles::updateInfo (string sheet, string marker, string info) +void Database_Styles::updateInfo (std::string sheet, std::string marker, std::string info) { Database_Styles_Item item = read_item (sheet, marker); item.info = info; @@ -182,7 +182,7 @@ void Database_Styles::updateInfo (string sheet, string marker, string info) // Updates a style's category. -void Database_Styles::updateCategory (string sheet, string marker, string category) +void Database_Styles::updateCategory (std::string sheet, std::string marker, std::string category) { Database_Styles_Item item = read_item (sheet, marker); item.category = category; @@ -191,7 +191,7 @@ void Database_Styles::updateCategory (string sheet, string marker, string catego // Updates a style's type. -void Database_Styles::updateType (string sheet, string marker, int type) +void Database_Styles::updateType (std::string sheet, std::string marker, int type) { Database_Styles_Item item = read_item (sheet, marker); item.type = type; @@ -200,7 +200,7 @@ void Database_Styles::updateType (string sheet, string marker, int type) // Updates a style's subtype. -void Database_Styles::updateSubType (string sheet, string marker, int subtype) +void Database_Styles::updateSubType (std::string sheet, std::string marker, int subtype) { Database_Styles_Item item = read_item (sheet, marker); item.subtype = subtype; @@ -209,7 +209,7 @@ void Database_Styles::updateSubType (string sheet, string marker, int subtype) // Updates a style's font size. -void Database_Styles::updateFontsize (string sheet, string marker, float fontsize) +void Database_Styles::updateFontsize (std::string sheet, std::string marker, float fontsize) { Database_Styles_Item item = read_item (sheet, marker); item.fontsize = fontsize; @@ -218,7 +218,7 @@ void Database_Styles::updateFontsize (string sheet, string marker, float fontsiz // Updates a style's italic setting. -void Database_Styles::updateItalic (string sheet, string marker, int italic) +void Database_Styles::updateItalic (std::string sheet, std::string marker, int italic) { Database_Styles_Item item = read_item (sheet, marker); item.italic = italic; @@ -227,7 +227,7 @@ void Database_Styles::updateItalic (string sheet, string marker, int italic) // Updates a style's bold setting. -void Database_Styles::updateBold (string sheet, string marker, int bold) +void Database_Styles::updateBold (std::string sheet, std::string marker, int bold) { Database_Styles_Item item = read_item (sheet, marker); item.bold = bold; @@ -236,7 +236,7 @@ void Database_Styles::updateBold (string sheet, string marker, int bold) // Updates a style's underline setting. -void Database_Styles::updateUnderline (string sheet, string marker, int underline) +void Database_Styles::updateUnderline (std::string sheet, std::string marker, int underline) { Database_Styles_Item item = read_item (sheet, marker); item.underline = underline; @@ -245,7 +245,7 @@ void Database_Styles::updateUnderline (string sheet, string marker, int underlin // Updates a style's small caps setting. -void Database_Styles::updateSmallcaps (string sheet, string marker, int smallcaps) +void Database_Styles::updateSmallcaps (std::string sheet, std::string marker, int smallcaps) { Database_Styles_Item item = read_item (sheet, marker); item.smallcaps = smallcaps; @@ -253,7 +253,7 @@ void Database_Styles::updateSmallcaps (string sheet, string marker, int smallcap } -void Database_Styles::updateSuperscript (string sheet, string marker, int superscript) +void Database_Styles::updateSuperscript (std::string sheet, std::string marker, int superscript) { Database_Styles_Item item = read_item (sheet, marker); item.superscript = superscript; @@ -261,7 +261,7 @@ void Database_Styles::updateSuperscript (string sheet, string marker, int supers } -void Database_Styles::updateJustification (string sheet, string marker, int justification) +void Database_Styles::updateJustification (std::string sheet, std::string marker, int justification) { Database_Styles_Item item = read_item (sheet, marker); item.justification = justification; @@ -269,7 +269,7 @@ void Database_Styles::updateJustification (string sheet, string marker, int just } -void Database_Styles::updateSpaceBefore (string sheet, string marker, float spacebefore) +void Database_Styles::updateSpaceBefore (std::string sheet, std::string marker, float spacebefore) { Database_Styles_Item item = read_item (sheet, marker); item.spacebefore = spacebefore; @@ -277,7 +277,7 @@ void Database_Styles::updateSpaceBefore (string sheet, string marker, float spac } -void Database_Styles::updateSpaceAfter (string sheet, string marker, float spaceafter) +void Database_Styles::updateSpaceAfter (std::string sheet, std::string marker, float spaceafter) { Database_Styles_Item item = read_item (sheet, marker); item.spaceafter = spaceafter; @@ -285,7 +285,7 @@ void Database_Styles::updateSpaceAfter (string sheet, string marker, float space } -void Database_Styles::updateLeftMargin (string sheet, string marker, float leftmargin) +void Database_Styles::updateLeftMargin (std::string sheet, std::string marker, float leftmargin) { Database_Styles_Item item = read_item (sheet, marker); item.leftmargin = leftmargin; @@ -293,7 +293,7 @@ void Database_Styles::updateLeftMargin (string sheet, string marker, float leftm } -void Database_Styles::updateRightMargin (string sheet, string marker, float rightmargin) +void Database_Styles::updateRightMargin (std::string sheet, std::string marker, float rightmargin) { Database_Styles_Item item = read_item (sheet, marker); item.rightmargin = rightmargin; @@ -301,7 +301,7 @@ void Database_Styles::updateRightMargin (string sheet, string marker, float righ } -void Database_Styles::updateFirstLineIndent (string sheet, string marker, float firstlineindent) +void Database_Styles::updateFirstLineIndent (std::string sheet, std::string marker, float firstlineindent) { Database_Styles_Item item = read_item (sheet, marker); item.firstlineindent = firstlineindent; @@ -309,7 +309,7 @@ void Database_Styles::updateFirstLineIndent (string sheet, string marker, float } -void Database_Styles::updateSpanColumns (string sheet, string marker, bool spancolumns) +void Database_Styles::updateSpanColumns (std::string sheet, std::string marker, bool spancolumns) { Database_Styles_Item item = read_item (sheet, marker); item.spancolumns = spancolumns; @@ -317,7 +317,7 @@ void Database_Styles::updateSpanColumns (string sheet, string marker, bool spanc } -void Database_Styles::updateColor (string sheet, string marker, string color) +void Database_Styles::updateColor (std::string sheet, std::string marker, std::string color) { Database_Styles_Item item = read_item (sheet, marker); item.color = color; @@ -325,7 +325,7 @@ void Database_Styles::updateColor (string sheet, string marker, string color) } -void Database_Styles::updatePrint (string sheet, string marker, bool print) +void Database_Styles::updatePrint (std::string sheet, std::string marker, bool print) { Database_Styles_Item item = read_item (sheet, marker); item.print = print; @@ -333,7 +333,7 @@ void Database_Styles::updatePrint (string sheet, string marker, bool print) } -void Database_Styles::updateUserbool1 (string sheet, string marker, bool userbool1) +void Database_Styles::updateUserbool1 (std::string sheet, std::string marker, bool userbool1) { Database_Styles_Item item = read_item (sheet, marker); item.userbool1 = userbool1; @@ -341,7 +341,7 @@ void Database_Styles::updateUserbool1 (string sheet, string marker, bool userboo } -void Database_Styles::updateUserbool2 (string sheet, string marker, bool userbool2) +void Database_Styles::updateUserbool2 (std::string sheet, std::string marker, bool userbool2) { Database_Styles_Item item = read_item (sheet, marker); item.userbool2 = userbool2; @@ -349,7 +349,7 @@ void Database_Styles::updateUserbool2 (string sheet, string marker, bool userboo } -void Database_Styles::updateUserbool3 (string sheet, string marker, bool userbool3) +void Database_Styles::updateUserbool3 (std::string sheet, std::string marker, bool userbool3) { Database_Styles_Item item = read_item (sheet, marker); item.userbool3 = userbool3; @@ -357,7 +357,7 @@ void Database_Styles::updateUserbool3 (string sheet, string marker, bool userboo } -void Database_Styles::updateUserint1 (string sheet, string marker, int userint1) +void Database_Styles::updateUserint1 (std::string sheet, std::string marker, int userint1) { Database_Styles_Item item = read_item (sheet, marker); item.userint1 = userint1; @@ -365,7 +365,7 @@ void Database_Styles::updateUserint1 (string sheet, string marker, int userint1) } -void Database_Styles::updateUserint2 (string sheet, string marker, int userint2) +void Database_Styles::updateUserint2 (std::string sheet, std::string marker, int userint2) { Database_Styles_Item item = read_item (sheet, marker); item.userint2 = userint2; @@ -373,7 +373,7 @@ void Database_Styles::updateUserint2 (string sheet, string marker, int userint2) } -void Database_Styles::updateUserstring1 (string sheet, string marker, string userstring1) +void Database_Styles::updateUserstring1 (std::string sheet, std::string marker, std::string userstring1) { Database_Styles_Item item = read_item (sheet, marker); item.userstring1 = userstring1; @@ -381,7 +381,7 @@ void Database_Styles::updateUserstring1 (string sheet, string marker, string use } -void Database_Styles::updateUserstring2 (string sheet, string marker, string userstring2) +void Database_Styles::updateUserstring2 (std::string sheet, std::string marker, std::string userstring2) { Database_Styles_Item item = read_item (sheet, marker); item.userstring2 = userstring2; @@ -389,7 +389,7 @@ void Database_Styles::updateUserstring2 (string sheet, string marker, string use } -void Database_Styles::updateUserstring3 (string sheet, string marker, string userstring3) +void Database_Styles::updateUserstring3 (std::string sheet, std::string marker, std::string userstring3) { Database_Styles_Item item = read_item (sheet, marker); item.userstring3 = userstring3; @@ -397,7 +397,7 @@ void Database_Styles::updateUserstring3 (string sheet, string marker, string use } -void Database_Styles::updateBackgroundColor (string sheet, string marker, string color) +void Database_Styles::updateBackgroundColor (std::string sheet, std::string marker, std::string color) { Database_Styles_Item item = read_item (sheet, marker); item.backgroundcolor = color; @@ -406,7 +406,7 @@ void Database_Styles::updateBackgroundColor (string sheet, string marker, string // Grant $user write access to stylesheet $sheet. -void Database_Styles::grantWriteAccess (string user, string sheet) +void Database_Styles::grantWriteAccess (std::string user, std::string sheet) { SqliteSQL sql; sql.add ("INSERT INTO users VALUES ("); @@ -422,7 +422,7 @@ void Database_Styles::grantWriteAccess (string user, string sheet) // Revoke a $user's write access to stylesheet $sheet. // If the $user is empty, then revoke write access of anybody to that $sheet. -void Database_Styles::revokeWriteAccess (string user, string sheet) +void Database_Styles::revokeWriteAccess (std::string user, std::string sheet) { SqliteSQL sql; sql.add ("DELETE FROM users WHERE"); @@ -441,7 +441,7 @@ void Database_Styles::revokeWriteAccess (string user, string sheet) // Returns true or false depending on whether $user has write access to $sheet. -bool Database_Styles::hasWriteAccess (string user, string sheet) +bool Database_Styles::hasWriteAccess (std::string user, std::string sheet) { SqliteSQL sql; sql.add ("SELECT rowid FROM users WHERE user ="); @@ -462,13 +462,13 @@ string Database_Styles::databasefolder () } -string Database_Styles::sheetfolder (string sheet) +string Database_Styles::sheetfolder (std::string sheet) { return filter_url_create_path ({databasefolder (), sheet}); } -string Database_Styles::stylefile (string sheet, string marker) +string Database_Styles::stylefile (std::string sheet, std::string marker) { return filter_url_create_path ({sheetfolder (sheet), marker}); } @@ -476,7 +476,7 @@ string Database_Styles::stylefile (string sheet, string marker) // Reads a style from file. // If the file is not there, it takes the default value. -Database_Styles_Item Database_Styles::read_item (string sheet, string marker) +Database_Styles_Item Database_Styles::read_item (std::string sheet, std::string marker) { Database_Styles_Item item; @@ -568,7 +568,7 @@ Database_Styles_Item Database_Styles::read_item (string sheet, string marker) } -void Database_Styles::write_item (string sheet, Database_Styles_Item & item) +void Database_Styles::write_item (std::string sheet, Database_Styles_Item & item) { // The style is saved to file here. // When the style is loaded again from file, the various parts of the style are loaded by line number. diff --git a/database/users.cpp b/database/users.cpp index 7ad5b0006..5d570b42b 100644 --- a/database/users.cpp +++ b/database/users.cpp @@ -80,7 +80,7 @@ void Database_Users::optimize () // Add the user details to the database. -void Database_Users::add_user (string user, string password, int level, string email) +void Database_Users::add_user (std::string user, std::string password, int level, std::string email) { { SqliteDatabase sql (filename ()); @@ -98,7 +98,7 @@ void Database_Users::add_user (string user, string password, int level, string e // Updates the password for user. -void Database_Users::set_password (string user, string password) +void Database_Users::set_password (std::string user, std::string password) { SqliteDatabase sql (filename ()); sql.add ("UPDATE users SET password ="); @@ -111,7 +111,7 @@ void Database_Users::set_password (string user, string password) // Returns true if the user and password match. -bool Database_Users::matchUserPassword (string user, string password) +bool Database_Users::matchUserPassword (std::string user, std::string password) { SqliteDatabase sql (filename ()); sql.add ("SELECT username FROM users WHERE username ="); @@ -125,7 +125,7 @@ bool Database_Users::matchUserPassword (string user, string password) // Returns true if the email and password match. -bool Database_Users::matchEmailPassword (string email, string password) +bool Database_Users::matchEmailPassword (std::string email, std::string password) { SqliteDatabase sql (filename ()); sql.add ("SELECT username FROM users WHERE email ="); @@ -139,7 +139,7 @@ bool Database_Users::matchEmailPassword (string email, string password) // Returns the query to execute to add a new user. -string Database_Users::add_userQuery (string user, string password, int level, string email) +string Database_Users::add_userQuery (std::string user, std::string password, int level, std::string email) { user = database_sqlite_no_sql_injection (user); password = md5 (password); @@ -150,7 +150,7 @@ string Database_Users::add_userQuery (string user, string password, int level, s // Returns the username that belongs to the email. -string Database_Users::getEmailToUser (string email) +string Database_Users::getEmailToUser (std::string email) { SqliteDatabase sql (filename ()); sql.add ("SELECT username FROM users WHERE email ="); @@ -163,7 +163,7 @@ string Database_Users::getEmailToUser (string email) // Returns the email address that belongs to user. -string Database_Users::get_email (string user) +string Database_Users::get_email (std::string user) { SqliteDatabase sql (filename ()); sql.add ("SELECT email FROM users WHERE username = "); @@ -176,7 +176,7 @@ string Database_Users::get_email (string user) // Returns true if the username exists in the database. -bool Database_Users::usernameExists (string user) +bool Database_Users::usernameExists (std::string user) { SqliteDatabase sql (filename ()); sql.add ("SELECT username FROM users WHERE username ="); @@ -188,7 +188,7 @@ bool Database_Users::usernameExists (string user) // Returns true if the email address exists in the database. -bool Database_Users::emailExists (string email) +bool Database_Users::emailExists (std::string email) { SqliteDatabase sql (filename ()); sql.add ("SELECT username FROM users WHERE email = "); @@ -200,7 +200,7 @@ bool Database_Users::emailExists (string email) // Returns the level that belongs to the user. -int Database_Users::get_level (string user) +int Database_Users::get_level (std::string user) { SqliteDatabase sql (filename ()); sql.add ("SELECT level FROM users WHERE username = "); @@ -213,7 +213,7 @@ int Database_Users::get_level (string user) // Updates the level of a given user. -void Database_Users::set_level (string user, int level) +void Database_Users::set_level (std::string user, int level) { SqliteDatabase sql (filename ()); sql.add ("UPDATE users SET level ="); @@ -226,7 +226,7 @@ void Database_Users::set_level (string user, int level) // Remove a user from the database. -void Database_Users::removeUser (string user) +void Database_Users::removeUser (std::string user) { SqliteDatabase sql (filename ()); sql.add ("DELETE FROM users WHERE username ="); @@ -249,7 +249,7 @@ vector Database_Users::getAdministrators () // Returns the query to update a user's email address. -string Database_Users::updateEmailQuery (string user, string email) +string Database_Users::updateEmailQuery (std::string user, std::string email) { SqliteDatabase sql (filename ()); sql.add ("UPDATE users SET email ="); @@ -262,7 +262,7 @@ string Database_Users::updateEmailQuery (string user, string email) // Updates the "email" for "user". -void Database_Users::updateUserEmail (string user, string email) +void Database_Users::updateUserEmail (std::string user, std::string email) { execute (updateEmailQuery (user, email)); } @@ -279,7 +279,7 @@ vector Database_Users::get_users () // Returns the md5 hash for the $user's password. -string Database_Users::get_md5 (string user) +string Database_Users::get_md5 (std::string user) { SqliteDatabase sql (filename ()); sql.add ("SELECT password FROM users WHERE username ="); @@ -292,7 +292,7 @@ string Database_Users::get_md5 (string user) // Executes the SQL fragment. -void Database_Users::execute (string sqlfragment) +void Database_Users::execute (std::string sqlfragment) { SqliteDatabase sql (filename ()); sql.sql = sqlfragment; @@ -301,7 +301,7 @@ void Database_Users::execute (string sqlfragment) // Set the LDAP state for the $user account $on or off. -void Database_Users::set_ldap (string user, bool on) +void Database_Users::set_ldap (std::string user, bool on) { SqliteDatabase sql (filename ()); sql.add ("UPDATE users SET ldap ="); @@ -314,7 +314,7 @@ void Database_Users::set_ldap (string user, bool on) // Get whether the $user account comes from a LDAP server. -bool Database_Users::get_ldap (string user) +bool Database_Users::get_ldap (std::string user) { SqliteDatabase sql (filename ()); sql.add ("SELECT ldap FROM users WHERE username ="); @@ -330,7 +330,7 @@ bool Database_Users::get_ldap (string user) // Enable the $user account. -void Database_Users::set_enabled (string user, bool on) +void Database_Users::set_enabled (std::string user, bool on) { SqliteDatabase sql (filename ()); sql.add ("UPDATE users SET disabled ="); @@ -343,7 +343,7 @@ void Database_Users::set_enabled (string user, bool on) // Disable the $user account. -bool Database_Users::get_enabled (string user) +bool Database_Users::get_enabled (std::string user) { SqliteDatabase sql (filename ()); sql.add ("SELECT disabled FROM users WHERE username ="); diff --git a/database/volatile.cpp b/database/volatile.cpp index 16fce9e4f..bb743ff72 100644 --- a/database/volatile.cpp +++ b/database/volatile.cpp @@ -39,7 +39,7 @@ void Database_Volatile::setValue (int id, const std::string& key, const std::str } -string Database_Volatile::filename (int id, string key) +string Database_Volatile::filename (int id, std::string key) { std::string identifier = filter_url_clean_filename (filter::strings::convert_to_string (id)); key = filter_url_clean_filename (key); diff --git a/demo/logic.cpp b/demo/logic.cpp index 4e964dc22..8556d4b4b 100644 --- a/demo/logic.cpp +++ b/demo/logic.cpp @@ -72,7 +72,7 @@ using namespace std; // Returns true if the credentials are correct for a demo installation. -bool demo_acl (string user, string pass) +bool demo_acl (std::string user, std::string pass) { if (config::logic::demo_enabled ()) { if (user == session_admin_credentials ()) { diff --git a/dialog/color.cpp b/dialog/color.cpp index 861b0cd93..25d47a933 100644 --- a/dialog/color.cpp +++ b/dialog/color.cpp @@ -25,7 +25,7 @@ using namespace std; -Dialog_Color::Dialog_Color (string url, string question) +Dialog_Color::Dialog_Color (std::string url, std::string question) { base_url = url; assets_view.set_variable ("question", question); @@ -41,7 +41,7 @@ Dialog_Color::~Dialog_Color () // If any $query is passed, if Cancel is clicked in this dialog, it should go go back // to the original caller page with the $query added. // Same for when a selection is made: It adds the $query to the page where to go. -void Dialog_Color::add_query (string parameter, string value) +void Dialog_Color::add_query (std::string parameter, std::string value) { base_url = filter_url_build_http_query (base_url, parameter, value); } diff --git a/dialog/entry.cpp b/dialog/entry.cpp index 35f41ba33..3072aa1ec 100644 --- a/dialog/entry.cpp +++ b/dialog/entry.cpp @@ -34,7 +34,7 @@ using namespace std; // $value : The initial value to be put into the entry. // $submit : Name of POST request to submit the information. // $help : Help information explaining to the user what's going on. -Dialog_Entry::Dialog_Entry (string url, string question, string value, string submit, string help) +Dialog_Entry::Dialog_Entry (std::string url, std::string question, std::string value, std::string submit, std::string help) { base_url = url; assets_view.set_variable ("question", question); @@ -49,7 +49,7 @@ Dialog_Entry::~Dialog_Entry () } -void Dialog_Entry::add_query (string parameter, string value) +void Dialog_Entry::add_query (std::string parameter, std::string value) { base_url = filter_url_build_http_query (base_url, parameter, value); } diff --git a/dialog/list.cpp b/dialog/list.cpp index eb0674965..da9fd8ca6 100644 --- a/dialog/list.cpp +++ b/dialog/list.cpp @@ -31,7 +31,7 @@ using namespace std; // $info_top : Information. // $info_bottom: Information. // $post: causes the result to be sent via the POST method rather than the default GET method. -Dialog_List::Dialog_List (string url, string question, string info_top, string info_bottom, bool post) +Dialog_List::Dialog_List (std::string url, std::string question, std::string info_top, std::string info_bottom, bool post) { base_url = url; assets_view.set_variable ("question", question); @@ -52,13 +52,13 @@ Dialog_List::~Dialog_List () // If any $query is passed, if Cancel is clicked in this dialog, it should go go back // to the original caller page with the $query added. // Same for when a selection is made: It adds the $query to the page where to go. -void Dialog_List::add_query (string parameter, string value) +void Dialog_List::add_query (std::string parameter, std::string value) { base_url = filter_url_build_http_query (base_url, parameter, value); } -void Dialog_List::add_row (string text, string parameter, string value) +void Dialog_List::add_row (std::string text, std::string parameter, std::string value) { if (!list_block.empty ()) list_block.append ("\n"); list_block.append ("
  • "); diff --git a/dialog/list2.cpp b/dialog/list2.cpp index ac287d565..3e9ea8fdf 100644 --- a/dialog/list2.cpp +++ b/dialog/list2.cpp @@ -22,7 +22,7 @@ using namespace std; // Generate the option tags based on the inserted key and its value. -string Options_To_Select::add_selection (string text, string value, string html) +string Options_To_Select::add_selection (std::string text, std::string value, std::string html) { if (value == "") { html.append (""); @@ -35,7 +35,7 @@ string Options_To_Select::add_selection (string text, string value, string html) // Mark the current selected option's option tag. -string Options_To_Select::mark_selected (string value, string html) +string Options_To_Select::mark_selected (std::string value, std::string html) { std::string new_value = "value='" + value + "'"; size_t new_pos = html.find (new_value) + new_value.length (); diff --git a/edit/logic.cpp b/edit/logic.cpp index fa38e23ae..0de2a3064 100644 --- a/edit/logic.cpp +++ b/edit/logic.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. using namespace std; -string edit2_logic_volatile_key (string bible, int book, int chapter, string editor) +string edit2_logic_volatile_key (std::string bible, int book, int chapter, std::string editor) { std::string key; key.append (bible); @@ -39,7 +39,7 @@ string edit2_logic_volatile_key (string bible, int book, int chapter, string edi } -void storeLoadedUsfm2 (Webserver_Request& webserver_request, string bible, int book, int chapter, string editor, [[maybe_unused]] const char * message) +void storeLoadedUsfm2 (Webserver_Request& webserver_request, std::string bible, int book, int chapter, std::string editor, [[maybe_unused]] const char * message) { int userid = filter::strings::user_identifier (webserver_request); @@ -51,7 +51,7 @@ void storeLoadedUsfm2 (Webserver_Request& webserver_request, string bible, int b } -string getLoadedUsfm2 (Webserver_Request& webserver_request, string bible, int book, int chapter, string editor) +string getLoadedUsfm2 (Webserver_Request& webserver_request, std::string bible, int book, int chapter, std::string editor) { int userid = filter::strings::user_identifier (webserver_request); diff --git a/editone2/index.cpp b/editone2/index.cpp index d18646f5e..f3a2a8141 100644 --- a/editone2/index.cpp +++ b/editone2/index.cpp @@ -109,7 +109,7 @@ string editone2_index (Webserver_Request& webserver_request) view.set_variable ("navigationCode", Navigation_Passage::code (bible)); // Create the script, quote the strings to ensure it's legal Javascript. - stringstream script_stream {}; + 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"; diff --git a/editone2/logic.cpp b/editone2/logic.cpp index a44748a70..39fc2500c 100644 --- a/editone2/logic.cpp +++ b/editone2/logic.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. using namespace std; -void editone_logic_prefix_html (string usfm, string stylesheet, string& html, string& last_p_style) +void editone_logic_prefix_html (std::string usfm, std::string stylesheet, std::string& html, std::string& last_p_style) { if (!usfm.empty ()) { Editor_Usfm2Html editor_usfm2html; @@ -45,7 +45,7 @@ void editone_logic_prefix_html (string usfm, string stylesheet, string& html, st } -void editone_logic_editable_html (string usfm, string stylesheet, string& html) +void editone_logic_editable_html (std::string usfm, std::string stylesheet, std::string& html) { if (!usfm.empty ()) { Editor_Usfm2Html editor_usfm2html; @@ -57,7 +57,7 @@ void editone_logic_editable_html (string usfm, string stylesheet, string& html) } -void editone_logic_suffix_html (string editable_last_p_style, string usfm, string stylesheet, string& html) +void editone_logic_suffix_html (std::string editable_last_p_style, std::string usfm, std::string stylesheet, std::string& html) { if (!usfm.empty ()) { Editor_Usfm2Html editor_usfm2html; @@ -85,7 +85,7 @@ void editone_logic_suffix_html (string editable_last_p_style, string usfm, strin if (p_style.empty ()) { p_node.append_attribute ("class") = editable_last_p_style.c_str (); } - stringstream output; + std::stringstream output; document.print (output, "", pugi::format_raw); html = output.str (); } @@ -93,7 +93,7 @@ void editone_logic_suffix_html (string editable_last_p_style, string usfm, strin } -string editone_logic_html_to_usfm (string stylesheet, string html) +string editone_logic_html_to_usfm (std::string stylesheet, std::string html) { // It used to convert XML entities to normal characters. // For example, it used to convert "<" to "<". @@ -116,7 +116,7 @@ string editone_logic_html_to_usfm (string stylesheet, string html) // Move the notes from the $prefix to the $suffix. -void editone_logic_move_notes_v2 (string & prefix, string & suffix) +void editone_logic_move_notes_v2 (std::string & prefix, std::string & suffix) { // No input: Ready. if (prefix.empty ()) return; @@ -156,7 +156,7 @@ void editone_logic_move_notes_v2 (string & prefix, string & suffix) // Remove the notes separator node from the prefix. std::string notes_text; for (pugi::xml_node p_node : prefix_note_nodes) { - stringstream ss; + std::stringstream ss; p_node.print (ss, "", pugi::format_raw); std::string note = ss.str (); notes_text.append (note); @@ -166,7 +166,7 @@ void editone_logic_move_notes_v2 (string & prefix, string & suffix) // Convert the XML document back to a possibly cleaned prefix without notes. { - stringstream ss; + std::stringstream ss; document.print (ss, "", pugi::format_raw); prefix = ss.str (); } @@ -198,7 +198,7 @@ void editone_logic_move_notes_v2 (string & prefix, string & suffix) // Convert the DOM to suffix text. { - stringstream ss; + std::stringstream ss; document.print (ss, "", pugi::format_raw); suffix = ss.str (); } diff --git a/editor/html2format.cpp b/editor/html2format.cpp index 0d1296568..9c67cae6b 100644 --- a/editor/html2format.cpp +++ b/editor/html2format.cpp @@ -29,7 +29,7 @@ using namespace std; -void Editor_Html2Format::load (string html) +void Editor_Html2Format::load (std::string html) { // The web editor may insert non-breaking spaces. Convert them to normal spaces. html = filter::strings::replace (filter::strings::unicode_non_breaking_space_entity (), " ", html); @@ -157,7 +157,7 @@ void Editor_Html2Format::closeElementNode (pugi::xml_node node) } -void Editor_Html2Format::openInline (string className) +void Editor_Html2Format::openInline (std::string className) { current_character_format = className; } @@ -175,7 +175,7 @@ void Editor_Html2Format::postprocess () } -string Editor_Html2Format::update_quill_class (string classname) +string Editor_Html2Format::update_quill_class (std::string classname) { classname = filter::strings::replace (quill_logic_class_prefix_block (), "", classname); classname = filter::strings::replace (quill_logic_class_prefix_inline (), "", classname); diff --git a/editor/html2usfm.cpp b/editor/html2usfm.cpp index 236c441d5..a45b6e6c4 100644 --- a/editor/html2usfm.cpp +++ b/editor/html2usfm.cpp @@ -29,7 +29,7 @@ using namespace std; -void Editor_Html2Usfm::load (string html) +void Editor_Html2Usfm::load (std::string html) { // The web editor may insert non-breaking spaces. Convert them to normal spaces. html = filter::strings::replace (filter::strings::unicode_non_breaking_space_entity (), " ", html); @@ -49,7 +49,7 @@ void Editor_Html2Usfm::load (string html) } -void Editor_Html2Usfm::stylesheet (string stylesheet) +void Editor_Html2Usfm::stylesheet (std::string stylesheet) { styles.clear (); noteOpeners.clear (); @@ -57,7 +57,7 @@ void Editor_Html2Usfm::stylesheet (string stylesheet) Database_Styles database_styles; std::vector markers = database_styles.getMarkers (stylesheet); // Load the style information into the object. - for (string & marker : markers) { + for (std::string & marker : markers) { Database_Styles_Item style = database_styles.getMarkerData (stylesheet, marker); styles [marker] = style; // Get markers that should not have endmarkers. @@ -258,7 +258,7 @@ void Editor_Html2Usfm::closeElementNode (pugi::xml_node node) } -void Editor_Html2Usfm::openInline (string className) +void Editor_Html2Usfm::openInline (std::string className) { // It has been observed that the elements of the character styles may be embedded, like so: // The @@ -358,10 +358,10 @@ void Editor_Html2Usfm::processNoteCitation (pugi::xml_node node) } -string Editor_Html2Usfm::cleanUSFM (string usfm) +string Editor_Html2Usfm::cleanUSFM (std::string usfm) { // Replace a double space after a note opener. - for (string noteOpener : noteOpeners) { + for (std::string noteOpener : noteOpeners) { std::string opener = filter::usfm::get_opening_usfm (noteOpener); usfm = filter::strings::replace (opener + " ", opener, usfm); } @@ -405,7 +405,7 @@ void Editor_Html2Usfm::postprocess () // Retrieves a pointer to a relevant footnote element in the XML. -pugi::xml_node Editor_Html2Usfm::get_note_pointer (pugi::xml_node body, string id) +pugi::xml_node Editor_Html2Usfm::get_note_pointer (pugi::xml_node body, std::string id) { // The note wrapper node to look for. pugi::xml_node p_note_wrapper; @@ -471,7 +471,7 @@ pugi::xml_node Editor_Html2Usfm::get_note_pointer (pugi::xml_node body, string i } -string Editor_Html2Usfm::update_quill_class (string classname) +string Editor_Html2Usfm::update_quill_class (std::string classname) { classname = filter::strings::replace (quill_logic_class_prefix_block (), "", classname); classname = filter::strings::replace (quill_logic_class_prefix_inline (), "", classname); @@ -482,7 +482,7 @@ string Editor_Html2Usfm::update_quill_class (string classname) // This function takes the html from a Quill-based editor that edits one verse, // and converts it to USFM. // It properly deals with cases when a verse does not start a new paragraph. -string editor_export_verse_quill (string stylesheet, string html) +string editor_export_verse_quill (std::string stylesheet, std::string html) { // When the $html starts with a paragraph without a style, // put a recognizable style there. diff --git a/email/send.cpp b/email/send.cpp index e96ab57fb..3a57e86ae 100644 --- a/email/send.cpp +++ b/email/send.cpp @@ -99,7 +99,7 @@ void email_send () std::string result = email_send (email, username, subject, body); if (result.empty ()) { database_mail.erase (id); - stringstream ss; + std::stringstream ss; ss << "Email to " << email << " with subject " << quoted(subject) << " was "; result = ss.str(); #ifdef HAVE_CLOUD @@ -361,7 +361,7 @@ string email_send ([[maybe_unused]] string to_mail, } -void email_schedule (string to, string subject, string body, int time) +void email_schedule (std::string to, std::string subject, std::string body, int time) { // Schedule the mail for sending. Webserver_Request webserver_request; diff --git a/esword/text.cpp b/esword/text.cpp index 20778ec80..5fc6cc3b5 100644 --- a/esword/text.cpp +++ b/esword/text.cpp @@ -28,7 +28,7 @@ using namespace std; // Class for creating e-Sword documents. -Esword_Text::Esword_Text (string bible) +Esword_Text::Esword_Text (std::string bible) { currentBook = 0; currentChapter = 0; @@ -87,7 +87,7 @@ void Esword_Text::newVerse (int verse) } -void Esword_Text::add_text (string text) +void Esword_Text::add_text (std::string text) { if (text != "") currentText += text; } @@ -104,11 +104,11 @@ void Esword_Text::finalize () // This creates the eSword module. // $filename: the name of the file to create. -void Esword_Text::createModule (string filename) +void Esword_Text::createModule (std::string filename) { flushCache (); sqlite3 * db = database_sqlite_connect_file (filename); - for (string statement : sql) { + for (std::string statement : sql) { database_sqlite_exec (db, statement); } database_sqlite_disconnect (db); diff --git a/export/bibledropbox.cpp b/export/bibledropbox.cpp index 58be74d27..45f9b5172 100644 --- a/export/bibledropbox.cpp +++ b/export/bibledropbox.cpp @@ -34,7 +34,7 @@ using namespace std; -void export_bibledropbox (string user, string bible) +void export_bibledropbox (std::string user, std::string bible) { Webserver_Request request; Database_Bibles database_bibles; diff --git a/export/esword.cpp b/export/esword.cpp index d464b0f83..7c28a7e54 100644 --- a/export/esword.cpp +++ b/export/esword.cpp @@ -37,7 +37,7 @@ using namespace std; -void export_esword (string bible, bool log) +void export_esword (std::string bible, bool log) { std::string directory = filter_url_create_path ({export_logic::bible_directory (bible), "esword"}); if (!file_or_dir_exists (directory)) filter_url_mkdir (directory); diff --git a/export/html.cpp b/export/html.cpp index f4f68c1cf..5e8927a9e 100644 --- a/export/html.cpp +++ b/export/html.cpp @@ -40,7 +40,7 @@ using namespace std; -void export_html_book (string bible, int book, bool log) +void export_html_book (std::string bible, int book, bool log) { // Create folders for the html export. std::string directory = filter_url_create_path ({export_logic::bible_directory (bible), "html"}); diff --git a/export/info.cpp b/export/info.cpp index 4646a5697..2d41140ca 100644 --- a/export/info.cpp +++ b/export/info.cpp @@ -36,7 +36,7 @@ using namespace std; -void export_info (string bible, bool log) +void export_info (std::string bible, bool log) { // Create folders for the information. std::string directory = filter_url_create_path ({export_logic::bible_directory (bible), "info"}); diff --git a/export/odt.cpp b/export/odt.cpp index 2142ce5aa..2fff907fc 100644 --- a/export/odt.cpp +++ b/export/odt.cpp @@ -39,7 +39,7 @@ using namespace std; -void export_odt_book (string bible, int book, bool log) +void export_odt_book (std::string bible, int book, bool log) { // Create folders for the OpenDocument export. std::string directory = filter_url_create_path ({export_logic::bible_directory (bible), "opendocument"}); diff --git a/export/onlinebible.cpp b/export/onlinebible.cpp index 180d9ff0e..50aa655b1 100644 --- a/export/onlinebible.cpp +++ b/export/onlinebible.cpp @@ -38,7 +38,7 @@ using namespace std; -void export_onlinebible (string bible, bool log) +void export_onlinebible (std::string bible, bool log) { std::string directory = filter_url_create_path ({export_logic::bible_directory (bible), "onlinebible"}); if (!file_or_dir_exists (directory)) filter_url_mkdir (directory); diff --git a/export/textusfm.cpp b/export/textusfm.cpp index 81fbfc7c2..80514f1a2 100644 --- a/export/textusfm.cpp +++ b/export/textusfm.cpp @@ -37,7 +37,7 @@ using namespace std; -void export_text_usfm_book (string bible, int book, bool log) +void export_text_usfm_book (std::string bible, int book, bool log) { // Create folders for the clear text and the basic USFM exports. std::string usfmDirectory = export_logic::usfm_directory (bible, 1); diff --git a/export/usfm.cpp b/export/usfm.cpp index b6385b8f0..6b82857a4 100644 --- a/export/usfm.cpp +++ b/export/usfm.cpp @@ -36,7 +36,7 @@ using namespace std; -void export_usfm (string bible, bool log) +void export_usfm (std::string bible, bool log) { Database_Bibles database_bibles; diff --git a/export/web.cpp b/export/web.cpp index a454eb456..b60c3fae6 100644 --- a/export/web.cpp +++ b/export/web.cpp @@ -40,7 +40,7 @@ using namespace std; -void export_web_book (string bible, int book, bool log) +void export_web_book (std::string bible, int book, bool log) { const std::string directory = export_logic::web_directory (bible); if (!file_or_dir_exists (directory)) filter_url_mkdir (directory); @@ -160,7 +160,7 @@ void export_web_book (string bible, int book, bool log) } -void export_web_index (string bible, bool log) +void export_web_index (std::string bible, bool log) { // Create folders for the web export. std::string directory = export_logic::web_directory (bible); diff --git a/filter/archive.cpp b/filter/archive.cpp index b19a233bc..cd244a9a0 100644 --- a/filter/archive.cpp +++ b/filter/archive.cpp @@ -34,7 +34,7 @@ using namespace std; // Compresses a $folder into zip format. // Returns the path to the compressed archive it created. -string filter_archive_zip_folder (string folder) +string filter_archive_zip_folder (std::string folder) { #ifdef HAVE_CLOUD return filter_archive_zip_folder_shell_internal (folder); @@ -47,7 +47,7 @@ string filter_archive_zip_folder (string folder) // Compresses a $folder into zip format. // Returns the path to the compressed archive it created. -string filter_archive_zip_folder_shell_internal (string folder) +string filter_archive_zip_folder_shell_internal (std::string folder) { if (!file_or_dir_exists (folder)) return std::string(); std::string zippedfile = filter_url_tempfile () + ".zip"; @@ -71,7 +71,7 @@ string filter_archive_zip_folder_shell_internal (string folder) // Compresses a $folder into zip format. // Returns the path to the compressed archive it created. -string filter_archive_zip_folder_miniz_internal (string folder) +string filter_archive_zip_folder_miniz_internal (std::string folder) { if (!file_or_dir_exists (folder)) { return ""; @@ -107,7 +107,7 @@ string filter_archive_zip_folder_miniz_internal (string folder) // Uncompresses a zip archive identified by $file. // Returns the path to the folder it created. -string filter_archive_unzip (string file) +string filter_archive_unzip (std::string file) { #ifdef HAVE_CLOUD return filter_archive_unzip_shell_internal (file); @@ -148,7 +148,7 @@ string filter_archive_unzip_shell_internal ([[maybe_unused]] string file) // Uncompresses the $zipfile. // Returns the path to the folder it created. -string filter_archive_unzip_miniz_internal (string zipfile) +string filter_archive_unzip_miniz_internal (std::string zipfile) { // Directory where to unzip the archive. std::string folder = filter_url_tempfile (); @@ -239,7 +239,7 @@ string filter_archive_unzip_miniz_internal (string zipfile) // Compresses a file identified by $filename into gzipped tar format. // Returns the path to the compressed archive it created. -string filter_archive_tar_gzip_file (string filename) +string filter_archive_tar_gzip_file (std::string filename) { std::string tarball = filter_url_tempfile () + ".tar.gz"; std::string dirname = filter_url_escape_shell_argument (filter_url_dirname (filename)); @@ -266,7 +266,7 @@ string filter_archive_tar_gzip_file (string filename) // Compresses a $folder into gzipped tar format. // Returns the path to the compressed archive it created. -string filter_archive_tar_gzip_folder (string folder) +string filter_archive_tar_gzip_folder (std::string folder) { std::string tarball = filter_url_tempfile () + ".tar.gz"; folder = filter_url_escape_shell_argument (folder); @@ -292,7 +292,7 @@ string filter_archive_tar_gzip_folder (string folder) // Uncompresses a .tar.gz archive identified by $file. // Returns the path to the folder it created. -string filter_archive_untar_gzip (string file) +string filter_archive_untar_gzip (std::string file) { file = filter_url_escape_shell_argument (file); std::string folder = filter_url_tempfile (); @@ -320,7 +320,7 @@ string filter_archive_untar_gzip (string file) // Uncompresses a known archive identified by $file. // Returns the path to the folder it created. -string filter_archive_uncompress (string file) +string filter_archive_uncompress (std::string file) { int type = filter_archive_is_archive (file); if (type == 1) { @@ -335,7 +335,7 @@ string filter_archive_uncompress (string file) // Returns 0 if it is not an archive that Bibledit supports. // Else returns 1, 2, 3... depending on the type of archive. -int filter_archive_is_archive (string file) +int filter_archive_is_archive (std::string file) { // Tar (.tar) archives, including those compressed with gzip (.tar.gz, .tgz), bzip (.tar.bz, .tbz), bzip2 (.tar.bz2, .tbz2), compress (.tar.Z, .taz), lzop (.tar.lzo, .tzo) and lzma (.tar.lzma) // Zip archives (.zip) @@ -359,7 +359,7 @@ int filter_archive_is_archive (string file) // Create a tarball at $tarpath with input $files from $directory. -string filter_archive_microtar_pack (string tarpath, string directory, std::vector files) +string filter_archive_microtar_pack (std::string tarpath, std::string directory, std::vector files) { mtar_t tar; int res; @@ -398,7 +398,7 @@ string filter_archive_microtar_pack (string tarpath, string directory, std::vect // Unpack the tarball at $tarpath and store the individual files at $outputpath. -string filter_archive_microtar_unpack (string tarball, string directory) +string filter_archive_microtar_unpack (std::string tarball, std::string directory) { mtar_t tar; mtar_header_t h; diff --git a/filter/css.cpp b/filter/css.cpp index 0de41be0d..21bcd7d91 100644 --- a/filter/css.cpp +++ b/filter/css.cpp @@ -63,7 +63,7 @@ string Filter_Css::rtl () } -int Filter_Css::directionValue (string direction) +int Filter_Css::directionValue (std::string direction) { if (direction == ltr ()) return 1; if (direction == rtl ()) return 2; @@ -140,7 +140,7 @@ string Filter_Css::bt_rl () } -int Filter_Css::writingModeValue (string mode) +int Filter_Css::writingModeValue (std::string mode) { if (mode == tb_lr ()) return 1; if (mode == tb_rl ()) return 2; @@ -155,7 +155,7 @@ int Filter_Css::writingModeValue (string mode) // Since a bible can contain any Unicode character, // just using the bible as the class identifier will not work. // The function solves that. -string Filter_Css::getClass (string bible) +string Filter_Css::getClass (std::string bible) { std::string classs = md5 (bible); classs = classs.substr (0, 6); @@ -170,7 +170,7 @@ string Filter_Css::getClass (string bible) // directionvalue: The value for the text direction. // $lineheigh: Value in percents. // $letterspacing: Value multiplied by 10, in pixels. -string Filter_Css::get_css (string class_, string font, int directionvalue, int lineheight, int letterspacing) +string Filter_Css::get_css (std::string class_, std::string font, int directionvalue, int lineheight, int letterspacing) { std::vector css; diff --git a/filter/diff.cpp b/filter/diff.cpp index 222dcea54..805c2acd6 100644 --- a/filter/diff.cpp +++ b/filter/diff.cpp @@ -52,7 +52,7 @@ static mutex filter_diff_mutex; // The function returns the differences marked. // If the containers for $removals and $additions are given, // they will be filled with the appropriate text fragments. -string filter_diff_diff (string oldstring, string newstring, +string filter_diff_diff (std::string oldstring, std::string newstring, std::vector * removals, std::vector * additions) { @@ -77,7 +77,7 @@ string filter_diff_diff (string oldstring, string newstring, diff.compose(); // Get the shortest edit distance. - stringstream result; + std::stringstream result; diff.printSES (result); filter_diff_mutex.unlock(); @@ -110,9 +110,9 @@ string filter_diff_diff (string oldstring, string newstring, } -// This filter returns the diff of two input vector's. -// $old: The old vector for input. -// $new: The new vector for input. +// This filter returns the diff of two input vector's. +// $old: The old vector for input. +// $new: The new vector for input. // // The function produces information, // that if applied to the old input, will produce the new input. @@ -169,7 +169,7 @@ void filter_diff_diff_utf16 (const std::vector & oldinput, const s diff.compose(); // Get the shortest edit distance. - stringstream result; + std::stringstream result; diff.printSES (result); // Convert the new line place holder back to the original new line. @@ -227,7 +227,7 @@ void filter_diff_diff_utf16 (const std::vector & oldinput, const s // 100% means that the text is completely similar. // And 0% means that the text is completely different. // The output ranges from 0 to 100%. -int filter_diff_character_similarity (string oldstring, string newstring) +int filter_diff_character_similarity (std::string oldstring, std::string newstring) { try { @@ -254,7 +254,7 @@ int filter_diff_character_similarity (string oldstring, string newstring) diff.compose(); // Get the shortest edit distance. - stringstream result; + std::stringstream result; diff.printSES (result); filter_diff_mutex.unlock(); @@ -289,7 +289,7 @@ int filter_diff_character_similarity (string oldstring, string newstring) // 100% means that the text is completely similar. // And 0% means that the text is completely different. // The output ranges from 0 to 100%. -int filter_diff_word_similarity (string oldstring, string newstring) +int filter_diff_word_similarity (std::string oldstring, std::string newstring) { // Split the input up into words separated by spaces. std::vector old_sequence; @@ -310,7 +310,7 @@ int filter_diff_word_similarity (string oldstring, string newstring) diff.compose(); // Get the shortest edit distance. - stringstream result; + std::stringstream result; diff.printSES (result); filter_diff_mutex.unlock(); @@ -339,7 +339,7 @@ int filter_diff_word_similarity (string oldstring, string newstring) // $directory: The existing directory where to put the files. // Two files are created: verses_old.usfm and verses_new.usfm. // The book chapter.verse precede each verse. -void filter_diff_produce_verse_level (string bible, string directory) +void filter_diff_produce_verse_level (std::string bible, std::string directory) { Webserver_Request request; Database_Modifications database_modifications; @@ -401,7 +401,7 @@ void filter_diff_produce_verse_level (string bible, string directory) * $newfile: The name of the new file for input. * $outputfile: The name of the output file */ -void filter_diff_run_file (string oldfile, string newfile, string outputfile) +void filter_diff_run_file (std::string oldfile, std::string newfile, std::string outputfile) { std::string oldstring = filter_url_file_get_contents (oldfile); std::string newstring = filter_url_file_get_contents (newfile); diff --git a/filter/git.cpp b/filter/git.cpp index 84d78d8e2..fdf3d0e88 100644 --- a/filter/git.cpp +++ b/filter/git.cpp @@ -37,13 +37,13 @@ using namespace std; // This function returns the directory of the git repository belonging to $object. -string filter_git_directory (string object) +string filter_git_directory (std::string object) { return filter_url_create_root_path ({"git", object}); } -void filter_git_check_error (string data) +void filter_git_check_error (std::string data) { std::vector lines = filter::strings::explode (data, '\n'); for (auto & line : lines) Database_Logs::log (line); @@ -51,7 +51,7 @@ void filter_git_check_error (string data) // Runs the equivalent of "git init". -bool filter_git_init (string directory, bool bare) +bool filter_git_init (std::string directory, bool bare) { std::vector parameters = {"init"}; if (bare) parameters.push_back ("--bare"); @@ -64,8 +64,8 @@ bool filter_git_init (string directory, bool bare) // Internal function that commits a user-generated change to the git repository. -void filter_git_commit_modification_to_git (string repository, string user, int book, int chapter, - std::string & oldusfm, string & newusfm) +void filter_git_commit_modification_to_git (std::string repository, std::string user, int book, int chapter, + std::string & oldusfm, std::string & newusfm) { std::string bookname = database::books::get_english_from_id (static_cast(book)); std::string bookdir = filter_url_create_path ({repository, bookname}); @@ -91,7 +91,7 @@ void filter_git_commit_modification_to_git (string repository, string user, int // This filter stores the changes made by users on $bible in $repository. // This puts commits in the repository, where the author is the user who made the changes. // This information in the git repository can then be used for statistical or other purposes. -void filter_git_sync_modifications_to_git (string bible, string repository) +void filter_git_sync_modifications_to_git (std::string bible, std::string repository) { // Go through all the users who saved data to this Bible. std::vector users = Database_Git::get_users (bible); @@ -152,7 +152,7 @@ void filter_git_sync_modifications_to_git (string bible, string repository) // The $git is a git repository, and may contain other data as well. // The filter focuses on reading the data in the git repository, and only writes to it if necessary, // This speeds up the filter. -void filter_git_sync_bible_to_git (Webserver_Request& webserver_request, string bible, string repository) +void filter_git_sync_bible_to_git (Webserver_Request& webserver_request, std::string bible, std::string repository) { // First stage. // Read the chapters in the git repository, @@ -220,7 +220,7 @@ void filter_git_sync_bible_to_git (Webserver_Request& webserver_request, string // The filter focuses on reading the data in the git repository and the database, // and only writes to the database if necessary, // This speeds up the filter. -void filter_git_sync_git_to_bible (Webserver_Request& webserver_request, string repository, string bible) +void filter_git_sync_git_to_bible (Webserver_Request& webserver_request, std::string repository, std::string bible) { // Stage one: // Read the chapters in the git repository, @@ -306,7 +306,7 @@ string filter_git_disabled () // This filter takes one chapter of the Bible data as it is stored in the $git folder, // and puts this information into Bibledit's database. // The $git is a git repository, and may contain other data as well. -void filter_git_sync_git_chapter_to_bible (string repository, string bible, int book, int chapter) +void filter_git_sync_git_chapter_to_bible (std::string repository, std::string bible, int book, int chapter) { // Filename for the chapter. std::string bookname = database::books::get_english_from_id (static_cast(book)); @@ -333,7 +333,7 @@ void filter_git_sync_git_chapter_to_bible (string repository, string bible, int // Returns true if the git repository at "url" is online. -bool filter_git_remote_read (string url, string & error) +bool filter_git_remote_read (std::string url, std::string & error) { std::string output; int result = filter_shell_run ("", "git", {"ls-remote", url}, &output, &error); @@ -343,7 +343,7 @@ bool filter_git_remote_read (string url, string & error) } -bool filter_git_remote_clone (string url, string path, [[maybe_unused]] int jobid, string & error) +bool filter_git_remote_clone (std::string url, std::string path, [[maybe_unused]] int jobid, std::string & error) { // Clear a possible existing git repository directory. filter_url_rmdir (path); @@ -357,7 +357,7 @@ bool filter_git_remote_clone (string url, string path, [[maybe_unused]] int jobi } -bool filter_git_add_remove_all (string repository, string & error) +bool filter_git_add_remove_all (std::string repository, std::string & error) { std::string output; int result = filter_shell_run (repository, "git", {"add", "--all", "."}, &output, &error); @@ -368,12 +368,12 @@ bool filter_git_add_remove_all (string repository, string & error) // This function runs "git commit" through the shell. -bool filter_git_commit (string repository, string user, string message, - std::vector & messages, string & error) +bool filter_git_commit (std::string repository, std::string user, std::string message, + std::vector & messages, std::string & error) { user = filter_git_user (user); std::string email = filter_git_email (user); - stringstream author; + std::stringstream author; author << "--author=" << quoted(user + " <" + email + ">"); std::string out, err; int result = filter_shell_run (repository, "git", @@ -399,21 +399,21 @@ bool filter_git_commit (string repository, string user, string message, } -void filter_git_config_set_bool (string repository, string name, bool value) +void filter_git_config_set_bool (std::string repository, std::string name, bool value) { std::string svalue = value ? "true" : "false"; filter_git_config_set_string (repository, name, svalue); } -void filter_git_config_set_int (string repository, string name, int value) +void filter_git_config_set_int (std::string repository, std::string name, int value) { std::string svalue = filter::strings::convert_to_string (value); filter_git_config_set_string (repository, name, svalue); } -void filter_git_config_set_string (string repository, string name, string value) +void filter_git_config_set_string (std::string repository, std::string name, std::string value) { std::string output, error; filter_shell_run (repository, "git", {"config", name, value}, &output, &error); @@ -423,7 +423,7 @@ void filter_git_config_set_string (string repository, string name, string value) // This filter takes a $line of the output of the git pull command. // It tries to interpret it to find a passage that would have been updated. // If a valid book and chapter are found, it returns them. -Passage filter_git_get_passage (string line) +Passage filter_git_get_passage (std::string line) { // Sample lines for git pull: @@ -473,7 +473,7 @@ Passage filter_git_get_passage (string line) // Repository: "repository". // If $porcelain is given, it adds the --porcelain flag. // All changed files will be returned. -vector filter_git_status (string repository, bool porcelain) +vector filter_git_status (std::string repository, bool porcelain) { std::vector paths; std::string output, error; @@ -488,7 +488,7 @@ vector filter_git_status (string repository, bool porcelain) // Runs "git pull" and returns true if it ran fine. // It puts the messages in container "messages". -bool filter_git_pull (string repository, std::vector & messages) +bool filter_git_pull (std::string repository, std::vector & messages) { std::string out, err; int result = filter_shell_run (repository, "git", {"pull"}, &out, &err); @@ -503,7 +503,7 @@ bool filter_git_pull (string repository, std::vector & messages) // Runs "git pull" and returns true if it ran fine. // It puts the push messages in container "messages". -bool filter_git_push (string repository, std::vector & messages, bool all) +bool filter_git_push (std::string repository, std::vector & messages, bool all) { std::string out, err; std::vector parameters = {"push"}; @@ -522,7 +522,7 @@ bool filter_git_push (string repository, std::vector & messages, b // It fills "paths" with the paths to the files with the resolved merge conflicts. // It fills "error" with any error that git generates. // It returns true on success, that is, no errors occurred. -bool filter_git_resolve_conflicts (string repository, std::vector & paths, string & error) +bool filter_git_resolve_conflicts (std::string repository, std::vector & paths, std::string & error) { int result = 0; paths.clear(); @@ -576,7 +576,7 @@ bool filter_git_resolve_conflicts (string repository, std::vector // Configure the $repository: Make certain settings. -void filter_git_config (string repository) +void filter_git_config (std::string repository) { // At times there's a stale index.lock file that prevents any collaboration. // This is to be removed. @@ -610,7 +610,7 @@ void filter_git_config (string repository) // This checks $user, and optionally set it, to be sure it always returns a username. -string filter_git_user (string user) +string filter_git_user (std::string user) { if (user.empty ()) { user = Database_Config_General::getSiteMailName (); @@ -625,7 +625,7 @@ string filter_git_user (string user) // This takes the email address that belongs to $user, // and optionally sets the email address to a valid value, // and returns that email address. -string filter_git_email (string user) +string filter_git_email (std::string user) { Database_Users database_users; std::string email = database_users.get_email (user); diff --git a/filter/google.cpp b/filter/google.cpp index b65984d81..c94e758e6 100644 --- a/filter/google.cpp +++ b/filter/google.cpp @@ -56,7 +56,7 @@ tuple get_json_key_value_error () // plus the resulting output of the command. tuple activate_service_account () { - stringstream command; + std::stringstream command; command << "gcloud auth activate-service-account --quiet --key-file="; command << quoted(config::logic::google_translate_json_key_path ()); std::string out_err; diff --git a/filter/image.cpp b/filter/image.cpp index aca23a161..fc905165a 100644 --- a/filter/image.cpp +++ b/filter/image.cpp @@ -35,7 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. using namespace std; -void filter_image_get_sizes (string image_path, int & width, int & height) +void filter_image_get_sizes (std::string image_path, int & width, int & height) { int bpp; uint8_t* rgb_image = stbi_load (image_path.c_str(), &width, &height, &bpp, 0); diff --git a/filter/mail.cpp b/filter/mail.cpp index b3b2cf8b3..15e75ca3a 100644 --- a/filter/mail.cpp +++ b/filter/mail.cpp @@ -52,7 +52,7 @@ using namespace std; using namespace mimetic; -string filter_mail_remove_headers_internal (string contents) +string filter_mail_remove_headers_internal (std::string contents) { bool empty_line_encountered = false; std::vector cleaned; @@ -69,7 +69,7 @@ string filter_mail_remove_headers_internal (string contents) } -void filter_mail_dissect_internal (const MimeEntity& me, string& plaintext) +void filter_mail_dissect_internal (const MimeEntity& me, std::string& plaintext) { // If the plain text of this email has been found already, // there's no need to search any further. @@ -87,7 +87,7 @@ void filter_mail_dissect_internal (const MimeEntity& me, string& plaintext) if (subtype== "plain") { // Get the plain text of the message. - stringstream ss; + std::stringstream ss; ss << me; plaintext = ss.str (); // Remove headers. @@ -96,7 +96,7 @@ void filter_mail_dissect_internal (const MimeEntity& me, string& plaintext) if (subtype== "html") { // Get the html text of the message. - stringstream ss; + std::stringstream ss; ss << me; std::string html = ss.str (); // Remove headers. @@ -143,19 +143,19 @@ void filter_mail_dissect_internal (const MimeEntity& me, string& plaintext) // Dissects an email $message. // It extracts the $from address, the $subject, and the plain text body. -void filter_mail_dissect (string message, string & from, string & subject, string & plaintext) +void filter_mail_dissect (std::string message, std::string & from, std::string & subject, std::string & plaintext) { // Load the email message into the mimetic library. MimeEntity me; me.load (message.begin(), message.end(), 0); // Get the sender's address. - stringstream fromstream; + std::stringstream fromstream; fromstream << me.header().from(); from = fromstream.str (); // Get the subject. - stringstream subjectstream; + std::stringstream subjectstream; subjectstream << me.header().subject(); subject = subjectstream.str (); diff --git a/filter/merge.cpp b/filter/merge.cpp index 8a9797704..42ef1dad9 100644 --- a/filter/merge.cpp +++ b/filter/merge.cpp @@ -81,7 +81,7 @@ vector filter_merge_merge (const std::vector & base, } -string filter_merge_lines2words (string data) +string filter_merge_lines2words (std::string data) { data = filter::strings::replace ("\n", " new__line ", data); data = filter::strings::replace (" ", "\n", data); @@ -89,7 +89,7 @@ string filter_merge_lines2words (string data) } -string filter_merge_words2lines (string data) +string filter_merge_words2lines (std::string data) { data = filter::strings::replace ("\n", " ", data); data = filter::strings::replace (" new__line ", "\n", data); @@ -97,7 +97,7 @@ string filter_merge_words2lines (string data) } -string filter_merge_lines2graphemes (string data) +string filter_merge_lines2graphemes (std::string data) { data = filter::strings::replace ("\n", " new__line ", data); std::string data2; @@ -111,7 +111,7 @@ string filter_merge_lines2graphemes (string data) } -string filter_merge_graphemes2lines (string data) +string filter_merge_graphemes2lines (std::string data) { data = filter::strings::replace ("\n", "", data); data = filter::strings::replace (" new__line ", "\n", data); @@ -119,7 +119,7 @@ string filter_merge_graphemes2lines (string data) } -void filter_merge_detect_conflict (string base, +void filter_merge_detect_conflict (std::string base, std::string change, std::string prioritized_change, std::string result, @@ -191,7 +191,7 @@ void filter_merge_detect_conflict (string base, // In case of a conflict, it prioritizes changes from $prioritized_change. // The filter returns the merged data. // If $clever, it calls a more clever routine when it fails to merge. -string filter_merge_run (string base, string change, string prioritized_change, +string filter_merge_run (std::string base, std::string change, std::string prioritized_change, bool clever, std::vector & conflicts) { @@ -263,7 +263,7 @@ string filter_merge_run (string base, string change, string prioritized_change, // $change: Data as modified by one user. // $prioritized_change: Data as modified by a user but prioritized. // The filter uses a three-way merge algorithm. -string filter_merge_run_clever (string base, string change, string prioritized_change, +string filter_merge_run_clever (std::string base, std::string change, std::string prioritized_change, std::vector & conflicts) { // Get the verse numbers in the changed text. diff --git a/filter/note.cpp b/filter/note.cpp index 10aca4064..1200f061c 100644 --- a/filter/note.cpp +++ b/filter/note.cpp @@ -58,7 +58,7 @@ void citation::set_restart (int setting) else this->restart = "chapter"; } -string citation::get (string citation_in) +string citation::get (std::string citation_in) { // Handle USFM automatic note citation. if (citation_in == "+") { diff --git a/filter/passage.cpp b/filter/passage.cpp index 9dfcece82..86d0898b6 100644 --- a/filter/passage.cpp +++ b/filter/passage.cpp @@ -47,7 +47,7 @@ Passage::Passage () } -Passage::Passage (string bible, int book, int chapter, string verse) +Passage::Passage (std::string bible, int book, int chapter, std::string verse) { m_bible = bible; m_book = book; @@ -115,7 +115,7 @@ Passage Passage::decode (const std::string& encoded) } -string filter_passage_display (int book, int chapter, string verse) +string filter_passage_display (int book, int chapter, std::string verse) { std::string display; display.append (translate (database::books::get_english_from_id (static_cast(book)).c_str())); @@ -174,7 +174,7 @@ Passage filter_integer_to_passage (int integer) // and looks whether it can be interpreted as a valid book in any way. // It returns a valid book identifier, // or the unknown enum in case no book could be interpreted. -book_id filter_passage_interpret_book_v2 (string book) +book_id filter_passage_interpret_book_v2 (std::string book) { book = filter::strings::trim (book); @@ -283,7 +283,7 @@ book_id filter_passage_interpret_book_v2 (string book) } -string filter_passage_clean_passage (string text) +string filter_passage_clean_passage (std::string text) { // Trim text. text = filter::strings::trim (text); @@ -303,7 +303,7 @@ string filter_passage_clean_passage (string text) // Takes the passage in $text, and explodes it into book, chapter, verse. // The book is the numerical identifier, not the string, e.g., // it would not return "Genesis", but identifier 1. -Passage filter_passage_explode_passage (string text) +Passage filter_passage_explode_passage (std::string text) { text = filter_passage_clean_passage (text); // Cut the text in its parts. @@ -340,7 +340,7 @@ Passage filter_passage_explode_passage (string text) // - Book and two numbers given, e.g. "Song of Solomon 2 3". // It deals with these situations. // If needed, it bases the interpreted passage on $currentPassage. -Passage filter_passage_interpret_passage (Passage currentPassage, string rawPassage) +Passage filter_passage_interpret_passage (Passage currentPassage, std::string rawPassage) { rawPassage = filter_passage_clean_passage (rawPassage); @@ -353,7 +353,7 @@ Passage filter_passage_interpret_passage (Passage currentPassage, string rawPass std::string book = ""; std::vector invertedInput (input.begin(), input.end ()); reverse (invertedInput.begin (), invertedInput.end()); - for (string & bit : invertedInput) { + for (std::string & bit : invertedInput) { int integer = filter::strings::convert_to_int (bit); if (bit == filter::strings::convert_to_string (integer)) { numerals.push_back (integer); @@ -417,7 +417,7 @@ vector filter_passage_handle_sequences_ranges (const std::string& // 27-28 // It implies that the first sequence has book and chapter. std::vector sequences = filter::strings::explode (passage, ','); - for (string & line : sequences) line = filter::strings::trim (line); + for (std::string & line : sequences) line = filter::strings::trim (line); // Store output lines. @@ -451,7 +451,7 @@ vector filter_passage_handle_sequences_ranges (const std::string& } -string filter_passage_link_for_opening_editor_at (int book, int chapter, string verse) +string filter_passage_link_for_opening_editor_at (int book, int chapter, std::string verse) { std::string display = filter_passage_display (book, chapter, verse); Passage passage = Passage ("", book, chapter, verse); @@ -464,7 +464,7 @@ string filter_passage_link_for_opening_editor_at (int book, int chapter, string a_node.text().set(display.c_str()); pugi::xml_node span_node = document.append_child("span"); span_node.text().set(" "); - stringstream output; + std::stringstream output; document.print (output, "", pugi::format_raw); std::string link = output.str (); return link; @@ -486,7 +486,7 @@ vector filter_passage_get_ordered_books (const std::string& bible) // Keep books available in the Bible. std::vector orderedbooks; - for (string & book : vs_orderedbooks) { + for (std::string & book : vs_orderedbooks) { int bk = filter::strings::convert_to_int (book); if (find (projectbooks.begin(), projectbooks.end(), bk) != projectbooks.end()) { orderedbooks.push_back (bk); diff --git a/filter/shell.cpp b/filter/shell.cpp index 395adbb6f..17101533f 100644 --- a/filter/shell.cpp +++ b/filter/shell.cpp @@ -32,10 +32,10 @@ using namespace std; // Internal declarations. -string filter_shell_escape_argument (string argument); +string filter_shell_escape_argument (std::string argument); -string filter_shell_escape_argument (string argument) +string filter_shell_escape_argument (std::string argument) { argument = filter::strings::replace ("'", "\\'", argument); argument.insert (0, "'"); @@ -62,7 +62,7 @@ int filter_shell_run ([[maybe_unused]] string directory, directory = filter_shell_escape_argument (directory); command.insert (0, "cd " + directory + "; "); } - for (string parameter : parameters) { + for (std::string parameter : parameters) { parameter = filter_shell_escape_argument (parameter); command.append (" " + parameter); } @@ -93,7 +93,7 @@ int filter_shell_run ([[maybe_unused]] string directory, // Runs $command with $parameters. // It does not run $command through the shell, but executes it straight. -int filter_shell_run (string command, +int filter_shell_run (std::string command, [[maybe_unused]] const char * parameter, [[maybe_unused]] string & output) { @@ -138,7 +138,7 @@ int filter_shell_run (string command, // Does not escape anything in the $command. // Returns the exit code of the process. // The output of the process, both stdout and stderr, go into $out_err. -int filter_shell_run (string command, string & out_err) +int filter_shell_run (std::string command, std::string & out_err) { #ifdef HAVE_IOS return 0; @@ -153,7 +153,7 @@ int filter_shell_run (string command, string & out_err) // Returns true if $program is present on the system. -bool filter_shell_is_present (string program) +bool filter_shell_is_present (std::string program) { // This crashes on iOS, so skip it. #ifdef HAVE_IOS diff --git a/filter/string.cpp b/filter/string.cpp index 48101c806..d0cc2bb7c 100644 --- a/filter/string.cpp +++ b/filter/string.cpp @@ -1748,7 +1748,7 @@ std::string html_get_element (std::string html, std::string element) /* - string filter_string_tidy_invalid_html_leaking (string html) + string filter_string_tidy_invalid_html_leaking (std::string html) { // Everything in the can be left out: It is not relevant. filter::strings::replace_between (html, "", "", ""); diff --git a/filter/text.cpp b/filter/text.cpp index d85216ef2..86c2591ce 100644 --- a/filter/text.cpp +++ b/filter/text.cpp @@ -32,7 +32,7 @@ using namespace std; namespace filter::text { -passage_marker_value::passage_marker_value (int book, int chapter, string verse, string marker, string value) +passage_marker_value::passage_marker_value (int book, int chapter, std::string verse, std::string marker, std::string value) { m_book = book; m_chapter = chapter; @@ -47,7 +47,7 @@ passage_marker_value::passage_marker_value (int book, int chapter, string verse, // This class filters USFM text, converting it into other formats. -Filter_Text::Filter_Text (string bible) +Filter_Text::Filter_Text (std::string bible) { m_bible = bible; space_type_after_verse = Database_Config_Bible::getOdtSpaceAfterVerse (m_bible); @@ -74,7 +74,7 @@ Filter_Text::~Filter_Text () // This function adds USFM code to the class. // $code: USFM code. -void Filter_Text::add_usfm_code (string usfm) +void Filter_Text::add_usfm_code (std::string usfm) { // Check that the USFM is valid UTF-8. if (!filter::strings::unicode_string_is_valid (usfm)) { @@ -93,7 +93,7 @@ void Filter_Text::add_usfm_code (string usfm) // This function runs the filter. // $stylesheet - The stylesheet to use. -void Filter_Text::run (string stylesheet) +void Filter_Text::run (std::string stylesheet) { // Get the styles. get_styles (stylesheet); @@ -165,7 +165,7 @@ void Filter_Text::get_usfm_next_chapter () // This function gets the styles from the database, // and stores them in the object for quicker access. -void Filter_Text::get_styles (string stylesheet) +void Filter_Text::get_styles (std::string stylesheet) { styles.clear(); // Get the relevant styles information included. @@ -1381,7 +1381,7 @@ void Filter_Text::processNote () // This creates and saves the information document. // It contains formatting information, collected from the USFM code. // $path: Path to the document. -void Filter_Text::produceInfoDocument (string path) +void Filter_Text::produceInfoDocument (std::string path) { HtmlText information (translate("Information")); @@ -1484,7 +1484,7 @@ string Filter_Text::getCurrentPassageText () // $text: String to add to the Info array. // $next: If true, it also adds the text following the marker to the info, // and removes this text from the USFM input stream. -void Filter_Text::addToInfo (string text, bool next) +void Filter_Text::addToInfo (std::string text, bool next) { text = getCurrentPassageText() + " " + text; if (next) { @@ -1499,7 +1499,7 @@ void Filter_Text::addToInfo (string text, bool next) // $text: String to add to the Fallout array. // $next: If true, it also adds the text following the marker to the fallout, // and removes this text from the USFM input stream. -void Filter_Text::addToFallout (string text, bool next) +void Filter_Text::addToFallout (std::string text, bool next) { text = getCurrentPassageText () + " " + text; if (next) { @@ -1527,11 +1527,11 @@ void Filter_Text::addToWordList (vector & list) // This produces and saves the Fallout document. // $path: Path to the document. -void Filter_Text::produceFalloutDocument (string path) +void Filter_Text::produceFalloutDocument (std::string path) { HtmlText html_text (translate("Fallout")); html_text.new_heading1 (translate("Fallout")); - for (string line : fallout) { + for (std::string line : fallout) { html_text.new_paragraph (); html_text.add_text (line); } @@ -1629,7 +1629,7 @@ void Filter_Text::applyDropCapsToCurrentParagraph (int dropCapsLength) // This puts the chapter number in a frame in the current paragraph. // This is to put the chapter number in a frame so it looks like drop caps in the OpenDocument. // $chapterText: The text of the chapter indicator to put. -void Filter_Text::putChapterNumberInFrame (string chapterText) +void Filter_Text::putChapterNumberInFrame (std::string chapterText) { Database_Styles_Item style = styles[chapterMarker]; if (odf_text_standard) odf_text_standard->place_text_in_frame (chapterText, this->chapterMarker, style.fontsize, style.italic, style.bold); @@ -1668,7 +1668,7 @@ string Filter_Text::getNoteCitation (const Database_Styles_Item & style) // This function ensures that a certain paragraph style for a note is present in the OpenDocument. // $marker: Which note, e.g. 'f' or 'x' or 'fe'. // $style: The style to use. -void Filter_Text::ensureNoteParagraphStyle (string marker, const Database_Styles_Item & style) +void Filter_Text::ensureNoteParagraphStyle (std::string marker, const Database_Styles_Item & style) { if (find (createdStyles.begin(), createdStyles.end(), marker) == createdStyles.end()) { std::string fontname = Database_Config_Bible::getExportFont (m_bible); diff --git a/filter/url.cpp b/filter/url.cpp index 76f101b4f..1ecc3313b 100644 --- a/filter/url.cpp +++ b/filter/url.cpp @@ -52,9 +52,9 @@ using namespace std; // Internal function declarations. -vector filter_url_scandir_internal (string folder); -string filter_url_dirname_internal (string url, const char * separator); -string filter_url_basename_internal (string url, const char * separator); +vector filter_url_scandir_internal (std::string folder); +string filter_url_dirname_internal (std::string url, const char * separator); +string filter_url_basename_internal (std::string url, const char * separator); size_t filter_url_curl_write_function (void *ptr, size_t size, size_t count, void *stream); void filter_url_curl_debug_dump (const char *text, FILE *stream, unsigned char *ptr, size_t size); #ifdef HAVE_CLOUD @@ -68,7 +68,7 @@ mbedtls_ctr_drbg_context filter_url_mbed_tls_ctr_drbg; mbedtls_x509_crt filter_url_mbed_tls_cacert; -vector filter_url_scandir_internal (string folder) +vector filter_url_scandir_internal (std::string folder) { std::vector files; @@ -144,7 +144,7 @@ string get_base_url (Webserver_Request& webserver_request) // This function redirects the browser to "path". // "path" is an absolute value. -void redirect_browser (Webserver_Request& webserver_request, string path) +void redirect_browser (Webserver_Request& webserver_request, std::string path) { // A location header should contain an absolute url, like http://localhost/some/path. // See 14.30 in the specification https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html. @@ -181,7 +181,7 @@ void redirect_browser (Webserver_Request& webserver_request, string path) // C++ replacement for the dirname function, see http://linux.die.net/man/3/dirname. // The BSD dirname is not thread-safe, see the implementation notes on $ man 3 dirname. -string filter_url_dirname_internal (string url, const char * separator) +string filter_url_dirname_internal (std::string url, const char * separator) { if (!url.empty ()) { if (url.find_last_of (separator) == url.length () - 1) { @@ -199,7 +199,7 @@ string filter_url_dirname_internal (string url, const char * separator) // Dirname routine for the operating system. // It uses the defined slash as the separator. -string filter_url_dirname (string url) +string filter_url_dirname (std::string url) { return filter_url_dirname_internal (url, DIRECTORY_SEPARATOR); } @@ -208,7 +208,7 @@ string filter_url_dirname (string url) // Dirname routine for the filesystem. // It uses the automatically defined separator as the directory separator. // As of February 2022 the std::filesystem does not yet work on Android. -//string filter_url_dirname (string url) +//string filter_url_dirname (std::string url) //{ // // Remove possible trailing path slash. // if (!url.empty ()) { @@ -228,7 +228,7 @@ string filter_url_dirname (string url) // Dirname routine for the web. // It uses the forward slash as the separator. -string filter_url_dirname_web (string url) +string filter_url_dirname_web (std::string url) { const char * separator = "/"; if (!url.empty ()) { @@ -248,7 +248,7 @@ string filter_url_dirname_web (string url) // C++ replacement for the basename function, see http://linux.die.net/man/3/basename. // The BSD basename is not thread-safe, see the warnings in $ man 3 basename. -string filter_url_basename_internal (string url, const char * separator) +string filter_url_basename_internal (std::string url, const char * separator) { if (!url.empty ()) { if (url.find_last_of (separator) == url.length () - 1) { @@ -264,7 +264,7 @@ string filter_url_basename_internal (string url, const char * separator) // Basename routine for the operating system. // It uses the defined slash as the separator. -string filter_url_basename (string url) +string filter_url_basename (std::string url) { return filter_url_basename_internal (url, DIRECTORY_SEPARATOR); } @@ -273,7 +273,7 @@ string filter_url_basename (string url) // Basename routine for the filesystem. // It uses the automatically defined separator as the directory separator. // As of February 2022 the std::filesystem does not yet work on Android. -//string filter_url_basename (string url) +//string filter_url_basename (std::string url) //{ // // Remove possible trailing path slash. // if (!url.empty ()) { @@ -291,7 +291,7 @@ string filter_url_basename (string url) // Basename routine for the web. // It uses the forward slash as the separator. -string filter_url_basename_web (string url) +string filter_url_basename_web (std::string url) { if (!url.empty ()) { // Remove trailing slash. @@ -308,7 +308,7 @@ string filter_url_basename_web (string url) } -void filter_url_unlink (string filename) +void filter_url_unlink (std::string filename) { #ifdef HAVE_WINDOWS wstring wfilename = filter::strings::string2wstring (filename); @@ -320,7 +320,7 @@ void filter_url_unlink (string filename) // As of February 2022 the std::filesystem does not yet work on Android. -//void filter_url_unlink (string filename) +//void filter_url_unlink (std::string filename) //{ // try { // filesystem::path path (filename); @@ -439,7 +439,7 @@ string filter_url_create_root_path (const std::vector & parts) // Gets the file / url extension, e.g. /home/joe/file.txt returns "txt". -string filter_url_get_extension (string url) +string filter_url_get_extension (std::string url) { std::string extension; size_t pos = url.find_last_of ("."); @@ -452,7 +452,7 @@ string filter_url_get_extension (string url) // Gets the file / url extension, e.g. /home/joe/file.txt returns "txt". // As of February 2022 the std::filesystem does not yet work on Android. -//string filter_url_get_extension (string url) +//string filter_url_get_extension (std::string url) //{ // std::filesystem::path path (url); // std::string extension; @@ -467,7 +467,7 @@ string filter_url_get_extension (string url) // Returns true if the file at $url exists. -bool file_or_dir_exists (string url) +bool file_or_dir_exists (std::string url) { #ifdef HAVE_WINDOWS // Function '_wstat' works with wide characters. @@ -485,7 +485,7 @@ bool file_or_dir_exists (string url) // Returns true if the file or directory at $url exists. // As of February 2022 the std::filesystem does not yet work on Android. -//bool file_or_dir_exists (string url) +//bool file_or_dir_exists (std::string url) //{ // filesystem::path path (url); // bool exists = filesystem::exists (path); @@ -495,7 +495,7 @@ bool file_or_dir_exists (string url) // Makes a directory. // Creates parents where needed. -void filter_url_mkdir (string directory) +void filter_url_mkdir (std::string directory) { int status; #ifdef HAVE_WINDOWS @@ -528,7 +528,7 @@ void filter_url_mkdir (string directory) // Makes a directory. // Creates parents where needed. // As of February 2022 the std::filesystem does not yet work on Android. -//void filter_url_mkdir (string directory) +//void filter_url_mkdir (std::string directory) //{ // try { // std::filesystem::path path (directory); @@ -538,7 +538,7 @@ void filter_url_mkdir (string directory) // Removes directory recursively. -void filter_url_rmdir (string directory) +void filter_url_rmdir (std::string directory) { std::vector files = filter_url_scandir_internal (directory); for (auto path : files) { @@ -569,7 +569,7 @@ void filter_url_rmdir (string directory) // Removes directory recursively. // As of February 2022 the std::filesystem does not yet work on Android. -//void filter_url_rmdir (string directory) +//void filter_url_rmdir (std::string directory) //{ // try { // filesystem::path path (directory); @@ -579,7 +579,7 @@ void filter_url_rmdir (string directory) // Returns true is $path points to a directory. -bool filter_url_is_dir (string path) +bool filter_url_is_dir (std::string path) { #ifdef HAVE_WINDOWS // Function '_wstat', on Windows, works with wide characters. @@ -596,7 +596,7 @@ bool filter_url_is_dir (string path) // Returns true is $path points to a directory. // As of February 2022 the std::filesystem does not yet work on Android. -//bool filter_url_is_dir (string path) +//bool filter_url_is_dir (std::string path) //{ // bool is_dir = false; // try { @@ -607,7 +607,7 @@ bool filter_url_is_dir (string path) //} -bool filter_url_get_write_permission (string path) +bool filter_url_get_write_permission (std::string path) { #ifdef HAVE_WINDOWS wstring wpath = filter::strings::string2wstring (path); @@ -619,7 +619,7 @@ bool filter_url_get_write_permission (string path) } -void filter_url_set_write_permission (string path) +void filter_url_set_write_permission (std::string path) { #ifdef HAVE_WINDOWS wstring wpath = filter::strings::string2wstring (path); @@ -631,7 +631,7 @@ void filter_url_set_write_permission (string path) // As of February 2022 the std::filesystem does not yet work on Android. -//void filter_url_set_write_permission (string path) +//void filter_url_set_write_permission (std::string path) //{ // filesystem::path p (path); // filesystem::permissions(p, filesystem::perms::owner_all | filesystem::perms::group_all | filesystem::perms::others_all); @@ -639,7 +639,7 @@ void filter_url_set_write_permission (string path) // Get and returns the contents of $filename. -string filter_url_file_get_contents(string filename) +string filter_url_file_get_contents(std::string filename) { if (!file_or_dir_exists (filename)) return std::string(); try { @@ -663,7 +663,7 @@ string filter_url_file_get_contents(string filename) // Puts the $contents into $filename. -void filter_url_file_put_contents (string filename, string contents) +void filter_url_file_put_contents (std::string filename, std::string contents) { try { ofstream file; @@ -682,7 +682,7 @@ void filter_url_file_put_contents (string filename, string contents) // C++ rough equivalent for PHP's file_put_contents. // Appends the data if the file exists. -void filter_url_file_put_contents_append (string filename, string contents) +void filter_url_file_put_contents_append (std::string filename, std::string contents) { try { ofstream file; @@ -701,7 +701,7 @@ void filter_url_file_put_contents_append (string filename, string contents) // Copies the contents of file named "input" to file named "output". // It is assumed that the folder where "output" will reside exists. -bool filter_url_file_cp (string input, string output) +bool filter_url_file_cp (std::string input, std::string output) { try { #ifdef HAVE_WINDOWS @@ -746,7 +746,7 @@ void filter_url_dir_cp (const std::string& input, const std::string& output) // A C++ equivalent for PHP's filesize function. -int filter_url_filesize (string filename) +int filter_url_filesize (std::string filename) { #ifdef HAVE_WINDOWS wstring wfilename = filter::strings::string2wstring (filename); @@ -762,7 +762,7 @@ int filter_url_filesize (string filename) // Returns the size of the file at $filename. // As of February 2022 the std::filesystem does not yet work on Android. -//int filter_url_filesize (string filename) +//int filter_url_filesize (std::string filename) //{ // uintmax_t filesize = 0; // try { @@ -774,7 +774,7 @@ int filter_url_filesize (string filename) // Scans the directory for files it contains. -vector filter_url_scandir (string folder) +vector filter_url_scandir (std::string folder) { std::vector files = filter_url_scandir_internal (folder); files = filter::strings::array_diff (files, {"gitflag"}); @@ -784,7 +784,7 @@ vector filter_url_scandir (string folder) // Scans the directory for files it contains. // As of February 2022 the std::filesystem does not yet work on Android. -//vector filter_url_scandir (string folder) +//vector filter_url_scandir (std::string folder) //{ // std::vector files; // try { @@ -814,7 +814,7 @@ vector filter_url_scandir (string folder) // Recursively scans a directory for directories and files. -void filter_url_recursive_scandir (string folder, std::vector & paths) +void filter_url_recursive_scandir (std::string folder, std::vector & paths) { std::vector files = filter_url_scandir (folder); for (auto & file : files) { @@ -828,7 +828,7 @@ void filter_url_recursive_scandir (string folder, std::vector & pa // Gets the file modification time. -int filter_url_file_modification_time (string filename) +int filter_url_file_modification_time (std::string filename) { #ifdef HAVE_WINDOWS wstring wfilename = filter::strings::string2wstring (filename); @@ -843,7 +843,7 @@ int filter_url_file_modification_time (string filename) // A C++ near equivalent for PHP's urldecode function. -string filter_url_urldecode (string url) +string filter_url_urldecode (std::string url) { url = UriDecode (url); replace (url.begin (), url.end (), '+', ' '); @@ -852,7 +852,7 @@ string filter_url_urldecode (string url) // A C++ near equivalent for PHP's urlencode function. -string filter_url_urlencode (string url) +string filter_url_urlencode (std::string url) { url = UriEncode (url); return url; @@ -880,7 +880,7 @@ string filter_url_tempfile (const char * directory) // C++ equivalent for PHP's escapeshellarg function. -string filter_url_escape_shell_argument (string argument) +string filter_url_escape_shell_argument (std::string argument) { argument = filter::strings::replace ("'", "\\'", argument); argument.insert (0, "'"); @@ -892,7 +892,7 @@ string filter_url_escape_shell_argument (string argument) // The function accepts a $path. // The function may add a numerical suffix // to ensure that the $path does not yet exist in the filesystem. -string filter_url_unique_path (string path) +string filter_url_unique_path (std::string path) { if (!file_or_dir_exists (path)) return path; for (size_t i = 1; i < 100; i++) { @@ -904,7 +904,7 @@ string filter_url_unique_path (string path) // Returns true if the email address is valid. -bool filter_url_email_is_valid (string email) +bool filter_url_email_is_valid (std::string email) { const std::string valid_set ("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-"); // The @ character should appear only once. @@ -930,7 +930,7 @@ bool filter_url_email_is_valid (string email) } -string filter_url_build_http_query (string url, const std::string& parameter, const std::string& value) +string filter_url_build_http_query (std::string url, const std::string& parameter, const std::string& value) { size_t pos = url.find ("?"); if (pos == std::string::npos) url.append ("?"); @@ -952,7 +952,7 @@ size_t filter_url_curl_write_function (void *ptr, size_t size, size_t count, voi // Sends a http GET request to the $url. // It returns the response from the server. // It writes any error to $error. -string filter_url_http_get (string url, string& error, [[maybe_unused]] bool check_certificate) +string filter_url_http_get (std::string url, std::string& error, [[maybe_unused]] bool check_certificate) { std::string response; #ifdef HAVE_CLIENT @@ -1066,7 +1066,7 @@ int filter_url_curl_trace (CURL *handle, curl_infotype type, char *data, size_t // It appends the $values to the post data. // It returns the response from the server. // It writes any error to $error. -string filter_url_http_post (const std::string& url, [[maybe_unused]] string post_data, const std::map & post_values, string& error, [[maybe_unused]] bool burst, [[maybe_unused]] bool check_certificate, [[maybe_unused]] const std::vector > & headers) +string filter_url_http_post (const std::string& url, [[maybe_unused]] string post_data, const std::map & post_values, std::string& error, [[maybe_unused]] bool burst, [[maybe_unused]] bool check_certificate, [[maybe_unused]] const std::vector > & headers) { std::string response; #ifdef HAVE_CLIENT @@ -1141,7 +1141,7 @@ string filter_url_http_post (const std::string& url, [[maybe_unused]] string pos string filter_url_http_upload ([[maybe_unused]] string url, [[maybe_unused]] std::map values, [[maybe_unused]] string filename, - string& error) + std::string& error) { std::string response; @@ -1264,7 +1264,7 @@ string filter_url_http_response_code_text (int code) // Downloads the file at $url, and stores it at $filename. -void filter_url_download_file (string url, string filename, string& error, +void filter_url_download_file (std::string url, std::string filename, std::string& error, [[maybe_unused]] bool check_certificate) { #ifdef HAVE_CLIENT @@ -1302,7 +1302,7 @@ void filter_url_download_file (string url, string filename, string& error, * $book - The book identifier. * $chapter - The chapter number. */ -string filter_url_html_file_name_bible (string path, int book, int chapter) +string filter_url_html_file_name_bible (std::string path, int book, int chapter) { std::string filename; @@ -1389,7 +1389,7 @@ void filter_url_curl_set_timeout (void *curl_handle, bool burst) // When the client POSTs + sign to the server, // the + sign is replaced with a space in the process. // Therefore first convert the + to a TAG before sending it off. -string filter_url_plus_to_tag (string data) +string filter_url_plus_to_tag (std::string data) { return filter::strings::replace ("+", "PLUSSIGN", data); } @@ -1399,14 +1399,14 @@ string filter_url_plus_to_tag (string data) // the + sign is replaced with a space in the process. // Javascript first converts the + to a TAG before sending it off. // This function reverts the TAG to the original + sign. -string filter_url_tag_to_plus (string data) +string filter_url_tag_to_plus (std::string data) { return filter::strings::replace ("PLUSSIGN", "+", data); } // This filter removes the username and password components from the $url. -string filter_url_remove_username_password (string url) +string filter_url_remove_username_password (std::string url) { std::string slashes = "//"; size_t pos = url.find (slashes); @@ -1431,7 +1431,7 @@ string filter_url_remove_username_password (string url) // $post: Value pairs for a POST request. // $filename: The filename to save the data to. // $check_certificate: Whether to check the server certificate in case of secure http. -string filter_url_http_request_mbed (string url, string& error, const std::map & post, const std::string& filename, bool check_certificate) +string filter_url_http_request_mbed (std::string url, std::string& error, const std::map & post, const std::string& filename, bool check_certificate) { // The "http" scheme is used to locate network resources via the HTTP protocol. // $url = "http(s):" "//" host [ ":" port ] [ abs_path [ "?" query ]] @@ -1951,7 +1951,7 @@ void filter_url_display_mbed_tls_error (int& ret, string* error, bool server, co // This takes $url, removes any scheme (http / https) it has, // then sets the correct scheme based on $secure, // and returns the URL, e.g. as http://localhost or https://localhost. -string filter_url_set_scheme (string url, bool secure) +string filter_url_set_scheme (std::string url, bool secure) { // Remove whitespace. url = filter::strings::trim (url); @@ -1972,7 +1972,7 @@ string filter_url_set_scheme (string url, bool secure) // Replace invalid characters in Windows filenames with valid abbreviations. -string filter_url_clean_filename (string name) +string filter_url_clean_filename (std::string name) { name = filter::strings::replace ("\\", "b2", name); name = filter::strings::replace ("/", "sl", name); @@ -1990,7 +1990,7 @@ string filter_url_clean_filename (string name) // Replace invalid characters in Windows filenames with valid abbreviations. // In contrast with the above function, the $name in this function can be "uncleaned" again. // The next function does the "unclean" operation, to get the original $name back. -string filter_url_filename_clean (string name) +string filter_url_filename_clean (std::string name) { name = filter::strings::replace ("\\", "___b2___", name); name = filter::strings::replace ("/", "___sl___", name); @@ -2006,7 +2006,7 @@ string filter_url_filename_clean (string name) // Take $name, and undo the "clean" function in the above. -string filter_url_filename_unclean (string name) +string filter_url_filename_unclean (std::string name) { name = filter::strings::replace ("___b2___", "\\", name); name = filter::strings::replace ("___sl___", "/", name); @@ -2023,7 +2023,7 @@ string filter_url_filename_unclean (string name) // Changes a Unix directory separator to a Windows one. // Works on Windows only. -string filter_url_update_directory_separator_if_windows (string filename) +string filter_url_update_directory_separator_if_windows (std::string filename) { #ifdef HAVE_WINDOWS filename = filter::strings::replace ("/", DIRECTORY_SEPARATOR, filename); @@ -2033,7 +2033,7 @@ string filter_url_update_directory_separator_if_windows (string filename) // Returns true if it is possible to connect to port $port on $hostname. -bool filter_url_port_can_connect (string hostname, int port) +bool filter_url_port_can_connect (std::string hostname, int port) { // Resolve the host. addrinfo hints; @@ -2084,7 +2084,7 @@ bool filter_url_port_can_connect (string hostname, int port) } -bool filter_url_is_image (string extension) +bool filter_url_is_image (std::string extension) { if (extension == "png") return true; @@ -2103,7 +2103,7 @@ bool filter_url_is_image (string extension) // https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types // See also: // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types -string filter_url_get_mime_type (string extension) +string filter_url_get_mime_type (std::string extension) { static std::map mime_types = { {"jar", "application/java-archive"}, @@ -2145,7 +2145,7 @@ string filter_url_get_mime_type (string extension) // - bibledit.org // - 8080 // If any of these three parts is not found, then the part is left empty, or the port remains 0. -void filter_url_get_scheme_host_port (string url, string & scheme, string & host, int & port) +void filter_url_get_scheme_host_port (std::string url, std::string & scheme, std::string & host, int & port) { // Clear the values that are going to be detected. scheme.clear(); diff --git a/filter/usfm.cpp b/filter/usfm.cpp index e4433d44f..26adb0c8b 100644 --- a/filter/usfm.cpp +++ b/filter/usfm.cpp @@ -47,7 +47,7 @@ using namespace std; namespace filter::usfm { -BookChapterData::BookChapterData (int book, int chapter, string data) +BookChapterData::BookChapterData (int book, int chapter, std::string data) { m_book = book; m_chapter = chapter; @@ -57,11 +57,11 @@ BookChapterData::BookChapterData (int book, int chapter, string data) // Returns the string $usfm as one long string. // $usfm may contain new lines, but the resulting long string won't. -string one_string (string usfm) +string one_string (std::string usfm) { std::string long_string = ""; std::vector usfm_lines = filter::strings::explode (usfm, '\n'); - for (string & line : usfm_lines) { + for (std::string & line : usfm_lines) { line = filter::strings::trim (line); // Skip empty line. if (line != "") { @@ -84,7 +84,7 @@ string one_string (string usfm) // ... // Output would be: array ("\id ", "GEN", "\c ", "10", ...) // If $code does not start with a marker, this becomes visible in the output too. -vector get_markers_and_text (string code) +vector get_markers_and_text (std::string code) { std::vector markers_and_text; code = filter::strings::replace ("\n\\", "\\", code); // New line followed by backslash: leave new line out. @@ -133,7 +133,7 @@ vector get_markers_and_text (string code) // "\id " -> "id" // "\add*" -> "add" // "\+add*" -> "add" -string get_marker (string usfm) +string get_marker (std::string usfm) { if (usfm.empty ()) return usfm; size_t pos = usfm.find ("\\"); @@ -171,7 +171,7 @@ string get_marker (string usfm) // This imports USFM $input. // It takes raw $input, // and returns a vector with objects with book_number, chapter_number, chapter_data. -vector usfm_import (string input, string stylesheet) +vector usfm_import (std::string input, std::string stylesheet) { std::vector result; @@ -184,7 +184,7 @@ vector usfm_import (string input, string stylesheet) bool retrieve_book_number_on_next_iteration = false; bool retrieve_chapter_number_on_next_iteration = false; - for (string marker_or_text : markers_and_text) { + for (std::string marker_or_text : markers_and_text) { if (retrieve_book_number_on_next_iteration) { bookid = database::books::get_id_from_usfm (marker_or_text.substr (0, 3)); chapter_number = 0; @@ -242,12 +242,12 @@ vector usfm_import (string input, string stylesheet) // 10-12b // 10,11a // 10,12 -vector get_verse_numbers (string usfm) +vector get_verse_numbers (std::string usfm) { std::vector verse_numbers = { 0 }; std::vector markers_and_text = get_markers_and_text (usfm); bool extract_verse = false; - for (string marker_or_text : markers_and_text) { + for (std::string marker_or_text : markers_and_text) { if (extract_verse) { std::string verse = peek_verse_number (marker_or_text); // Range of verses. @@ -268,12 +268,12 @@ vector get_verse_numbers (string usfm) // Returns the chapter numbers found in $usfm. -vector get_chapter_numbers (string usfm) +vector get_chapter_numbers (std::string usfm) { std::vector chapter_numbers = { 0 }; std::vector markers_and_text = get_markers_and_text (usfm); bool extract_chapter = false; - for (string marker_or_text : markers_and_text) { + for (std::string marker_or_text : markers_and_text) { if (extract_chapter) { std::string chapter = peek_verse_number (marker_or_text); chapter_numbers.push_back (filter::strings::convert_to_int (chapter)); @@ -288,7 +288,7 @@ vector get_chapter_numbers (string usfm) // Returns the verse numbers in the string of $usfm code at line number $line_number. -vector linenumber_to_versenumber (string usfm, unsigned int line_number) +vector linenumber_to_versenumber (std::string usfm, unsigned int line_number) { std::vector verse_number = {0}; // Initial verse number. std::vector lines = filter::strings::explode (usfm, '\n'); @@ -306,7 +306,7 @@ vector linenumber_to_versenumber (string usfm, unsigned int line_number) // Returns the verse numbers in the string of $usfm code at offset $offset. // Offset is calculated with filter::strings::unicode_string_length to support UTF-8. -vector offset_to_versenumber (string usfm, unsigned int offset) +vector offset_to_versenumber (std::string usfm, unsigned int offset) { size_t totalOffset = 0; std::vector lines = filter::strings::explode (usfm, '\n'); @@ -325,13 +325,13 @@ vector offset_to_versenumber (string usfm, unsigned int offset) // Returns the offset within the $usfm code where $verse number starts. -int versenumber_to_offset (string usfm, int verse) +int versenumber_to_offset (std::string usfm, int verse) { // Verse number 0 starts at offset 0. if (verse == 0) return 0; int totalOffset = 0; std::vector lines = filter::strings::explode (usfm, '\n'); - for (string line : lines) { + for (std::string line : lines) { std::vector verses = get_verse_numbers (line); for (auto & v : verses) { if (v == verse) return totalOffset; @@ -346,13 +346,13 @@ int versenumber_to_offset (string usfm, int verse) // Returns the verse text given a $verse_number and $usfm code. // Handles combined verses. -string get_verse_text (string usfm, int verse_number) +string get_verse_text (std::string usfm, int verse_number) { std::vector result; bool hit = (verse_number == 0); std::vector lines = filter::strings::explode (usfm, '\n'); - for (string line : lines) { + for (std::string line : lines) { std::vector verses = get_verse_numbers (line); if (verse_number == 0) { if (verses.size () != 1) hit = false; @@ -380,7 +380,7 @@ string get_verse_text (string usfm, int verse_number) // Gets the USFM for the $verse number for a Quill-based verse editor. // This means that preceding empty paragraphs will be included also. // And that empty paragraphs at the end will be omitted. -string get_verse_text_quill (string usfm, int verse) +string get_verse_text_quill (std::string usfm, int verse) { // Get the raw USFM for the verse, that is, the bit between the \v... markers. std::string raw_verse_usfm = get_verse_text (usfm, verse); @@ -437,7 +437,7 @@ string get_verse_text_quill (string usfm, int verse) // Gets the chapter text given a book of $usfm code, and the $chapter_number. -string get_chapter_text (string usfm, int chapter_number) +string get_chapter_text (std::string usfm, int chapter_number) { // Empty input: Ready. if (usfm.empty ()) return usfm; @@ -491,7 +491,7 @@ string get_chapter_text (string usfm, int chapter_number) // It ensures that the $exclude_usfm does not make it to the output of the function. // In case of $quill, it uses a routine optimized for a Quill-based editor. // This means that empty paragraphs at the end of the extracted USFM fragment are not included. -string get_verse_range_text (string usfm, int verse_from, int verse_to, const std::string& exclude_usfm, bool quill) +string get_verse_range_text (std::string usfm, int verse_from, int verse_to, const std::string& exclude_usfm, bool quill) { std::vector bits; std::string previous_usfm; @@ -520,7 +520,7 @@ string get_verse_range_text (string usfm, int verse_from, int verse_to, const st // Returns true if the $code contains a USFM marker. -bool is_usfm_marker (string code) +bool is_usfm_marker (std::string code) { if (code.length () < 2) return false; if (code.substr (0, 1) == "\\") return true; @@ -530,7 +530,7 @@ bool is_usfm_marker (string code) // Returns true if the marker in $usfm is an opening marker. // Else it returns false. -bool is_opening_marker (string usfm) +bool is_opening_marker (std::string usfm) { return usfm.find ("*") == std::string::npos; } @@ -538,7 +538,7 @@ bool is_opening_marker (string usfm) // Returns true if the marker in $usfm is an embedded marker. // Else it returns false. -bool is_embedded_marker (string usfm) +bool is_embedded_marker (std::string usfm) { return usfm.find ( "+") != std::string::npos; } @@ -581,7 +581,7 @@ string peek_text_following_marker (const std::vector & usfm, unsign // Returns the verse number in the $usfm code. -string peek_verse_number (string usfm) +string peek_verse_number (std::string usfm) { // Make it robust, even handling cases like \v 1-2“Moi - No space after verse number. std::string verseNumber = ""; @@ -614,7 +614,7 @@ string peek_verse_number (string usfm) // Takes a marker in the form of text only, like "id" or "add", // and converts it into opening USFM, like "\id " or "\add ". // Supports the embedded markup "+". -string get_opening_usfm (string text, bool embedded) +string get_opening_usfm (std::string text, bool embedded) { std::string embed = embedded ? "+" : ""; return "\\" + embed + text + " "; @@ -624,7 +624,7 @@ string get_opening_usfm (string text, bool embedded) // Takes a marker in the form of text only, like "add", // and converts it into closing USFM, like "\add*". // Supports the embedded markup "+". -string get_closing_usfm (string text, bool embedded) +string get_closing_usfm (std::string text, bool embedded) { std::string embed = embedded ? "+" : ""; return "\\" + embed + text + "*"; @@ -636,7 +636,7 @@ string get_closing_usfm (string text, bool embedded) // It returns a short message specifying the difference if it exceeds that limit. // It fills $explanation with a longer message in case saving is not safe. string save_is_safe (Webserver_Request& webserver_request, - std::string oldtext, string newtext, bool chapter, string & explanation) + std::string oldtext, std::string newtext, bool chapter, std::string & explanation) { // Two texts are equal: safe. if (newtext == oldtext) return std::string(); @@ -717,7 +717,7 @@ string save_is_safe (Webserver_Request& webserver_request, // where the text in the editors would get corrupted. // It also is useful in view of an unstable connection between browser and server, to prevent data corruption. string safely_store_chapter (Webserver_Request& webserver_request, - std::string bible, int book, int chapter, string usfm, string & explanation) + std::string bible, int book, int chapter, std::string usfm, std::string & explanation) { // Existing chapter contents. std::string existing = webserver_request.database_bibles()->get_chapter (bible, book, chapter); @@ -749,7 +749,7 @@ string safely_store_chapter (Webserver_Request& webserver_request, // It also is useful in view of an unstable connection between browser and server, to prevent data corruption. // It handles combined verses. string safely_store_verse (Webserver_Request& webserver_request, - std::string bible, int book, int chapter, int verse, string usfm, + std::string bible, int book, int chapter, int verse, std::string usfm, std::string & explanation, bool quill) { usfm = filter::strings::trim (usfm); @@ -835,7 +835,7 @@ string safely_store_verse (Webserver_Request& webserver_request, // Returns whether $usfm contains one or more empty verses. -bool contains_empty_verses (string usfm) +bool contains_empty_verses (std::string usfm) { usfm = filter::strings::replace ("\n", "", usfm); if (usfm.empty ()) return false; @@ -857,7 +857,7 @@ bool contains_empty_verses (string usfm) // This looks at the $fragment, whether it's a range of verses. // If so, it puts the all of the verses in $verses, and returns true. -bool handle_verse_range (string verse, std::vector & verses) +bool handle_verse_range (std::string verse, std::vector & verses) { if (verse.find ("-") != std::string::npos) { size_t position; @@ -884,7 +884,7 @@ bool handle_verse_range (string verse, std::vector & verses) // This looks at the $fragment, whether it's a sequence of verses. // If so, it puts the all of the verses in $verses, and returns true. -bool handle_verse_sequence (string verse, std::vector & verses) +bool handle_verse_sequence (std::string verse, std::vector & verses) { if (verse.find (",") != std::string::npos) { int iterations = 0; @@ -964,7 +964,7 @@ void remove_word_level_attributes (const std::string& marker, // https://ubsicap.github.io/usfm/characters/index.html#fig-fig // That means it is backwards compatible with USFM 1/2: // \fig DESC|FILE|SIZE|LOC|COPY|CAP|REF\fig* -string extract_fig (string usfm, string & caption, string & alt, string& src, string& size, string& loc, string& copy, string& ref) +string extract_fig (std::string usfm, std::string & caption, std::string & alt, std::string& src, std::string& size, std::string& loc, std::string& copy, std::string& ref) { // The resulting USFM where the \fig markup has been removed from. std::string usfm_out; @@ -992,7 +992,7 @@ string extract_fig (string usfm, string & caption, string & alt, string& src, st } // Split the bit of USFM between the \fig...\fig* markup on the vertical bar. - vector bits = filter::strings::explode(usfm, '|'); + vector bits = filter::strings::explode(usfm, '|'); // Clear the variables that will contain the extracted information. caption.clear(); diff --git a/filter/webview.cpp b/filter/webview.cpp index d0608711d..2f0d111f0 100644 --- a/filter/webview.cpp +++ b/filter/webview.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. using namespace std; -void filter_webview_log_user_agent (string user_agent) +void filter_webview_log_user_agent (std::string user_agent) { // Whether the information has been logged. static bool filter_webview_logged = false; diff --git a/flate/flate.cpp b/flate/flate.cpp index 6733f0c49..967e05e95 100644 --- a/flate/flate.cpp +++ b/flate/flate.cpp @@ -26,21 +26,21 @@ using namespace std; // Sets a variable (key and value) for the html template. -void Flate::set_variable (string key, string value) +void Flate::set_variable (std::string key, std::string value) { variables [key] = value; } // Enable a zone in the html template. -void Flate::enable_zone (string zone) +void Flate::enable_zone (std::string zone) { zones [zone] = true; } // Add $value-s for one iteration to iterator $key. -void Flate::add_iteration (string key, std::map value) +void Flate::add_iteration (std::string key, std::map value) { // The $key is the name for the iteration, // where to add $value, which is a map of keys and values. @@ -49,7 +49,7 @@ void Flate::add_iteration (string key, std::map value) // Renders the html template. -string Flate::render (string html) +string Flate::render (std::string html) { std::string rendering; try { @@ -77,7 +77,7 @@ string Flate::render (string html) } -void Flate::process_iterations (string & rendering) +void Flate::process_iterations (std::string & rendering) { // Limit iteration count. int iteration_count = 0; diff --git a/html/header.cpp b/html/header.cpp index 78f59a248..325c07df2 100644 --- a/html/header.cpp +++ b/html/header.cpp @@ -46,7 +46,7 @@ m_html_text (html_text) { } -void Html_Header::search_back_link (string url, string text) +void Html_Header::search_back_link (std::string url, std::string text) { m_search_back_link_url = url; m_search_back_link_text = text; diff --git a/i18n/logic.cpp b/i18n/logic.cpp index 528724f72..776f7d84c 100644 --- a/i18n/logic.cpp +++ b/i18n/logic.cpp @@ -70,7 +70,7 @@ void i18n_logic_augment_via_google_translate () // Find the ones in the google file and insert them into the real .po file // Container for updated .po file contents. - stringstream updated_po_contents {}; + std::stringstream updated_po_contents {}; // Iterate over the current messages and assemble translations. for (auto & message : current_msgid_msgstr_map) { diff --git a/images/logic.cpp b/images/logic.cpp index 246f1a2b8..5e50b8cc0 100644 --- a/images/logic.cpp +++ b/images/logic.cpp @@ -28,7 +28,7 @@ using namespace std; -void images_logic_import_images (string path) +void images_logic_import_images (std::string path) { Database_BibleImages database_bibleimages; diff --git a/journal/index.cpp b/journal/index.cpp index a8feb9ab7..fd446acc1 100644 --- a/journal/index.cpp +++ b/journal/index.cpp @@ -57,7 +57,7 @@ bool journal_index_acl ([[maybe_unused]]Webserver_Request& webserver_request) } -string render_journal_entry (string filename, [[maybe_unused]] int userlevel) +string render_journal_entry (std::string filename, [[maybe_unused]] int userlevel) { // Sample filename: "146495380700927147". // The first 10 characters are the number of seconds past the Unix epoch, @@ -107,7 +107,7 @@ string render_journal_entry (string filename, [[maybe_unused]] int userlevel) // Deal with AJAX call for a possible new journal entry. -string journal_index_ajax_next (Webserver_Request& webserver_request, string filename) +string journal_index_ajax_next (Webserver_Request& webserver_request, std::string filename) { int userLevel = webserver_request.session_logic()->currentLevel (); std::string result = Database_Logs::next (filename); @@ -175,7 +175,7 @@ string journal_index (Webserver_Request& webserver_request) std::string lines; - for (string record : records) { + for (std::string record : records) { std::string rendering = render_journal_entry (record, userLevel); if (!rendering.empty ()) { lines.append (rendering); @@ -189,7 +189,7 @@ string journal_index (Webserver_Request& webserver_request) // It should be passed as a String object in JavaScript. // Because when it were passed as an Int, JavaScript would round the value off. // And rounding it off often led to double journal entries. - stringstream script; + std::stringstream script; script << "var filename = " << quoted(lastfilename) << ";"; view.set_variable ("script", script.str()); diff --git a/journal/logic.cpp b/journal/logic.cpp index 2cf19ca56..66feeb079 100644 --- a/journal/logic.cpp +++ b/journal/logic.cpp @@ -81,7 +81,7 @@ string journal_logic_see_journal_for_progress () href.append (journal_index_url ()); a_node.append_attribute ("href") = href.c_str (); a_node.text () = translate ("See the Journal for progress.").c_str(); - stringstream output; + std::stringstream output; document.print (output, "", pugi::format_default); return output.str (); } diff --git a/ldap/logic.cpp b/ldap/logic.cpp index 73842346d..6c918e074 100644 --- a/ldap/logic.cpp +++ b/ldap/logic.cpp @@ -140,7 +140,7 @@ bool ldap_logic_is_on (bool log) // Parameter $mail returns the email address. // Parameter $role returns the user's role. // If the query was done successfully, the function returns true. -bool ldap_logic_fetch (const std::string& user, const std::string& password, bool& access, string& email, int& role, bool log) +bool ldap_logic_fetch (const std::string& user, const std::string& password, bool& access, std::string& email, int& role, bool log) { // Initialize result values for the caller. access = false; diff --git a/lexicon/definition.cpp b/lexicon/definition.cpp index ab0945c32..7edced530 100644 --- a/lexicon/definition.cpp +++ b/lexicon/definition.cpp @@ -81,7 +81,7 @@ string lexicon_definition (Webserver_Request& webserver_request) for (size_t i = 0; i < strongs.size (); i++) { std::string rendering1 = lexicon_logic_render_strongs_definition (strongs[i]); if (!rendering1.empty ()) renderings.push_back (rendering1); - stringstream rendering2; + std::stringstream rendering2; rendering2 << "Brown Driver Briggs"; renderings.push_back (rendering2.str()); } diff --git a/lexicon/logic.cpp b/lexicon/logic.cpp index ab11ba7d6..fae3afe1f 100644 --- a/lexicon/logic.cpp +++ b/lexicon/logic.cpp @@ -69,7 +69,7 @@ vector lexicon_logic_resource_names () // Gets the HTMl for displaying the book/chapter/verse of the $lexicon. -string lexicon_logic_get_html ([[maybe_unused]] Webserver_Request& webserver_request, string lexicon, int book, int chapter, int verse) +string lexicon_logic_get_html ([[maybe_unused]] Webserver_Request& webserver_request, std::string lexicon, int book, int chapter, int verse) { std::string html; @@ -78,7 +78,7 @@ string lexicon_logic_get_html ([[maybe_unused]] Webserver_Request& webserver_req Database_Etcbc4 database_etcbc4; // Data from the ETCBC4 database. std::vector rowids = database_etcbc4.rowids (book, chapter, verse); - stringstream ss; + std::stringstream ss; if (!rowids.empty ()) { std::string id = "lexicontxt" + prefix; ss << "
    " << std::endl; @@ -110,7 +110,7 @@ string lexicon_logic_get_html ([[maybe_unused]] Webserver_Request& webserver_req Database_Kjv database_kjv; std::vector rowids = database_kjv.rowids (book, chapter, verse); if (!rowids.empty ()) { - stringstream ss; + std::stringstream ss; std::string id = "lexicontxt" + prefix; ss << "
    " << std::endl; for (size_t i = 0; i < rowids.size (); i++) { @@ -129,7 +129,7 @@ string lexicon_logic_get_html ([[maybe_unused]] Webserver_Request& webserver_req Database_OsHb database_oshb; std::vector rowids = database_oshb.rowids (book, chapter, verse); if (!rowids.empty ()) { - stringstream ss; + std::stringstream ss; std::string id = "lexicontxt" + prefix; ss << "
    " << std::endl; for (size_t i = 0; i < rowids.size (); i++) { @@ -150,7 +150,7 @@ string lexicon_logic_get_html ([[maybe_unused]] Webserver_Request& webserver_req Database_MorphGnt database_morphgnt; std::vector rowids = database_morphgnt.rowids (book, chapter, verse); if (!rowids.empty ()) { - stringstream ss; + std::stringstream ss; std::string id = "lexicontxt" + prefix; ss << "
    " << std::endl; for (size_t i = 0; i < rowids.size (); i++) { @@ -170,7 +170,7 @@ string lexicon_logic_get_html ([[maybe_unused]] Webserver_Request& webserver_req // The script to put into the html for a lexicon's defined $prefix. -string lexicon_logic_get_script (string prefix) +string lexicon_logic_get_script (std::string prefix) { std::string defid = "lexicondef" + prefix; std::string txtid = "lexicontxt" + prefix; @@ -231,7 +231,7 @@ string lexicon_logic_get_script (string prefix) // Clean up the Strong's number. -string lexicon_logic_strong_number_cleanup (string strong) +string lexicon_logic_strong_number_cleanup (std::string strong) { // Remove the leading zero from a Hebrew Strong's number. strong = filter::strings::replace ("H0", "H", strong); @@ -242,7 +242,7 @@ string lexicon_logic_strong_number_cleanup (string strong) // Converts a parsing from the Open Scriptures Hebrew database to Strong's numbers. // It also provides the links to call BDB entries. -void lexicon_logic_convert_morphhb_parsing_to_strong (string parsing, +void lexicon_logic_convert_morphhb_parsing_to_strong (std::string parsing, std::vector & strongs, std::vector & bdbs) { @@ -293,7 +293,7 @@ void lexicon_logic_convert_morphhb_parsing_to_strong (string parsing, } -string lexicon_logic_render_strongs_definition (string strong) +string lexicon_logic_render_strongs_definition (std::string strong) { std::vector renderings; Database_Strong database_strong; @@ -444,7 +444,7 @@ string lexicon_logic_render_part_of_speech_pop_front (vector & par // Render the part of speech. -string lexicon_logic_render_strongs_part_of_speech (string value) +string lexicon_logic_render_strongs_part_of_speech (std::string value) { if (value == filter::strings::unicode_string_casefold (value)) { // Deal with Strong's parsings. @@ -541,38 +541,38 @@ string lexicon_logic_render_strongs_part_of_speech (string value) } -string lexicon_logic_render_strongs_part_of_speech_stem (string abbrev) +string lexicon_logic_render_strongs_part_of_speech_stem (std::string abbrev) { return abbrev; } -string lexicon_logic_render_strongs_part_of_speech_person (string abbrev) +string lexicon_logic_render_strongs_part_of_speech_person (std::string abbrev) { return abbrev; } -string lexicon_logic_render_strongs_part_of_speech_gender (string abbrev) +string lexicon_logic_render_strongs_part_of_speech_gender (std::string abbrev) { return abbrev; } -string lexicon_logic_render_strongs_part_of_speech_number (string abbrev) +string lexicon_logic_render_strongs_part_of_speech_number (std::string abbrev) { return abbrev; } -string lexicon_logic_render_strongs_part_of_speech_state (string abbrev) +string lexicon_logic_render_strongs_part_of_speech_state (std::string abbrev) { return abbrev; } // Define user-defined Strong's numbers. -string lexicon_logic_define_user_strong (string strong) +string lexicon_logic_define_user_strong (std::string strong) { std::string definition; if (!strong.empty ()) { @@ -609,7 +609,7 @@ string lexicon_logic_define_user_strong (string strong) } -string lexicon_logic_render_morphgnt_part_of_speech (string pos) +string lexicon_logic_render_morphgnt_part_of_speech (std::string pos) { pos = filter::strings::replace ("-", "", pos); std::string rendering; @@ -630,7 +630,7 @@ string lexicon_logic_render_morphgnt_part_of_speech (string pos) } -string lexicon_logic_render_morphgnt_parsing_code (string parsing) +string lexicon_logic_render_morphgnt_parsing_code (std::string parsing) { std::vector renderings; // person. @@ -707,7 +707,7 @@ string lexicon_logic_render_morphgnt_parsing_code (string parsing) } -string lexicon_logic_render_etcbc4_morphology (string rowid) +string lexicon_logic_render_etcbc4_morphology (std::string rowid) { // The order of the rendered morphological information is such // that the pieces of information most relevant to the Bible translator come first, @@ -1047,7 +1047,7 @@ string lexicon_logic_render_etcbc4_morphology (string rowid) // Converts a code from MorphHb into a rendered BDB entry from the HebrewLexicon. -string lexicon_logic_render_bdb_entry (string code) +string lexicon_logic_render_bdb_entry (std::string code) { Database_HebrewLexicon database_hebrewlexicon; // Get the intermediate map value between the augmented Strong's numbers and the BDB lexicon. @@ -1069,7 +1069,7 @@ string lexicon_logic_render_bdb_entry (string code) // Gets and removes an attribute from $xml, and updates $xml. // Returns the attribute. -string lexicon_logic_get_remove_attribute (string & xml, const char * key) +string lexicon_logic_get_remove_attribute (std::string & xml, const char * key) { std::string value; pugi::xml_document document; @@ -1080,7 +1080,7 @@ string lexicon_logic_get_remove_attribute (string & xml, const char * key) if (attribute) { value = attribute.value (); child.remove_attribute (attribute); - stringstream output; + std::stringstream output; child.print (output, "", pugi::format_raw); xml = output.str (); } @@ -1090,7 +1090,7 @@ string lexicon_logic_get_remove_attribute (string & xml, const char * key) // Gets the text contents of the $xml node. -string lexicon_logic_get_text (string & xml) +string lexicon_logic_get_text (std::string & xml) { std::string value; pugi::xml_document document; @@ -1101,7 +1101,7 @@ string lexicon_logic_get_text (string & xml) if (text) { value = text.get (); text.set (""); - stringstream output; + std::stringstream output; child.print (output, "", pugi::format_raw); xml = output.str (); } @@ -1110,7 +1110,7 @@ string lexicon_logic_get_text (string & xml) } -string lexicon_logic_hebrew_morphology_render (string value) +string lexicon_logic_hebrew_morphology_render (std::string value) { // No data: bail out. if (value.empty ()) return value; @@ -1209,7 +1209,7 @@ string lexicon_logic_hebrew_morphology_render (string value) // Verb conjugation types -string lexicon_logic_hebrew_morphology_render_type_verb_conjugation (string & value) +string lexicon_logic_hebrew_morphology_render_type_verb_conjugation (std::string & value) { std::string rendering; if (!value.empty ()) { @@ -1233,7 +1233,7 @@ string lexicon_logic_hebrew_morphology_render_type_verb_conjugation (string & va // Adjective types -string lexicon_logic_hebrew_morphology_render_type_adjective (string & value) +string lexicon_logic_hebrew_morphology_render_type_adjective (std::string & value) { std::string rendering; if (!value.empty ()) { @@ -1250,7 +1250,7 @@ string lexicon_logic_hebrew_morphology_render_type_adjective (string & value) // Noun types -string lexicon_logic_hebrew_morphology_render_type_noun (string & value) +string lexicon_logic_hebrew_morphology_render_type_noun (std::string & value) { std::string rendering; if (!value.empty ()) { @@ -1266,7 +1266,7 @@ string lexicon_logic_hebrew_morphology_render_type_noun (string & value) // Pronoun types -string lexicon_logic_hebrew_morphology_render_type_pronoun (string & value) +string lexicon_logic_hebrew_morphology_render_type_pronoun (std::string & value) { std::string rendering; if (!value.empty ()) { @@ -1284,7 +1284,7 @@ string lexicon_logic_hebrew_morphology_render_type_pronoun (string & value) // Preposition types -string lexicon_logic_hebrew_morphology_render_type_preposition (string & value) +string lexicon_logic_hebrew_morphology_render_type_preposition (std::string & value) { std::string rendering; if (!value.empty ()) { @@ -1298,7 +1298,7 @@ string lexicon_logic_hebrew_morphology_render_type_preposition (string & value) // Suffix types -string lexicon_logic_hebrew_morphology_render_type_suffix (string & value) +string lexicon_logic_hebrew_morphology_render_type_suffix (std::string & value) { std::string rendering; if (!value.empty ()) { @@ -1315,7 +1315,7 @@ string lexicon_logic_hebrew_morphology_render_type_suffix (string & value) // Particle types -string lexicon_logic_hebrew_morphology_render_type_particle (string & value) +string lexicon_logic_hebrew_morphology_render_type_particle (std::string & value) { std::string rendering; if (!value.empty ()) { @@ -1337,7 +1337,7 @@ string lexicon_logic_hebrew_morphology_render_type_particle (string & value) // Render verb stems. -string lexicon_logic_hebrew_morphology_render_stem (bool hebrew, bool aramaic, string & value) +string lexicon_logic_hebrew_morphology_render_stem (bool hebrew, bool aramaic, std::string & value) { std::string rendering; if (!value.empty ()) { @@ -1413,7 +1413,7 @@ string lexicon_logic_hebrew_morphology_render_stem (bool hebrew, bool aramaic, s // Person -string lexicon_logic_hebrew_morphology_render_person (string & value) +string lexicon_logic_hebrew_morphology_render_person (std::string & value) { std::string rendering; if (!value.empty ()) { @@ -1431,7 +1431,7 @@ string lexicon_logic_hebrew_morphology_render_person (string & value) // Gender -string lexicon_logic_hebrew_morphology_render_gender (string & value) +string lexicon_logic_hebrew_morphology_render_gender (std::string & value) { std::string rendering; if (!value.empty ()) { @@ -1448,7 +1448,7 @@ string lexicon_logic_hebrew_morphology_render_gender (string & value) // Number -string lexicon_logic_hebrew_morphology_render_number (string & value) +string lexicon_logic_hebrew_morphology_render_number (std::string & value) { std::string rendering; if (!value.empty ()) { @@ -1464,7 +1464,7 @@ string lexicon_logic_hebrew_morphology_render_number (string & value) // State -string lexicon_logic_hebrew_morphology_render_state (string & value) +string lexicon_logic_hebrew_morphology_render_state (std::string & value) { std::string rendering; if (!value.empty ()) { @@ -1530,7 +1530,7 @@ struct abbott_smith_walker: pugi::xml_tree_walker }; -string lexicon_logic_render_abbott_smiths_definition (string lemma, string strong) +string lexicon_logic_render_abbott_smiths_definition (std::string lemma, std::string strong) { std::vector renderings; diff --git a/library/bibledit.cpp b/library/bibledit.cpp index 9cfce672a..2502882f1 100644 --- a/library/bibledit.cpp +++ b/library/bibledit.cpp @@ -465,7 +465,7 @@ void bibledit_put_reference_from_accordance (const char * reference) // Interpret the passage from Accordance, e.g. MAT 1:1. // Accordance broadcasts for instance, 2 Corinthians 9:2, as "2CO 9:2". - vector book_rest = filter::strings::explode (reference, ' '); + vector book_rest = filter::strings::explode (reference, ' '); if (book_rest.size() != 2) return; int book = static_cast(database::books::get_id_from_usfm (book_rest[0])); std::vector chapter_verse = filter::strings::explode(book_rest[1], ':'); diff --git a/locale/logic.cpp b/locale/logic.cpp index ec56e18cf..2c12c48c2 100644 --- a/locale/logic.cpp +++ b/locale/logic.cpp @@ -104,7 +104,7 @@ map locale_logic_localizations () } -unordered_map locale_logic_read_msgid_msgstr (string file) +unordered_map locale_logic_read_msgid_msgstr (std::string file) { unordered_map translations; std::string contents = filter_url_file_get_contents (file); @@ -218,7 +218,7 @@ string locale_logic_text_reload () // Returns the Unicode name of the $space. -string locale_logic_space_get_name (string space, bool english) +string locale_logic_space_get_name (std::string space, bool english) { if (space == " ") { if (english) return "space"; @@ -244,7 +244,7 @@ string locale_logic_space_get_name (string space, bool english) } -string locale_logic_deobfuscate (string value) +string locale_logic_deobfuscate (std::string value) { // Replace longest strings first. diff --git a/locale/translate.cpp b/locale/translate.cpp index 7bbce49a9..abaf92216 100644 --- a/locale/translate.cpp +++ b/locale/translate.cpp @@ -30,7 +30,7 @@ vector locale_translate_obfuscation_replace; // Translates $english to its localized string. -string translate (string english) +string translate (std::string english) { // Start off with the English message. std::string result (english); diff --git a/manage/exports.cpp b/manage/exports.cpp index d9f2f9af6..19a54de12 100644 --- a/manage/exports.cpp +++ b/manage/exports.cpp @@ -55,7 +55,7 @@ bool manage_exports_acl (Webserver_Request& webserver_request) } -string space_href (string name) +string space_href (std::string name) { name = filter::strings::replace ("-", "", name); name = filter::strings::replace (" ", "", name); diff --git a/manage/hyphenate.cpp b/manage/hyphenate.cpp index 7f9dd6d7d..8d74daa8c 100644 --- a/manage/hyphenate.cpp +++ b/manage/hyphenate.cpp @@ -31,7 +31,7 @@ using namespace std; -void manage_hyphenate (string bible, string user) +void manage_hyphenate (std::string bible, std::string user) { Database_Bibles database_bibles; @@ -104,7 +104,7 @@ void manage_hyphenate (string bible, string user) * $text: A string of text to operate on. * Returns: The hyphenated text. */ -string hyphenate_at_transition (vector & firstset, std::vector & secondset, string text) +string hyphenate_at_transition (vector & firstset, std::vector & secondset, std::string text) { // Verify the input. if (firstset.empty ()) return text; @@ -113,7 +113,7 @@ string hyphenate_at_transition (vector & firstset, std::vector lines = filter::strings::explode (text, '\n'); - for (string & line : lines) { + for (std::string & line : lines) { // Split the line up into an array of UTF8 Unicode characters. std::vector characters; diff --git a/manage/users.cpp b/manage/users.cpp index a80c7c115..1240c083e 100644 --- a/manage/users.cpp +++ b/manage/users.cpp @@ -267,7 +267,7 @@ string manage_users (Webserver_Request& webserver_request) // User accounts to display. - stringstream tbody; + std::stringstream tbody; bool ldap_on = ldap_logic_is_on (); // Retrieve assigned users. std::vector users = access_user::assignees (webserver_request); diff --git a/mapping/index.cpp b/mapping/index.cpp index 04a513762..cd1ef1435 100644 --- a/mapping/index.cpp +++ b/mapping/index.cpp @@ -92,7 +92,7 @@ string mapping_index (Webserver_Request& webserver_request) view.set_variable ("error", error); view.set_variable ("success", success); - stringstream mappingsblock; + std::stringstream mappingsblock; std::vector mappings = database_mappings.names (); for (auto & mapping : mappings) { mappingsblock << "

    "; diff --git a/menu/logic.cpp b/menu/logic.cpp index 06ff8172d..972b05367 100644 --- a/menu/logic.cpp +++ b/menu/logic.cpp @@ -106,7 +106,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. using namespace std; -string menu_logic_href (string href) +string menu_logic_href (std::string href) { href = filter::strings::replace ("?", "__q__", href); href = filter::strings::replace ("&", "__a__", href); @@ -115,7 +115,7 @@ string menu_logic_href (string href) } -string menu_logic_click (string item) +string menu_logic_click (std::string item) { item = filter::strings::replace ("__q__", "?", item); item = filter::strings::replace ("__a__", "&", item); @@ -125,7 +125,7 @@ string menu_logic_click (string item) } -string menu_logic_create_item (string href, string text, bool history, string title, string colour) +string menu_logic_create_item (std::string href, std::string text, bool history, std::string title, std::string colour) { std::string item; item.append (R"( html; @@ -361,7 +361,7 @@ string menu_logic_basic_categories (Webserver_Request& webserver_request) // Generates html for the workspace main menu. // Plus the tooltip for it. -string menu_logic_workspace_category (Webserver_Request& webserver_request, string * tooltip) +string menu_logic_workspace_category (Webserver_Request& webserver_request, std::string * tooltip) { std::vector html; std::vector labels; @@ -389,7 +389,7 @@ string menu_logic_workspace_category (Webserver_Request& webserver_request, stri } -string menu_logic_translate_category (Webserver_Request& webserver_request, string * tooltip) +string menu_logic_translate_category (Webserver_Request& webserver_request, std::string * tooltip) { std::vector html; std::vector labels; @@ -464,7 +464,7 @@ string menu_logic_translate_category (Webserver_Request& webserver_request, stri } -string menu_logic_search_category (Webserver_Request& webserver_request, string * tooltip) +string menu_logic_search_category (Webserver_Request& webserver_request, std::string * tooltip) { std::vector html; std::vector labels; @@ -532,7 +532,7 @@ string menu_logic_search_category (Webserver_Request& webserver_request, string } -string menu_logic_tools_category (Webserver_Request& webserver_request, string * tooltip) +string menu_logic_tools_category (Webserver_Request& webserver_request, std::string * tooltip) { // The labels that may end up in the menu. std::string checks = translate ("Checks"); @@ -655,7 +655,7 @@ string menu_logic_tools_category (Webserver_Request& webserver_request, string * } -string menu_logic_settings_category (Webserver_Request& webserver_request, string * tooltip) +string menu_logic_settings_category (Webserver_Request& webserver_request, std::string * tooltip) { [[maybe_unused]] bool demo = config::logic::demo_enabled (); @@ -1003,7 +1003,7 @@ bool menu_logic_public_or_guest (Webserver_Request& webserver_request) // Returns the text that belongs to a certain menu item. -string menu_logic_menu_text (string menu_item) +string menu_logic_menu_text (std::string menu_item) { if (menu_item == menu_logic_translate_menu ()) { return menu_logic_translate_text (); @@ -1025,7 +1025,7 @@ string menu_logic_menu_text (string menu_item) // Returns the URL that belongs to $menu_item. -string menu_logic_menu_url (string menu_item) +string menu_logic_menu_url (std::string menu_item) { if ( (menu_item == menu_logic_translate_menu ()) @@ -1236,7 +1236,7 @@ bool menu_logic_can_do_tabbed_mode () // For internal repatitive use. -jsonxx::Object menu_logic_tabbed_mode_add_tab (string url, string label) +jsonxx::Object menu_logic_tabbed_mode_add_tab (std::string url, std::string label) { jsonxx::Object object; object << "url" << url; @@ -1286,7 +1286,7 @@ void menu_logic_tabbed_mode_save_json (Webserver_Request& webserver_request) } -string menu_logic_verse_separator (string separator) +string menu_logic_verse_separator (std::string separator) { if (separator == ".") { return translate ("dot") + " ( . )"; diff --git a/mimetic098/contenttype.cxx b/mimetic098/contenttype.cxx index 46fec4883..50e91b00c 100644 --- a/mimetic098/contenttype.cxx +++ b/mimetic098/contenttype.cxx @@ -102,7 +102,7 @@ ContentType::Boundary::Boundary() "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "-_."; // "=+,()/" - stringstream ss; + std::stringstream ss; srand((unsigned int)time(0)); short tbSize = sizeof(tb)-1; for(uint i=0; i < 48; ++i) diff --git a/mimetic098/rfc822/datetime.cxx b/mimetic098/rfc822/datetime.cxx index 917a6905a..128459020 100644 --- a/mimetic098/rfc822/datetime.cxx +++ b/mimetic098/rfc822/datetime.cxx @@ -449,7 +449,7 @@ DateTime::Zone DateTime::zone() const std::string DateTime::str() const { - stringstream ss; + std::stringstream ss; ss << *this; return ss.str(); } diff --git a/mimetic098/utils.cxx b/mimetic098/utils.cxx index 9e1d6b214..1aabfc61f 100644 --- a/mimetic098/utils.cxx +++ b/mimetic098/utils.cxx @@ -109,18 +109,18 @@ struct Int Int(int n) : m_i(n) { - stringstream ss; + std::stringstream ss; ss << m_i; ss >> m_si; } Int(const std::string& ns) { - stringstream ss; + std::stringstream ss; ss << ns; ss >> m_i; if(ss.fail()) m_i = 0; - stringstream ss2; + std::stringstream ss2; ss2 << m_i; ss2 >> m_si; } diff --git a/navigation/paratext.cpp b/navigation/paratext.cpp index d948deb02..c42291cd4 100644 --- a/navigation/paratext.cpp +++ b/navigation/paratext.cpp @@ -47,7 +47,7 @@ string navigation_paratext (Webserver_Request& webserver_request) // User should have set to receive references from Paratext. if (webserver_request.database_config_user ()->getReceiveFocusedReferenceFromParatext ()) { // Parse the reference from Paratext. - vector book_rest = filter::strings::explode (from, ' '); + vector book_rest = filter::strings::explode (from, ' '); if (book_rest.size() == 2) { int book = static_cast(database::books::get_id_from_usfm (book_rest[0])); std::vector chapter_verse = filter::strings::explode(book_rest[1], ':'); diff --git a/navigation/passage.cpp b/navigation/passage.cpp index 8f7997733..511e5438c 100644 --- a/navigation/passage.cpp +++ b/navigation/passage.cpp @@ -54,7 +54,7 @@ using namespace std; */ -string Navigation_Passage::get_mouse_navigator (Webserver_Request& webserver_request, string bible) +string Navigation_Passage::get_mouse_navigator (Webserver_Request& webserver_request, std::string bible) { Database_Navigation database_navigation; @@ -207,14 +207,14 @@ string Navigation_Passage::get_mouse_navigator (Webserver_Request& webserver_req } // The result. - stringstream output; + std::stringstream output; document.print (output, "", pugi::format_raw); std::string fragment = output.str (); return fragment; } -string Navigation_Passage::get_books_fragment (Webserver_Request& webserver_request, string bible) +string Navigation_Passage::get_books_fragment (Webserver_Request& webserver_request, std::string bible) { book_id active_book = static_cast(Ipc_Focus::getBook (webserver_request)); // Take standard books in case of no Bible. @@ -240,7 +240,7 @@ string Navigation_Passage::get_books_fragment (Webserver_Request& webserver_requ } -string Navigation_Passage::get_chapters_fragment (Webserver_Request& webserver_request, string bible, int book, int chapter) +string Navigation_Passage::get_chapters_fragment (Webserver_Request& webserver_request, std::string bible, int book, int chapter) { std::vector chapters; if (bible.empty ()) { @@ -264,7 +264,7 @@ string Navigation_Passage::get_chapters_fragment (Webserver_Request& webserver_r } -string Navigation_Passage::get_verses_fragment (Webserver_Request& webserver_request, string bible, int book, int chapter, int verse) +string Navigation_Passage::get_verses_fragment (Webserver_Request& webserver_request, std::string bible, int book, int chapter, int verse) { std::vector verses; if (bible == "") { @@ -288,7 +288,7 @@ string Navigation_Passage::get_verses_fragment (Webserver_Request& webserver_req } -string Navigation_Passage::code (string bible) +string Navigation_Passage::code (std::string bible) { std::string code; code += R"(