CreatureLib/CInterface/Library/BaseLibrary.cpp

33 lines
3.5 KiB
C++

#define export extern "C"
#define BASELIBRARY(simpleName, fullname, returnType) \
export void simpleName##_Insert(fullname* p, const char* name, returnType* t) { \
p->Insert(Arbutils::CaseInsensitiveConstString::GetHash(name), t); \
} \
\
export void simpleName##_InsertWithHash(fullname* p, uint32_t hashedKey, returnType* t) { \
p->Insert(hashedKey, t); \
} \
\
export void simpleName##_Delete(fullname* p, const char* name) { \
p->Delete(Arbutils::CaseInsensitiveConstString::GetHash(name)); \
} \
\
export void simpleName##_DeleteWithHash(fullname* p, uint32_t hashedKey) { p->Delete(hashedKey); } \
\
export bool simpleName##_TryGet(fullname* p, const char* name, const returnType* out) { \
return p->TryGet(Arbutils::CaseInsensitiveConstString::GetHash(name), out); \
} \
\
export bool simpleName##_TryGetWithHash(fullname* p, uint32_t hashedKey, const returnType* out) { \
return p->TryGet(hashedKey, out); \
} \
\
export bool simpleName##_Get(fullname* p, const char* name) { \
return p->Get(Arbutils::CaseInsensitiveConstString::GetHash(name)); \
} \
\
export bool simpleName##_GetWithHash(fullname* p, uint32_t hashedKey) { return p->Get(hashedKey); } \
\
export size_t simpleName##_GetCount(fullname* p) { return p->GetCount(); }