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,17 +36,20 @@ 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) {
#ifdef LUA_HPP case LUA:
case LUA: ADDTARGET(LuaTarget) #ifdef LUA_HPP
#endif ADDTARGET(LUA_HPP); break;
#ifdef JS_HPP #endif
case JS: ADDTARGET(JsTarget) case JS:
#endif #ifdef JS_HPP
#ifdef PY_HPP ADDTARGET(JS_HPP); break;
case PY: ADDTARGET(PyTarget) #endif
#endif case PY:
#ifdef PY_HPP
ADDTARGET(PY_HPP); break;
#endif
case NONE: case NONE:
default: { default: {
if (not name.empty()) { if (not name.empty()) {

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 {};