| QxOrm 1.1.7 C++ Object Relational Mapping library

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

- File List
- File Members

QxBoostSerializeRegisterHelper.h
Go to the documentation of this file.

    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 _QX_BOOST_SERIALIZE_REGISTER_HELPER_H_
    00027 #define _QX_BOOST_SERIALIZE_REGISTER_HELPER_H_
    00028
    00029 #ifdef _MSC_VER
    00030 #pragma once
    00031 #endif
    00032
    00033 #include <QxSerialize/QxBoostSerializeHelper/IxBoostSerializeRegisterHelper.h>
    00034 #include <QxSerialize/QxBoostSerializeHelper/QxBoostSerializeHelper.h>
    00035
    00036 #define QX_BOOST_SERIALIZE_REGISTER_HELPER_IMPLEMENT_VIRTUAL_ARCHIVE(ArchiveIn, ArchiveOut) \
    00037 virtual void helper(ArchiveIn & ar) const { private_helper(ar); } \
    00038 virtual void helper(ArchiveOut & ar) const { private_helper(ar); }
    00039
    00040 namespace qx {
    00041
    00042 template <class T>
    00043 class QxBoostSerializeRegisterHelper : public IxBoostSerializeRegisterHelper
    00044 {
    00045
    00046 public:
    00047
    00048    QxBoostSerializeRegisterHelper(const QString & sKey) : IxBoostSerializeRegisterHelper(sKey) { ; }
    00049    virtual ~QxBoostSerializeRegisterHelper() { ; }
    00050
    00051    virtual void helper() const { private_helper(); }
    00052
    00053 #if _QX_SERIALIZE_POLYMORPHIC
    00054    QX_BOOST_SERIALIZE_REGISTER_HELPER_IMPLEMENT_VIRTUAL_ARCHIVE(boost::archive::polymorphic_iarchive, boost::archive::polymorphic_oarchive)
    00055 #endif // _QX_SERIALIZE_POLYMORPHIC
    00056
    00057 #if _QX_SERIALIZE_BINARY
    00058    QX_BOOST_SERIALIZE_REGISTER_HELPER_IMPLEMENT_VIRTUAL_ARCHIVE(boost::archive::binary_iarchive, boost::archive::binary_oarchive)
    00059 #endif // _QX_SERIALIZE_BINARY
    00060
    00061 #if _QX_SERIALIZE_TEXT
    00062    QX_BOOST_SERIALIZE_REGISTER_HELPER_IMPLEMENT_VIRTUAL_ARCHIVE(boost::archive::text_iarchive, boost::archive::text_oarchive)
    00063 #endif // _QX_SERIALIZE_TEXT
    00064
    00065 #if _QX_SERIALIZE_XML
    00066    QX_BOOST_SERIALIZE_REGISTER_HELPER_IMPLEMENT_VIRTUAL_ARCHIVE(boost::archive::xml_iarchive, boost::archive::xml_oarchive)
    00067 #endif // _QX_SERIALIZE_XML
    00068
    00069 #if _QX_SERIALIZE_PORTABLE_BINARY
    00070    QX_BOOST_SERIALIZE_REGISTER_HELPER_IMPLEMENT_VIRTUAL_ARCHIVE(eos::portable_iarchive, eos::portable_oarchive)
    00071 #endif // _QX_SERIALIZE_PORTABLE_BINARY
    00072
    00073 #if _QX_SERIALIZE_WIDE_BINARY
    00074    QX_BOOST_SERIALIZE_REGISTER_HELPER_IMPLEMENT_VIRTUAL_ARCHIVE(boost::archive::binary_wiarchive, boost::archive::binary_woarchive)
    00075 #endif // _QX_SERIALIZE_WIDE_BINARY
    00076
    00077 #if _QX_SERIALIZE_WIDE_TEXT
    00078    QX_BOOST_SERIALIZE_REGISTER_HELPER_IMPLEMENT_VIRTUAL_ARCHIVE(boost::archive::text_wiarchive, boost::archive::text_woarchive)
    00079 #endif // _QX_SERIALIZE_WIDE_TEXT
    00080
    00081 #if _QX_SERIALIZE_WIDE_XML
    00082    QX_BOOST_SERIALIZE_REGISTER_HELPER_IMPLEMENT_VIRTUAL_ARCHIVE(boost::archive::xml_wiarchive, boost::archive::xml_woarchive)
    00083 #endif // _QX_SERIALIZE_WIDE_XML
    00084
    00085 private:
    00086
    00087    template <class Archive>
    00088    inline void private_helper(Archive & ar) const
    00089    {
    00090       qx::QxBoostSerializeHelper<T>::register_type_helper(ar, static_cast<T *>(NULL));
    00091       qx::QxBoostSerializeHelper<T>::void_cast_register_helper(static_cast<T *>(NULL));
    00092       qx::QxBoostSerializeHelper<T>::init_guid(static_cast<T *>(NULL));
    00093    }
    00094
    00095    inline void private_helper() const
    00096    {
    00097       qx::QxBoostSerializeHelper<T>::void_cast_register_helper(static_cast<T *>(NULL));
    00098       qx::QxBoostSerializeHelper<T>::init_guid(static_cast<T *>(NULL));
    00099    }
    00100
    00101 };
    00102
    00103 } // namespace qx
    00104
    00105 #if _QX_USE_BOOST_SERIALIZE_REGISTER_HELPER
    00106 #define QX_REGISTER_BOOST_SERIALIZE_HELPER_COMPLEX_CLASS_NAME(className, classNameFormatted) \
    00107 extern qx::QxBoostSerializeRegisterHelper< className > G_QX_REGISTER_BOOST_SERIALIZE_HELPER_##classNameFormatted;
    00108 #define QX_REGISTER_BOOST_SERIALIZE_HELPER(className) \
    00109 QX_REGISTER_BOOST_SERIALIZE_HELPER_COMPLEX_CLASS_NAME(className, className)
    00110 #else
    00111 #define QX_REGISTER_BOOST_SERIALIZE_HELPER_COMPLEX_CLASS_NAME(className, classNameFormatted) /* Nothing */
    00112 #define QX_REGISTER_BOOST_SERIALIZE_HELPER(className) /* Nothing */
    00113 #endif // _QX_USE_BOOST_SERIALIZE_REGISTER_HELPER
    00114
    00115 #if _QX_USE_BOOST_SERIALIZE_REGISTER_HELPER
    00116 #define QX_REGISTER_BOOST_SERIALIZE_HELPER_COMPLEX_CLASS_NAME_CPP(className, classNameFormatted) \
    00117 qx::QxBoostSerializeRegisterHelper< className > G_QX_REGISTER_BOOST_SERIALIZE_HELPER_##classNameFormatted(QString(#className));
    00118 #define QX_REGISTER_BOOST_SERIALIZE_HELPER_CPP(className) \
    00119 QX_REGISTER_BOOST_SERIALIZE_HELPER_COMPLEX_CLASS_NAME_CPP(className, className)
    00120 #else
    00121 #define QX_REGISTER_BOOST_SERIALIZE_HELPER_COMPLEX_CLASS_NAME_CPP(className, classNameFormatted) /* Nothing */
    00122 #define QX_REGISTER_BOOST_SERIALIZE_HELPER_CPP(className) /* Nothing */
    00123 #endif // _QX_USE_BOOST_SERIALIZE_REGISTER_HELPER
    00124
    00125 #endif // _QX_BOOST_SERIALIZE_REGISTER_HELPER_H_

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines