QxOrm  1.5.0
C++ Object Relational Mapping library
IxClass.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** https://www.qxorm.com/
00004 ** Copyright (C) 2013 Lionel Marty (contact@qxorm.com)
00005 **
00006 ** This file is part of the QxOrm library
00007 **
00008 ** This software is provided 'as-is', without any express or implied
00009 ** warranty. In no event will the authors be held liable for any
00010 ** damages arising from the use of this software
00011 **
00012 ** Commercial Usage
00013 ** Licensees holding valid commercial QxOrm licenses may use this file in
00014 ** accordance with the commercial license agreement provided with the
00015 ** Software or, alternatively, in accordance with the terms contained in
00016 ** a written agreement between you and Lionel Marty
00017 **
00018 ** GNU General Public License Usage
00019 ** Alternatively, this file may be used under the terms of the GNU
00020 ** General Public License version 3.0 as published by the Free Software
00021 ** Foundation and appearing in the file 'license.gpl3.txt' included in the
00022 ** packaging of this file. Please review the following information to
00023 ** ensure the GNU General Public License version 3.0 requirements will be
00024 ** met : http://www.gnu.org/copyleft/gpl.html
00025 **
00026 ** If you are unsure which license is appropriate for your use, or
00027 ** if you have questions regarding the use of this file, please contact :
00028 ** contact@qxorm.com
00029 **
00030 ****************************************************************************/
00031 
00032 #ifndef _IX_CLASS_H_
00033 #define _IX_CLASS_H_
00034 
00035 #ifdef _MSC_VER
00036 #pragma once
00037 #endif
00038 
00046 #ifndef _QX_NO_RTTI
00047 #include <typeinfo>
00048 #endif // _QX_NO_RTTI
00049 
00050 #include <QxCommon/QxPropertyBag.h>
00051 
00052 #include <QxDataMember/IxDataMemberX.h>
00053 
00054 #include <QxFunction/IxFunction.h>
00055 
00056 #include <QxDao/QxSoftDelete.h>
00057 
00058 #include <QxValidator/IxValidatorX.h>
00059 
00060 namespace qx {
00061 
00062 class IxSqlRelation;
00063 
00068 class QX_DLL_EXPORT IxClass : public qx::QxPropertyBag
00069 {
00070 
00071 private:
00072 
00073    struct IxClassImpl;
00074    std::unique_ptr<IxClassImpl> m_pImpl; 
00075 
00076 protected:
00077 
00078    IxClass();
00079    virtual ~IxClass() = 0;
00080 
00081 public:
00082 
00083    QString getKey() const;
00084    QString getName() const;
00085    const char * getNamePtr() const;
00086    QString getDescription() const;
00087    long getVersion() const;
00088    qx::dao::strategy::inheritance getDaoStrategy() const;
00089    qx::QxSoftDelete getSoftDelete() const;
00090    bool isFinalClass() const;
00091    bool isDaoReadOnly() const;
00092    bool isRegistered() const;
00093    IxDataMemberX * getDataMemberX() const;
00094    IxFunctionX * getFctMemberX() const;
00095    IxFunctionX * getFctStaticX() const;
00096    std::shared_ptr<QxCollection<QString, IxSqlRelation *> > getSqlRelationX();
00097    std::shared_ptr<QxCollection<QString, IxDataMember *> > getSqlDataMemberX();
00098 
00099    void setKey(const QString & s);
00100    void setName(const QString & s);
00101    void setDescription(const QString & s);
00102    void setDaoStrategy(qx::dao::strategy::inheritance e);
00103    void setSoftDelete(const qx::QxSoftDelete & o);
00104    void setDaoReadOnly(bool b);
00105    void setVersion(long l);
00106 
00107    virtual bool isAbstract() const = 0;
00108    virtual bool implementIxPersistable() const = 0;
00109    virtual IxClass * getBaseClass() const = 0;
00110    virtual IxValidatorX * getAllValidator();
00111 
00112    IxDataMember * getId(bool bRecursive = false) const;
00113    bool isKindOf(const QString & sClassName) const;
00114    QString dumpClass() const;
00115 
00116 #ifndef _QX_NO_RTTI
00117    virtual const std::type_info & typeInfo() const = 0;
00118    bool isKindOf(const std::type_info & typeInfo) const;
00119 #endif // _QX_NO_RTTI
00120 
00121 protected:
00122 
00123    void updateClassX();
00124    void setRegistered(bool b);
00125    void setFinalClass(bool b);
00126    void setDataMemberX(IxDataMemberX * p);
00127    void setFctMemberX(IxFunctionX * p);
00128    void setFctStaticX(IxFunctionX * p);
00129    IxValidatorX_ptr & getAllValidatorRef();
00130 
00131 };
00132 
00133 typedef std::shared_ptr<IxClass> IxClass_ptr;
00134 
00135 } // namespace qx
00136 
00137 #endif // _IX_CLASS_H_