mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
Core: LambdaIze
git-svn-id: svn://ultimatepp.org/upp/trunk@15938 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
863f4187f0
commit
b8e1c466a9
2 changed files with 26 additions and 0 deletions
|
|
@ -457,3 +457,20 @@ void JsonizeBySerialize(JsonIO& jio, T& x)
|
||||||
throw JsonizeError("jsonize by serialize error");
|
throw JsonizeError("jsonize by serialize error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class IZE>
|
||||||
|
struct LambdaIzeVar {
|
||||||
|
IZE& ize;
|
||||||
|
|
||||||
|
void Jsonize(JsonIO& io) { ize(io); }
|
||||||
|
void Xmlize(XmlIO& io) { ize(io); }
|
||||||
|
|
||||||
|
LambdaIzeVar(IZE& ize) : ize(ize) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class IO, class IZE>
|
||||||
|
void LambdaIze(IO& io, const char *id, IZE ize)
|
||||||
|
{
|
||||||
|
LambdaIzeVar<IZE> var(ize);
|
||||||
|
io(id, var);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -216,4 +216,13 @@ _[@(0.0.255) void]_[* JsonizeBySerialize]([_^JsonIO^ JsonIO][@(0.0.255) `&]_[*@3
|
||||||
[*@4 T][@(0.0.255) `&]_[*@3 x])&]
|
[*@4 T][@(0.0.255) `&]_[*@3 x])&]
|
||||||
[s2;%% This function encodes/retrieves Json by binary serializing
|
[s2;%% This function encodes/retrieves Json by binary serializing
|
||||||
the object and Jsonizing the hexadecimal data string.&]
|
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;%% ]]
|
[s3;%% ]]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue