def generate(self): package = self.cppPackage.package guard = re.sub( "_+", "_", re.sub("[^a-zA-Z0-9]+", "_", os.path.basename(self.filePath))).strip("_").upper() includes = [ cpp_path_norm(package.cpp.filenames["opMessageDeclaration"]), "modules/protobuf/src/protobuf_input.h", "modules/protobuf/src/protobuf_output.h", "modules/protobuf/src/protobuf_message.h", "modules/protobuf/src/protobuf_data.h", "modules/protobuf/src/generated/g_protobuf_descriptors.h", ] text = fileHeader() text += "\n" + render( """ // Generated from %(proto_file)s #include "core/pch.h" #ifndef %(guard)s #define %(guard)s %(defines)s %(includes)s """, { "proto_file": self.cppPackage.makeRelativePath( package.filename), "guard": guard, "defines": self.renderDefines(self.cppPackage.defines), "includes": self.renderIncludes(includes), }) + "\n" set_gen = CppOpMessageSetGenerator(package, self.cppPackage.messages, options=self.cppPackage) text += set_gen.getImplementation() text += render( """ %(endifs)s #endif // %(guard)s """, { "endifs": self.renderEndifs(self.cppPackage.defines), "guard": guard, }) + "\n" return text
def generate(self): package = self.cppPackage.package guard = re.sub( "_+", "_", re.sub("[^a-zA-Z0-9]+", "_", os.path.basename(self.filePath))).strip("_").upper() includes = [ cpp_path_norm(package.cpp.filenames["messageDeclaration"]), "modules/hardcore/component/OpTypedMessage.h", ] text = fileHeader() text += "\n" + render( """ // Generated from %(proto_file)s #ifndef %(guard)s #define %(guard)s %(defines)s %(includes)s """, { "proto_file": self.cppPackage.makeRelativePath( package.filename), "guard": guard, "defines": self.renderDefines(self.cppPackage.defines), "includes": self.renderIncludes(includes), }) + "\n" set_gen = CppOpMessageSetGenerator(package, self.cppPackage.messages, options=self.cppPackage) text += set_gen.getInterface() text += render( """ %(endifs)s #endif // %(guard)s """, { "endifs": self.renderEndifs(self.cppPackage.defines), "guard": guard, }) + "\n" return text
def generate(self): text = fileHeader() text += ( "\n" + render( """ #include "core/pch.h" %(defines)s #include "%(interfaceInclude)s" """, { "defines": self.renderDefines(self.defines), "interfaceInclude": cpp_path_norm(self.includes["interfaceDeclaration"]), "serviceStr": strQuote(self.service.name), }, ) + "\n" ) className = self.service.iparent.cpp.cppMessageSet().name set_gen = CppMessageSetGenerator( self.service.iparent, serviceMessages2(self.service), className, self.operaRoot ) text += set_gen.renderDescriptorImplementation() text += set_gen.getImplementation() gen = CppServiceGenerator(self.service) text += gen.getInterfaceImplementation() text += "\n// Service implementation: BEGIN\n" text += gen.getServiceImplementation(generate_instance=self.cppService.generateInstance) text += "\n// Service implementation: END\n\n" text += ( render( """ %(endifs)s """, {"endifs": self.renderEndifs(self.defines)}, ) + "\n" ) return text
def generate(self): package = self.cppPackage.package guard = re.sub("_+", "_", re.sub("[^a-zA-Z0-9]+", "_", os.path.basename(self.filePath))).strip("_").upper() includes = [cpp_path_norm(package.cpp.filenames["opMessageDeclaration"]), "modules/protobuf/src/protobuf_input.h", "modules/protobuf/src/protobuf_output.h", "modules/protobuf/src/protobuf_message.h", "modules/protobuf/src/protobuf_data.h", "modules/protobuf/src/generated/g_protobuf_descriptors.h", ] text = fileHeader() text += "\n" + render(""" // Generated from %(proto_file)s #include "core/pch.h" #ifndef %(guard)s #define %(guard)s %(defines)s %(includes)s """, { "proto_file": self.cppPackage.makeRelativePath(package.filename), "guard": guard, "defines": self.renderDefines(self.cppPackage.defines), "includes": self.renderIncludes(includes), }) + "\n" set_gen = CppOpMessageSetGenerator(package, self.cppPackage.messages, options=self.cppPackage) text += set_gen.getImplementation() text += render(""" %(endifs)s #endif // %(guard)s """, { "endifs": self.renderEndifs(self.cppPackage.defines), "guard": guard, }) + "\n" return text
def generate(self): text = fileHeader() text += "\n" + render( """ #include "core/pch.h" %(defines)s #include "%(interfaceInclude)s" """, { "defines": self.renderDefines(self.defines), "interfaceInclude": cpp_path_norm(self.includes["interfaceDeclaration"]), "serviceStr": strQuote(self.service.name), }) + "\n" className = self.service.iparent.cpp.cppMessageSet().name set_gen = CppMessageSetGenerator(self.service.iparent, serviceMessages2(self.service), className, self.operaRoot) text += set_gen.renderDescriptorImplementation() text += set_gen.getImplementation() gen = CppServiceGenerator(self.service) text += gen.getInterfaceImplementation() text += "\n// Service implementation: BEGIN\n" text += gen.getServiceImplementation( generate_instance=self.cppService.generateInstance) text += "\n// Service implementation: END\n\n" text += render(""" %(endifs)s """, { "endifs": self.renderEndifs(self.defines), }) + "\n" return text
def generate(self): package = self.cppPackage.package guard = re.sub("_+", "_", re.sub("[^a-zA-Z0-9]+", "_", os.path.basename(self.filePath))).strip("_").upper() includes = [cpp_path_norm(package.cpp.filenames["messageDeclaration"]), "modules/hardcore/component/OpTypedMessage.h", ] text = fileHeader() text += "\n" + render(""" // Generated from %(proto_file)s #ifndef %(guard)s #define %(guard)s %(defines)s %(includes)s """, { "proto_file": self.cppPackage.makeRelativePath(package.filename), "guard": guard, "defines": self.renderDefines(self.cppPackage.defines), "includes": self.renderIncludes(includes), }) + "\n" set_gen = CppOpMessageSetGenerator(package, self.cppPackage.messages, options=self.cppPackage) text += set_gen.getInterface() text += render(""" %(endifs)s #endif // %(guard)s """, { "endifs": self.renderEndifs(self.cppPackage.defines), "guard": guard, }) + "\n" return text