diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2022-12-14 10:19:40 -0500 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2022-12-14 10:19:40 -0500 |
| commit | 6218b88920120dea23d605856b9d27f9deb4746c (patch) | |
| tree | 657840cc60749db1e8ee453593211cd336462e98 /lib/part.cpp | |
| parent | c498cfa5cfd6408b465e45409987467b47b2b73d (diff) | |
| download | verbly-6218b88920120dea23d605856b9d27f9deb4746c.tar.gz verbly-6218b88920120dea23d605856b9d27f9deb4746c.tar.bz2 verbly-6218b88920120dea23d605856b9d27f9deb4746c.zip | |
Migrate from mpark::variant to std::variant
Diffstat (limited to 'lib/part.cpp')
| -rw-r--r-- | lib/part.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
| diff --git a/lib/part.cpp b/lib/part.cpp index bd8501a..2f9db87 100644 --- a/lib/part.cpp +++ b/lib/part.cpp | |||
| @@ -76,16 +76,16 @@ namespace verbly { | |||
| 76 | 76 | ||
| 77 | part::part(const database& db, hatkirby::row row) | 77 | part::part(const database& db, hatkirby::row row) |
| 78 | { | 78 | { |
| 79 | int id = mpark::get<int>(row[0]); | 79 | int id = std::get<int>(row[0]); |
| 80 | 80 | ||
| 81 | type_ = static_cast<part_type>(mpark::get<int>(row[3])); | 81 | type_ = static_cast<part_type>(std::get<int>(row[3])); |
| 82 | 82 | ||
| 83 | switch (type_) | 83 | switch (type_) |
| 84 | { | 84 | { |
| 85 | case part_type::noun_phrase: | 85 | case part_type::noun_phrase: |
| 86 | { | 86 | { |
| 87 | variant_ = np_type { | 87 | variant_ = np_type { |
| 88 | mpark::get<std::string>(row[4]), | 88 | std::get<std::string>(row[4]), |
| 89 | db.selrestrs(id), | 89 | db.selrestrs(id), |
| 90 | db.synrestrs(id) | 90 | db.synrestrs(id) |
| 91 | }; | 91 | }; |
| @@ -96,7 +96,7 @@ namespace verbly { | |||
| 96 | case part_type::preposition: | 96 | case part_type::preposition: |
| 97 | { | 97 | { |
| 98 | hatkirby::blob_type raw = | 98 | hatkirby::blob_type raw = |
| 99 | mpark::get<hatkirby::blob_type>(row[5]); | 99 | std::get<hatkirby::blob_type>(row[5]); |
| 100 | 100 | ||
| 101 | std::string serializedChoices( | 101 | std::string serializedChoices( |
| 102 | std::begin(raw), | 102 | std::begin(raw), |
| @@ -106,7 +106,7 @@ namespace verbly { | |||
| 106 | hatkirby::split<std::vector<std::string>>( | 106 | hatkirby::split<std::vector<std::string>>( |
| 107 | std::move(serializedChoices), | 107 | std::move(serializedChoices), |
| 108 | ","), | 108 | ","), |
| 109 | (mpark::get<int>(row[6]) == 1) | 109 | (std::get<int>(row[6]) == 1) |
| 110 | }; | 110 | }; |
| 111 | 111 | ||
| 112 | break; | 112 | break; |
| @@ -114,7 +114,7 @@ namespace verbly { | |||
| 114 | 114 | ||
| 115 | case part_type::literal: | 115 | case part_type::literal: |
| 116 | { | 116 | { |
| 117 | variant_ = mpark::get<std::string>(row[7]); | 117 | variant_ = std::get<std::string>(row[7]); |
| 118 | 118 | ||
| 119 | break; | 119 | break; |
| 120 | } | 120 | } |
| @@ -136,7 +136,7 @@ namespace verbly { | |||
| 136 | throw std::domain_error("part is not a noun phrase"); | 136 | throw std::domain_error("part is not a noun phrase"); |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | return mpark::get<np_type>(variant_).role; | 139 | return std::get<np_type>(variant_).role; |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | const std::set<std::string>& part::getNounSelrestrs() const | 142 | const std::set<std::string>& part::getNounSelrestrs() const |
| @@ -146,7 +146,7 @@ namespace verbly { | |||
| 146 | throw std::domain_error("part is not a noun phrase"); | 146 | throw std::domain_error("part is not a noun phrase"); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | return mpark::get<np_type>(variant_).selrestrs; | 149 | return std::get<np_type>(variant_).selrestrs; |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | const std::set<std::string>& part::getNounSynrestrs() const | 152 | const std::set<std::string>& part::getNounSynrestrs() const |
| @@ -156,7 +156,7 @@ namespace verbly { | |||
| 156 | throw std::domain_error("part is not a noun phrase"); | 156 | throw std::domain_error("part is not a noun phrase"); |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | return mpark::get<np_type>(variant_).synrestrs; | 159 | return std::get<np_type>(variant_).synrestrs; |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | bool part::nounHasSynrestr(std::string synrestr) const | 162 | bool part::nounHasSynrestr(std::string synrestr) const |
| @@ -166,7 +166,7 @@ namespace verbly { | |||
| 166 | throw std::domain_error("part is not a noun phrase"); | 166 | throw std::domain_error("part is not a noun phrase"); |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | return mpark::get<np_type>(variant_).synrestrs.count(synrestr); | 169 | return std::get<np_type>(variant_).synrestrs.count(synrestr); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | const std::vector<std::string>& part::getPrepositionChoices() const | 172 | const std::vector<std::string>& part::getPrepositionChoices() const |
| @@ -176,7 +176,7 @@ namespace verbly { | |||
| 176 | throw std::domain_error("part is not a preposition"); | 176 | throw std::domain_error("part is not a preposition"); |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | return mpark::get<prep_type>(variant_).choices; | 179 | return std::get<prep_type>(variant_).choices; |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | bool part::isPrepositionLiteral() const | 182 | bool part::isPrepositionLiteral() const |
| @@ -186,7 +186,7 @@ namespace verbly { | |||
| 186 | throw std::domain_error("part is not a preposition"); | 186 | throw std::domain_error("part is not a preposition"); |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | return mpark::get<prep_type>(variant_).literal; | 189 | return std::get<prep_type>(variant_).literal; |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | const std::string& part::getLiteralValue() const | 192 | const std::string& part::getLiteralValue() const |
| @@ -196,7 +196,7 @@ namespace verbly { | |||
| 196 | throw std::domain_error("part is not a literal"); | 196 | throw std::domain_error("part is not a literal"); |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | return mpark::get<std::string>(variant_); | 199 | return std::get<std::string>(variant_); |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | filter part::synrestr_field::operator%=(std::string synrestr) const | 202 | filter part::synrestr_field::operator%=(std::string synrestr) const |
