class MxxRu::Generators::Impl::Cpp::Generator
Main class for code generation of C/C++ projects.
Usage:
receiver = StdReceiver.new generator = Generator.new( target_type, args, receiver ) generator.run
Constants
- TARGET_SPECIFIC_BANNERS
Target specific parts of banner.
Public Class Methods
new( target_type, args, receiver )
click to toggle source
# File lib/mxx_ru/generators/impl/cpp/generation.rb, line 220 def initialize( target_type, args, receiver ) @target_type = target_type @args = args @receiver = receiver end
Public Instance Methods
run()
click to toggle source
# File lib/mxx_ru/generators/impl/cpp/generation.rb, line 226 def run options = Options.parse( @args, "Stubs for C/C++ projects generator\n" + target_specific_banner_line + "\n", :implib_path => ( EXE == @target_type || DLL == @target_type ) ) result = do_generation( options ) @receiver.receive( result, options.output_file ) end
Private Instance Methods
do_generation( options )
click to toggle source
Performs main generation actions.
Returns generation result as String.
# File lib/mxx_ru/generators/impl/cpp/generation.rb, line 260 def do_generation( options ) template = IO.read( File.join( File.dirname( __FILE__ ), 'template.erb' ) ) generator = ERB.new( template ) params = TemplateParams.new( @target_type, options ) generator.result( params.get_binding ).gsub( /\n\n\n+/, "\n\n" ) end