mirror of
https://github.com/silverqx/TinyORM.git
synced 2026-02-13 22:09:23 -06:00
cleanup, macro guards, inline
- removed expression.cpp, Query::Expression is header only now - fixed macro guard names - inline from defn. to decl.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef ORM_EXPRESSION_HPP
|
||||
#define ORM_EXPRESSION_HPP
|
||||
#ifndef ORM_QUERY_EXPRESSION_HPP
|
||||
#define ORM_QUERY_EXPRESSION_HPP
|
||||
|
||||
#include "orm/macros/systemheader.hpp"
|
||||
TINY_SYSTEM_HEADER
|
||||
@@ -9,7 +9,6 @@ TINY_SYSTEM_HEADER
|
||||
#include <QVector>
|
||||
|
||||
#include "orm/macros/commonnamespace.hpp"
|
||||
#include "orm/macros/export.hpp"
|
||||
|
||||
TINYORM_BEGIN_COMMON_NAMESPACE
|
||||
|
||||
@@ -17,7 +16,7 @@ namespace Orm::Query
|
||||
{
|
||||
|
||||
/*! Expression in sql query. */
|
||||
class SHAREDLIB_EXPORT Expression
|
||||
class Expression
|
||||
{
|
||||
public:
|
||||
/*! Default constructor, needed by Q_DECLARE_METATYPE. */
|
||||
@@ -26,9 +25,9 @@ namespace Orm::Query
|
||||
inline ~Expression() = default;
|
||||
|
||||
/*! Converting constructor from QVariant type. */
|
||||
explicit Expression(const QVariant &value);
|
||||
inline explicit Expression(const QVariant &value);
|
||||
/*! Converting constructor from QVariant type. */
|
||||
explicit Expression(QVariant &&value);
|
||||
inline explicit Expression(QVariant &&value);
|
||||
|
||||
/*! Copy constructor. */
|
||||
inline Expression(const Expression &) = default;
|
||||
@@ -41,10 +40,10 @@ namespace Orm::Query
|
||||
inline Expression &operator=(Expression &&) = default;
|
||||
|
||||
/*! Converting operator, QVariant(Expression). */
|
||||
operator QVariant() const; // NOLINT(google-explicit-constructor)
|
||||
inline operator QVariant() const; // NOLINT(google-explicit-constructor)
|
||||
|
||||
/*! Obtain expression's value. */
|
||||
const QVariant &getValue() const;
|
||||
inline const QVariant &getValue() const;
|
||||
|
||||
/*! Equality operator, the inequality operator is automatically generated. */
|
||||
inline bool operator==(const Expression &) const = default;
|
||||
@@ -54,7 +53,21 @@ namespace Orm::Query
|
||||
QVariant m_value {};
|
||||
};
|
||||
|
||||
inline const QVariant &Expression::getValue() const
|
||||
// NOLINTNEXTLINE(modernize-pass-by-value)
|
||||
Expression::Expression(const QVariant &value)
|
||||
: m_value(value)
|
||||
{}
|
||||
|
||||
Expression::Expression(QVariant &&value)
|
||||
: m_value(std::move(value))
|
||||
{}
|
||||
|
||||
Expression::operator QVariant() const
|
||||
{
|
||||
return QVariant::fromValue(*this);
|
||||
}
|
||||
|
||||
const QVariant &Expression::getValue() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
@@ -71,4 +84,4 @@ Q_DECLARE_METATYPE(TINYORM_COMMON_NAMESPACE::Orm::Query::Expression)
|
||||
Q_DECLARE_METATYPE(Orm::Query::Expression)
|
||||
#endif
|
||||
|
||||
#endif // ORM_EXPRESSION_HPP
|
||||
#endif // ORM_QUERY_EXPRESSION_HPP
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef ORM_JOINCLAUSE_HPP
|
||||
#define ORM_JOINCLAUSE_HPP
|
||||
#ifndef ORM_QUERY_JOINCLAUSE_HPP
|
||||
#define ORM_QUERY_JOINCLAUSE_HPP
|
||||
|
||||
#include "orm/macros/systemheader.hpp"
|
||||
TINY_SYSTEM_HEADER
|
||||
@@ -39,9 +39,9 @@ namespace Orm::Query
|
||||
const QString &second);
|
||||
|
||||
/*! Get the type of join being performed. */
|
||||
const QString &getType() const;
|
||||
inline const QString &getType() const;
|
||||
/*! Get the table the join clause is joining to. */
|
||||
const std::variant<std::monostate, QString, Expression> &
|
||||
inline const std::variant<std::monostate, QString, Expression> &
|
||||
getTable() const;
|
||||
|
||||
/*! Get a new instance of the join clause builder. */
|
||||
@@ -58,13 +58,13 @@ namespace Orm::Query
|
||||
const JoinTable m_table;
|
||||
};
|
||||
|
||||
inline const QString &
|
||||
const QString &
|
||||
JoinClause::getType() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
inline const std::variant<std::monostate, QString, Expression> &
|
||||
const std::variant<std::monostate, QString, Expression> &
|
||||
JoinClause::getTable() const
|
||||
{
|
||||
return m_table;
|
||||
@@ -74,4 +74,4 @@ namespace Orm::Query
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
#endif // ORM_JOINCLAUSE_HPP
|
||||
#endif // ORM_QUERY_JOINCLAUSE_HPP
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef ORM_PROCESSORS_MYSQLPROCESSOR_HPP
|
||||
#define ORM_PROCESSORS_MYSQLPROCESSOR_HPP
|
||||
#ifndef ORM_QUERY_PROCESSORS_MYSQLPROCESSOR_HPP
|
||||
#define ORM_QUERY_PROCESSORS_MYSQLPROCESSOR_HPP
|
||||
|
||||
#include "orm/macros/systemheader.hpp"
|
||||
TINY_SYSTEM_HEADER
|
||||
@@ -31,4 +31,4 @@ namespace Orm::Query::Processors
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
#endif // ORM_PROCESSORS_MYSQLPROCESSOR_HPP
|
||||
#endif // ORM_QUERY_PROCESSORS_MYSQLPROCESSOR_HPP
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef ORM_PROCESSORS_POSTGRESPROCESSOR_HPP
|
||||
#define ORM_PROCESSORS_POSTGRESPROCESSOR_HPP
|
||||
#ifndef ORM_QUERY_PROCESSORS_POSTGRESPROCESSOR_HPP
|
||||
#define ORM_QUERY_PROCESSORS_POSTGRESPROCESSOR_HPP
|
||||
|
||||
#include "orm/macros/systemheader.hpp"
|
||||
TINY_SYSTEM_HEADER
|
||||
@@ -31,4 +31,4 @@ namespace Orm::Query::Processors
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
#endif // ORM_PROCESSORS_POSTGRESPROCESSOR_HPP
|
||||
#endif // ORM_QUERY_PROCESSORS_POSTGRESPROCESSOR_HPP
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef ORM_PROCESSORS_PROCESSOR_HPP
|
||||
#define ORM_PROCESSORS_PROCESSOR_HPP
|
||||
#ifndef ORM_QUERY_PROCESSORS_PROCESSOR_HPP
|
||||
#define ORM_QUERY_PROCESSORS_PROCESSOR_HPP
|
||||
|
||||
#include "orm/macros/systemheader.hpp"
|
||||
TINY_SYSTEM_HEADER
|
||||
@@ -37,4 +37,4 @@ namespace Orm::Query::Processors
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
#endif // ORM_PROCESSORS_PROCESSOR_HPP
|
||||
#endif // ORM_QUERY_PROCESSORS_PROCESSOR_HPP
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef ORM_PROCESSORS_SQLITEPROCESSOR_HPP
|
||||
#define ORM_PROCESSORS_SQLITEPROCESSOR_HPP
|
||||
#ifndef ORM_QUERY_PROCESSORS_SQLITEPROCESSOR_HPP
|
||||
#define ORM_QUERY_PROCESSORS_SQLITEPROCESSOR_HPP
|
||||
|
||||
#include "orm/macros/systemheader.hpp"
|
||||
TINY_SYSTEM_HEADER
|
||||
@@ -31,4 +31,4 @@ namespace Orm::Query::Processors
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
#endif // ORM_PROCESSORS_SQLITEPROCESSOR_HPP
|
||||
#endif // ORM_QUERY_PROCESSORS_SQLITEPROCESSOR_HPP
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef ORM_QUERYBUILDER_HPP
|
||||
#define ORM_QUERYBUILDER_HPP
|
||||
#ifndef ORM_QUERY_QUERYBUILDER_HPP
|
||||
#define ORM_QUERY_QUERYBUILDER_HPP
|
||||
|
||||
#include "orm/macros/systemheader.hpp"
|
||||
TINY_SYSTEM_HEADER
|
||||
@@ -29,7 +29,6 @@ namespace Query
|
||||
concept Remove = std::convertible_to<T, quint64> ||
|
||||
std::same_as<T, Query::Expression>;
|
||||
|
||||
// FEATURE subqueries, add support for subqueries, first in where() silverqx
|
||||
// TODO add inRandomOrder() silverqx
|
||||
// TODO QueryBuilder::updateOrInsert() silverqx
|
||||
/*! Database query builder. */
|
||||
@@ -1207,4 +1206,4 @@ namespace Query
|
||||
|
||||
TINYORM_END_COMMON_NAMESPACE
|
||||
|
||||
#endif // ORM_QUERYBUILDER_HPP
|
||||
#endif // ORM_QUERY_QUERYBUILDER_HPP
|
||||
|
||||
Reference in New Issue
Block a user