Enum template for cpp binding
novice3
sorryno at em.ail
Mon Feb 15 12:37:14 UTC 2021
Hello.
I want make binding for some CPP api.
I have .h file with enums like:
///////////
typedef enum {
SOMEAPI_PHASE_A = 91,
SOMEAPI_PHASE_B = 92,
SOMEAPI_PHASE_C = 93
} someapiPhase;
///////////
It used later in .cpp like:
func(SOMEAPI_PHASE_A);
I want .d file like this:
///////////
enum SOMEAPI_PHASE {
A = 91,
B = 92,
C = 93
}
alias SOMEAPI_PHASE_A = SOMEAPI_PHASE.A; // for using like
anonymous enum like C++
alias SOMEAPI_PHASE_B = SOMEAPI_PHASE.B;
alias SOMEAPI_PHASE_C = SOMEAPI_PHASE.C;
alias SomeapiPhase = SOMEAPI_PHASE; // for using type in func
declarations
///////////
This is reduced example.
I am sorry for this type of question,
but could please anybody show me template for this boring coding?
Is this possible to avoid this manual coding?
Show me direction or examples please.
Thanks.
More information about the Digitalmars-d-learn
mailing list