Skip to content

Commit

Permalink
Make namspace clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
teusbenschop committed Apr 18, 2024
1 parent 9fb3ef7 commit dfe88f4
Show file tree
Hide file tree
Showing 65 changed files with 302 additions and 303 deletions.
12 changes: 6 additions & 6 deletions checks/sentences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,31 @@
using namespace std;


void Checks_Sentences::enter_capitals (const string & capitals)
void Checks_Sentences::enter_capitals (const std::string& capitals)
{
m_capitals = filter::strings::explode (capitals, ' ');
}


void Checks_Sentences::enter_small_letters (const string & small_letters)
void Checks_Sentences::enter_small_letters (const std::string& small_letters)
{
m_small_letters = filter::strings::explode (small_letters, ' ');
}


void Checks_Sentences::enter_end_marks (const string & end_marks)
void Checks_Sentences::enter_end_marks (const std::string& end_marks)
{
m_end_marks = filter::strings::explode (end_marks, ' ');
}


void Checks_Sentences::enter_center_marks (const string & center_marks)
void Checks_Sentences::enter_center_marks (const std::string& center_marks)
{
m_center_marks = filter::strings::explode (center_marks, ' ');
}


void Checks_Sentences::enter_disregards (const string & disregards)
void Checks_Sentences::enter_disregards (const std::string& disregards)
{
m_disregards = filter::strings::explode (disregards, ' ');
}
Expand Down Expand Up @@ -204,7 +204,7 @@ void Checks_Sentences::paragraphs (const vector <string> & paragraph_start_marke
// Check that the paragraph starts with a capital.
is_capital = in_array (character2, m_capitals);
if (!is_capital) {
const string & paragraph_marker = paragraph_start_markers [p];
const std::string& paragraph_marker = paragraph_start_markers [p];
if (!in_array (paragraph_marker, within_sentence_paragraph_markers)) {
string context = verses_paragraph.begin()->second;
context = filter::strings::unicode_string_substr (context, 0, 15);
Expand Down
8 changes: 4 additions & 4 deletions checks/space.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ using namespace std;
namespace checks::space {


void double_space_usfm (const string & bible, int book, int chapter, int verse, const string & data)
void double_space_usfm (const std::string& bible, int book, int chapter, int verse, const std::string& data)
{
const size_t pos = data.find (" ");
if (pos != std::string::npos) {
Expand All @@ -41,7 +41,7 @@ void double_space_usfm (const string & bible, int book, int chapter, int verse,
}


void space_before_punctuation (const string & bible, int book, int chapter, const map <int, string> & texts)
void space_before_punctuation (const std::string& bible, int book, int chapter, const map <int, string> & texts)
{
Database_Check database_check {};
for (const auto & element : texts) {
Expand Down Expand Up @@ -69,7 +69,7 @@ void space_before_punctuation (const string & bible, int book, int chapter, cons
}


void space_end_verse (const string & bible, int book, int chapter, const string & usfm)
void space_end_verse (const std::string& bible, int book, int chapter, const std::string& usfm)
{
Database_Check database_check {};
vector <int> verses = filter::usfm::get_verse_numbers (usfm);
Expand Down Expand Up @@ -118,7 +118,7 @@ bool transpose_note_space (string & usfm)
}


void space_before_final_note_markup (const string & bible, int book, int chapter, int verse, const string & data)
void space_before_final_note_markup (const std::string& bible, int book, int chapter, int verse, const std::string& data)
{
Database_Check database_check {};
if (data.find (R"( \f*)") != std::string::npos) {
Expand Down
8 changes: 4 additions & 4 deletions checks/usfm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
using namespace std;


Checks_Usfm::Checks_Usfm (const string & bible)
Checks_Usfm::Checks_Usfm (const std::string& bible)
{
Database_Styles database_styles {};
string stylesheet = Database_Config_Bible::getExportStylesheet (bible);
Expand Down Expand Up @@ -107,7 +107,7 @@ void Checks_Usfm::finalize ()
}


void Checks_Usfm::check (const string & usfm)
void Checks_Usfm::check (const std::string& usfm)
{
new_line_in_usfm (usfm);

Expand Down Expand Up @@ -165,7 +165,7 @@ void Checks_Usfm::malformed_verse_number ()
}


void Checks_Usfm::new_line_in_usfm (const string & usfm)
void Checks_Usfm::new_line_in_usfm (const std::string& usfm)
{
size_t position {string::npos};
size_t pos = usfm.find ("\\\n");
Expand Down Expand Up @@ -224,7 +224,7 @@ void Checks_Usfm::malformed_id ()
}


void Checks_Usfm::forward_slash (const string & usfm)
void Checks_Usfm::forward_slash (const std::string& usfm)
{
string code = filter::strings::replace ("\n", " ", usfm);
size_t pos = code.find ("/");
Expand Down
8 changes: 4 additions & 4 deletions checks/verses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
using namespace std;


void checks_verses::missing_punctuation_at_end (const string & bible, int book, int chapter,
void checks_verses::missing_punctuation_at_end (const std::string& bible, int book, int chapter,
const map <int, string> & verses,
const string & center_marks, const string & end_marks,
const string & disregards)
const std::string& center_marks, const std::string& end_marks,
const std::string& disregards)
{
const vector <string> centermarks = filter::strings::explode (center_marks, ' ');
const vector <string> endmarks = filter::strings::explode (end_marks, ' ');
Expand All @@ -55,7 +55,7 @@ void checks_verses::missing_punctuation_at_end (const string & bible, int book,
}


void checks_verses::patterns (const string & bible, int book, int chapter,
void checks_verses::patterns (const std::string& bible, int book, int chapter,
const map <int, string> & verses, const vector <string> & patterns)
{
Database_Check database_check {};
Expand Down
6 changes: 3 additions & 3 deletions checks/versification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
using namespace std;


void checks_versification::books (const string & bible, const vector <int> & books)
void checks_versification::books (const std::string& bible, const vector <int> & books)
{
Database_Versifications database_versifications {};
string versification = Database_Config_Bible::getVersificationSystem (bible);
Expand All @@ -44,7 +44,7 @@ void checks_versification::books (const string & bible, const vector <int> & boo
}


void checks_versification::chapters (const string & bible, int book, const vector <int> & chapters)
void checks_versification::chapters (const std::string& bible, int book, const vector <int> & chapters)
{
Database_Versifications database_versifications {};
string versification = Database_Config_Bible::getVersificationSystem (bible);
Expand All @@ -62,7 +62,7 @@ void checks_versification::chapters (const string & bible, int book, const vecto
}


void checks_versification::verses (const string & bible, int book, int chapter, const vector <int> & verses)
void checks_versification::verses (const std::string& bible, int book, int chapter, const vector <int> & verses)
{
// Get verses in this chapter according to the versification system for the Bible.
Database_Versifications database_versifications {};
Expand Down
10 changes: 5 additions & 5 deletions checksum/logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,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 string & data, bool readwrite)
string checksum_logic::send (const std::string& data, bool readwrite)
{
string checksum = get (data);
checksum.append ("\n");
Expand All @@ -45,7 +45,7 @@ string checksum_logic::send (const 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 string & data)
string checksum_logic::get (const std::string& data)
{
return filter::strings::convert_to_string (data.length ());
}
Expand All @@ -62,7 +62,7 @@ string checksum_logic::get (const vector <string>& data)


// Returns a proper checksum for the USFM in the chapter.
string checksum_logic::get_chapter (Webserver_Request& webserver_request, const string & bible, int book, int chapter)
string checksum_logic::get_chapter (Webserver_Request& webserver_request, const std::string& bible, int book, int chapter)
{
string usfm = webserver_request.database_bibles()->get_chapter (bible, book, chapter);
string checksum = md5 (filter::strings::trim (usfm));
Expand All @@ -71,7 +71,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 string & bible, int book)
string checksum_logic::get_book (Webserver_Request& webserver_request, const std::string& bible, int book)
{
vector <int> chapters = webserver_request.database_bibles()->get_chapters (bible, book);
vector <string> checksums;
Expand All @@ -85,7 +85,7 @@ string checksum_logic::get_book (Webserver_Request& webserver_request, const str


// Returns a proper checksum for the USFM in the $bible.
string checksum_logic::get_bible (Webserver_Request& webserver_request, const string & bible)
string checksum_logic::get_bible (Webserver_Request& webserver_request, const std::string& bible)
{
vector <int> books = webserver_request.database_bibles()->get_books (bible);
vector <string> checksums;
Expand Down
8 changes: 4 additions & 4 deletions client/logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,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 string & address, int port, const string & path)
string client_logic_url (const std::string& address, int port, const std::string& path)
{
return address + ":" + filter::strings::convert_to_string (port) + "/" + path;
}
Expand Down Expand Up @@ -118,8 +118,8 @@ string client_logic_connection_setup (string user, string hash)
}


string client_logic_create_note_encode (const string & bible, int book, int chapter, int verse,
const string & summary, const string & contents, bool raw)
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)
{
vector <string> data {};
data.push_back (bible);
Expand All @@ -133,7 +133,7 @@ string client_logic_create_note_encode (const string & bible, int book, int chap
}


void client_logic_create_note_decode (const string & data,
void client_logic_create_note_decode (const std::string& data,
string& bible, int& book, int& chapter, int& verse,
string& summary, string& contents, bool& raw)
{
Expand Down
12 changes: 6 additions & 6 deletions database/books.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ std::vector <book_id> get_ids ()
}


book_id get_id_from_english (const string & english)
book_id get_id_from_english (const std::string& english)
{
for (unsigned int i = 0; i < data_count; i++) {
if (english == books_table[i].english) {
Expand Down Expand Up @@ -100,7 +100,7 @@ string get_osis_from_id (book_id id)
}


book_id get_id_from_usfm (const string & usfm)
book_id get_id_from_usfm (const std::string& usfm)
{
for (unsigned int i = 0; i < data_count; i++) {
if (usfm == books_table[i].usfm) {
Expand All @@ -111,7 +111,7 @@ book_id get_id_from_usfm (const string & usfm)
}


book_id get_id_from_osis (const string & osis)
book_id get_id_from_osis (const std::string& osis)
{
for (unsigned int i = 0; i < data_count; i++) {
if (osis == books_table[i].osis) {
Expand All @@ -122,7 +122,7 @@ book_id get_id_from_osis (const string & osis)
}


book_id get_id_from_bibleworks (const string & bibleworks)
book_id get_id_from_bibleworks (const std::string& bibleworks)
{
for (unsigned int i = 0; i < data_count; i++) {
if (bibleworks == books_table[i].bibleworks) {
Expand All @@ -136,7 +136,7 @@ book_id get_id_from_bibleworks (const string & bibleworks)
// Tries to interprete $text as the name of a Bible book.
// Returns the book's identifier if it succeeds.
// If it fails, it returns 0.
book_id get_id_like_text (const string & text)
book_id get_id_like_text (const std::string& text)
{
// Go through all known book names and abbreviations.
// Note how much the $text differs from the known names.
Expand All @@ -162,7 +162,7 @@ book_id get_id_like_text (const string & text)
}


book_id get_id_from_onlinebible (const string & onlinebible)
book_id get_id_from_onlinebible (const std::string& onlinebible)
{
for (unsigned int i = 0; i < data_count; i++) {
if (onlinebible == books_table[i].onlinebible) {
Expand Down
2 changes: 1 addition & 1 deletion database/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ void database_cache_trim (bool clear)


// This returns true if the $html can be cached.
bool database_cache_can_cache (const string & error, const string & html)
bool database_cache_can_cache (const std::string& error, const std::string& html)
{
// Normally if everything is fine, then caching is possible.
bool cache = true;
Expand Down
2 changes: 1 addition & 1 deletion database/config/user.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@ vector <string> Database_Config_User::getChangeNotificationsBibles ()
{
return getList (change_notifications_bibles_key ());
}
vector <string> Database_Config_User::getChangeNotificationsBiblesForUser (const string & user)
vector <string> Database_Config_User::getChangeNotificationsBiblesForUser (const std::string& user)
{
return getListForUser (user, change_notifications_bibles_key ());
}
Expand Down
2 changes: 1 addition & 1 deletion database/imageresources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ string Database_ImageResources::mainFolder ()
}


string Database_ImageResources::resourceFolder (const string& name)
string Database_ImageResources::resourceFolder (const std::string& name)
{
return filter_url_create_path ({mainFolder (), name});
}
Expand Down
6 changes: 3 additions & 3 deletions database/localization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ using namespace std;
// In case of corruption, upgrade Bibledit and it will recreate the database.


Database_Localization::Database_Localization (const string& language_in)
Database_Localization::Database_Localization (const std::string& language_in)
{
language = language_in;
}
Expand Down Expand Up @@ -67,7 +67,7 @@ void Database_Localization::create (string po)
}


string Database_Localization::translate (const string& english)
string Database_Localization::translate (const std::string& english)
{
SqliteSQL sql = SqliteSQL ();
sql.add ("SELECT msgstr FROM localization WHERE msgid =");
Expand All @@ -81,7 +81,7 @@ string Database_Localization::translate (const string& english)
}


string Database_Localization::backtranslate (const string& localization)
string Database_Localization::backtranslate (const std::string& localization)
{
SqliteSQL sql = SqliteSQL ();
sql.add ("SELECT msgid FROM localization WHERE msgstr =");
Expand Down
10 changes: 5 additions & 5 deletions database/mappings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void Database_Mappings::optimize ()
}


void Database_Mappings::import (const string& name, const string& data)
void Database_Mappings::import (const std::string& name, const std::string& data)
{
// Delete existing mapping with this name.
erase (name);
Expand Down Expand Up @@ -189,7 +189,7 @@ void Database_Mappings::import (const string& name, const string& data)


// Exports a mapping.
string Database_Mappings::output (const string& name)
string Database_Mappings::output (const std::string& name)
{
vector <string> data;
SqliteSQL sql = SqliteSQL ();
Expand Down Expand Up @@ -222,7 +222,7 @@ string Database_Mappings::output (const string& name)
}


void Database_Mappings::create (const string & name)
void Database_Mappings::create (const std::string& name)
{
// Insert one entry, so the $name makes it into the database.
SqliteSQL sql = SqliteSQL ();
Expand All @@ -235,7 +235,7 @@ void Database_Mappings::create (const string & name)
}


void Database_Mappings::erase (const string & name)
void Database_Mappings::erase (const std::string& name)
{
SqliteSQL sql = SqliteSQL ();
sql.add ("DELETE FROM maps WHERE name =");
Expand Down Expand Up @@ -277,7 +277,7 @@ string Database_Mappings::original ()
// It returns an array with one passage in most cases.
// When the verses in the $input and $output versifications overlap,
// it may return an array with two passages.
vector <Passage> Database_Mappings::translate (const string& input, const string& output, int book, int chapter, int verse)
vector <Passage> Database_Mappings::translate (const std::string& input, const std::string& output, int book, int chapter, int verse)
{
// Care for situation that the input and output are the same.
if (input == output) {
Expand Down
Loading

0 comments on commit dfe88f4

Please sign in to comment.