made methods static

This commit is contained in:
silverqx
2022-05-17 14:30:16 +02:00
parent 65b13758b5
commit 9ecc787ca4
2 changed files with 15 additions and 15 deletions
+8 -8
View File
@@ -37,26 +37,26 @@ namespace Tom
protected:
/*! Get the migration stub file. */
QString getStub(const QString &table, bool create) const;
static QString getStub(const QString &table, bool create);
/*! Get the full path to the migration. */
fspath getPath(std::string &&datetimePrefix, const QString &name,
std::string &&extension, const fspath &path) const;
/*! Get the date prefix for the migration. */
std::string getDatePrefix() const;
static std::string getDatePrefix();
/*! Populate the place-holders in the migration stub. */
std::string populateStub(const QString &name, QString &&stub,
const QString &table) const;
static std::string
populateStub(const QString &name, QString &&stub, const QString &table);
/*! Get the class name of a migration name. */
QString getClassName(const QString &name) const;
static QString getClassName(const QString &name);
/*! Ensure a directory exists. */
void ensureDirectoryExists(const fspath &path) const;
static void ensureDirectoryExists(const fspath &path);
private:
/*! Ensure that a migration with the given name doesn't already exist. */
void throwIfMigrationAlreadyExists(const QString &name,
const fspath &migrationsPath) const;
static void throwIfMigrationAlreadyExists(const QString &name,
const fspath &migrationsPath);
};
} // namespace Tom
+7 -7
View File
@@ -53,7 +53,7 @@ fspath MigrationCreator::create(
/* protected */
QString MigrationCreator::getStub(const QString &table, const bool create) const
QString MigrationCreator::getStub(const QString &table, const bool create)
{
QString stub;
@@ -82,13 +82,13 @@ fspath MigrationCreator::getPath(std::string &&datetimePrefix, const QString &na
return path / std::move(filename);
}
std::string MigrationCreator::getDatePrefix() const
std::string MigrationCreator::getDatePrefix()
{
return QDateTime::currentDateTime().toString(DateTimePrefix).toStdString();
}
std::string MigrationCreator::populateStub(const QString &name, QString &&stub,
const QString &table) const
std::string
MigrationCreator::populateStub(const QString &name, QString &&stub, const QString &table)
{
const auto className = getClassName(name);
@@ -107,12 +107,12 @@ std::string MigrationCreator::populateStub(const QString &name, QString &&stub,
return stub.toStdString();
}
QString MigrationCreator::getClassName(const QString &name) const
QString MigrationCreator::getClassName(const QString &name)
{
return StringUtils::studly(name);
}
void MigrationCreator::ensureDirectoryExists(const fspath &path) const
void MigrationCreator::ensureDirectoryExists(const fspath &path)
{
if (fs::exists(path) && fs::is_directory(path))
return;
@@ -123,7 +123,7 @@ void MigrationCreator::ensureDirectoryExists(const fspath &path) const
/* private */
void MigrationCreator::throwIfMigrationAlreadyExists(const QString &name,
const fspath &migrationsPath) const
const fspath &migrationsPath)
{
// Nothing to check
if (!fs::exists(migrationsPath))