diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2022-12-14 10:12:03 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2022-12-14 10:12:03 -0500 |
commit | c498cfa5cfd6408b465e45409987467b47b2b73d (patch) | |
tree | dae79502ee523128375a3d67ff668b6a18228300 /lib | |
parent | 6816abc1e89fd955524d7c772477d6483d12cbf9 (diff) | |
download | verbly-c498cfa5cfd6408b465e45409987467b47b2b73d.tar.gz verbly-c498cfa5cfd6408b465e45409987467b47b2b73d.tar.bz2 verbly-c498cfa5cfd6408b465e45409987467b47b2b73d.zip |
Fixed uncopyable word class
Diffstat (limited to 'lib')
-rw-r--r-- | lib/word.cpp | 9 | ||||
-rw-r--r-- | lib/word.h | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/word.cpp b/lib/word.cpp index 60657ba..2fccb9f 100644 --- a/lib/word.cpp +++ b/lib/word.cpp | |||
@@ -44,7 +44,7 @@ namespace verbly { | |||
44 | return field::joinThroughWhere(object::word, "lemma_id", object::form, "lemmas_forms", "form_id", "category", static_cast<int>(category)); | 44 | return field::joinThroughWhere(object::word, "lemma_id", object::form, "lemmas_forms", "form_id", "category", static_cast<int>(category)); |
45 | } | 45 | } |
46 | 46 | ||
47 | word::word(const database& db, hatkirby::row row) : db_(db), valid_(true) | 47 | word::word(const database& db, hatkirby::row row) : db_(&db), valid_(true) |
48 | { | 48 | { |
49 | id_ = mpark::get<int>(row[0]); | 49 | id_ = mpark::get<int>(row[0]); |
50 | 50 | ||
@@ -104,7 +104,12 @@ namespace verbly { | |||
104 | 104 | ||
105 | void word::initializeForm(inflection infl) const | 105 | void word::initializeForm(inflection infl) const |
106 | { | 106 | { |
107 | forms_[infl] = db_.forms(form::words(infl) %= *this, verbly::form::id, -1).all(); | 107 | if (!db_) |
108 | { | ||
109 | throw std::domain_error("Database not present"); | ||
110 | } | ||
111 | |||
112 | forms_[infl] = db_->forms(form::words(infl) %= *this, verbly::form::id, -1).all(); | ||
108 | } | 113 | } |
109 | 114 | ||
110 | filter word::synonyms_field::operator%=(filter joinCondition) const | 115 | filter word::synonyms_field::operator%=(filter joinCondition) const |
diff --git a/lib/word.h b/lib/word.h index f52cc4d..6c3a5d7 100644 --- a/lib/word.h +++ b/lib/word.h | |||
@@ -214,7 +214,7 @@ namespace verbly { | |||
214 | std::vector<frame> frames_; | 214 | std::vector<frame> frames_; |
215 | mutable std::map<inflection, std::vector<form>> forms_; | 215 | mutable std::map<inflection, std::vector<form>> forms_; |
216 | 216 | ||
217 | const database& db_; | 217 | const database* db_ = nullptr; |
218 | }; | 218 | }; |
219 | 219 | ||
220 | }; | 220 | }; |