Skip to content

Commit

Permalink
Merge pull request #1006 from nbradac/template-id-define-for-c
Browse files Browse the repository at this point in the history
Template id #define for c
  • Loading branch information
JPWatson authored Aug 1, 2024
2 parents cce1047 + d99bf7e commit 7d3da8a
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1960,6 +1960,8 @@ private CharSequence generateMessageFlyweightFunctions(
" return %2$s;\n" +
"}\n\n" +

"#define %13$s_SBE_TEMPLATE_ID %4$s\n\n" +

"SBE_ONE_DEF %3$s %10$s_sbe_template_id(void)\n" +
"{\n" +
" return %4$s;\n" +
Expand Down Expand Up @@ -2100,7 +2102,23 @@ private CharSequence generateMessageFlyweightFunctions(
semanticType,
structName,
messageHeaderStruct,
semanticVersion);
semanticVersion,
toUppercaseWithUnderscores(structName));
}

private String toUppercaseWithUnderscores(final String camelCaseString)
{
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < camelCaseString.length(); i++)
{
final char theChar = camelCaseString.charAt(i);
if (Character.isUpperCase(theChar))
{
sb.append("_");
}
sb.append(Character.toUpperCase(theChar));
}
return sb.toString();
}

private CharSequence generateFieldFunctions(
Expand Down

0 comments on commit 7d3da8a

Please sign in to comment.