remotemono
RMonoAPIFunction_Impl.h
1 /*
2  Copyright 2020 David "Alemarius Nexus" Lerch
3 
4  This file is part of RemoteMono.
5 
6  RemoteMono is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  RemoteMono is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with RemoteMono. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 #pragma once
21 
22 #include "../config.h"
23 
24 #include "RMonoAPIFunction_Def.h"
25 
26 #include "../log.h"
27 #include "../util.h"
28 
29 
30 
31 
32 namespace remotemono
33 {
34 
35 
36 
37 template <typename ABI, bool required, typename RetT, typename... ArgsT>
39 {
40  std::string defSigStr = std::string(typeid(RetT).name()).append(" ").append(name).append("(");
41  std::string rawSigStr = std::string(typeid(typename RMonoAPIFunctionRawTraits<Self>::RawRetType).name()).append(" ").append(name).append("(");
42  std::string wrapSigStr = std::string(typeid(typename RMonoAPIFunctionWrapTraits<Self>::WrapRetType).name()).append(" ").append(name).append("(");
43  std::string apiSigStr = std::string(typeid(typename RMonoAPIFunctionAPITraits<Self>::APIRetType).name()).append(" ").append(name).append("(");
44 
45  debugDumpSignaturesArgRecurse<DefArgsTuple, 0>(defSigStr);
46  debugDumpSignaturesArgRecurse<typename RMonoAPIFunctionRawTraits<Self>::RawArgsTuple, 0>(rawSigStr);
47  debugDumpSignaturesArgRecurse<typename RMonoAPIFunctionWrapTraits<Self>::WrapArgsTuple, 0>(wrapSigStr);
48  debugDumpSignaturesArgRecurse<typename RMonoAPIFunctionAPITraits<Self>::APIArgsTuple, 0>(apiSigStr);
49 
50  defSigStr.append(")");
51  rawSigStr.append(")");
52  wrapSigStr.append(")");
53  apiSigStr.append(")");
54 
55  RMonoLogVerbose("Signatures for '%s':", name.data());
56  //RMonoLogVerbose(" Def: %s", defSigStr.data());
57  RMonoLogVerbose(" Raw: %s", rawSigStr.data());
58  RMonoLogVerbose(" Wrap: %s", wrapSigStr.data());
59  RMonoLogVerbose(" API: %s", apiSigStr.data());
60 }
61 
62 
63 template <typename ABI, bool required, typename RetT, typename... ArgsT>
64 template <typename ArgsTupleT, size_t argIdx>
66  std::string& sigStr
67 ) {
68  if constexpr(argIdx < std::tuple_size_v<ArgsTupleT>) {
69  if constexpr(argIdx != 0) {
70  sigStr.append(", ");
71  }
72 
73  sigStr.append(qualified_type_name<std::tuple_element_t<argIdx, ArgsTupleT>>());
74 
75  debugDumpSignaturesArgRecurse<ArgsTupleT, argIdx+1>(sigStr);
76  }
77 }
78 
79 
80 
81 }
remotemono::RMonoAPIFunctionWrapTraits
Definition: RMonoAPIFunctionTypeAdapters.h:126
remotemono::RMonoAPIFunctionAPITraits
Definition: RMonoAPIFunctionTypeAdapters.h:129
remotemono::RMonoAPIFunctionBase::debugDumpSignatures
void debugDumpSignatures()
Definition: RMonoAPIFunction_Impl.h:38
remotemono::RMonoAPIFunctionBase
Definition: RMonoAPIFunction_Def.h:55
remotemono::RMonoAPIFunctionRawTraits
Definition: RMonoAPIFunctionTypeAdapters.h:123