![]() |
QxOrm
1.2.3
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_VALIDATOR_X_H_ 00027 #define _IX_VALIDATOR_X_H_ 00028 00029 #ifdef _MSC_VER 00030 #pragma once 00031 #endif 00032 00040 #include <QxCollection/QxCollection.h> 00041 00042 #include <QxValidator/IxValidator.h> 00043 00044 namespace qx { 00045 00046 class IxClass; 00047 class IxDataMember; 00048 class QxInvalidValueX; 00049 00057 class QX_DLL_EXPORT IxValidatorX 00058 { 00059 00060 friend class IxClass; 00061 00062 protected: 00063 00064 typedef QList<IxValidator_ptr> type_lst_validator; 00065 typedef boost::shared_ptr<type_lst_validator> type_lst_validator_ptr; 00066 typedef QxCollection<QString, type_lst_validator_ptr> type_lst_validator_ptr_by_group; 00067 00068 type_lst_validator_ptr_by_group m_lstValidatorByGroup; 00069 IxClass * m_pClass; 00070 00071 public: 00072 00073 IxValidatorX(); 00074 virtual ~IxValidatorX() = 0; 00075 00076 QxInvalidValueX validate(void * pOwner, const QString & sGroup = QString()) const; 00077 00078 IxValidator * add_NotNull(const QString & sPropertyKey, const QString & sMessage = QString(), const QString & sGroup = QString()); 00079 IxValidator * add_NotEmpty(const QString & sPropertyKey, const QString & sMessage = QString(), const QString & sGroup = QString()); 00080 IxValidator * add_MinValue(const QString & sPropertyKey, long lMinValue, const QString & sMessage = QString(), const QString & sGroup = QString()); 00081 IxValidator * add_MaxValue(const QString & sPropertyKey, long lMaxValue, const QString & sMessage = QString(), const QString & sGroup = QString()); 00082 IxValidator * add_Range(const QString & sPropertyKey, long lMinValue, long lMaxValue, const QString & sMessage = QString(), const QString & sGroup = QString()); 00083 IxValidator * add_MinDecimal(const QString & sPropertyKey, double dMinValue, const QString & sMessage = QString(), const QString & sGroup = QString()); 00084 IxValidator * add_MaxDecimal(const QString & sPropertyKey, double dMaxValue, const QString & sMessage = QString(), const QString & sGroup = QString()); 00085 IxValidator * add_RangeDecimal(const QString & sPropertyKey, double dMinValue, double dMaxValue, const QString & sMessage = QString(), const QString & sGroup = QString()); 00086 IxValidator * add_MinLength(const QString & sPropertyKey, long lMinLength, const QString & sMessage = QString(), const QString & sGroup = QString()); 00087 IxValidator * add_MaxLength(const QString & sPropertyKey, long lMaxLength, const QString & sMessage = QString(), const QString & sGroup = QString()); 00088 IxValidator * add_Size(const QString & sPropertyKey, long lMinLength, long lMaxLength, const QString & sMessage = QString(), const QString & sGroup = QString()); 00089 IxValidator * add_DatePast(const QString & sPropertyKey, const QString & sMessage = QString(), const QString & sGroup = QString()); 00090 IxValidator * add_DateFuture(const QString & sPropertyKey, const QString & sMessage = QString(), const QString & sGroup = QString()); 00091 IxValidator * add_RegExp(const QString & sPropertyKey, const QString & sPattern, const QString & sMessage = QString(), const QString & sGroup = QString()); 00092 IxValidator * add_EMail(const QString & sPropertyKey, const QString & sMessage = QString(), const QString & sGroup = QString()); 00093 00094 QStringList getAllGroup() const; 00095 QList<IxValidator_ptr> getAllValidatorByGroup(const QString & group) const; 00096 00097 protected: 00098 00099 void setClass(IxClass * p); 00100 void insertIntoGroup(IxValidator_ptr pValidator, const QString & sGroup); 00101 IxValidator_ptr createValidator(IxValidator::validator_type type, const QString & sPropertyKey, const QString & sMessage, const QString & sGroup); 00102 IxDataMember * getDataMember(const QString & sPropertyKey) const; 00103 00104 }; 00105 00106 typedef boost::shared_ptr<IxValidatorX> IxValidatorX_ptr; 00107 00108 } // namespace qx 00109 00110 #endif // _IX_VALIDATOR_X_H_