diff --git a/include/gp/enveloppe/cbor.hpp b/include/gp/enveloppe/cbor.hpp index 9289258..dbc80ac 100644 --- a/include/gp/enveloppe/cbor.hpp +++ b/include/gp/enveloppe/cbor.hpp @@ -243,7 +243,77 @@ namespace gp { } case cbor_type::oths: { - + switch((cbor_oths)local) { + case cbor_oths::value_false: { + return { + cbor_value{ + cbor_composite(false), + alloc + }, + src.begin()+1 + }; + } + case cbor_oths::value_true: { + return { + cbor_value{ + cbor_composite(true), + alloc + }, + src.begin()+1 + }; + } + case cbor_oths::value_null: { + return { + cbor_value{ + cbor_composite(nullopt), + alloc + }, + src.begin()+1 + }; + } + case cbor_oths::value_undefined: { + return { + cbor_value{ + cbor_composite(undefined_t{}), + alloc + }, + src.begin()+1 + }; + } + case cbor_oths::word: { + if(src.size()<3) ERROR; + return { + cbor_value{ + cbor_floating_point{(ieee754_hf)(*(gp::endian_wrapper*)(src.begin().data))}, + alloc + }, + src.begin()+3 + }; + } + case cbor_oths::dword: { + if(src.size()<5) ERROR; + return { + cbor_value{ + cbor_floating_point{float(*(gp::endian_wrapper*)(src.begin().data))}, + alloc + }, + src.begin()+5 + }; + } + case cbor_oths::qword: { + if(src.size()<9) ERROR; + return { + cbor_value{ + cbor_floating_point{double(*(gp::endian_wrapper*)(src.begin().data))}, + alloc + }, + src.begin()+9 + }; + } + default: { + ERROR; + } + } } } ERROR;