Skip to content

Commit

Permalink
Fixing macro trying to pair empty defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
Neko-Box-Coder committed Aug 29, 2024
1 parent 8f680e6 commit be37f78
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions Include_MultiHeaders/Macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,16 @@ namespace CppOverride
INTERNAL_CO_POPULATE_ARGS_NAMES(argsTypes) \
)

#define INTERNAL_CO_OVERRIDE_METHOD_BASE_NO_DEF(overrideObjName, instance, functionPrepend, returnType, functionName, argsTypes, functionAppend) \
MPT_REMOVE_PARENTHESIS(functionPrepend) inline MPT_REMOVE_PARENTHESIS(returnType) functionName \
( \
MPT_REMOVE_PARENTHESIS_IN_LIST( INTERNAL_POPULATE_ARGS_FIELD(argsTypes) ) \
) MPT_REMOVE_PARENTHESIS(functionAppend) \
{ \
INTERNAL_CO_OVERRIDE_IMPL_BASE(overrideObjName, returnType, instance, (INTERNAL_CO_POPULATE_ARGS_NAMES(argsTypes))); \
return MPT_REMOVE_PARENTHESIS(returnType)(); \
}

#define INTERNAL_CO_OVERRIDE_METHOD_BASE(overrideObjName, instance, functionPrepend, returnType, functionName, argsTypes, argsDefaults, functionAppend) \
MPT_REMOVE_PARENTHESIS(functionPrepend) inline MPT_REMOVE_PARENTHESIS(returnType) functionName \
( \
Expand All @@ -229,6 +239,15 @@ namespace CppOverride
return MPT_REMOVE_PARENTHESIS(returnType)(); \
}

#define INTERNAL_CO_OVERRIDE_MEMBER_METHOD_CTOR_BASE_NO_DEF(overrideObjName, functionPrepend, className, argsTypes, functionAppend) \
MPT_REMOVE_PARENTHESIS(functionPrepend) inline className \
( \
MPT_REMOVE_PARENTHESIS_IN_LIST( INTERNAL_POPULATE_ARGS_FIELD(argsTypes) ) \
) MPT_REMOVE_PARENTHESIS(functionAppend) \
{ \
CO_OVERRIDE_MEMBER_IMPL_CTOR_DTOR(overrideObjName, (INTERNAL_CO_POPULATE_ARGS_NAMES(argsTypes))); \
}

#define INTERNAL_CO_OVERRIDE_MEMBER_METHOD_CTOR_BASE(overrideObjName, functionPrepend, className, argsTypes, argsDefaults, functionAppend) \
MPT_REMOVE_PARENTHESIS(functionPrepend) inline className \
( \
Expand Down Expand Up @@ -282,13 +301,13 @@ namespace CppOverride
static_assert(false, "CO_OVERRIDE_METHOD must have 4 to 7 arguments, 3 given currently")

#define INTERNAL_CO_OVERRIDE_METHOD_4(overrideObjName, returnType, functionName, argsTypes) \
INTERNAL_CO_OVERRIDE_METHOD_BASE(overrideObjName, nullptr, /*functionPrepend*/, returnType, functionName, argsTypes, /*argsDefaults*/, /*functionAppend*/)
INTERNAL_CO_OVERRIDE_METHOD_BASE_NO_DEF(overrideObjName, nullptr, /*functionPrepend*/, returnType, functionName, argsTypes, /*functionAppend*/)

#define INTERNAL_CO_OVERRIDE_METHOD_5(overrideObjName, returnType, functionName, argsTypes, functionPrepend) \
INTERNAL_CO_OVERRIDE_METHOD_BASE(overrideObjName, nullptr, functionPrepend, returnType, functionName, argsTypes, /*argsDefaults*/, /*functionAppend*/)
INTERNAL_CO_OVERRIDE_METHOD_BASE_NO_DEF(overrideObjName, nullptr, functionPrepend, returnType, functionName, argsTypes, /*functionAppend*/)

#define INTERNAL_CO_OVERRIDE_METHOD_6(overrideObjName, returnType, functionName, argsTypes, functionPrepend, functionAppend) \
INTERNAL_CO_OVERRIDE_METHOD_BASE(overrideObjName, nullptr, functionPrepend, returnType, functionName, argsTypes, /*argsDefaults*/, functionAppend)
INTERNAL_CO_OVERRIDE_METHOD_BASE_NO_DEF(overrideObjName, nullptr, functionPrepend, returnType, functionName, argsTypes, functionAppend)

#define INTERNAL_CO_OVERRIDE_METHOD_7(overrideObjName, returnType, functionName, argsTypes, functionPrepend, functionAppend, argsDefaults) \
INTERNAL_CO_OVERRIDE_METHOD_BASE(overrideObjName, nullptr, functionPrepend, returnType, functionName, argsTypes, argsDefaults, functionAppend)
Expand All @@ -315,13 +334,13 @@ namespace CppOverride
static_assert(false, "CO_OVERRIDE_MEMBER_METHOD must have 4 to 7 arguments, 3 given currently")

#define INTERNAL_CO_OVERRIDE_MEMBER_METHOD_4(overrideObjName, returnType, functionName, argsTypes) \
INTERNAL_CO_OVERRIDE_METHOD_BASE(overrideObjName, this, /*functionPrepend*/, returnType, functionName, argsTypes, /*argsDefaults*/, /*functionAppend*/)
INTERNAL_CO_OVERRIDE_METHOD_BASE_NO_DEF(overrideObjName, this, /*functionPrepend*/, returnType, functionName, argsTypes, /*functionAppend*/)

#define INTERNAL_CO_OVERRIDE_MEMBER_METHOD_5(overrideObjName, returnType, functionName, argsTypes, functionPrepend) \
INTERNAL_CO_OVERRIDE_METHOD_BASE(overrideObjName, this, functionPrepend, returnType, functionName, argsTypes, /*argsDefaults*/, /*functionAppend*/)
INTERNAL_CO_OVERRIDE_METHOD_BASE_NO_DEF(overrideObjName, this, functionPrepend, returnType, functionName, argsTypes, /*functionAppend*/)

#define INTERNAL_CO_OVERRIDE_MEMBER_METHOD_6(overrideObjName, returnType, functionName, argsTypes, functionPrepend, functionAppend) \
INTERNAL_CO_OVERRIDE_METHOD_BASE(overrideObjName, this, functionPrepend, returnType, functionName, argsTypes, /*argsDefaults*/, functionAppend)
INTERNAL_CO_OVERRIDE_METHOD_BASE_NO_DEF(overrideObjName, this, functionPrepend, returnType, functionName, argsTypes, functionAppend)

#define INTERNAL_CO_OVERRIDE_MEMBER_METHOD_7(overrideObjName, returnType, functionName, argsTypes, functionPrepend, functionAppend, argsDefaults) \
INTERNAL_CO_OVERRIDE_METHOD_BASE(overrideObjName, this, functionPrepend, returnType, functionName, argsTypes, argsDefaults, functionAppend)
Expand All @@ -346,13 +365,13 @@ namespace CppOverride
static_assert(false, "CO_OVERRIDE_MEMBER_METHOD_CTOR must have 3 to 6 arguments, 2 given currently")

#define INTERNAL_CO_OVERRIDE_MEMBER_METHOD_CTOR_3(overrideObjName, className, argsTypes) \
INTERNAL_CO_OVERRIDE_MEMBER_METHOD_CTOR_BASE(overrideObjName, /*functionPrepend*/, className, argsTypes, /*argsDefaults*/, /*functionAppend*/)
INTERNAL_CO_OVERRIDE_MEMBER_METHOD_CTOR_BASE_NO_DEF(overrideObjName, /*functionPrepend*/, className, argsTypes, /*functionAppend*/)

#define INTERNAL_CO_OVERRIDE_MEMBER_METHOD_CTOR_4(overrideObjName, className, argsTypes, functionPrepend) \
INTERNAL_CO_OVERRIDE_MEMBER_METHOD_CTOR_BASE(overrideObjName, functionPrepend, className, argsTypes, /*argsDefaults*/, /*functionAppend*/) \
INTERNAL_CO_OVERRIDE_MEMBER_METHOD_CTOR_BASE_NO_DEF(overrideObjName, functionPrepend, className, argsTypes, /*functionAppend*/) \

#define INTERNAL_CO_OVERRIDE_MEMBER_METHOD_CTOR_5(overrideObjName, className, argsTypes, functionPrepend, functionAppend) \
INTERNAL_CO_OVERRIDE_MEMBER_METHOD_CTOR_BASE(overrideObjName, functionPrepend, className, argsTypes, /*argsDefaults*/, functionAppend)
INTERNAL_CO_OVERRIDE_MEMBER_METHOD_CTOR_BASE_NO_DEF(overrideObjName, functionPrepend, className, argsTypes, functionAppend)

#define INTERNAL_CO_OVERRIDE_MEMBER_METHOD_CTOR_6(overrideObjName, className, argsTypes, functionPrepend, functionAppend, argsDefaults) \
INTERNAL_CO_OVERRIDE_MEMBER_METHOD_CTOR_BASE(overrideObjName, functionPrepend, className, argsTypes, argsDefaults, functionAppend)
Expand Down

0 comments on commit be37f78

Please sign in to comment.