aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/room_upgrades.cpp
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-05-08 17:43:08 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-05-08 17:43:58 +0200
commitb79f67919e05698a8c3daffbe0fe53fa1ce46e54 (patch)
treee010db5f39d218dae7b5924576bf19b6706263f1 /lib/csapi/room_upgrades.cpp
parent72ffe9651fcdc3dfc0ceb34bd677aa15bbbe2ebf (diff)
downloadlibquotient-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/csapi/room_upgrades.cpp')
0 files changed, 0 insertions, 0 deletions