Class: AtCoderFriends::Generator::CxxBuiltin

Inherits:
CBuiltin
  • Object
show all
Defined in:
lib/at_coder_friends/generator/cxx_builtin.rb

Overview

generates C++ source from problem description

Constant Summary collapse

TEMPLATE =
File.join(TMPL_DIR, 'cxx_builtin.cxx.erb')
ATTRS =
Attributes.new(:cxx, TEMPLATE, FRAGMENTS)

Constants inherited from CBuiltin

AtCoderFriends::Generator::CBuiltin::ACF_HOME, AtCoderFriends::Generator::CBuiltin::FRAGMENTS, AtCoderFriends::Generator::CBuiltin::TMPL_DIR

Constants inherited from Base

Base::ACF_HOME, Base::TMPL_DIR

Instance Attribute Summary

Attributes inherited from Base

#cfg, #pbm

Instance Method Summary collapse

Methods included from InputFragmentMixin

#gen_input, #gen_inputs

Methods included from DeclFragmentMixin

#gen_decl, #gen_decls

Methods included from ConstFragmentMixin

#gen_consts

Methods inherited from Base

#config_file_ext, #config_fragments, #config_template, #embed_lines, #fragments, #generate, #initialize, #process

Constructor Details

This class inherits a constructor from AtCoderFriends::Generator::Base

Instance Method Details

#attrsObject



10
11
12
# File 'lib/at_coder_friends/generator/cxx_builtin.rb', line 10

def attrs
  ATTRS
end

#gen_const(c) ⇒ Object



14
15
16
# File 'lib/at_coder_friends/generator/cxx_builtin.rb', line 14

def gen_const(c)
  ConstFragment.new(c, fragments['cxx_constant']).generate
end

#render(src) ⇒ Object

deprecated, use ERB syntax



19
20
21
22
23
# File 'lib/at_coder_friends/generator/cxx_builtin.rb', line 19

def render(src)
  src = embed_lines(src, '/*** CONSTS ***/', gen_consts)
  src = embed_lines(src, '/*** DCLS ***/', gen_decls)
  embed_lines(src, '/*** INPUTS ***/', gen_inputs)
end