diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-08-07 15:09:03 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-08-07 15:09:03 +0200 |
commit | 5a04301b323a79d3aeb6cb5c316dcf822d3b40c4 (patch) | |
tree | a356654b2184a2c634f1391643feb529f8b8fb0f /contrib/epee/include/serialization/keyvalue_serialization.h | |
parent | Merge pull request #2200 (diff) | |
parent | wallet_rpc_server: optionally return tx blobs on transfer calls (diff) | |
download | monero-5a04301b323a79d3aeb6cb5c316dcf822d3b40c4.tar.xz |
Merge pull request #2201
dc0b312f wallet_rpc_server: optionally return tx blobs on transfer calls (moneromooo-monero)
5eb79983 epee: add a KV_SERIALIZE variant for optional parameters (moneromooo-monero)
Diffstat (limited to 'contrib/epee/include/serialization/keyvalue_serialization.h')
-rw-r--r-- | contrib/epee/include/serialization/keyvalue_serialization.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/contrib/epee/include/serialization/keyvalue_serialization.h b/contrib/epee/include/serialization/keyvalue_serialization.h index bf2c8dacd..f4442e46c 100644 --- a/contrib/epee/include/serialization/keyvalue_serialization.h +++ b/contrib/epee/include/serialization/keyvalue_serialization.h @@ -70,6 +70,12 @@ public: \ #define KV_SERIALIZE_N(varialble, val_name) \ epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name); +#define KV_SERIALIZE_OPT_N(variable, val_name, default_value) \ + do { \ + if (!epee::serialization::selector<is_store>::serialize(this_ref.variable, stg, hparent_section, val_name)) \ + this_ref.variable = default_value; \ + } while (0); + #define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, val_name) \ epee::serialization::selector<is_store>::serialize_t_val_as_blob(this_ref.varialble, stg, hparent_section, val_name); @@ -86,6 +92,7 @@ public: \ #define KV_SERIALIZE_VAL_POD_AS_BLOB(varialble) KV_SERIALIZE_VAL_POD_AS_BLOB_N(varialble, #varialble) #define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(varialble) KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, #varialble) //skip is_pod compile time check #define KV_SERIALIZE_CONTAINER_POD_AS_BLOB(varialble) KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N(varialble, #varialble) +#define KV_SERIALIZE_OPT(variable,default_value) KV_SERIALIZE_OPT_N(variable, #variable, default_value) } |