ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
qt_boxing.hpp
Go to the documentation of this file.
1/** ************************************************************************************************
2 * \file
3 * This header file is part of the \aliblong.
4 *
5 * \emoji :copyright: 2013-2024 A-Worx GmbH, Germany.
6 * Published under \ref mainpage_license "Boost Software License".
7 *
8 * <b>Legal Notice:</b>
9 * This is an optional extension header to provide compatibility between ALib and
10 * the QT class library.
11 * All information about QT is found at https://www.qt.io
12 * ALib otherwise does not use or rely on QT.
13 * The use of QT is bound to the QT license restrictions.
14 **************************************************************************************************/
15#ifndef HPP_ALIB_COMPATIBILITY_BOXING_QT
16#define HPP_ALIB_COMPATIBILITY_BOXING_QT 1
17
18#if !defined(HPP_ALIB) && !defined(ALIB_DOX)
19# include "alib/alib.hpp"
20#endif
21
23
24#if !defined(ALIB_QT_LIB_NOT_FOUND) // this is only set in an automated test project
25
26#if defined(__clang__)
27 #pragma clang diagnostic push
28 #pragma clang diagnostic ignored "-Wreserved-id-macro"
29 #pragma clang diagnostic ignored "-Wredundant-parens"
30 #pragma clang diagnostic ignored "-Wcovered-switch-default"
31 #pragma clang diagnostic ignored "-Wsign-conversion"
32 #pragma clang diagnostic ignored "-Wdeprecated"
33 #pragma clang diagnostic ignored "-Wunused-variable"
34 #pragma clang diagnostic ignored "-Wcomma"
35 #pragma clang diagnostic ignored "-Wduplicate-enum"
36#endif
37#include <QtCore/QString>
38#include <QtCore/QVector>
39
40#if defined(__clang__)
41 #pragma clang diagnostic pop
42#endif
43
44#if ALIB_CHARACTERS && !defined(HPP_ALIB_COMPATIBILITY_QT_CHARACTERS)
46#endif
47
48
49#if !defined(HPP_ALIB_BOXING_BOXING)
50# include "alib/boxing/boxing.hpp"
51#endif
52
53#if !defined(_GLIBCXX_FUNCTIONAL) && !defined(_FUNCTIONAL_)
54 #include <functional>
55#endif
56
57
58namespace alib { namespace boxing { namespace compatibility {
59/**
60 * This namespace documents compatibility features of \alib_boxing_nl and the
61 * \https{QT Class Library,www.qt.io}.
62 */
63namespace qt {
64
65
66
68/**
69 * Initializes \alib_boxing_nl in respect to boxing QT string types.
70 *
71 * This method is \b not automatically invoked with function \alib{Bootstrap}, because support
72 * for boxing QT string types is optional and provided with the inclusion of header
73 * \alibheader{compatibility/qt_boxing.hpp}.
74 *
75 * In general, boxing of QT string types works well without the one-time invocation of
76 * this function at the bootstrap section of a process.
77 * This method registers box-function \alib{boxing;FAppend} for QT string
78 * types when \ref alib_boxing_customizing_identity "custom boxing is bypassed" by wrapping the
79 * types in \c std::reference_wrapper<T>.
80 * The function is implemented with the help of \alib{boxing;FAppend::WrappedAppendable}
81 * for wrapped types \b QByteArray, \b QQLatin1String and \b QString, each for character types
82 * \b nchar and \b wchar.
83 *
84 * \note
85 * If invoked after bootstrap and module \alib_monomem_nl is included in the \alibdist,
86 * mutex \alib{monomem;GlobalAllocatorLock} has to be locked prior to an invocation.
87 */
89{
90 #if ALIB_STRINGS
91 alib::boxing::BootstrapRegister<boxing::FAppend<nchar>, boxing::TMappedTo<::std::reference_wrapper<QByteArray> >>( boxing::FAppend<nchar>::WrappedAppendable<QByteArray> );
92 alib::boxing::BootstrapRegister<boxing::FAppend<wchar>, boxing::TMappedTo<::std::reference_wrapper<QByteArray> >>( boxing::FAppend<wchar>::WrappedAppendable<QByteArray> );
93 alib::boxing::BootstrapRegister<boxing::FAppend<nchar>, boxing::TMappedTo<::std::reference_wrapper<QLatin1String>>>( boxing::FAppend<nchar>::WrappedAppendable<QLatin1String> );
94 alib::boxing::BootstrapRegister<boxing::FAppend<wchar>, boxing::TMappedTo<::std::reference_wrapper<QLatin1String>>>( boxing::FAppend<wchar>::WrappedAppendable<QLatin1String> );
95 alib::boxing::BootstrapRegister<boxing::FAppend<nchar>, boxing::TMappedTo<::std::reference_wrapper<QString> >>( boxing::FAppend<nchar>::WrappedAppendable<QString> );
96 alib::boxing::BootstrapRegister<boxing::FAppend<wchar>, boxing::TMappedTo<::std::reference_wrapper<QString> >>( boxing::FAppend<wchar>::WrappedAppendable<QString> );
97 #endif
98}
99}}}}
100
101#endif // !defined(ALIB_QT_LIB_NOT_FOUND) // this is only set in an automated test project
102
103#endif // HPP_ALIB_COMPATIBILITY_BOXING_QT
#define ALIB_ASSERT_MODULE(modulename)
Definition alib.hpp:190
Definition alib.cpp:57