QxOrm  1.4.5
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 
00066 class QX_DLL_EXPORT IxClass : public qx::QxPropertyBag
00067 {
00068 
00069 private:
00070 
00071    struct IxClassImpl;
00072    std::unique_ptr<IxClassImpl> m_pImpl; 
00073 
00074 protected:
00075 
00076    IxClass();
00077    virtual ~IxClass() = 0;
00078 
00079 public:
00080 
00081    QString getKey() const;
00082    QString getName() const;
00083    const char * getNamePtr() const;
00084    QString getDescription() const;
00085    long getVersion() const;
00086    qx::dao::strategy::inheritance getDaoStrategy() const;
00087    qx::QxSoftDelete getSoftDelete() const;
00088    bool isFinalClass() const;
00089    bool isDaoReadOnly() const;
00090    bool isRegistered() const;
00091    IxDataMemberX * getDataMemberX() const;
00092    IxFunctionX * getFctMemberX() const;
00093    IxFunctionX * getFctStaticX() const;
00094 
00095    void setKey(const QString & s);
00096    void setName(const QString & s);
00097    void setDescription(const QString & s);
00098    void setDaoStrategy(qx::dao::strategy::inheritance e);
00099    void setSoftDelete(const qx::QxSoftDelete & o);
00100    void setDaoReadOnly(bool b);
00101    void setVersion(long l);
00102 
00103    virtual bool isAbstract() const = 0;
00104    virtual bool implementIxPersistable() const = 0;
00105    virtual IxClass * getBaseClass() const = 0;
00106    virtual IxValidatorX * getAllValidator();
00107 
00108    IxDataMember * getId(bool bRecursive = false) const;
00109    bool isKindOf(const QString & sClassName) const;
00110    QString dumpClass() const;
00111 
00112 #ifndef _QX_NO_RTTI
00113    virtual const std::type_info & typeInfo() const = 0;
00114    bool isKindOf(const std::type_info & typeInfo) const;
00115 #endif // _QX_NO_RTTI
00116 
00117 protected:
00118 
00119    void updateClassX();
00120    void setRegistered(bool b);
00121    void setFinalClass(bool b);
00122    void setDataMemberX(IxDataMemberX * p);
00123    void setFctMemberX(IxFunctionX * p);
00124    void setFctStaticX(IxFunctionX * p);
00125    IxValidatorX_ptr & getAllValidatorRef();
00126 
00127 };
00128 
00129 typedef std::shared_ptr<IxClass> IxClass_ptr;
00130 
00131 } // namespace qx
00132 
00133 #endif // _IX_CLASS_H_