2020-03-25 18:07:36 +00:00
|
|
|
#include "../Core.hpp"
|
2020-02-29 13:52:15 +00:00
|
|
|
|
|
|
|
#define BASELIBRARY(simpleName, fullname, returnType) \
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t simpleName##_Insert(fullname* p, const char* name, returnType* t) { \
|
|
|
|
Try(p->Insert(Arbutils::CaseInsensitiveConstString::GetHash(name), t);) \
|
2020-02-29 13:52:15 +00:00
|
|
|
} \
|
|
|
|
\
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t simpleName##_InsertWithHash(fullname* p, uint32_t hashedKey, returnType* t) { \
|
|
|
|
Try(p->Insert(hashedKey, t);) \
|
2020-02-29 13:52:15 +00:00
|
|
|
} \
|
|
|
|
\
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t simpleName##_Delete(fullname* p, const char* name) { \
|
|
|
|
Try(p->Delete(Arbutils::CaseInsensitiveConstString::GetHash(name));) \
|
2020-02-29 13:52:15 +00:00
|
|
|
} \
|
|
|
|
\
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t simpleName##_DeleteWithHash(fullname* p, uint32_t hashedKey) { Try(p->Delete(hashedKey);) } \
|
2020-02-29 13:52:15 +00:00
|
|
|
\
|
2020-03-25 18:07:36 +00:00
|
|
|
export bool simpleName##_TryGet(fullname* p, const char* name, const returnType*& out) { \
|
2020-05-26 12:13:30 +00:00
|
|
|
borrowed_ptr<const returnType> o; \
|
2020-05-24 18:57:22 +00:00
|
|
|
auto v = p->TryGet(Arbutils::CaseInsensitiveConstString::GetHash(name), o); \
|
|
|
|
out = o.operator->(); \
|
|
|
|
return v; \
|
2020-02-29 13:52:15 +00:00
|
|
|
} \
|
|
|
|
\
|
2020-03-25 18:07:36 +00:00
|
|
|
export bool simpleName##_TryGetWithHash(fullname* p, uint32_t hashedKey, const returnType*& out) { \
|
2020-05-26 12:13:30 +00:00
|
|
|
borrowed_ptr<const returnType> o; \
|
2020-05-24 18:57:22 +00:00
|
|
|
auto v = p->TryGet(hashedKey, o); \
|
|
|
|
out = o.operator->(); \
|
|
|
|
return v; \
|
2020-02-29 13:52:15 +00:00
|
|
|
} \
|
|
|
|
\
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t simpleName##_Get(fullname* p, const char* name, const returnType*& out) { \
|
2020-05-24 18:57:22 +00:00
|
|
|
Try(out = p->Get(Arbutils::CaseInsensitiveConstString::GetHash(name)).operator->();) \
|
2020-02-29 13:52:15 +00:00
|
|
|
} \
|
|
|
|
\
|
2020-03-25 18:07:36 +00:00
|
|
|
export uint8_t simpleName##_GetWithHash(fullname* p, uint32_t hashedKey, const returnType*& out) { \
|
2020-05-24 18:57:22 +00:00
|
|
|
Try(out = p->Get(hashedKey).operator->();) \
|
2020-03-25 18:07:36 +00:00
|
|
|
} \
|
2020-02-29 13:52:15 +00:00
|
|
|
\
|
|
|
|
export size_t simpleName##_GetCount(fullname* p) { return p->GetCount(); }
|