| QxOrm 1.1.6 C++ Object Relational Mapping library

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

- File List
- File Members

QxBoostSerializeHelper.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_HELPER_H_
    00027 #define _QX_BOOST_SERIALIZE_HELPER_H_
    00028
    00029 #ifdef _MSC_VER
    00030 #pragma once
    00031 #endif
    00032
    00033 #include <boost/type_traits/is_same.hpp>
    00034 #include <boost/serialization/void_cast.hpp>
    00035
    00036 #include <QxTraits/get_base_class.h>
    00037
    00038 #include <QxSerialize/QxBoostSerializeHelper/QxBoostInitGuid.h>
    00039
    00040 namespace qx {
    00041
    00042 template <class T>
    00043 class QxBoostSerializeHelper
    00044 {
    00045
    00046 private:
    00047
    00048    typedef T type_derived;
    00049    typedef typename qx::trait::get_base_class<type_derived>::type type_base;
    00050
    00051 public:
    00052
    00053    template <class Archive>
    00054    static inline void register_type_helper(Archive & ar, const T * t)
    00055    { Q_UNUSED(t); ar.template register_type<type_derived>(); }
    00056
    00057    static inline void void_cast_register_helper(const T * t)
    00058    { Q_UNUSED(t); QxBoostVoidCastRegisterHelper<boost::is_same<type_base, qx::trait::no_base_class_defined>::value, 0>::helper(); }
    00059
    00060    static inline void init_guid(const T * t)
    00061    { Q_UNUSED(t); QxBoostInitGuid<T>::init(); }
    00062
    00063 private:
    00064
    00065    template <bool bNoBaseClass /* = false */, int dummy>
    00066    struct QxBoostVoidCastRegisterHelper
    00067    { static inline void helper() { boost::serialization::void_cast_register(static_cast<type_derived *>(NULL), static_cast<type_base *>(NULL)); } };
    00068
    00069    template <int dummy>
    00070    struct QxBoostVoidCastRegisterHelper<true, dummy>
    00071    { static inline void helper() { /* Nothing */ ; } };
    00072
    00073 };
    00074
    00075 } // namespace qx
    00076
    00077 #endif // _QX_BOOST_SERIALIZE_HELPER_H_

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines