From e6c087fb6c631d5acf16536356ebe5a72967c9b0 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 10 Aug 2018 16:15:11 -0400 Subject: Replaced some split/implode uses with hkutil --- lib/form.cpp | 1 - lib/part.cpp | 8 ++++---- lib/pronunciation.cpp | 4 ++-- lib/statement.cpp | 8 ++++---- lib/token.cpp | 12 ++++++------ lib/verbly.h | 1 - 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/lib/form.cpp b/lib/form.cpp index feaf765..b2c424d 100644 --- a/lib/form.cpp +++ b/lib/form.cpp @@ -4,7 +4,6 @@ #include "filter.h" #include "database.h" #include "query.h" -#include "util.h" namespace verbly { diff --git a/lib/part.cpp b/lib/part.cpp index 341d4bb..e7e467b 100644 --- a/lib/part.cpp +++ b/lib/part.cpp @@ -1,8 +1,8 @@ #include "part.h" #include #include +#include #include "database.h" -#include "util.h" namespace verbly { @@ -19,7 +19,7 @@ namespace verbly { const field part::selrestr_field::selrestrJoin = field::joinField(object::part, "part_id", "selrestrs"); const field part::selrestr_field::selrestrField = field::stringField("selrestrs", "selrestr"); - + const field part::synrestr_field::synrestrJoin = field::joinField(object::part, "part_id", "synrestrs"); const field part::synrestr_field::synrestrField = field::stringField("synrestrs", "synrestr"); @@ -91,8 +91,8 @@ namespace verbly { case part_type::preposition: { std::string serializedChoices(reinterpret_cast(sqlite3_column_blob(row, 5))); - new(&preposition_.choices) std::vector(split>(serializedChoices, ",")); - + new(&preposition_.choices) std::vector(hatkirby::split>(serializedChoices, ",")); + preposition_.literal = (sqlite3_column_int(row, 6) == 1); break; diff --git a/lib/pronunciation.cpp b/lib/pronunciation.cpp index fa471ec..1f36899 100644 --- a/lib/pronunciation.cpp +++ b/lib/pronunciation.cpp @@ -1,8 +1,8 @@ #include "pronunciation.h" #include +#include #include "form.h" #include "word.h" -#include "util.h" namespace verbly { @@ -27,7 +27,7 @@ namespace verbly { id_ = sqlite3_column_int(row, 0); std::string phonemesStr(reinterpret_cast(sqlite3_column_text(row, 1))); - phonemes_ = split>(phonemesStr, " "); + phonemes_ = hatkirby::split>(phonemesStr, " "); syllables_ = sqlite3_column_int(row, 2); stress_ = std::string(reinterpret_cast(sqlite3_column_text(row, 3))); diff --git a/lib/statement.cpp b/lib/statement.cpp index 5dd3789..ac83084 100644 --- a/lib/statement.cpp +++ b/lib/statement.cpp @@ -1,8 +1,8 @@ #include "statement.h" #include #include +#include #include "filter.h" -#include "util.h" #include "order.h" namespace verbly { @@ -69,7 +69,7 @@ namespace verbly { ctes.push_back(cteStream.str()); } - queryStream << implode(std::begin(ctes), std::end(ctes), ", "); + queryStream << hatkirby::implode(std::begin(ctes), std::end(ctes), ", "); queryStream << " "; } @@ -80,7 +80,7 @@ namespace verbly { } queryStream << "SELECT "; - queryStream << implode(std::begin(realSelect), std::end(realSelect), ", "); + queryStream << hatkirby::implode(std::begin(realSelect), std::end(realSelect), ", "); queryStream << " FROM "; queryStream << tables_.at(topTable_); queryStream << " AS "; @@ -1069,7 +1069,7 @@ namespace verbly { { return clauses.front(); } else { - std::string result = implode(std::begin(clauses), std::end(clauses), group_.orlogic_ ? " OR " : " AND "); + std::string result = hatkirby::implode(std::begin(clauses), std::end(clauses), group_.orlogic_ ? " OR " : " AND "); if (toplevel) { diff --git a/lib/token.cpp b/lib/token.cpp index 945be5e..7b1d1fa 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -1,7 +1,7 @@ #include "token.h" #include #include -#include "util.h" +#include namespace verbly { @@ -359,7 +359,7 @@ namespace verbly { } else if (capitalization == casing::title_case) { std::list swords = - split>(result, " "); + hatkirby::split>(result, " "); for (std::string& sword : swords) { @@ -369,7 +369,7 @@ namespace verbly { } } - result = implode(std::begin(swords), std::end(swords), " "); + result = hatkirby::implode(std::begin(swords), std::end(swords), " "); } else if (capitalization == casing::all_caps) { for (char& ch : result) @@ -410,7 +410,7 @@ namespace verbly { } else if (capitalization == casing::title_case) { std::list swords = - split>(result, " "); + hatkirby::split>(result, " "); for (std::string& sword : swords) { @@ -420,7 +420,7 @@ namespace verbly { } } - result = implode(std::begin(swords), std::end(swords), " "); + result = hatkirby::implode(std::begin(swords), std::end(swords), " "); } else if (capitalization == casing::all_caps) { for (char& ch : result) @@ -458,7 +458,7 @@ namespace verbly { first = false; } - return implode(std::begin(compiled), std::end(compiled), separator); + return hatkirby::implode(std::begin(compiled), std::end(compiled), separator); } case type::transform: diff --git a/lib/verbly.h b/lib/verbly.h index 5bf204d..c002d3e 100644 --- a/lib/verbly.h +++ b/lib/verbly.h @@ -1,7 +1,6 @@ #ifndef VERBLY_H_5B39CE50 #define VERBLY_H_5B39CE50 -#include "util.h" #include "database.h" #include "filter.h" #include "field.h" -- cgit 1.4.1