Value explicit handling of bool
all so we can know when to print/parse "true" and "false".
This commit is contained in:
+16
-2
@@ -293,7 +293,6 @@ void to_wire_field(Buffer& buf, const FieldDesc* desc, const std::shared_ptr<con
|
||||
case StoreType::UInteger: {
|
||||
auto& fld = store->as<uint64_t>();
|
||||
switch(desc->code.code) {
|
||||
case TypeCode::Bool: to_wire(buf, uint8_t (fld!=0)); return;
|
||||
case TypeCode::UInt8: to_wire(buf, uint8_t (fld)); return;
|
||||
case TypeCode::UInt16: to_wire(buf, uint16_t(fld)); return;
|
||||
case TypeCode::UInt32: to_wire(buf, uint32_t(fld)); return;
|
||||
@@ -302,6 +301,14 @@ void to_wire_field(Buffer& buf, const FieldDesc* desc, const std::shared_ptr<con
|
||||
}
|
||||
}
|
||||
break;
|
||||
case StoreType::Bool: {
|
||||
auto& fld = store->as<bool>();
|
||||
switch(desc->code.code) {
|
||||
case TypeCode::Bool: to_wire(buf, uint8_t (fld)); return;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case StoreType::String: {
|
||||
auto& fld = store->as<std::string>();
|
||||
switch(desc->code.code) {
|
||||
@@ -508,7 +515,6 @@ void from_wire_field(Buffer& buf, TypeStore& ctxt, const FieldDesc* desc, const
|
||||
case StoreType::UInteger: {
|
||||
auto& fld = store->as<uint64_t>();
|
||||
switch(desc->code.code) {
|
||||
case TypeCode::Bool: fld = 0!=from_wire_as<uint8_t>(buf); return;
|
||||
case TypeCode::UInt8: fld = from_wire_as<int8_t>(buf); return;
|
||||
case TypeCode::UInt16: fld = from_wire_as<int16_t>(buf); return;
|
||||
case TypeCode::UInt32: fld = from_wire_as<int32_t>(buf); return;
|
||||
@@ -517,6 +523,14 @@ void from_wire_field(Buffer& buf, TypeStore& ctxt, const FieldDesc* desc, const
|
||||
}
|
||||
}
|
||||
break;
|
||||
case StoreType::Bool: {
|
||||
auto& fld = store->as<bool>();
|
||||
switch(desc->code.code) {
|
||||
case TypeCode::Bool: fld = 0!=from_wire_as<uint8_t>(buf); return;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case StoreType::String: {
|
||||
auto& fld = store->as<std::string>();
|
||||
switch(desc->code.code) {
|
||||
|
||||
Reference in New Issue
Block a user