diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-05-08 17:43:08 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-05-08 17:43:58 +0200 |
commit | b79f67919e05698a8c3daffbe0fe53fa1ce46e54 (patch) | |
tree | e010db5f39d218dae7b5924576bf19b6706263f1 /lib/events/eventcontent.h | |
parent | 72ffe9651fcdc3dfc0ceb34bd677aa15bbbe2ebf (diff) | |
download | libquotient-b79f67919e05698a8c3daffbe0fe53fa1ce46e54.tar.gz libquotient-b79f67919e05698a8c3daffbe0fe53fa1ce46e54.zip |
toSnakeCase and EventContent::SingleKeyValue
This is a rework of EventContent::SimpleContent previously defined in
simplestateevents.h. Quite a few events (and not only state events) have
just a single key-value pair in their content - this structure (which
is really just a template wrapper around the value) and the accompanying
JsonConverter<> specialisation encapsulate the concept to streamline
definition of such events. This commit only has simplestateevents.h
using it; further commits will use SingleKeyValue in other places.
toSnakeCase is a facility function that converts camelCase used for
C++ variables into snake_case used in JSON payloads. Combined with
the preprocessor trick that makes a string literal from an identifier,
this allows to reduce boilerplate code that repeats the same name for
fields in C++ event classes and fields in JSON. SingleKeyValue uses it,
and there are other cases for it coming.
Diffstat (limited to 'lib/events/eventcontent.h')
0 files changed, 0 insertions, 0 deletions