Class: AtCoderFriends::Generator::CxxIostream
- Inherits:
-
Base
- Object
- Base
- AtCoderFriends::Generator::CxxIostream
show all
- Includes:
- CxxIostreamConstants, ConstFragmentMixin, InputFragmentMixin
- Defined in:
- lib/at_coder_friends/generator/cxx_iostream.rb
Overview
generates C++(iostream) source from problem description
Constant Summary
collapse
- ACF_HOME =
File.realpath(File.join(__dir__, '..', '..', '..'))
- TMPL_DIR =
File.join(ACF_HOME, 'templates')
- TEMPLATE =
File.join(TMPL_DIR, 'cxx_iostream.cxx.erb')
- FRAGMENTS =
File.join(TMPL_DIR, 'cxx_iostream_fragments.yml')
- ATTRS =
Attributes.new(:cxx, TEMPLATE, FRAGMENTS)
AtCoderFriends::Generator::CxxIostreamConstants::VERSION
Instance Method Summary
collapse
Instance Method Details
#attrs ⇒ Object
45
46
47
|
# File 'lib/at_coder_friends/generator/cxx_iostream.rb', line 45
def attrs
ATTRS
end
|
#gen_decl(inpdef, func) ⇒ Object
69
70
71
|
# File 'lib/at_coder_friends/generator/cxx_iostream.rb', line 69
def gen_decl(inpdef, func)
CxxIostreamDeclFragment.new(inpdef, fragments['declaration']).generate(func)
end
|
#gen_global_decls(inpdefs = pbm.formats) ⇒ Object
49
50
51
52
53
54
55
56
57
|
# File 'lib/at_coder_friends/generator/cxx_iostream.rb', line 49
def gen_global_decls(inpdefs = pbm.formats)
return [] unless cfg['use_global']
inpdefs
.map do |inpdef|
gen_decl(inpdef, :decl).split("\n")
end
.flatten
end
|
#gen_local_decls(inpdefs = pbm.formats) ⇒ Object
59
60
61
62
63
64
65
66
67
|
# File 'lib/at_coder_friends/generator/cxx_iostream.rb', line 59
def gen_local_decls(inpdefs = pbm.formats)
fnc = cfg['use_global'] ? :alloc : :decl_alloc
inpdefs
.map do |inpdef|
gen_decl(inpdef, fnc).split("\n") +
gen_input(inpdef).split("\n")
end
.flatten
end
|