PrettifierAnnotated.cc
Go to the documentation of this file.
3 #include "fhiclcpp/coding.h"
6 
7 using namespace fhicl;
8 using namespace fhicl::detail;
9 
10 //===================================================================
11 
12 PrettifierAnnotated::PrettifierAnnotated(unsigned const initial_indent_level)
13  : buffer_()
14  , indent_{initial_indent_level}
15  , curr_info_()
16  , cached_info_()
17  , sequence_sizes_{{-1u}}
19 {}
20 
21 //==========================================================================
22 void
24  any_t const&,
25  ParameterSet const* ps)
26 {
27  curr_info_ = ps->get_src_info(key);
28 }
29 
30 void
32 {
34 }
35 
36 //==========================================================================
37 
38 void
40 {
43  indent_.push();
44 }
45 
46 void
48 {
49  indent_.pop();
51  << printed_suffix(key, curr_size_) << nl();
52 }
53 
54 //==========================================================================
55 
56 void
58 {
59  push_size_(a);
62  indent_.push();
63 }
64 
65 void
67 {
68  indent_.pop();
70  << printed_suffix(key, curr_size_) << nl();
71  pop_size_();
72 }
73 
74 //==========================================================================
75 
76 void
77 PrettifierAnnotated::atom(std::string const& key, std::any const& a)
78 {
80  << printed_suffix(key, curr_size_)
82 }
83 
84 //=========================================================================
85 
86 void
88 {
89  sequence_sizes_.emplace(std::any_cast<ps_sequence_t>(a).size());
91 }
92 
93 void
95 {
96  sequence_sizes_.pop();
98 }
std::string printed_suffix(std::string const &key, std::size_t const sz)
std::string print_annotated_info(std::string const &curr_info, std::string const &cached_info)
std::string printed_prefix(std::string const &key)
std::string string
Definition: nybbler.cc:12
void before_action(key_t const &, any_t const &, ParameterSet const *) override
std::stack< std::size_t > sequence_sizes_
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
void enter_table(key_t const &, any_t const &) override
std::string printed_prefix(std::string const &key)
void after_action(key_t const &) override
def key(type, name=None)
Definition: graph.py:13
const double a
std::string value(std::any const &)
static constexpr double ps
Definition: Units.h:99
void atom(key_t const &, any_t const &) override
void exit_table(key_t const &, any_t const &) override
void exit_sequence(key_t const &, any_t const &) override
std::string get_src_info(std::string const &key) const
void enter_sequence(key_t const &, any_t const &) override
PrettifierAnnotated(unsigned initial_indent_level=0)
std::string printed_prefix(std::string const &key)
std::string nl(std::size_t i=1)
std::string closing_brace()