| QxOrm 1.4.2 C++ Object Relational Mapping library

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

IxClass.h
Go to the documentation of this file.

    00001 /****************************************************************************
    00002 **
    00003 ** http://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 protected:
    00070
    00071    IxDataMemberX * m_pDataMemberX;
    00072    IxFunctionX_ptr m_pFctMemberX;
    00073    IxFunctionX_ptr m_pFctStaticX;
    00074
    00075    QString m_sKey;
    00076    QString m_sName;
    00077    QString m_sDescription;
    00078    long m_lVersion;
    00079    bool m_bFinalClass;
    00080    bool m_bDaoReadOnly;
    00081    bool m_bRegistered;
    00082    qx::dao::strategy::inheritance m_eDaoStrategy;
    00083    qx::QxSoftDelete m_oSoftDelete;
    00084    IxValidatorX_ptr m_pAllValidator;
    00085
    00086    QByteArray m_byteName;
    00087    const char * m_pName;
    00088
    00089 protected:
    00090
    00091    IxClass() : qx::QxPropertyBag(), m_pDataMemberX(NULL), m_lVersion(-1), m_bFinalClass(false), m_bDaoReadOnly(false), m_bRegistered(false), m_eDaoStrategy(qx::dao::strategy::concrete_table_inheritance), m_pName(NULL) { ; }
    00092    virtual ~IxClass() = 0;
    00093
    00094    void updateClassX();
    00095
    00096 public:
    00097
    00098    inline QString getKey() const                                  { return m_sKey; }
    00099    inline QString getName() const                                 { return m_sName; }
    00100    inline const char * getNamePtr() const                         { return m_pName; }
    00101    inline QString getDescription() const                          { return m_sDescription; }
    00102    inline long getVersion() const                                 { return m_lVersion; }
    00103    inline qx::dao::strategy::inheritance getDaoStrategy() const   { return m_eDaoStrategy; }
    00104    inline qx::QxSoftDelete getSoftDelete() const                  { return m_oSoftDelete; }
    00105    inline bool isFinalClass() const                               { return m_bFinalClass; }
    00106    inline bool isDaoReadOnly() const                              { return m_bDaoReadOnly; }
    00107    inline bool isRegistered() const                               { return m_bRegistered; }
    00108    inline IxDataMemberX * getDataMemberX() const                  { return m_pDataMemberX; }
    00109    inline IxFunctionX * getFctMemberX() const                     { return m_pFctMemberX.get(); }
    00110    inline IxFunctionX * getFctStaticX() const                     { return m_pFctStaticX.get(); }
    00111
    00112    inline void setName(const QString & sName)                                 { m_sName = sName; updateNamePtr(); }
    00113    inline void setDescription(const QString & sDesc)                          { m_sDescription = sDesc; }
    00114    inline void setDaoStrategy(qx::dao::strategy::inheritance eDaoStrategy)    { m_eDaoStrategy = eDaoStrategy; }
    00115    inline void setSoftDelete(const qx::QxSoftDelete & oSoftDelete)            { m_oSoftDelete = oSoftDelete; if (m_oSoftDelete.getTableName().isEmpty()) { m_oSoftDelete.setTableName(m_sName); } }
    00116    inline void setDaoReadOnly(bool bDaoReadOnly)                              { m_bDaoReadOnly = bDaoReadOnly; }
    00117
    00118    virtual bool isAbstract() const = 0;
    00119    virtual bool implementIxPersistable() const = 0;
    00120    virtual IxClass * getBaseClass() const = 0;
    00121    virtual IxValidatorX * getAllValidator();
    00122
    00123    IxDataMember * getId(bool bRecursive = false) const;
    00124    bool isKindOf(const QString & sClassName) const;
    00125    QString dumpClass() const;
    00126
    00127 #ifndef _QX_NO_RTTI
    00128    virtual const std::type_info & typeInfo() const = 0;
    00129    bool isKindOf(const std::type_info & typeInfo) const;
    00130 #endif // _QX_NO_RTTI
    00131
    00132 private:
    00133
    00134    inline void updateNamePtr()   { m_byteName = m_sName.toLatin1(); m_pName = m_byteName.constData(); }
    00135
    00136 };
    00137
    00138 typedef qx_shared_ptr<IxClass> IxClass_ptr;
    00139
    00140 } // namespace qx
    00141
    00142 #endif // _IX_CLASS_H_