diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-08-10 16:15:11 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-08-10 16:15:11 -0400 |
commit | e6c087fb6c631d5acf16536356ebe5a72967c9b0 (patch) | |
tree | 69dc3215baa3330c76c016419f12f8498dbf3b05 /lib | |
parent | 494e19b3c27e6a1eb63b39c245ad4024702e883b (diff) | |
download | verbly-e6c087fb6c631d5acf16536356ebe5a72967c9b0.tar.gz verbly-e6c087fb6c631d5acf16536356ebe5a72967c9b0.tar.bz2 verbly-e6c087fb6c631d5acf16536356ebe5a72967c9b0.zip |
Replaced some split/implode uses with hkutil
Diffstat (limited to 'lib')
-rw-r--r-- | lib/form.cpp | 1 | ||||
-rw-r--r-- | lib/part.cpp | 8 | ||||
-rw-r--r-- | lib/pronunciation.cpp | 4 | ||||
-rw-r--r-- | lib/statement.cpp | 8 | ||||
-rw-r--r-- | lib/token.cpp | 12 | ||||
-rw-r--r-- | 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 @@ | |||
4 | #include "filter.h" | 4 | #include "filter.h" |
5 | #include "database.h" | 5 | #include "database.h" |
6 | #include "query.h" | 6 | #include "query.h" |
7 | #include "util.h" | ||
8 | 7 | ||
9 | namespace verbly { | 8 | namespace verbly { |
10 | 9 | ||
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 @@ | |||
1 | #include "part.h" | 1 | #include "part.h" |
2 | #include <stdexcept> | 2 | #include <stdexcept> |
3 | #include <sqlite3.h> | 3 | #include <sqlite3.h> |
4 | #include <hkutil/string.h> | ||
4 | #include "database.h" | 5 | #include "database.h" |
5 | #include "util.h" | ||
6 | 6 | ||
7 | namespace verbly { | 7 | namespace verbly { |
8 | 8 | ||
@@ -19,7 +19,7 @@ namespace verbly { | |||
19 | 19 | ||
20 | const field part::selrestr_field::selrestrJoin = field::joinField(object::part, "part_id", "selrestrs"); | 20 | const field part::selrestr_field::selrestrJoin = field::joinField(object::part, "part_id", "selrestrs"); |
21 | const field part::selrestr_field::selrestrField = field::stringField("selrestrs", "selrestr"); | 21 | const field part::selrestr_field::selrestrField = field::stringField("selrestrs", "selrestr"); |
22 | 22 | ||
23 | const field part::synrestr_field::synrestrJoin = field::joinField(object::part, "part_id", "synrestrs"); | 23 | const field part::synrestr_field::synrestrJoin = field::joinField(object::part, "part_id", "synrestrs"); |
24 | const field part::synrestr_field::synrestrField = field::stringField("synrestrs", "synrestr"); | 24 | const field part::synrestr_field::synrestrField = field::stringField("synrestrs", "synrestr"); |
25 | 25 | ||
@@ -91,8 +91,8 @@ namespace verbly { | |||
91 | case part_type::preposition: | 91 | case part_type::preposition: |
92 | { | 92 | { |
93 | std::string serializedChoices(reinterpret_cast<const char*>(sqlite3_column_blob(row, 5))); | 93 | std::string serializedChoices(reinterpret_cast<const char*>(sqlite3_column_blob(row, 5))); |
94 | new(&preposition_.choices) std::vector<std::string>(split<std::vector<std::string>>(serializedChoices, ",")); | 94 | new(&preposition_.choices) std::vector<std::string>(hatkirby::split<std::vector<std::string>>(serializedChoices, ",")); |
95 | 95 | ||
96 | preposition_.literal = (sqlite3_column_int(row, 6) == 1); | 96 | preposition_.literal = (sqlite3_column_int(row, 6) == 1); |
97 | 97 | ||
98 | break; | 98 | 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 @@ | |||
1 | #include "pronunciation.h" | 1 | #include "pronunciation.h" |
2 | #include <sqlite3.h> | 2 | #include <sqlite3.h> |
3 | #include <hkutil/string.h> | ||
3 | #include "form.h" | 4 | #include "form.h" |
4 | #include "word.h" | 5 | #include "word.h" |
5 | #include "util.h" | ||
6 | 6 | ||
7 | namespace verbly { | 7 | namespace verbly { |
8 | 8 | ||
@@ -27,7 +27,7 @@ namespace verbly { | |||
27 | id_ = sqlite3_column_int(row, 0); | 27 | id_ = sqlite3_column_int(row, 0); |
28 | 28 | ||
29 | std::string phonemesStr(reinterpret_cast<const char*>(sqlite3_column_text(row, 1))); | 29 | std::string phonemesStr(reinterpret_cast<const char*>(sqlite3_column_text(row, 1))); |
30 | phonemes_ = split<std::vector<std::string>>(phonemesStr, " "); | 30 | phonemes_ = hatkirby::split<std::vector<std::string>>(phonemesStr, " "); |
31 | 31 | ||
32 | syllables_ = sqlite3_column_int(row, 2); | 32 | syllables_ = sqlite3_column_int(row, 2); |
33 | stress_ = std::string(reinterpret_cast<const char*>(sqlite3_column_text(row, 3))); | 33 | stress_ = std::string(reinterpret_cast<const char*>(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 @@ | |||
1 | #include "statement.h" | 1 | #include "statement.h" |
2 | #include <sstream> | 2 | #include <sstream> |
3 | #include <utility> | 3 | #include <utility> |
4 | #include <hkutil/string.h> | ||
4 | #include "filter.h" | 5 | #include "filter.h" |
5 | #include "util.h" | ||
6 | #include "order.h" | 6 | #include "order.h" |
7 | 7 | ||
8 | namespace verbly { | 8 | namespace verbly { |
@@ -69,7 +69,7 @@ namespace verbly { | |||
69 | ctes.push_back(cteStream.str()); | 69 | ctes.push_back(cteStream.str()); |
70 | } | 70 | } |
71 | 71 | ||
72 | queryStream << implode(std::begin(ctes), std::end(ctes), ", "); | 72 | queryStream << hatkirby::implode(std::begin(ctes), std::end(ctes), ", "); |
73 | queryStream << " "; | 73 | queryStream << " "; |
74 | } | 74 | } |
75 | 75 | ||
@@ -80,7 +80,7 @@ namespace verbly { | |||
80 | } | 80 | } |
81 | 81 | ||
82 | queryStream << "SELECT "; | 82 | queryStream << "SELECT "; |
83 | queryStream << implode(std::begin(realSelect), std::end(realSelect), ", "); | 83 | queryStream << hatkirby::implode(std::begin(realSelect), std::end(realSelect), ", "); |
84 | queryStream << " FROM "; | 84 | queryStream << " FROM "; |
85 | queryStream << tables_.at(topTable_); | 85 | queryStream << tables_.at(topTable_); |
86 | queryStream << " AS "; | 86 | queryStream << " AS "; |
@@ -1069,7 +1069,7 @@ namespace verbly { | |||
1069 | { | 1069 | { |
1070 | return clauses.front(); | 1070 | return clauses.front(); |
1071 | } else { | 1071 | } else { |
1072 | std::string result = implode(std::begin(clauses), std::end(clauses), group_.orlogic_ ? " OR " : " AND "); | 1072 | std::string result = hatkirby::implode(std::begin(clauses), std::end(clauses), group_.orlogic_ ? " OR " : " AND "); |
1073 | 1073 | ||
1074 | if (toplevel) | 1074 | if (toplevel) |
1075 | { | 1075 | { |
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 @@ | |||
1 | #include "token.h" | 1 | #include "token.h" |
2 | #include <stdexcept> | 2 | #include <stdexcept> |
3 | #include <algorithm> | 3 | #include <algorithm> |
4 | #include "util.h" | 4 | #include <hkutil/string.h> |
5 | 5 | ||
6 | namespace verbly { | 6 | namespace verbly { |
7 | 7 | ||
@@ -359,7 +359,7 @@ namespace verbly { | |||
359 | } else if (capitalization == casing::title_case) | 359 | } else if (capitalization == casing::title_case) |
360 | { | 360 | { |
361 | std::list<std::string> swords = | 361 | std::list<std::string> swords = |
362 | split<std::list<std::string>>(result, " "); | 362 | hatkirby::split<std::list<std::string>>(result, " "); |
363 | 363 | ||
364 | for (std::string& sword : swords) | 364 | for (std::string& sword : swords) |
365 | { | 365 | { |
@@ -369,7 +369,7 @@ namespace verbly { | |||
369 | } | 369 | } |
370 | } | 370 | } |
371 | 371 | ||
372 | result = implode(std::begin(swords), std::end(swords), " "); | 372 | result = hatkirby::implode(std::begin(swords), std::end(swords), " "); |
373 | } else if (capitalization == casing::all_caps) | 373 | } else if (capitalization == casing::all_caps) |
374 | { | 374 | { |
375 | for (char& ch : result) | 375 | for (char& ch : result) |
@@ -410,7 +410,7 @@ namespace verbly { | |||
410 | } else if (capitalization == casing::title_case) | 410 | } else if (capitalization == casing::title_case) |
411 | { | 411 | { |
412 | std::list<std::string> swords = | 412 | std::list<std::string> swords = |
413 | split<std::list<std::string>>(result, " "); | 413 | hatkirby::split<std::list<std::string>>(result, " "); |
414 | 414 | ||
415 | for (std::string& sword : swords) | 415 | for (std::string& sword : swords) |
416 | { | 416 | { |
@@ -420,7 +420,7 @@ namespace verbly { | |||
420 | } | 420 | } |
421 | } | 421 | } |
422 | 422 | ||
423 | result = implode(std::begin(swords), std::end(swords), " "); | 423 | result = hatkirby::implode(std::begin(swords), std::end(swords), " "); |
424 | } else if (capitalization == casing::all_caps) | 424 | } else if (capitalization == casing::all_caps) |
425 | { | 425 | { |
426 | for (char& ch : result) | 426 | for (char& ch : result) |
@@ -458,7 +458,7 @@ namespace verbly { | |||
458 | first = false; | 458 | first = false; |
459 | } | 459 | } |
460 | 460 | ||
461 | return implode(std::begin(compiled), std::end(compiled), separator); | 461 | return hatkirby::implode(std::begin(compiled), std::end(compiled), separator); |
462 | } | 462 | } |
463 | 463 | ||
464 | case type::transform: | 464 | 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 @@ | |||
1 | #ifndef VERBLY_H_5B39CE50 | 1 | #ifndef VERBLY_H_5B39CE50 |
2 | #define VERBLY_H_5B39CE50 | 2 | #define VERBLY_H_5B39CE50 |
3 | 3 | ||
4 | #include "util.h" | ||
5 | #include "database.h" | 4 | #include "database.h" |
6 | #include "filter.h" | 5 | #include "filter.h" |
7 | #include "field.h" | 6 | #include "field.h" |