diff --git a/uppsrc/Core/JSON.h b/uppsrc/Core/JSON.h index 0640e0c07..ea2cddc6f 100644 --- a/uppsrc/Core/JSON.h +++ b/uppsrc/Core/JSON.h @@ -457,3 +457,20 @@ void JsonizeBySerialize(JsonIO& jio, T& x) throw JsonizeError("jsonize by serialize error"); } } + +template +struct LambdaIzeVar { + IZE& ize; + + void Jsonize(JsonIO& io) { ize(io); } + void Xmlize(XmlIO& io) { ize(io); } + + LambdaIzeVar(IZE& ize) : ize(ize) {} +}; + +template +void LambdaIze(IO& io, const char *id, IZE ize) +{ + LambdaIzeVar var(ize); + io(id, var); +} diff --git a/uppsrc/Core/src.tpp/Jsonize_en-us.tpp b/uppsrc/Core/src.tpp/Jsonize_en-us.tpp index 2781e1ee1..4cef4e745 100644 --- a/uppsrc/Core/src.tpp/Jsonize_en-us.tpp +++ b/uppsrc/Core/src.tpp/Jsonize_en-us.tpp @@ -216,4 +216,13 @@ _[@(0.0.255) void]_[* JsonizeBySerialize]([_^JsonIO^ JsonIO][@(0.0.255) `&]_[*@3 [*@4 T][@(0.0.255) `&]_[*@3 x])&] [s2;%% This function encodes/retrieves Json by binary serializing the object and Jsonizing the hexadecimal data string.&] +[s3;%% &] +[s4; &] +[s5;:Upp`:`:LambdaIze`(IO`&`,const char`*`,IZE`): [@(0.0.255) template]_<[@(0.0.255) clas +s]_[*@4 IO], [@(0.0.255) class]_[*@4 IZE]>_[@(0.0.255) void]_[* LambdaIze]([*@4 IO][@(0.0.255) `& +]_[*@3 io], [@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 id], [*@4 IZE]_[*@3 ize])&] +[s2;%% This special function uses [%-*@3 ize] to represent the value +of Jsonize or Xmlize node named [%-*@3 id]. Lambda should have +one paramter IO`&.&] +[s3;%% &] [s3;%% ]] \ No newline at end of file