File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -602,6 +602,22 @@ private void generateVarData(
602602 lengthCppType ,
603603 lengthToken .encoding ().applicableMaxValue ().longValue ());
604604
605+ new Formatter (sb ).format ("\n " +
606+ indent + " #if __cplusplus >= 201703L\n " +
607+ indent + " %1$s &put%2$s(const std::string_view str)\n " +
608+ indent + " {\n " +
609+ indent + " if (str.length() > %4$d)\n " +
610+ indent + " {\n " +
611+ indent + " throw std::runtime_error(\" std::string too long for length type [E109]\" );\n " +
612+ indent + " }\n " +
613+ indent + " return put%2$s(str.data(), static_cast<%3$s>(str.length()));" +
614+ indent + " }\n " +
615+ indent + " #endif\n " ,
616+ className ,
617+ propertyName ,
618+ lengthCppType ,
619+ lengthToken .encoding ().applicableMaxValue ().longValue ());
620+
605621 i += token .componentTokenCount ();
606622 }
607623 }
You can’t perform that action at this time.
0 commit comments