3535#include < stddef.h>
3636#endif
3737
38- // todo: bool member type
3938// todo: delete with custom predicate
4039
4140// todo: BETWEEN / IN / NOT IN predicate
@@ -52,7 +51,8 @@ enum class REFLECTION_EXPORT SqliteStorageClass
5251 kInt ,
5352 kReal ,
5453 kText ,
55- kDateTime
54+ kDateTime ,
55+ kBool
5656};
5757
5858// / A struct holding all information needed for introspection of user-defined structs
@@ -86,6 +86,7 @@ struct REFLECTION_EXPORT Reflection
8686 static const char * ToSqliteColumnName (const SqliteStorageClass storage_class) {
8787 switch (storage_class) {
8888 case SqliteStorageClass::kInt :
89+ case SqliteStorageClass::kBool :
8990 return " INTEGER" ;
9091 case SqliteStorageClass::kReal :
9192 return " REAL" ;
@@ -178,26 +179,30 @@ REFLECTION_EXPORT char* GetMemberAddress(void* p, const Reflection& record, size
178179#define MEMBER_REAL (R ) MEMBER_DECLARE(double , R)
179180#define MEMBER_TEXT (R ) MEMBER_DECLARE(std::wstring, R)
180181#define MEMBER_DATETIME (R ) MEMBER_DECLARE(sqlite_reflection::TimePoint, R)
182+ #define MEMBER_BOOL (R ) MEMBER_DECLARE(bool , R)
181183#define FUNC (SIGNATURE )
182184 FIELDS
183185#undef MEMBER_DECLARE
184186#undef MEMBER_INT
185187#undef MEMBER_REAL
186188#undef MEMBER_TEXT
187189#undef MEMBER_DATETIME
190+ #undef MEMBER_BOOL
188191#undef FUNC
189192
190193 // custom function declaration
191194#define MEMBER_INT (R )
192195#define MEMBER_REAL (R )
193196#define MEMBER_TEXT (R )
194197#define MEMBER_DATETIME (R )
198+ #define MEMBER_BOOL (R )
195199#define FUNC (SIGNATURE ) SIGNATURE;
196200 FIELDS
197201#undef MEMBER_INT
198202#undef MEMBER_REAL
199203#undef MEMBER_TEXT
200204#undef MEMBER_DATETIME
205+ #undef MEMBER_BOOL
201206#undef FUNC
202207 };
203208
@@ -217,12 +222,14 @@ REFLECTION_EXPORT char* GetMemberAddress(void* p, const Reflection& record, size
217222#define MEMBER_REAL (R ) DEFINE_MEMBER(R, SqliteStorageClass::kReal )
218223#define MEMBER_TEXT (R ) DEFINE_MEMBER(R, SqliteStorageClass::kText )
219224#define MEMBER_DATETIME (R ) DEFINE_MEMBER(R, SqliteStorageClass::kDateTime )
225+ #define MEMBER_BOOL (R ) DEFINE_MEMBER(R, SqliteStorageClass::kBool )
220226#define FUNC (SIGNATURE )
221227 FIELDS
222228#undef MEMBER_INT
223229#undef MEMBER_REAL
224230#undef MEMBER_TEXT
225231#undef MEMBER_DATETIME
232+ #undef MEMBER_BOOL
226233#undef FUNC
227234 }
228235 return name;
0 commit comments