/**************************************************************************** ** ** https://www.qxorm.com/ ** Copyright (C) 2013 XDL Team (ic-east.com) ** ** This file is part of the QxOrm library ** ** This software is provided 'as-is', without any express or implied ** warranty. In no event will the authors be held liable for any ** damages arising from the use of this software ** ** Commercial Usage ** Licensees holding valid commercial QxOrm licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and XDL Team ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file 'license.gpl3.txt' included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met : http://www.gnu.org/copyleft/gpl.html ** ** If you are unsure which license is appropriate for your use, or ** if you have questions regarding the use of this file, please contact : ** ic-east.com ** ****************************************************************************/ #include namespace qx { template void QxClass::init() { this->setDataMemberX(QxDataMemberX::getSingleton()); this->getDataMemberX()->setClass(this); this->setFctMemberX(new IxFunctionX()); this->setFctStaticX(new IxFunctionX()); #ifdef _QX_ENABLE_BOOST_SERIALIZATION this->setVersion(boost::serialization::version::value); #else // _QX_ENABLE_BOOST_SERIALIZATION this->setVersion(qx::version::value); #endif // _QX_ENABLE_BOOST_SERIALIZATION this->setKey(qx::trait::get_class_name::get()); this->setDaoStrategy(QxClass::type_base_class>::getSingleton()->getDaoStrategy()); this->setName(qx::trait::get_class_name::get_xml_tag()); this->updateClassX(); beforeRegisterClass(); } template IxDataMember *QxClass::data(const QString &sKey, long lVersion) { return this->dataMemberX()->add(sKey, lVersion); } template template IxDataMember *QxClass::data(V U::*pData, const QString &sKey, long lVersion /* = 0 */, bool bSerialize /* = true */, bool bDao /* = true */) { return this->dataMemberX()->add(pData, sKey, lVersion, bSerialize, bDao); } template IxDataMember *QxClass::id(const QString &sKey, long lVersion) { return this->dataMemberX()->id(sKey, lVersion); } template IxDataMember *QxClass::id(typename QxClass::type_primary_key T::*pDataMemberId, const QString &sKey, long lVersion /* = 0 */) { return this->dataMemberX()->id(pDataMemberId, sKey, lVersion); } template template IxSqlRelation *QxClass::relationOneToOne(V U::*pData, const QString &sKey, long lVersion /* = 0 */) { return this->dataMemberX()->relationOneToOne(pData, sKey, lVersion); } template template IxSqlRelation *QxClass::relationManyToOne(V U::*pData, const QString &sKey, long lVersion /* = 0 */) { return this->dataMemberX()->relationManyToOne(pData, sKey, lVersion); } template template IxSqlRelation *QxClass::relationOneToMany(V U::*pData, const QString &sKey, const QString &sForeignKey, long lVersion /* = 0 */) { return this->dataMemberX()->relationOneToMany(pData, sKey, sForeignKey, lVersion); } template template IxSqlRelation *QxClass::relationManyToMany(V U::*pData, const QString &sKey, const QString &sExtraTable, const QString &sForeignKeyOwner, const QString &sForeignKeyDataType, long lVersion /* = 0 */) { return this->dataMemberX()->relationManyToMany(pData, sKey, sExtraTable, sForeignKeyOwner, sForeignKeyDataType, lVersion); } template template IxDataMember *QxClass::pimpl(V U::*pData, const QString &sKey /* = QString("_PIMPL_") */) { return this->dataMemberX()->pimpl(pData, sKey); } template template IxDataMember *QxClass::id(typename QxClass::type_primary_key U::*pDataMemberId, const QString &sKey, long lVersion, IxDataMember *pImpl) { return this->dataMemberX()->id(pDataMemberId, sKey, lVersion, pImpl); } template template IxDataMember *QxClass::data(V U::*pData, const QString &sKey, long lVersion, bool bSerialize, bool bDao, IxDataMember *pImpl) { return this->dataMemberX()->add(pData, sKey, lVersion, bSerialize, bDao, pImpl); } template template IxSqlRelation *QxClass::relationOneToOne(V U::*pData, const QString &sKey, long lVersion, IxDataMember *pImpl) { return this->dataMemberX()->relationOneToOne(pData, sKey, lVersion, pImpl); } template template IxSqlRelation *QxClass::relationManyToOne(V U::*pData, const QString &sKey, long lVersion, IxDataMember *pImpl) { return this->dataMemberX()->relationManyToOne(pData, sKey, lVersion, pImpl); } template template IxSqlRelation *QxClass::relationOneToMany(V U::*pData, const QString &sKey, const QString &sForeignKey, long lVersion, IxDataMember *pImpl) { return this->dataMemberX()->relationOneToMany(pData, sKey, sForeignKey, lVersion, pImpl); } template template IxSqlRelation *QxClass::relationManyToMany(V U::*pData, const QString &sKey, const QString &sExtraTable, const QString &sForeignKeyOwner, const QString &sForeignKeyDataType, long lVersion, IxDataMember *pImpl) { return this->dataMemberX()->relationManyToMany(pData, sKey, sExtraTable, sForeignKeyOwner, sForeignKeyDataType, lVersion, pImpl); } template IxFunction *QxClass::insertFct(IxFunction_ptr pFct, const QString &sKey) { if (!this->getFctMemberX() || sKey.isEmpty() || this->getFctMemberX()->exist(sKey)) { qAssert(false); return NULL; } bool bInsertOk = this->getFctMemberX()->insert(sKey, pFct); if (bInsertOk) { pFct->setKey(sKey); } return (bInsertOk ? pFct.get() : NULL); } template IxFunction *QxClass::insertFctStatic(IxFunction_ptr pFct, const QString &sKey) { if (!this->getFctStaticX() || sKey.isEmpty() || this->getFctStaticX()->exist(sKey)) { qAssert(false); return NULL; } bool bInsertOk = this->getFctStaticX()->insert(sKey, pFct); if (bInsertOk) { pFct->setKey(sKey); } return (bInsertOk ? pFct.get() : NULL); } template template IxFunction *QxClass::fct_0(const typename QxFunction_0::type_fct &fct, const QString &sKey) { return this->insertFct(qx::function::bind_member_fct_0(fct), sKey); } template template IxFunction *QxClass::fct_1(const typename QxFunction_1::type_fct &fct, const QString &sKey) { return this->insertFct(qx::function::bind_member_fct_1(fct), sKey); } template template IxFunction *QxClass::fct_2(const typename QxFunction_2::type_fct &fct, const QString &sKey) { return this->insertFct(qx::function::bind_member_fct_2(fct), sKey); } template template IxFunction *QxClass::fct_3(const typename QxFunction_3::type_fct &fct, const QString &sKey) { return this->insertFct(qx::function::bind_member_fct_3(fct), sKey); } template template IxFunction *QxClass::fct_4(const typename QxFunction_4::type_fct &fct, const QString &sKey) { return this->insertFct(qx::function::bind_member_fct_4(fct), sKey); } template template IxFunction *QxClass::fct_5(const typename QxFunction_5::type_fct &fct, const QString &sKey) { return this->insertFct(qx::function::bind_member_fct_5(fct), sKey); } template template IxFunction *QxClass::fct_6(const typename QxFunction_6::type_fct &fct, const QString &sKey) { return this->insertFct(qx::function::bind_member_fct_6(fct), sKey); } template template IxFunction *QxClass::fct_7(const typename QxFunction_7::type_fct &fct, const QString &sKey) { return this->insertFct(qx::function::bind_member_fct_7(fct), sKey); } template template IxFunction *QxClass::fct_8(const typename QxFunction_8::type_fct &fct, const QString &sKey) { return this->insertFct(qx::function::bind_member_fct_8(fct), sKey); } template template IxFunction *QxClass::fct_9(const typename QxFunction_9::type_fct &fct, const QString &sKey) { return this->insertFct(qx::function::bind_member_fct_9(fct), sKey); } template template IxFunction *QxClass::fctStatic_0(const typename QxFunction_0::type_fct &fct, const QString &sKey) { return this->insertFctStatic(qx::function::bind_fct_0(fct), sKey); } template template IxFunction *QxClass::fctStatic_1(const typename QxFunction_1::type_fct &fct, const QString &sKey) { return this->insertFctStatic(qx::function::bind_fct_1(fct), sKey); } template template IxFunction *QxClass::fctStatic_2(const typename QxFunction_2::type_fct &fct, const QString &sKey) { return this->insertFctStatic(qx::function::bind_fct_2(fct), sKey); } template template IxFunction *QxClass::fctStatic_3(const typename QxFunction_3::type_fct &fct, const QString &sKey) { return this->insertFctStatic(qx::function::bind_fct_3(fct), sKey); } template template IxFunction *QxClass::fctStatic_4(const typename QxFunction_4::type_fct &fct, const QString &sKey) { return this->insertFctStatic(qx::function::bind_fct_4(fct), sKey); } template template IxFunction *QxClass::fctStatic_5(const typename QxFunction_5::type_fct &fct, const QString &sKey) { return this->insertFctStatic(qx::function::bind_fct_5(fct), sKey); } template template IxFunction *QxClass::fctStatic_6(const typename QxFunction_6::type_fct &fct, const QString &sKey) { return this->insertFctStatic(qx::function::bind_fct_6(fct), sKey); } template template IxFunction *QxClass::fctStatic_7(const typename QxFunction_7::type_fct &fct, const QString &sKey) { return this->insertFctStatic(qx::function::bind_fct_7(fct), sKey); } template template IxFunction *QxClass::fctStatic_8(const typename QxFunction_8::type_fct &fct, const QString &sKey) { return this->insertFctStatic(qx::function::bind_fct_8(fct), sKey); } template template IxFunction *QxClass::fctStatic_9(const typename QxFunction_9::type_fct &fct, const QString &sKey) { return this->insertFctStatic(qx::function::bind_fct_9(fct), sKey); } template <> QX_GCC_WORKAROUND_TEMPLATE_SPEC_INLINE QxClass::QxClass() : IxClass(), QxSingleton>("qx::QxClass_no_base_class_defined") { setName("qx::trait::no_base_class_defined"); setFinalClass(true); } template <> QX_GCC_WORKAROUND_TEMPLATE_SPEC_INLINE QxClass::QxClass() : IxClass(), QxSingleton>("qx::QxClass_QObject") { setKey("QObject"); setName("QObject"); setFinalClass(true); } template <> QX_GCC_WORKAROUND_TEMPLATE_SPEC_INLINE void QxClass::registerClass() { ; } template <> QX_GCC_WORKAROUND_TEMPLATE_SPEC_INLINE void QxClass::registerClass() { ; } template <> QX_GCC_WORKAROUND_TEMPLATE_SPEC_INLINE void QxClass::beforeRegisterClass() { ; } template <> QX_GCC_WORKAROUND_TEMPLATE_SPEC_INLINE void QxClass::beforeRegisterClass() { ; } } // namespace qx