![]() |
QxOrm 1.1.8
C++ Object Relational Mapping library
|
00001 /**************************************************************************** 00002 ** 00003 ** http://www.qxorm.com/ 00004 ** http://sourceforge.net/projects/qxorm/ 00005 ** Original file by Lionel Marty 00006 ** 00007 ** This file is part of the QxOrm library 00008 ** 00009 ** This software is provided 'as-is', without any express or implied 00010 ** warranty. In no event will the authors be held liable for any 00011 ** damages arising from the use of this software. 00012 ** 00013 ** GNU Lesser General Public License Usage 00014 ** This file must be used under the terms of the GNU Lesser 00015 ** General Public License version 2.1 as published by the Free Software 00016 ** Foundation and appearing in the file 'license.lgpl.txt' included in the 00017 ** packaging of this file. Please review the following information to 00018 ** ensure the GNU Lesser General Public License version 2.1 requirements 00019 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 00020 ** 00021 ** If you have questions regarding the use of this file, please contact : 00022 ** contact@qxorm.com 00023 ** 00024 ****************************************************************************/ 00025 00026 #ifndef _IX_CLASS_H_ 00027 #define _IX_CLASS_H_ 00028 00029 #ifdef _MSC_VER 00030 #pragma once 00031 #endif 00032 00040 #include <QxDataMember/IxDataMemberX.h> 00041 00042 #include <QxFunction/IxFunction.h> 00043 00044 #include <QxDao/QxSoftDelete.h> 00045 00046 namespace qx { 00047 00052 class QX_DLL_EXPORT IxClass 00053 { 00054 00055 protected: 00056 00057 IxDataMemberX * m_pDataMemberX; 00058 IxFunctionX_ptr m_pFctMemberX; 00059 00060 QString m_sKey; 00061 QString m_sKeyBaseClass; 00062 QString m_sName; 00063 QString m_sDescription; 00064 long m_lVersion; 00065 bool m_bFinalClass; 00066 qx::dao::strategy::inheritance m_eDaoStrategy; 00067 qx::QxSoftDelete m_oSoftDelete; 00068 00069 QByteArray m_byteName; 00070 const char * m_pName; 00071 00072 protected: 00073 00074 IxClass() : m_pDataMemberX(NULL), m_lVersion(-1), m_bFinalClass(false), m_eDaoStrategy(qx::dao::strategy::concrete_table_inheritance), m_pName(NULL) { ; } 00075 virtual ~IxClass() = 0; 00076 00077 void updateClassX(); 00078 00079 public: 00080 00081 inline QString getKey() const { return m_sKey; } 00082 inline QString getKeyBaseClass() const { return m_sKeyBaseClass; } 00083 inline QString getName() const { return m_sName; } 00084 inline const char * getNamePtr() const { return m_pName; } 00085 inline QString getDescription() const { return m_sDescription; } 00086 inline long getVersion() const { return m_lVersion; } 00087 inline qx::dao::strategy::inheritance getDaoStrategy() const { return m_eDaoStrategy; } 00088 inline qx::QxSoftDelete getSoftDelete() const { return m_oSoftDelete; } 00089 inline bool getFinalClass() const { return m_bFinalClass; } 00090 inline IxDataMemberX * getDataMemberX() const { return m_pDataMemberX; } 00091 inline IxFunctionX * getFctMemberX() const { return m_pFctMemberX.get(); } 00092 inline IxDataMember * getId() const { return (m_pDataMemberX ? m_pDataMemberX->getId() : NULL); } 00093 00094 inline void setName(const QString & sName) { m_sName = sName; updateNamePtr(); } 00095 inline void setDescription(const QString & sDesc) { m_sDescription = sDesc; } 00096 inline void setDaoStrategy(qx::dao::strategy::inheritance eDaoStrategy) { m_eDaoStrategy = eDaoStrategy; } 00097 inline void setSoftDelete(const qx::QxSoftDelete & oSoftDelete) { m_oSoftDelete = oSoftDelete; if (m_oSoftDelete.getTableName().isEmpty()) { m_oSoftDelete.setTableName(m_sName); } } 00098 00099 private: 00100 00101 inline void updateNamePtr() { m_byteName = m_sName.toAscii(); m_pName = m_byteName.constData(); } 00102 00103 }; 00104 00105 typedef boost::shared_ptr<IxClass> IxClass_ptr; 00106 00107 } // namespace qx 00108 00109 #endif // _IX_CLASS_H_