32 lines
788 B
Plaintext
32 lines
788 B
Plaintext
|
/* CRIAL
|
||
|
SERIALIZER_BEGIN
|
||
|
mpkutil_pack_str(packer, "$name");
|
||
|
mpkutil_pack_str(packer, $code);
|
||
|
END
|
||
|
DESERIALIZER_BEGIN
|
||
|
const char* v;
|
||
|
size_t vlen;
|
||
|
if (!mpkutil_get_str(
|
||
|
mpkutil_get_map_item_by_str(root, "$name"), &v, &vlen) ||
|
||
|
strncmp(v, $code, vlen) != 0 || $code[vlen] != 0) {
|
||
|
return false;
|
||
|
}
|
||
|
END
|
||
|
PROPERTY subclass = "particle"
|
||
|
|
||
|
SERIALIZER_BEGIN
|
||
|
mpkutil_pack_str(packer, "$name");
|
||
|
LOCOMMON_MSGPACK_PACK_ANY(packer, &base->$code);
|
||
|
END
|
||
|
DESERIALIZER_BEGIN
|
||
|
if (!LOCOMMON_MSGPACK_UNPACK_ANY(
|
||
|
mpkutil_get_map_item_by_str(root, "$name"), &base->$code)) {
|
||
|
return false;
|
||
|
}
|
||
|
END
|
||
|
PROPERTY type
|
||
|
PROPERTY id = super.id
|
||
|
|
||
|
# data property is serialized manually (plz see pack/unpack function)
|
||
|
*/
|