renamed relation tags, prepended Is

Renamed to IsOneRelation, IsManyRelation, IsPivotRelation.
This commit is contained in:
silverqx
2022-08-03 14:24:38 +02:00
parent ee007809e5
commit 6983b1967a
7 changed files with 37 additions and 37 deletions

View File

@@ -1112,7 +1112,7 @@ namespace Concerns
relation->touch();
// Many type relation
if constexpr (std::is_base_of_v<Relations::ManyRelation,
if constexpr (std::is_base_of_v<Relations::IsManyRelation,
typename Relation::element_type>)
{
for (auto *const relatedModel : getRelationValue<Related>(relationName))
@@ -1122,7 +1122,7 @@ namespace Concerns
}
// One type relation
else if constexpr (std::is_base_of_v<Relations::OneRelation,
else if constexpr (std::is_base_of_v<Relations::IsOneRelation,
typename Relation::element_type>)
{
if (auto *const relatedModel = getRelationValue<Related, One>(relationName);

View File

@@ -563,7 +563,7 @@ namespace Orm::Tiny::Concerns
{
using Relation = typename std::invoke_result_t<Method, Derived>::element_type;
if constexpr (!std::is_base_of_v<Relations::PivotRelation, Relation>)
if constexpr (!std::is_base_of_v<Relations::IsPivotRelation, Relation>)
return;
m_result = typename Relation::RelatedType().getTable();

View File

@@ -18,7 +18,7 @@ namespace Orm::Tiny::Relations
/*! Belongs to relation. */
template<class Model, class Related>
class BelongsTo : public OneRelation,
class BelongsTo : public IsOneRelation,
public Relation<Model, Related>,
public Concerns::SupportsDefaultModels<Model, Related>
{

View File

@@ -21,9 +21,9 @@ namespace Orm::Tiny::Relations
/*! Belongs to many relation. */
template<class Model, class Related, class PivotType = Pivot>
class BelongsToMany :
public ManyRelation,
public IsManyRelation,
public Relation<Model, Related>,
public PivotRelation,
public IsPivotRelation,
public Concerns::InteractsWithPivotTable<Model, Related, PivotType>
{
/*! Alias for the attribute utils. */

View File

@@ -14,7 +14,7 @@ namespace Orm::Tiny::Relations
/*! Has many relation. */
template<class Model, class Related>
class HasMany : public ManyRelation,
class HasMany : public IsManyRelation,
public HasOneOrMany<Model, Related>
{
Q_DISABLE_COPY(HasMany)

View File

@@ -15,7 +15,7 @@ namespace Orm::Tiny::Relations
/*! Has one relation. */
template<class Model, class Related>
class HasOne : public OneRelation,
class HasOne : public IsOneRelation,
public HasOneOrMany<Model, Related>,
public Concerns::SupportsDefaultModels<Model, Related>
{

View File

@@ -39,66 +39,66 @@ namespace Orm::Tiny::Relations
IsRelation::~IsRelation() = default;
/*! Tag for one type relation. */
class OneRelation
class IsOneRelation
{
Q_DISABLE_COPY(OneRelation)
Q_DISABLE_COPY(IsOneRelation)
public:
/*! Default constructor. */
inline OneRelation() = default;
inline IsOneRelation() = default;
/*! Pure virtual destructor. */
inline virtual ~OneRelation() = 0;
inline virtual ~IsOneRelation() = 0;
};
OneRelation::~OneRelation() = default;
IsOneRelation::~IsOneRelation() = default;
/*! Tag for many type relation. */
class ManyRelation
class IsManyRelation
{
protected:
/*! ManyRelation's copy constructor (used by BelongsToMany::clone()). */
inline ManyRelation(const ManyRelation &) = default;
/*! IsManyRelation's copy constructor (used by BelongsToMany::clone()). */
inline IsManyRelation(const IsManyRelation &) = default;
public:
/*! Default constructor. */
inline ManyRelation() = default;
inline IsManyRelation() = default;
/*! Pure virtual destructor. */
inline virtual ~ManyRelation() = 0;
inline virtual ~IsManyRelation() = 0;
/*! ManyRelation's move constructor. */
ManyRelation(ManyRelation &&) = delete;
/*! IsManyRelation's move constructor. */
IsManyRelation(IsManyRelation &&) = delete;
/*! ManyRelation's copy assignment operator. */
ManyRelation &operator=(const ManyRelation &) = delete;
/*! ManyRelation's move assignment operator. */
ManyRelation &operator=(ManyRelation &&) = delete;
/*! IsManyRelation's copy assignment operator. */
IsManyRelation &operator=(const IsManyRelation &) = delete;
/*! IsManyRelation's move assignment operator. */
IsManyRelation &operator=(IsManyRelation &&) = delete;
};
ManyRelation::~ManyRelation() = default;
IsManyRelation::~IsManyRelation() = default;
/*! Tag for the relation which contains pivot table, like many-to-many. */
class PivotRelation
class IsPivotRelation
{
protected:
/*! PivotRelation's copy constructor (used by BelongsToMany::clone()). */
inline PivotRelation(const PivotRelation &) = default;
/*! IsPivotRelation's copy constructor (used by BelongsToMany::clone()). */
inline IsPivotRelation(const IsPivotRelation &) = default;
public:
/*! Default constructor. */
inline PivotRelation() = default;
inline IsPivotRelation() = default;
/*! Pure virtual destructor. */
inline virtual ~PivotRelation() = 0;
inline virtual ~IsPivotRelation() = 0;
/*! PivotRelation's move constructor. */
PivotRelation(PivotRelation &&) = delete;
/*! IsPivotRelation's move constructor. */
IsPivotRelation(IsPivotRelation &&) = delete;
/*! PivotRelation's copy assignment operator. */
PivotRelation &operator=(const PivotRelation &) = delete;
/*! PivotRelation's move assignment operator. */
PivotRelation &operator=(PivotRelation &&) = delete;
/*! IsPivotRelation's copy assignment operator. */
IsPivotRelation &operator=(const IsPivotRelation &) = delete;
/*! IsPivotRelation's move assignment operator. */
IsPivotRelation &operator=(IsPivotRelation &&) = delete;
};
PivotRelation::~PivotRelation() = default;
IsPivotRelation::~IsPivotRelation() = default;
} // namespace Orm::Tiny::Relations