From e4fe5974f123cfba6d8eff908e7f1772b0b9635f Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 14 Dec 2022 10:19:40 -0500 Subject: Migrate from mpark::variant to std::variant --- CMakeLists.txt | 7 +-- lib/database.cpp | 8 ++-- lib/filter.cpp | 118 +++++++++++++++++++++++++------------------------- lib/filter.h | 10 ++--- lib/form.cpp | 10 ++--- lib/frame.cpp | 6 +-- lib/notion.cpp | 12 ++--- lib/part.cpp | 26 +++++------ lib/part.h | 6 +-- lib/pronunciation.cpp | 14 +++--- lib/statement.cpp | 56 ++++++++++++------------ lib/statement.h | 10 ++--- lib/token.cpp | 40 ++++++++--------- lib/token.h | 6 +-- lib/word.cpp | 14 +++--- vendor/hkutil | 2 +- 16 files changed, 171 insertions(+), 174 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2adad19..e00b490 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,6 @@ project (verbly) find_package(PkgConfig) pkg_check_modules(sqlite3 sqlite3>=3.8.3 REQUIRED) -set(CMAKE_BUILD_TYPE Debug) - add_library(verbly lib/filter.cpp lib/field.cpp @@ -21,9 +19,8 @@ add_library(verbly target_include_directories(verbly PUBLIC lib - vendor/hkutil - vendor/hkutil/vendor) + vendor/hkutil) -set_property(TARGET verbly PROPERTY CXX_STANDARD 11) +set_property(TARGET verbly PROPERTY CXX_STANDARD 17) set_property(TARGET verbly PROPERTY CXX_STANDARD_REQUIRED ON) target_link_libraries(verbly ${sqlite3_LIBRARIES}) diff --git a/lib/database.cpp b/lib/database.cpp index 96eed45..d5ff37e 100644 --- a/lib/database.cpp +++ b/lib/database.cpp @@ -12,8 +12,8 @@ namespace verbly { hatkirby::row version = ppdb_.queryFirst("SELECT major, minor FROM version"); - major_ = mpark::get(version[0]); - minor_ = mpark::get(version[1]); + major_ = std::get(version[0]); + minor_ = std::get(version[1]); if (major_ != DATABASE_MAJOR_VERSION) { @@ -62,7 +62,7 @@ namespace verbly { for (hatkirby::row& r : rows) { - result.emplace(std::move(mpark::get(r[0]))); + result.emplace(std::move(std::get(r[0]))); } return result; @@ -79,7 +79,7 @@ namespace verbly { for (hatkirby::row& r : rows) { - result.emplace(std::move(mpark::get(r[0]))); + result.emplace(std::move(std::get(r[0]))); } return result; diff --git a/lib/filter.cpp b/lib/filter.cpp index 592b190..e3174ce 100644 --- a/lib/filter.cpp +++ b/lib/filter.cpp @@ -377,7 +377,7 @@ namespace verbly { throw std::domain_error("This filter does not have a field"); } - return mpark::get(variant_).filterField; + return std::get(variant_).filterField; } filter::comparison filter::getComparison() const @@ -387,7 +387,7 @@ namespace verbly { throw std::domain_error("This filter does not have a comparison"); } - return mpark::get(variant_).filterType; + return std::get(variant_).filterType; } filter filter::getJoinCondition() const @@ -397,7 +397,7 @@ namespace verbly { throw std::domain_error("This filter does not have a join condition"); } - const singleton_type& ss = mpark::get(variant_); + const singleton_type& ss = std::get(variant_); switch (ss.filterType) { @@ -406,7 +406,7 @@ namespace verbly { case comparison::hierarchally_matches: case comparison::does_not_hierarchally_match: { - return *mpark::get(ss.data); + return *std::get(ss.data); } case comparison::string_equals: @@ -437,7 +437,7 @@ namespace verbly { throw std::domain_error("This filter does not have a string argument"); } - const singleton_type& ss = mpark::get(variant_); + const singleton_type& ss = std::get(variant_); switch (ss.filterType) { @@ -446,7 +446,7 @@ namespace verbly { case comparison::string_is_like: case comparison::string_is_not_like: { - return mpark::get(ss.data); + return std::get(ss.data); } case comparison::int_equals: @@ -477,7 +477,7 @@ namespace verbly { throw std::domain_error("This filter does not have an integer argument"); } - const singleton_type& ss = mpark::get(variant_); + const singleton_type& ss = std::get(variant_); switch (ss.filterType) { @@ -488,7 +488,7 @@ namespace verbly { case comparison::int_is_at_most: case comparison::int_is_less_than: { - return mpark::get(ss.data); + return std::get(ss.data); } case comparison::string_equals: @@ -514,13 +514,13 @@ namespace verbly { bool filter::getBooleanArgument() const { if ((type_ != type::singleton) || - (mpark::get(variant_).filterType != + (std::get(variant_).filterType != comparison::boolean_equals)) { throw std::domain_error("This filter does not have a boolean argument"); } - return mpark::get(mpark::get(variant_).data); + return std::get(std::get(variant_).data); } field filter::getCompareField() const @@ -530,14 +530,14 @@ namespace verbly { throw std::domain_error("This filter does not have a compare field"); } - const singleton_type& ss = mpark::get(variant_); + const singleton_type& ss = std::get(variant_); switch (ss.filterType) { case comparison::field_equals: case comparison::field_does_not_equal: { - return mpark::get(ss.data); + return std::get(ss.data); break; } @@ -579,7 +579,7 @@ namespace verbly { throw std::domain_error("This filter is not a group filter"); } - return mpark::get(variant_).orlogic; + return std::get(variant_).orlogic; } filter filter::operator+(filter condition) const @@ -597,7 +597,7 @@ namespace verbly { throw std::domain_error("Children can only be added to group filters"); } - mpark::get(variant_).children.push_back(std::move(condition)); + std::get(variant_).children.push_back(std::move(condition)); return *this; } @@ -609,7 +609,7 @@ namespace verbly { throw std::domain_error("This filter has no children"); } - return std::begin(mpark::get(variant_).children); + return std::begin(std::get(variant_).children); } filter::const_iterator filter::end() const @@ -619,7 +619,7 @@ namespace verbly { throw std::domain_error("This filter has no children"); } - return std::end(mpark::get(variant_).children); + return std::end(std::get(variant_).children); } filter::filter( @@ -642,7 +642,7 @@ namespace verbly { throw std::domain_error("This filter is not a mask filter"); } - return mpark::get(variant_).name; + return std::get(variant_).name; } bool filter::isMaskInternal() const @@ -652,7 +652,7 @@ namespace verbly { throw std::domain_error("This filter is not a mask filter"); } - return mpark::get(variant_).internal; + return std::get(variant_).internal; } const filter& filter::getMaskFilter() const @@ -662,7 +662,7 @@ namespace verbly { throw std::domain_error("This filter is not a mask filter"); } - return *mpark::get(variant_).subfilter; + return *std::get(variant_).subfilter; } filter filter::operator!() const @@ -676,7 +676,7 @@ namespace verbly { case type::singleton: { - const singleton_type& ss = mpark::get(variant_); + const singleton_type& ss = std::get(variant_); switch (ss.filterType) { @@ -685,7 +685,7 @@ namespace verbly { return filter( ss.filterField, comparison::int_does_not_equal, - mpark::get(ss.data)); + std::get(ss.data)); } case comparison::int_does_not_equal: @@ -693,7 +693,7 @@ namespace verbly { return filter( ss.filterField, comparison::int_equals, - mpark::get(ss.data)); + std::get(ss.data)); } case comparison::int_is_at_least: @@ -701,7 +701,7 @@ namespace verbly { return filter( ss.filterField, comparison::int_is_less_than, - mpark::get(ss.data)); + std::get(ss.data)); } case comparison::int_is_greater_than: @@ -709,7 +709,7 @@ namespace verbly { return filter( ss.filterField, comparison::int_is_at_most, - mpark::get(ss.data)); + std::get(ss.data)); } case comparison::int_is_at_most: @@ -717,7 +717,7 @@ namespace verbly { return filter( ss.filterField, comparison::int_is_greater_than, - mpark::get(ss.data)); + std::get(ss.data)); } case comparison::int_is_less_than: @@ -725,7 +725,7 @@ namespace verbly { return filter( ss.filterField, comparison::int_is_at_least, - mpark::get(ss.data)); + std::get(ss.data)); } case comparison::boolean_equals: @@ -733,7 +733,7 @@ namespace verbly { return filter( ss.filterField, comparison::boolean_equals, - !mpark::get(ss.data)); + !std::get(ss.data)); } case comparison::string_equals: @@ -741,7 +741,7 @@ namespace verbly { return filter( ss.filterField, comparison::string_does_not_equal, - mpark::get(ss.data)); + std::get(ss.data)); } case comparison::string_does_not_equal: @@ -749,7 +749,7 @@ namespace verbly { return filter( ss.filterField, comparison::string_equals, - mpark::get(ss.data)); + std::get(ss.data)); } case comparison::string_is_like: @@ -757,7 +757,7 @@ namespace verbly { return filter( ss.filterField, comparison::string_is_not_like, - mpark::get(ss.data)); + std::get(ss.data)); } case comparison::string_is_not_like: @@ -765,7 +765,7 @@ namespace verbly { return filter( ss.filterField, comparison::string_is_like, - mpark::get(ss.data)); + std::get(ss.data)); } case comparison::is_null: @@ -787,7 +787,7 @@ namespace verbly { return filter( ss.filterField, comparison::does_not_match, - *mpark::get(ss.data)); + *std::get(ss.data)); } case comparison::does_not_match: @@ -795,7 +795,7 @@ namespace verbly { return filter( ss.filterField, comparison::matches, - *mpark::get(ss.data)); + *std::get(ss.data)); } case comparison::hierarchally_matches: @@ -803,7 +803,7 @@ namespace verbly { return filter( ss.filterField, comparison::does_not_hierarchally_match, - *mpark::get(ss.data)); + *std::get(ss.data)); } case comparison::does_not_hierarchally_match: @@ -811,7 +811,7 @@ namespace verbly { return filter( ss.filterField, comparison::hierarchally_matches, - *mpark::get(ss.data)); + *std::get(ss.data)); } case comparison::field_equals: @@ -819,7 +819,7 @@ namespace verbly { return filter( ss.filterField, comparison::field_does_not_equal, - mpark::get(ss.data)); + std::get(ss.data)); } case comparison::field_does_not_equal: @@ -827,14 +827,14 @@ namespace verbly { return filter( ss.filterField, comparison::field_equals, - mpark::get(ss.data)); + std::get(ss.data)); } } } case type::group: { - const group_type& gg = mpark::get(variant_); + const group_type& gg = std::get(variant_); filter result(!gg.orlogic); @@ -848,7 +848,7 @@ namespace verbly { case type::mask: { - const mask_type& mm = mpark::get(variant_); + const mask_type& mm = std::get(variant_); return {mm.name, mm.internal, !*mm.subfilter}; } @@ -879,7 +879,7 @@ namespace verbly { { filter result(false); - group_type& gg = mpark::get(result.variant_); + group_type& gg = std::get(result.variant_); gg.children.push_back(*this); gg.children.push_back(std::move(condition)); @@ -889,13 +889,13 @@ namespace verbly { case type::group: { - const group_type& og = mpark::get(variant_); + const group_type& og = std::get(variant_); if (og.orlogic) { filter result(false); - group_type& gg = mpark::get(result.variant_); + group_type& gg = std::get(result.variant_); gg.children.push_back(*this); gg.children.push_back(std::move(condition)); @@ -904,7 +904,7 @@ namespace verbly { } else { filter result(*this); - group_type& gg = mpark::get(result.variant_); + group_type& gg = std::get(result.variant_); gg.children.push_back(std::move(condition)); @@ -928,7 +928,7 @@ namespace verbly { { filter result(true); - group_type& gg = mpark::get(result.variant_); + group_type& gg = std::get(result.variant_); gg.children.push_back(*this); gg.children.push_back(std::move(condition)); @@ -938,13 +938,13 @@ namespace verbly { case type::group: { - const group_type& og = mpark::get(variant_); + const group_type& og = std::get(variant_); if (!og.orlogic) { filter result(true); - group_type& gg = mpark::get(result.variant_); + group_type& gg = std::get(result.variant_); gg.children.push_back(*this); gg.children.push_back(std::move(condition)); @@ -953,7 +953,7 @@ namespace verbly { } else { filter result(*this); - group_type& gg = mpark::get(result.variant_); + group_type& gg = std::get(result.variant_); gg.children.push_back(std::move(condition)); @@ -980,7 +980,7 @@ namespace verbly { case type::singleton: { - const singleton_type& ss = mpark::get(variant_); + const singleton_type& ss = std::get(variant_); // First, switch on the normalized context, and then switch on the // current context. We recursively recontextualize by using the @@ -1147,7 +1147,7 @@ namespace verbly { case type::group: { - const group_type& gg = mpark::get(variant_); + const group_type& gg = std::get(variant_); filter result(gg.orlogic); std::map positiveJoins; @@ -1166,7 +1166,7 @@ namespace verbly { case type::singleton: { singleton_type& normSing = - mpark::get(normalized.variant_); + std::get(normalized.variant_); switch (normalized.getComparison()) { @@ -1178,7 +1178,7 @@ namespace verbly { } positiveJoins.at(normalized.getField()) += - std::move(*mpark::get(normSing.data)); + std::move(*std::get(normSing.data)); break; } @@ -1192,7 +1192,7 @@ namespace verbly { } negativeJoins.at(normalized.getField()) += - std::move(*mpark::get(normSing.data)); + std::move(*std::get(normSing.data)); break; } @@ -1202,7 +1202,7 @@ namespace verbly { if (gg.orlogic) { positiveJoins[normalized.getField()] |= - std::move(*mpark::get(normSing.data)); + std::move(*std::get(normSing.data)); } else { result += std::move(normalized); } @@ -1215,7 +1215,7 @@ namespace verbly { if (!gg.orlogic) { negativeJoins[normalized.getField()] |= - std::move(*mpark::get(normSing.data)); + std::move(*std::get(normSing.data)); } else { result += std::move(normalized); } @@ -1259,7 +1259,7 @@ namespace verbly { case type::mask: { mask_type& normMask = - mpark::get(normalized.variant_); + std::get(normalized.variant_); auto maskId = std::tie( @@ -1310,7 +1310,7 @@ namespace verbly { case type::mask: { - const mask_type& mm = mpark::get(variant_); + const mask_type& mm = std::get(variant_); return { mm.name, @@ -1333,7 +1333,7 @@ namespace verbly { case type::group: { - const group_type& gg = mpark::get(variant_); + const group_type& gg = std::get(variant_); filter result(gg.orlogic); for (const filter& child : gg.children) @@ -1345,7 +1345,7 @@ namespace verbly { } } - group_type& resGroup = mpark::get(result.variant_); + group_type& resGroup = std::get(result.variant_); if (resGroup.children.empty()) { @@ -1362,7 +1362,7 @@ namespace verbly { case type::mask: { - const mask_type& mm = mpark::get(variant_); + const mask_type& mm = std::get(variant_); filter subfilter = mm.subfilter->compact(); diff --git a/lib/filter.h b/lib/filter.h index 7db2773..6da30dd 100644 --- a/lib/filter.h +++ b/lib/filter.h @@ -4,7 +4,7 @@ #include #include #include -#include "../vendor/hkutil/vendor/variant.hpp" +#include #include "../vendor/hkutil/hkutil/recptr.h" #include "field.h" #include "enums.h" @@ -133,8 +133,8 @@ namespace verbly { field filterField; comparison filterType; - mpark::variant< - mpark::monostate, + std::variant< + std::monostate, rec_filter, std::string, int, @@ -154,8 +154,8 @@ namespace verbly { }; using variant_type = - mpark::variant< - mpark::monostate, + std::variant< + std::monostate, singleton_type, group_type, mask_type>; diff --git a/lib/form.cpp b/lib/form.cpp index 06a00b9..256dc59 100644 --- a/lib/form.cpp +++ b/lib/form.cpp @@ -30,11 +30,11 @@ namespace verbly { form::form(const database& db, hatkirby::row row) : valid_(true) { - id_ = mpark::get(row[0]); - text_ = mpark::get(row[1]); - complexity_ = mpark::get(row[2]); - proper_ = (mpark::get(row[3]) == 1); - length_ = mpark::get(row[4]); + id_ = std::get(row[0]); + text_ = std::get(row[1]); + complexity_ = std::get(row[2]); + proper_ = (std::get(row[3]) == 1); + length_ = std::get(row[4]); pronunciations_ = db.pronunciations(*this, pronunciation::id, -1).all(); } diff --git a/lib/frame.cpp b/lib/frame.cpp index 51d6936..2a07e5f 100644 --- a/lib/frame.cpp +++ b/lib/frame.cpp @@ -25,9 +25,9 @@ namespace verbly { frame::frame(const database& db, hatkirby::row row) : valid_(true) { - id_ = mpark::get(row[0]); - groupId_ = mpark::get(row[1]); - length_ = mpark::get(row[2]); + id_ = std::get(row[0]); + groupId_ = std::get(row[1]); + length_ = std::get(row[2]); parts_ = db.parts(*this, verbly::part::index, -1).all(); } diff --git a/lib/notion.cpp b/lib/notion.cpp index 733c852..94a5194 100644 --- a/lib/notion.cpp +++ b/lib/notion.cpp @@ -60,19 +60,19 @@ namespace verbly { notion::notion(const database& db, hatkirby::row row) : valid_(true) { - id_ = mpark::get(row[0]); - partOfSpeech_ = static_cast(mpark::get(row[1])); + id_ = std::get(row[0]); + partOfSpeech_ = static_cast(std::get(row[1])); - if (!mpark::holds_alternative(row[2])) + if (!std::holds_alternative(row[2])) { hasWnid_ = true; - wnid_ = mpark::get(row[2]); + wnid_ = std::get(row[2]); } - if (!mpark::holds_alternative(row[3])) + if (!std::holds_alternative(row[3])) { hasNumOfImages_ = true; - numOfImages_ = mpark::get(row[3]); + numOfImages_ = std::get(row[3]); } } 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 { part::part(const database& db, hatkirby::row row) { - int id = mpark::get(row[0]); + int id = std::get(row[0]); - type_ = static_cast(mpark::get(row[3])); + type_ = static_cast(std::get(row[3])); switch (type_) { case part_type::noun_phrase: { variant_ = np_type { - mpark::get(row[4]), + std::get(row[4]), db.selrestrs(id), db.synrestrs(id) }; @@ -96,7 +96,7 @@ namespace verbly { case part_type::preposition: { hatkirby::blob_type raw = - mpark::get(row[5]); + std::get(row[5]); std::string serializedChoices( std::begin(raw), @@ -106,7 +106,7 @@ namespace verbly { hatkirby::split>( std::move(serializedChoices), ","), - (mpark::get(row[6]) == 1) + (std::get(row[6]) == 1) }; break; @@ -114,7 +114,7 @@ namespace verbly { case part_type::literal: { - variant_ = mpark::get(row[7]); + variant_ = std::get(row[7]); break; } @@ -136,7 +136,7 @@ namespace verbly { throw std::domain_error("part is not a noun phrase"); } - return mpark::get(variant_).role; + return std::get(variant_).role; } const std::set& part::getNounSelrestrs() const @@ -146,7 +146,7 @@ namespace verbly { throw std::domain_error("part is not a noun phrase"); } - return mpark::get(variant_).selrestrs; + return std::get(variant_).selrestrs; } const std::set& part::getNounSynrestrs() const @@ -156,7 +156,7 @@ namespace verbly { throw std::domain_error("part is not a noun phrase"); } - return mpark::get(variant_).synrestrs; + return std::get(variant_).synrestrs; } bool part::nounHasSynrestr(std::string synrestr) const @@ -166,7 +166,7 @@ namespace verbly { throw std::domain_error("part is not a noun phrase"); } - return mpark::get(variant_).synrestrs.count(synrestr); + return std::get(variant_).synrestrs.count(synrestr); } const std::vector& part::getPrepositionChoices() const @@ -176,7 +176,7 @@ namespace verbly { throw std::domain_error("part is not a preposition"); } - return mpark::get(variant_).choices; + return std::get(variant_).choices; } bool part::isPrepositionLiteral() const @@ -186,7 +186,7 @@ namespace verbly { throw std::domain_error("part is not a preposition"); } - return mpark::get(variant_).literal; + return std::get(variant_).literal; } const std::string& part::getLiteralValue() const @@ -196,7 +196,7 @@ namespace verbly { throw std::domain_error("part is not a literal"); } - return mpark::get(variant_); + return std::get(variant_); } filter part::synrestr_field::operator%=(std::string synrestr) const diff --git a/lib/part.h b/lib/part.h index 7783a61..a2d3667 100644 --- a/lib/part.h +++ b/lib/part.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include "field.h" #include "filter.h" #include "enums.h" @@ -129,8 +129,8 @@ namespace verbly { }; using variant_type = - mpark::variant< - mpark::monostate, + std::variant< + std::monostate, np_type, prep_type, std::string>; diff --git a/lib/pronunciation.cpp b/lib/pronunciation.cpp index 856f891..b039da8 100644 --- a/lib/pronunciation.cpp +++ b/lib/pronunciation.cpp @@ -31,22 +31,22 @@ namespace verbly { hatkirby::row row) : valid_(true) { - id_ = mpark::get(row[0]); + id_ = std::get(row[0]); phonemes_ = hatkirby::split>( - mpark::get(row[1]), + std::get(row[1]), " "); - syllables_ = mpark::get(row[2]); - stress_ = mpark::get(row[3]); + syllables_ = std::get(row[2]); + stress_ = std::get(row[3]); - if (!mpark::holds_alternative(row[5])) + if (!std::holds_alternative(row[5])) { hasRhyme_ = true; - prerhyme_ = mpark::get(row[4]); - rhyme_ = mpark::get(row[5]); + prerhyme_ = std::get(row[4]); + rhyme_ = std::get(row[5]); } } diff --git a/lib/statement.cpp b/lib/statement.cpp index 669dc2a..3440acb 100644 --- a/lib/statement.cpp +++ b/lib/statement.cpp @@ -800,7 +800,7 @@ namespace verbly { case type::singleton: { - const singleton_type& singleton = mpark::get(variant_); + const singleton_type& singleton = std::get(variant_); sql << singleton.table << "." << singleton.column; @@ -816,20 +816,20 @@ namespace verbly { sql << " != "; } - if (mpark::holds_alternative(singleton.value)) + if (std::holds_alternative(singleton.value)) { - sql << std::get<0>(mpark::get(singleton.value)) + sql << std::get<0>(std::get(singleton.value)) << "." - << std::get<1>(mpark::get(singleton.value)); + << std::get<1>(std::get(singleton.value)); } else if (debug) { - if (mpark::holds_alternative(singleton.value)) + if (std::holds_alternative(singleton.value)) { - sql << "\"" << mpark::get(singleton.value) << "\""; + sql << "\"" << std::get(singleton.value) << "\""; } - else if (mpark::holds_alternative(singleton.value)) + else if (std::holds_alternative(singleton.value)) { - sql << mpark::get(singleton.value); + sql << std::get(singleton.value); } } else { sql << "?"; @@ -844,7 +844,7 @@ namespace verbly { if (debug) { - sql << mpark::get(singleton.value); + sql << std::get(singleton.value); } else { sql << "?"; } @@ -858,7 +858,7 @@ namespace verbly { if (debug) { - sql << mpark::get(singleton.value); + sql << std::get(singleton.value); } else { sql << "?"; } @@ -872,7 +872,7 @@ namespace verbly { if (debug) { - sql << mpark::get(singleton.value); + sql << std::get(singleton.value); } else { sql << "?"; } @@ -886,7 +886,7 @@ namespace verbly { if (debug) { - sql << mpark::get(singleton.value); + sql << std::get(singleton.value); } else { sql << "?"; } @@ -900,7 +900,7 @@ namespace verbly { if (debug) { - sql << "\"" << mpark::get(singleton.value) << "\""; + sql << "\"" << std::get(singleton.value) << "\""; } else { sql << "?"; } @@ -914,7 +914,7 @@ namespace verbly { if (debug) { - sql << "\"" << mpark::get(singleton.value) << "\""; + sql << "\"" << std::get(singleton.value) << "\""; } else { sql << "?"; } @@ -942,7 +942,7 @@ namespace verbly { case type::group: { - const group_type& group = mpark::get(variant_); + const group_type& group = std::get(variant_); std::list clauses; for (const condition& cond : group.children) @@ -990,14 +990,14 @@ namespace verbly { case type::singleton: { - const singleton_type& singleton = mpark::get(variant_); + const singleton_type& singleton = std::get(variant_); - if (mpark::holds_alternative(singleton.value)) + if (std::holds_alternative(singleton.value)) { - return {{ mpark::get(singleton.value) }}; - } else if (mpark::holds_alternative(singleton.value)) + return {{ std::get(singleton.value) }}; + } else if (std::holds_alternative(singleton.value)) { - return {{ mpark::get(singleton.value) }}; + return {{ std::get(singleton.value) }}; } else { return {}; } @@ -1005,7 +1005,7 @@ namespace verbly { case type::group: { - const group_type& group = mpark::get(variant_); + const group_type& group = std::get(variant_); std::list bindings; for (const condition& cond : group.children) @@ -1035,7 +1035,7 @@ namespace verbly { throw std::domain_error("Cannot add condition to non-group condition"); } - group_type& group = mpark::get(variant_); + group_type& group = std::get(variant_); group.children.emplace_back(std::move(n)); return *this; @@ -1082,7 +1082,7 @@ namespace verbly { throw std::domain_error("Cannot get children of non-group condition"); } - const group_type& group = mpark::get(variant_); + const group_type& group = std::get(variant_); return group.children; } @@ -1099,7 +1099,7 @@ namespace verbly { case type::group: { - const group_type& group = mpark::get(variant_); + const group_type& group = std::get(variant_); condition result(group.orlogic); @@ -1110,7 +1110,7 @@ namespace verbly { if (newChild.type_ == type::group) { group_type& childGroup = - mpark::get(newChild.variant_); + std::get(newChild.variant_); if (childGroup.orlogic == group.orlogic) { @@ -1144,7 +1144,7 @@ namespace verbly { case type::singleton: { - const singleton_type& singleton = mpark::get(variant_); + const singleton_type& singleton = std::get(variant_); if (singleton.parentObject != object::undefined && singleton.parentObject == context) @@ -1155,7 +1155,7 @@ namespace verbly { singleton.comparison, field_binding { tableName, - std::get<1>(mpark::get(singleton.value)) + std::get<1>(std::get(singleton.value)) } }; } else { @@ -1165,7 +1165,7 @@ namespace verbly { case type::group: { - const group_type& group = mpark::get(variant_); + const group_type& group = std::get(variant_); condition result(group.orlogic); for (const condition& cond : group.children) diff --git a/lib/statement.h b/lib/statement.h index 6c2e42e..632807f 100644 --- a/lib/statement.h +++ b/lib/statement.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include "enums.h" #include "field.h" #include "filter.h" @@ -19,8 +19,8 @@ namespace verbly { std::tuple; using binding = - mpark::variant< - mpark::monostate, + std::variant< + std::monostate, std::string, int, field_binding>; @@ -185,8 +185,8 @@ namespace verbly { }; using variant_type = - mpark::variant< - mpark::monostate, + std::variant< + std::monostate, singleton_type, group_type>; diff --git a/lib/token.cpp b/lib/token.cpp index b3c7062..6b78f53 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -23,7 +23,7 @@ namespace verbly { case type::utterance: { - const utterance_type& utterance = mpark::get(variant_); + const utterance_type& utterance = std::get(variant_); return std::all_of( std::begin(utterance), @@ -35,7 +35,7 @@ namespace verbly { case type::transform: { - const transform_type& transform = mpark::get(variant_); + const transform_type& transform = std::get(variant_); return transform.inner->isComplete(); } @@ -56,7 +56,7 @@ namespace verbly { { case type::word: { - const word_type& w = mpark::get(variant_); + const word_type& w = std::get(variant_); const form& wordForm = w.value.getInflections(w.category).front(); @@ -108,7 +108,7 @@ namespace verbly { case type::literal: { - std::string result = mpark::get(variant_); + std::string result = std::get(variant_); if (indefiniteArticle && std::isalpha(result[0])) { @@ -164,7 +164,7 @@ namespace verbly { case type::utterance: { - const utterance_type& utterance = mpark::get(variant_); + const utterance_type& utterance = std::get(variant_); bool first = true; std::list compiled; @@ -192,7 +192,7 @@ namespace verbly { case type::transform: { - const transform_type& transform = mpark::get(variant_); + const transform_type& transform = std::get(variant_); switch (transform.type) { @@ -257,7 +257,7 @@ namespace verbly { throw std::domain_error("Token is not a word"); } - return mpark::get(variant_).value; + return std::get(variant_).value; } token token::inflect(inflection category) const @@ -268,7 +268,7 @@ namespace verbly { } return { - mpark::get(variant_).value, + std::get(variant_).value, category }; } @@ -293,7 +293,7 @@ namespace verbly { throw std::domain_error("Token is not a literal"); } - return mpark::get(variant_); + return std::get(variant_); } token::token( @@ -310,7 +310,7 @@ namespace verbly { throw std::domain_error("Token is not a part"); } - return mpark::get(variant_); + return std::get(variant_); } token::token( @@ -327,7 +327,7 @@ namespace verbly { throw std::domain_error("Token is not a fillin"); } - return mpark::get(variant_); + return std::get(variant_); } bool token::hasSynrestr(std::string synrestr) const @@ -337,7 +337,7 @@ namespace verbly { throw std::domain_error("Token is not a fillin"); } - return mpark::get(variant_).count(synrestr); + return std::get(variant_).count(synrestr); } void token::addSynrestr(std::string synrestr) @@ -347,7 +347,7 @@ namespace verbly { throw std::domain_error("Token is not a fillin"); } - fillin_type& fillin = mpark::get(variant_); + fillin_type& fillin = std::get(variant_); fillin.insert(std::move(synrestr)); } @@ -378,7 +378,7 @@ namespace verbly { throw std::domain_error("Token is not an utterance"); } - return std::begin(mpark::get(variant_)); + return std::begin(std::get(variant_)); } token::const_iterator token::begin() const @@ -388,7 +388,7 @@ namespace verbly { throw std::domain_error("Token is not an utterance"); } - return std::begin(mpark::get(variant_)); + return std::begin(std::get(variant_)); } token::iterator token::end() @@ -398,7 +398,7 @@ namespace verbly { throw std::domain_error("Token is not an utterance"); } - return std::end(mpark::get(variant_)); + return std::end(std::get(variant_)); } token::const_iterator token::end() const @@ -408,7 +408,7 @@ namespace verbly { throw std::domain_error("Token is not an utterance"); } - return std::end(mpark::get(variant_)); + return std::end(std::get(variant_)); } token& token::operator<<(token arg) @@ -418,7 +418,7 @@ namespace verbly { throw std::domain_error("Token is not an utterance"); } - utterance_type& utterance = mpark::get(variant_); + utterance_type& utterance = std::get(variant_); utterance.push_back(std::move(arg)); return *this; @@ -460,7 +460,7 @@ namespace verbly { throw std::domain_error("Invalid access on non-tranform token"); } - return *mpark::get(variant_).inner; + return *std::get(variant_).inner; } const token& token::getInnerToken() const @@ -470,7 +470,7 @@ namespace verbly { throw std::domain_error("Invalid access on non-tranform token"); } - return *mpark::get(variant_).inner; + return *std::get(variant_).inner; } token::token( diff --git a/lib/token.h b/lib/token.h index 910a465..a18fe42 100644 --- a/lib/token.h +++ b/lib/token.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include "enums.h" #include "word.h" @@ -38,7 +38,7 @@ namespace verbly { bool isEmpty() const { return (type_ == type::utterance && - mpark::get(variant_).empty()); + std::get(variant_).empty()); } // Word @@ -153,7 +153,7 @@ namespace verbly { }; using variant_type = - mpark::variant< + std::variant< word_type, literal_type, part, diff --git a/lib/word.cpp b/lib/word.cpp index 2fccb9f..5df9ba1 100644 --- a/lib/word.cpp +++ b/lib/word.cpp @@ -46,22 +46,22 @@ namespace verbly { word::word(const database& db, hatkirby::row row) : db_(&db), valid_(true) { - id_ = mpark::get(row[0]); + id_ = std::get(row[0]); - notion_ = db.notions(notion::id == mpark::get(row[1])).first(); + notion_ = db.notions(notion::id == std::get(row[1])).first(); - if (!mpark::holds_alternative(row[3])) + if (!std::holds_alternative(row[3])) { hasTagCount_ = true; - tagCount_ = mpark::get(row[3]); + tagCount_ = std::get(row[3]); } - if (!mpark::holds_alternative(row[4])) + if (!std::holds_alternative(row[4])) { - adjectivePosition_ = static_cast(mpark::get(row[4])); + adjectivePosition_ = static_cast(std::get(row[4])); } - if (!mpark::holds_alternative(row[5])) + if (!std::holds_alternative(row[5])) { frames_ = db.frames(*this).all(); } diff --git a/vendor/hkutil b/vendor/hkutil index a9a5996..fdddefb 160000 --- a/vendor/hkutil +++ b/vendor/hkutil @@ -1 +1 @@ -Subproject commit a9a5996310bb33207d3338f353aab97b9ed3a5e8 +Subproject commit fdddefbbbb8f3c0bd223280c74fa7e05bfdc3521 -- cgit 1.4.1