QxOrm  1.2.9
C++ Object Relational Mapping library
QxInvalidValue.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 _QX_VALIDATOR_INVALID_VALUE_H_
00033 #define _QX_VALIDATOR_INVALID_VALUE_H_
00034 
00035 #ifdef _MSC_VER
00036 #pragma once
00037 #endif
00038 
00046 #include <boost/serialization/serialization.hpp>
00047 #include <boost/serialization/nvp.hpp>
00048 
00049 #include <QxSerialize/boost/QxSerialize_shared_ptr.h>
00050 
00051 #include <QxSerialize/Qt/QxSerialize_QString.h>
00052 #include <QxSerialize/Qt/QxSerialize_QVariant.h>
00053 #include <QxSerialize/Qt/QxSerialize_QHash.h>
00054 
00055 #include <QxTraits/get_class_name.h>
00056 
00057 #include <QxCommon/QxPropertyBag.h>
00058 
00059 namespace qx {
00060 
00061 class IxValidator;
00062 
00070 class QX_DLL_EXPORT QxInvalidValue : public QxPropertyBag
00071 {
00072 
00073    friend class boost::serialization::access;
00074 
00075 protected:
00076 
00077    QString m_sMessage;                    
00078    QString m_sPropertyName;               
00079    QString m_sPath;                       
00080    const IxValidator * m_pValidator;      
00081 
00082 public:
00083 
00084    QxInvalidValue();
00085    virtual ~QxInvalidValue();
00086 
00087    QString getMessage() const                   { return m_sMessage; }
00088    QString getPropertyName() const              { return m_sPropertyName; }
00089    QString getPath() const                      { return m_sPath; }
00090    QString getFullName() const;
00091    const IxValidator * getValidator() const;
00092 
00093    void setMessage(const QString & s)           { m_sMessage = s; }
00094    void setPropertyName(const QString & s)      { m_sPropertyName = s; }
00095    void setPath(const QString & s)              { m_sPath = s; }
00096    void setValidator(const IxValidator * p);
00097 
00098 private:
00099 
00100    template <class Archive>
00101    void serialize(Archive & ar, const unsigned int file_version)
00102    {
00103       Q_UNUSED(file_version);
00104       ar & boost::serialization::make_nvp("message", m_sMessage);
00105       ar & boost::serialization::make_nvp("property_name", m_sPropertyName);
00106       ar & boost::serialization::make_nvp("path", m_sPath);
00107       ar & boost::serialization::make_nvp("list_property_bag", this->m_lstPropertyBag);
00108    }
00109 
00110 };
00111 
00112 } // namespace qx
00113 
00114 QX_REGISTER_CLASS_NAME(qx::QxInvalidValue)
00115 
00116 #endif // _QX_VALIDATOR_INVALID_VALUE_H_