File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/c Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -1960,6 +1960,8 @@ private CharSequence generateMessageFlyweightFunctions(
19601960 " return %2$s;\n " +
19611961 "}\n \n " +
19621962
1963+ "#define %13$s_SBE_TEMPLATE_ID %4$s\n \n " +
1964+
19631965 "SBE_ONE_DEF %3$s %10$s_sbe_template_id(void)\n " +
19641966 "{\n " +
19651967 " return %4$s;\n " +
@@ -2100,7 +2102,23 @@ private CharSequence generateMessageFlyweightFunctions(
21002102 semanticType ,
21012103 structName ,
21022104 messageHeaderStruct ,
2103- semanticVersion );
2105+ semanticVersion ,
2106+ toUppercaseWithUnderscores (structName ));
2107+ }
2108+
2109+ private String toUppercaseWithUnderscores (final String camelCaseString )
2110+ {
2111+ final StringBuilder sb = new StringBuilder ();
2112+ for (int i = 0 ; i < camelCaseString .length (); i ++)
2113+ {
2114+ final char theChar = camelCaseString .charAt (i );
2115+ if (Character .isUpperCase (theChar ))
2116+ {
2117+ sb .append ("_" );
2118+ }
2119+ sb .append (Character .toUpperCase (theChar ));
2120+ }
2121+ return sb .toString ();
21042122 }
21052123
21062124 private CharSequence generateFieldFunctions (
You can’t perform that action at this time.
0 commit comments