std::transform(enum_value.begin(), enum_value.end(), enum_value.begin(),
::toupper);
+ std::string prefix = GetHandlePrefix();
+ std::transform(prefix.begin(), prefix.end(), prefix.begin(), ::toupper);
+
+ std::string name = iface.GetID();
+ std::transform(name.begin(), name.end(), name.begin(), ::toupper);
+
std::string code(ReplaceAll(CB_INTERFACE_DELEGATE_BASE, {
{ "<PREFIX>", GetHandlePrefix() },
{ "<NAME>", iface.GetID() },
{ "<DELEGATE_PARAMS>", GenDelegateParams(iface, decl) },
{ "<DELEGATE_PARAMS_CHECK>", GenDelegateParamsCheck(iface, decl) },
{ "<DELEGATE_ENUM_VALUE>", enum_value },
- { "<DELEGATE_PARCEL_WRITE>", GenDelegateParcelWrite(iface, decl) }
+ { "<DELEGATE_PARCEL_WRITE>", GenDelegateParcelWrite(iface, decl) },
+ { "<UPPERCASE_PREFIX>", prefix },
+ { "<UPPERCASE_NAME>", name }
}));
stream << SmartIndent(code);
* <DELEGATE_PARAMS_CHECK> The implementation to check whether arguments are nullptr or not
* <DELEGATE_ENUM_VALUE> The enumeration value of the method.
* <DELEGATE_PARCEL_WRITE> The implementation to write arguments to the parcel.
+ * <UPPERCASE_PREFIX> The uppercase prefix of the interface.
+ * <UPPERCASE_NAME> The uppercase name of the interface.
*/
constexpr const char CB_INTERFACE_DELEGATE_BASE[] =
R"__c_cb(
return ret_;
}
- rpc_port_parcel_write_int32(parcel_, <DELEGATE_ENUM_VALUE>);
+ rpc_port_parcel_write_int32(parcel_, <UPPERCASE_PREFIX>_<UPPERCASE_NAME>_METHOD_CALLBACK_);
rpc_port_parcel_write(parcel_, &h->parcelable, h);