├── FunctionTraits.h ├── FunctionUtils.h ├── QtCallback.cpp ├── QtCallback.h ├── QtMetacallAdapter.h ├── QtSignalForwarder.cpp ├── QtSignalForwarder.h ├── README.md ├── SafeBinder.h ├── examples ├── common.pri ├── ui-controls │ ├── UiDemo.cpp │ └── ui-controls.pro └── web-page-fetcher │ ├── WebPageDownloader.cpp │ ├── WebPageDownloader.h │ └── web-page-fetcher.pro ├── qt-callbacks.pro └── tests ├── TestQtSignalTools.cpp ├── TestQtSignalTools.h └── tests.pro /FunctionTraits.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "FunctionUtils.h" 4 | 5 | namespace QtSignalTools 6 | { 7 | 8 | // extract the argument count and types 9 | // from a function signature 10 | template 11 | struct FunctionTraits; 12 | 13 | template 14 | struct FunctionTraits 15 | { 16 | enum { count = 0 }; 17 | typedef R result_type; 18 | }; 19 | 20 | template 21 | struct FunctionTraits : FunctionTraits 22 | { 23 | enum { count = 1 }; 24 | typedef T arg0_type; 25 | }; 26 | 27 | template 28 | struct FunctionTraits : FunctionTraits 29 | { 30 | enum { count = 2 }; 31 | typedef T2 arg1_type; 32 | }; 33 | 34 | template 35 | struct FunctionTraits : FunctionTraits 36 | { 37 | enum { count = 3 }; 38 | typedef T3 arg2_type; 39 | }; 40 | 41 | template 42 | struct FunctionTraits : FunctionTraits 43 | { 44 | enum { count = 4 }; 45 | typedef T4 arg3_type; 46 | }; 47 | 48 | template 49 | struct FunctionTraits : FunctionTraits 50 | { 51 | enum { count = 5 }; 52 | typedef T5 arg4_type; 53 | }; 54 | 55 | // extract the function signature from an input type T, 56 | // where T may be a function pointer or function object 57 | template 58 | struct ExtractSignature 59 | { 60 | typedef T type; 61 | }; 62 | 63 | template 64 | struct ExtractSignature 65 | { 66 | typedef T type; 67 | }; 68 | 69 | template