SERVER-115218 Module tags for versioned commands in IDL (#45053)

GitOrigin-RevId: f5f2904663191a0d5b221cfb34366295eacc68ec
This commit is contained in:
Ronald Steinke 2025-12-15 05:27:17 -07:00 committed by MongoDB Bot
parent f6c6558b7b
commit d9834cc470
1 changed files with 5 additions and 3 deletions

View File

@ -1132,11 +1132,13 @@ class _CppHeaderFileWriter(_CppFileWriterBase):
"""Generate a template declaration for a command's base class.""" """Generate a template declaration for a command's base class."""
self._writer.write_line("template <typename Derived>") self._writer.write_line("template <typename Derived>")
def gen_derived_class_declaration_block(self, class_name): def gen_derived_class_declaration_block(self, class_name, mod_visibility):
# type: (str) -> writer.IndentedScopedBlock # type: (str) -> writer.IndentedScopedBlock
"""Generate a command's base class declaration block.""" """Generate a command's base class declaration block."""
return writer.IndentedScopedBlock( return writer.IndentedScopedBlock(
self._writer, "class %s : public TypedCommand<Derived> {" % class_name, "};" self._writer,
f"class {make_mod_tag(mod_visibility)}{class_name} : public TypedCommand<Derived> {{",
"};",
) )
def gen_type_alias_declaration(self, new_type_name, old_type_name): def gen_type_alias_declaration(self, new_type_name, old_type_name):
@ -1196,7 +1198,7 @@ class _CppHeaderFileWriter(_CppFileWriterBase):
self.write_empty_line() self.write_empty_line()
self.gen_template_declaration() self.gen_template_declaration()
with self.gen_derived_class_declaration_block(class_name): with self.gen_derived_class_declaration_block(class_name, command.mod_visibility):
# Write type alias for InvocationBase. # Write type alias for InvocationBase.
self.gen_type_alias_declaration( self.gen_type_alias_declaration(
"_TypedCommandInvocationBase", "typename TypedCommand<Derived>::InvocationBase" "_TypedCommandInvocationBase", "typename TypedCommand<Derived>::InvocationBase"