Don't break in the ADDTARGET macro of Target.hpp, and define class names of Py.hpp, Lua.hpp and Js.hpp to use them in Target.hpp.

This commit is contained in:
Username404 2021-07-31 18:56:17 +02:00
parent ac195d413b
commit 4512909b23
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
4 changed files with 16 additions and 13 deletions

View File

@ -36,16 +36,19 @@ shared_ptr<Target> Target::forName(string_view name) {
} }
} }
shared_ptr<Target> target; shared_ptr<Target> target;
#define ADDTARGET(X) target = make_shared<X>(X()); break; #define ADDTARGET(X) target = make_shared<X>(X());
switch (selected) { switch (selected) {
case LUA:
#ifdef LUA_HPP #ifdef LUA_HPP
case LUA: ADDTARGET(LuaTarget) ADDTARGET(LUA_HPP); break;
#endif #endif
case JS:
#ifdef JS_HPP #ifdef JS_HPP
case JS: ADDTARGET(JsTarget) ADDTARGET(JS_HPP); break;
#endif #endif
case PY:
#ifdef PY_HPP #ifdef PY_HPP
case PY: ADDTARGET(PyTarget) ADDTARGET(PY_HPP); break;
#endif #endif
case NONE: case NONE:
default: { default: {

View File

@ -1,5 +1,5 @@
#ifndef JS_HPP #ifndef JS_HPP
#define JS_HPP #define JS_HPP JsTarget
struct JsTarget: Target {}; struct JsTarget: Target {};

View File

@ -1,5 +1,5 @@
#ifndef LUA_HPP #ifndef LUA_HPP
#define LUA_HPP #define LUA_HPP LuaTarget
struct LuaTarget: Target {}; struct LuaTarget: Target {};

View File

@ -1,5 +1,5 @@
#ifndef PY_HPP #ifndef PY_HPP
#define PY_HPP #define PY_HPP PyTarget
struct PyTarget: Target {}; struct PyTarget: Target {};