decompose PRIVATE_DEFINITION_END(c) to PRIVATE_DEFINITION_FINISH(c) and RIVATE_DEFINITION_INITIALIZE(c)

now you can define private in separate file and initialize it in main cpp
This commit is contained in:
2025-09-19 17:39:39 +03:00
parent fdec0e66a8
commit e5df76ab1d
2 changed files with 10 additions and 5 deletions

View File

@@ -135,7 +135,7 @@ JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature LambdaBodyIndentation: Signature
MacroBlockBegin: "PRIVATE_DEFINITION_START|STATIC_INITIALIZER_BEGIN" MacroBlockBegin: "PRIVATE_DEFINITION_START|STATIC_INITIALIZER_BEGIN"
MacroBlockEnd: "PRIVATE_DEFINITION_END|STATIC_INITIALIZER_END" MacroBlockEnd: "PRIVATE_DEFINITION_END|PRIVATE_DEFINITION_FINISH|STATIC_INITIALIZER_END"
MaxEmptyLinesToKeep: 2 MaxEmptyLinesToKeep: 2
NamespaceIndentation: None NamespaceIndentation: None
ObjCBinPackProtocolList: Auto ObjCBinPackProtocolList: Auto

View File

@@ -12,7 +12,7 @@
*/ */
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Base macros Base macros
Ivan Pelipenko peri4ko@yandex.ru Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
@@ -333,9 +333,10 @@ typedef long long ssize_t;
__PrivateInitializer__ __privateinitializer__; __PrivateInitializer__ __privateinitializer__;
# define PRIVATE_DEFINITION_START(c) struct c::__Private__ { # define PRIVATE_DEFINITION_START(c) struct c::__Private__ {
# define PRIVATE_DEFINITION_END(c) \ # define PRIVATE_DEFINITION_FINISH(c) \
} \ } \
; \ ;
# define PRIVATE_DEFINITION_INITIALIZE(c) \
c::__PrivateInitializer__::__PrivateInitializer__() { \ c::__PrivateInitializer__::__PrivateInitializer__() { \
p = new c::__Private__(); \ p = new c::__Private__(); \
} \ } \
@@ -350,6 +351,10 @@ typedef long long ssize_t;
p = new c::__Private__(); \ p = new c::__Private__(); \
return *this; \ return *this; \
} }
# define PRIVATE_DEFINITION_END(c) \
PRIVATE_DEFINITION_FINISH(c) \
PRIVATE_DEFINITION_INITIALIZE(c)
# define PRIVATE (__privateinitializer__.p) # define PRIVATE (__privateinitializer__.p)
# define PRIVATEWB __privateinitializer__.p # define PRIVATEWB __privateinitializer__.p