GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
octave-qtutils.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2021-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_octave_qtutils_h)
27 #define octave_octave_qtutils_h 1
28 
29 // This file should not be installed and should only be included in C++
30 // source files after config.h is included, not in other header files.
31 
32 #if ! defined (HAVE_QOVERLOAD_TEMPLATE)
33 
34 // The following are copied directly from qglobal.h from Qt 5.15.2 with
35 // Q_DECL_CONSTEXPR replaced by constexpr so that we don't have to
36 // include any Qt headers or define any other special magic here.
37 // Octave requires C++11 so using constexpr should be OK.
38 
39 template <typename... Args>
41 {
42  template <typename R, typename T>
43  constexpr auto operator()(R (T::*ptr)(Args...)) const noexcept -> decltype(ptr)
44  { return ptr; }
45 
46  template <typename R, typename T>
47  static constexpr auto of(R (T::*ptr)(Args...)) noexcept -> decltype(ptr)
48  { return ptr; }
49 };
50 
51 template <typename... Args>
53 {
54  template <typename R, typename T>
55  constexpr auto operator()(R (T::*ptr)(Args...) const) const noexcept -> decltype(ptr)
56  { return ptr; }
57 
58  template <typename R, typename T>
59  static constexpr auto of(R (T::*ptr)(Args...) const) noexcept -> decltype(ptr)
60  { return ptr; }
61 };
62 
63 template <typename... Args>
64 struct QOverload : QConstOverload<Args...>, QNonConstOverload<Args...>
65 {
66  using QConstOverload<Args...>::of;
68  using QNonConstOverload<Args...>::of;
70 
71  template <typename R>
72  constexpr auto operator()(R (*ptr)(Args...)) const noexcept -> decltype(ptr)
73  { return ptr; }
74 
75  template <typename R>
76  static constexpr auto of(R (*ptr)(Args...)) noexcept -> decltype(ptr)
77  { return ptr; }
78 };
79 
80 #endif
81 
82 #endif
constexpr auto operator()(R(T::*ptr)(Args...) const) const noexcept -> decltype(ptr)
static constexpr auto of(R(T::*ptr)(Args...) const) noexcept -> decltype(ptr)
constexpr auto operator()(R(T::*ptr)(Args...)) const noexcept -> decltype(ptr)
static constexpr auto of(R(T::*ptr)(Args...)) noexcept -> decltype(ptr)
static constexpr auto of(R(*ptr)(Args...)) noexcept -> decltype(ptr)
constexpr auto operator()(R(*ptr)(Args...)) const noexcept -> decltype(ptr)