QxOrm 1.4.9
C++ Object Relational Mapping library
Loading...
Searching...
No Matches
QxInvalidValueX.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** https://www.qxorm.com/
4** Copyright (C) 2013 Lionel Marty (contact@qxorm.com)
5**
6** This file is part of the QxOrm library
7**
8** This software is provided 'as-is', without any express or implied
9** warranty. In no event will the authors be held liable for any
10** damages arising from the use of this software
11**
12** Commercial Usage
13** Licensees holding valid commercial QxOrm licenses may use this file in
14** accordance with the commercial license agreement provided with the
15** Software or, alternatively, in accordance with the terms contained in
16** a written agreement between you and Lionel Marty
17**
18** GNU General Public License Usage
19** Alternatively, this file may be used under the terms of the GNU
20** General Public License version 3.0 as published by the Free Software
21** Foundation and appearing in the file 'license.gpl3.txt' included in the
22** packaging of this file. Please review the following information to
23** ensure the GNU General Public License version 3.0 requirements will be
24** met : http://www.gnu.org/copyleft/gpl.html
25**
26** If you are unsure which license is appropriate for your use, or
27** if you have questions regarding the use of this file, please contact :
28** contact@qxorm.com
29**
30****************************************************************************/
31
32#ifndef _QX_VALIDATOR_INVALID_VALUE_X_H_
33#define _QX_VALIDATOR_INVALID_VALUE_X_H_
34
35#ifdef _MSC_VER
36#pragma once
37#endif
38
46#ifdef _QX_ENABLE_BOOST_SERIALIZATION
47#include <boost/serialization/serialization.hpp>
48#include <boost/serialization/nvp.hpp>
49#endif // _QX_ENABLE_BOOST_SERIALIZATION
50
51#ifndef _QX_NO_JSON
52#include <QtCore/qjsonvalue.h>
53#endif // _QX_NO_JSON
54
57
59
60#include <QxConvert/QxConvert.h>
61
63
64namespace qx {
65class QxInvalidValueX;
66} // namespace qx
67
68QX_DLL_EXPORT QDataStream & operator<< (QDataStream & stream, const qx::QxInvalidValueX & t) QX_USED;
69QX_DLL_EXPORT QDataStream & operator>> (QDataStream & stream, qx::QxInvalidValueX & t) QX_USED;
70
71#ifndef _QX_NO_JSON
72namespace qx {
73namespace cvt {
74namespace detail {
75template <> struct QxConvert_ToJson< qx::QxInvalidValueX >;
76template <> struct QxConvert_FromJson< qx::QxInvalidValueX >;
77QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const qx::QxInvalidValueX & t, const QString & format) QX_USED;
78QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue & j, qx::QxInvalidValueX & t, const QString & format) QX_USED;
79} // namespace detail
80} // namespace cvt
81} // namespace qx
82#endif // _QX_NO_JSON
83
84namespace qx {
85
94{
95
96#ifdef _QX_ENABLE_BOOST_SERIALIZATION
97 friend class boost::serialization::access;
98#endif // _QX_ENABLE_BOOST_SERIALIZATION
99
100 friend QX_DLL_EXPORT QDataStream & ::operator<< (QDataStream & stream, const qx::QxInvalidValueX & t);
101 friend QX_DLL_EXPORT QDataStream & ::operator>> (QDataStream & stream, qx::QxInvalidValueX & t);
102
103#ifndef _QX_NO_JSON
105 friend struct qx::cvt::detail::QxConvert_FromJson< qx::QxInvalidValueX >;
106 friend QX_DLL_EXPORT QJsonValue qx::cvt::detail::QxConvert_ToJson_Helper(const qx::QxInvalidValueX & t, const QString & format);
107 friend QX_DLL_EXPORT qx_bool qx::cvt::detail::QxConvert_FromJson_Helper(const QJsonValue & j, qx::QxInvalidValueX & t, const QString & format);
108#endif // _QX_NO_JSON
109
110protected:
111
112 QList<QxInvalidValue> m_lstInvalidValues;
113 QString m_sCurrentPath;
114
115public:
116
118 virtual ~QxInvalidValueX();
119
120 QString getCurrentPath() const;
121 void setCurrentPath(const QString & s);
122
123 long count() const;
124 QxInvalidValue at(long l) const;
125 void insert(const IxValidator * pValidator);
126 void insert(const QString & sMessage);
127 void insert(const QxInvalidValue & invalidValue);
128 void insert(const QxInvalidValueX & other);
129
130 QString text() const;
131 void dump() const;
132
133 inline operator bool() const
134 { return (m_lstInvalidValues.count() == 0); }
135
136private:
137
138#ifdef _QX_ENABLE_BOOST_SERIALIZATION
139 template <class Archive>
140 void serialize(Archive & ar, const unsigned int file_version)
141 {
142 Q_UNUSED(file_version);
143 ar & boost::serialization::make_nvp("list_invalid_values", m_lstInvalidValues);
144 ar & boost::serialization::make_nvp("current_path", m_sCurrentPath);
145 }
146#endif // _QX_ENABLE_BOOST_SERIALIZATION
147
148};
149
150} // namespace qx
151
153
154#endif // _QX_VALIDATOR_INVALID_VALUE_X_H_
qx::cvt : namespace to provide global functions to convert any kind of objects to/from QString and QV...
Invalid value when a property fails to pass a constraint.
QX_DLL_EXPORT QDataStream & operator>>(QDataStream &stream, qx::QxInvalidValueX &t) QX_USED
QX_DLL_EXPORT QDataStream & operator<<(QDataStream &stream, const qx::QxInvalidValueX &t) QX_USED
#define QX_USED
Definition QxMacro.h:244
#define QX_DLL_EXPORT
Definition QxMacro.h:182
qx_bool : boolean type with code and description message when an error occured
Definition QxBool.h:71
qx::QxInvalidValue : invalid value when a property fails to pass a constraint
qx::QxInvalidValueX : list of invalid values
void serialize(Archive &ar, const unsigned int file_version)
qx::trait::get_class_name<T>::get() : return class name of type T under const char * format,...
#define QX_REGISTER_CLASS_NAME(className)
void dump(const T &t, bool bJsonFormat=false)
qx::dump(const T & t, bool bJsonFormat) : dump class of type T registered into QxOrm context using XM...
Definition QxDump.h:63
QX_DLL_EXPORT QJsonValue QxConvert_ToJson_Helper(const qx::dao::detail::IxSqlElement &t, const QString &format) QX_USED
QX_DLL_EXPORT qx_bool QxConvert_FromJson_Helper(const QJsonValue &j, qx::dao::detail::IxSqlElement &t, const QString &format) QX_USED
Root namespace for all QxOrm library features.