diff options
Diffstat (limited to 'lib/pronunciation.cpp')
-rw-r--r-- | lib/pronunciation.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/pronunciation.cpp b/lib/pronunciation.cpp index 1f36899..3aef815 100644 --- a/lib/pronunciation.cpp +++ b/lib/pronunciation.cpp | |||
@@ -1,5 +1,4 @@ | |||
1 | #include "pronunciation.h" | 1 | #include "pronunciation.h" |
2 | #include <sqlite3.h> | ||
3 | #include <hkutil/string.h> | 2 | #include <hkutil/string.h> |
4 | #include "form.h" | 3 | #include "form.h" |
5 | #include "word.h" | 4 | #include "word.h" |
@@ -22,22 +21,27 @@ namespace verbly { | |||
22 | const field pronunciation::rhymes_field::rhymeJoin = field::joinField(object::pronunciation, "rhyme", object::pronunciation); | 21 | const field pronunciation::rhymes_field::rhymeJoin = field::joinField(object::pronunciation, "rhyme", object::pronunciation); |
23 | const pronunciation::rhymes_field pronunciation::rhymes = {}; | 22 | const pronunciation::rhymes_field pronunciation::rhymes = {}; |
24 | 23 | ||
25 | pronunciation::pronunciation(const database& db, sqlite3_stmt* row) : db_(&db), valid_(true) | 24 | pronunciation::pronunciation( |
25 | const database& db, | ||
26 | hatkirby::row row) : | ||
27 | valid_(true) | ||
26 | { | 28 | { |
27 | id_ = sqlite3_column_int(row, 0); | 29 | id_ = mpark::get<int>(row[0]); |
28 | 30 | ||
29 | std::string phonemesStr(reinterpret_cast<const char*>(sqlite3_column_text(row, 1))); | 31 | phonemes_ = |
30 | phonemes_ = hatkirby::split<std::vector<std::string>>(phonemesStr, " "); | 32 | hatkirby::split<std::vector<std::string>>( |
33 | mpark::get<std::string>(row[1]), | ||
34 | " "); | ||
31 | 35 | ||
32 | syllables_ = sqlite3_column_int(row, 2); | 36 | syllables_ = mpark::get<int>(row[2]); |
33 | stress_ = std::string(reinterpret_cast<const char*>(sqlite3_column_text(row, 3))); | 37 | stress_ = mpark::get<std::string>(row[3]); |
34 | 38 | ||
35 | if (sqlite3_column_type(row, 5) != SQLITE_NULL) | 39 | if (!mpark::holds_alternative<std::nullptr_t>(row[5])) |
36 | { | 40 | { |
37 | hasRhyme_ = true; | 41 | hasRhyme_ = true; |
38 | 42 | ||
39 | prerhyme_ = std::string(reinterpret_cast<const char*>(sqlite3_column_text(row, 4))); | 43 | prerhyme_ = mpark::get<std::string>(row[4]); |
40 | rhyme_ = std::string(reinterpret_cast<const char*>(sqlite3_column_text(row, 5))); | 44 | rhyme_ = mpark::get<std::string>(row[5]); |
41 | } | 45 | } |
42 | } | 46 | } |
43 | 47 | ||