diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-09-09 20:47:38 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-09-09 20:47:47 +0200 |
commit | e4ea50f431e8efbfb572c441d00d5539db516820 (patch) | |
tree | 3134ec2c8b895fb43e3312cf665244e71e43a77e | |
parent | 919bbd2aad26bd73b0dfbc9243ccb7d89fdb8fb1 (diff) |
migration: type aliases confuse IDE so let's not
-rw-r--r-- | migration/migration.cpp | 17 | ||||
-rw-r--r-- | migration/migration.hpp | 10 |
2 files changed, 13 insertions, 14 deletions
diff --git a/migration/migration.cpp b/migration/migration.cpp index 06cd5b93..902490f5 100644 --- a/migration/migration.cpp +++ b/migration/migration.cpp @@ -60,9 +60,9 @@ void migrator::register_migration(migration* m) migrations().push_back(m); } -migrator::vec& migrator::migrations() +std::vector<migration*>& migrator::migrations() { - static vec ret; + static std::vector<migration*> ret; return ret; } @@ -81,7 +81,7 @@ QString migrator::last_migration_time() QString migrator::time_after_migrations() { - const vec list = sorted_migrations(); + const std::vector<migration*> list = sorted_migrations(); if (list.size() == 0u) return QStringLiteral("19700101_00"); @@ -101,9 +101,12 @@ void migrator::set_last_migration_time(const QString& val) s->endGroup(); } -migrator::vec migrator::sorted_migrations() +std::vector<migration*> migrator::sorted_migrations() { - vec list(migrations()); + std::vector<migration*> list(migrations()); + + using mm = migration*; + std::sort(list.begin(), list.end(), [](const mm x, const mm y) { return x->unique_date() < y->unique_date(); }); return list; } @@ -118,8 +121,8 @@ int migrator::to_int(const QString& str, bool& ok) std::vector<QString> migrator::run() { - vec migrations = sorted_migrations(); - vstr done; + std::vector<migration*> migrations = sorted_migrations(); + std::vector<QString> done; const QString last_migration = last_migration_time(); diff --git a/migration/migration.hpp b/migration/migration.hpp index 73ab2d53..6e95cca3 100644 --- a/migration/migration.hpp +++ b/migration/migration.hpp @@ -13,19 +13,15 @@ class registrator; namespace detail { class migrator final { - using mm = migration*; - template<typename t> using vec_ = std::vector<t>; - using vstr = vec_<QString>; - using vec = vec_<mm>; - static vec& migrations(); + static std::vector<migration*>& migrations(); static QString last_migration_time(); static QString time_after_migrations(); static void set_last_migration_time(const QString& val); migrator() = delete; - static vec sorted_migrations(); + static std::vector<migration*> sorted_migrations(); static int to_int(const QString& str, bool& ok); public: - static vstr run(); + static std::vector<QString> run(); static void register_migration(migration* m); static void mark_config_as_not_needing_migration(); }; |