|
|
@ -115,24 +115,25 @@ void SingularScalar::InMsgImpl(Context<FieldDescriptor> field) const { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SingularScalar::InExternC(Context<FieldDescriptor> field) const { |
|
|
|
void SingularScalar::InExternC(Context<FieldDescriptor> field) const { |
|
|
|
field.Emit( |
|
|
|
field.Emit({{"Scalar", PrimitiveRsTypeName(field.desc())}, |
|
|
|
{{"Scalar", PrimitiveRsTypeName(field.desc())}, |
|
|
|
|
|
|
|
{"hazzer_thunk", Thunk(field, "has")}, |
|
|
|
{"hazzer_thunk", Thunk(field, "has")}, |
|
|
|
{"getter_thunk", Thunk(field, "get")}, |
|
|
|
{"getter_thunk", Thunk(field, "get")}, |
|
|
|
{"setter_thunk", Thunk(field, "set")}, |
|
|
|
{"setter_thunk", Thunk(field, "set")}, |
|
|
|
{"clearer_thunk", Thunk(field, "clear")}, |
|
|
|
{"clearer_thunk", Thunk(field, "clear")}, |
|
|
|
{"hazzer", |
|
|
|
{"hazzer_and_clearer", |
|
|
|
[&] { |
|
|
|
[&] { |
|
|
|
if (field.desc().has_presence()) { |
|
|
|
if (field.desc().has_presence()) { |
|
|
|
field.Emit( |
|
|
|
field.Emit( |
|
|
|
R"rs(fn $hazzer_thunk$(raw_msg: $pbi$::RawMessage) -> bool;)rs"); |
|
|
|
R"rs( |
|
|
|
|
|
|
|
fn $hazzer_thunk$(raw_msg: $pbi$::RawMessage) -> bool; |
|
|
|
|
|
|
|
fn $clearer_thunk$(raw_msg: $pbi$::RawMessage); |
|
|
|
|
|
|
|
)rs"); |
|
|
|
} |
|
|
|
} |
|
|
|
}}}, |
|
|
|
}}}, |
|
|
|
R"rs( |
|
|
|
R"rs( |
|
|
|
$hazzer$ |
|
|
|
$hazzer_and_clearer$ |
|
|
|
fn $getter_thunk$(raw_msg: $pbi$::RawMessage) -> $Scalar$; |
|
|
|
fn $getter_thunk$(raw_msg: $pbi$::RawMessage) -> $Scalar$; |
|
|
|
fn $setter_thunk$(raw_msg: $pbi$::RawMessage, val: $Scalar$); |
|
|
|
fn $setter_thunk$(raw_msg: $pbi$::RawMessage, val: $Scalar$); |
|
|
|
fn $clearer_thunk$(raw_msg: $pbi$::RawMessage); |
|
|
|
|
|
|
|
)rs"); |
|
|
|
)rs"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -145,23 +146,23 @@ void SingularScalar::InThunkCc(Context<FieldDescriptor> field) const { |
|
|
|
{"getter_thunk", Thunk(field, "get")}, |
|
|
|
{"getter_thunk", Thunk(field, "get")}, |
|
|
|
{"setter_thunk", Thunk(field, "set")}, |
|
|
|
{"setter_thunk", Thunk(field, "set")}, |
|
|
|
{"clearer_thunk", Thunk(field, "clear")}, |
|
|
|
{"clearer_thunk", Thunk(field, "clear")}, |
|
|
|
{"hazzer", |
|
|
|
{"hazzer_and_clearer", |
|
|
|
[&] { |
|
|
|
[&] { |
|
|
|
if (field.desc().has_presence()) { |
|
|
|
if (field.desc().has_presence()) { |
|
|
|
field.Emit(R"cc( |
|
|
|
field.Emit(R"cc( |
|
|
|
bool $hazzer_thunk$($QualifiedMsg$* msg) { |
|
|
|
bool $hazzer_thunk$($QualifiedMsg$* msg) { |
|
|
|
return msg->has_$field$(); |
|
|
|
return msg->has_$field$(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void $clearer_thunk$($QualifiedMsg$* msg) { msg->clear_$field$(); } |
|
|
|
)cc"); |
|
|
|
)cc"); |
|
|
|
} |
|
|
|
} |
|
|
|
}}}, |
|
|
|
}}}, |
|
|
|
R"cc( |
|
|
|
R"cc( |
|
|
|
$hazzer$; |
|
|
|
$hazzer_and_clearer$; |
|
|
|
$Scalar$ $getter_thunk$($QualifiedMsg$* msg) { return msg->$field$(); } |
|
|
|
$Scalar$ $getter_thunk$($QualifiedMsg$* msg) { return msg->$field$(); } |
|
|
|
void $setter_thunk$($QualifiedMsg$* msg, $Scalar$ val) { |
|
|
|
void $setter_thunk$($QualifiedMsg$* msg, $Scalar$ val) { |
|
|
|
msg->set_$field$(val); |
|
|
|
msg->set_$field$(val); |
|
|
|
} |
|
|
|
} |
|
|
|
void $clearer_thunk$($QualifiedMsg$* msg) { msg->clear_$field$(); } |
|
|
|
|
|
|
|
)cc"); |
|
|
|
)cc"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|