Krita Source Code Documentation
Loading...
Searching...
No Matches
KisStaticInitializer.h File Reference

Go to the source code of this file.

Macros

#define CONCAT(a, b)   CONCAT_IMPL(a, b)
 
#define CONCAT_IMPL(a, b)   a ## b
 
#define KIS_DECLARE_STATIC_INITIALIZER   KIS_DECLARE_STATIC_INITIALIZER_IMPL(__COUNTER__)
 
#define KIS_DECLARE_STATIC_INITIALIZER_IMPL(uniqueId)
 

Macro Definition Documentation

◆ CONCAT

#define CONCAT ( a,
b )   CONCAT_IMPL(a, b)

Definition at line 10 of file KisStaticInitializer.h.

◆ CONCAT_IMPL

#define CONCAT_IMPL ( a,
b )   a ## b

Definition at line 11 of file KisStaticInitializer.h.

◆ KIS_DECLARE_STATIC_INITIALIZER

#define KIS_DECLARE_STATIC_INITIALIZER   KIS_DECLARE_STATIC_INITIALIZER_IMPL(__COUNTER__)

Sometimes we need to declare a static object that performs some actions on Krita loading, e.g. to register Qt's metatype for a Krita type. This macro helps with that:

KIS_DECLARE_STATIC_INITIALIZER { qRegisterMetaType<KoResourceSP>("KoResourceSP"); }

Definition at line 38 of file KisStaticInitializer.h.

◆ KIS_DECLARE_STATIC_INITIALIZER_IMPL

#define KIS_DECLARE_STATIC_INITIALIZER_IMPL ( uniqueId)
Value:
static void CONCAT(initializerFunc, uniqueId)(); \
\
class CONCAT(InitializerStruct, uniqueId) \
{ \
public: \
CONCAT(InitializerStruct, uniqueId)(void (*initializer)()) { \
initializer(); \
} \
}; \
\
static CONCAT(InitializerStruct, uniqueId) CONCAT(__initializerVariable, uniqueId)(&CONCAT(initializerFunc, uniqueId)); \
\
void CONCAT(initializerFunc, uniqueId)()
#define CONCAT(a, b)
typedef void(QOPENGLF_APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC)(GLuint buffer)

Definition at line 14 of file KisStaticInitializer.h.

14#define KIS_DECLARE_STATIC_INITIALIZER_IMPL(uniqueId) \
15 static void CONCAT(initializerFunc, uniqueId)(); \
16\
17 class CONCAT(InitializerStruct, uniqueId) \
18 { \
19 public: \
20 CONCAT(InitializerStruct, uniqueId)(void (*initializer)()) { \
21 initializer(); \
22 } \
23 }; \
24\
25 static CONCAT(InitializerStruct, uniqueId) CONCAT(__initializerVariable, uniqueId)(&CONCAT(initializerFunc, uniqueId)); \
26\
27 void CONCAT(initializerFunc, uniqueId)()