print_description_blocks.cc
Go to the documentation of this file.
5 #include "cetlib/bold_fontify.h"
6 
7 #include <sstream>
8 
9 namespace art::detail {
11  print_header(LibraryInfo const& li, std::string const& type_spec)
12  {
13  std::ostringstream result;
14  std::string const long_spec =
15  li.long_spec().empty() ? " [ No alternate specification available ] " :
16  li.long_spec();
17  result << indent_1() << type_spec << ": "
18  << cet::bold_fontify(li.short_spec()) << " (or \"" << long_spec
19  << "\")"
20  << "\n\n";
21  return result.str();
22  }
23 
26  std::string const& prefix,
27  std::string const& type_spec)
28  {
29  std::ostringstream result;
30  result << indent_1() << "Allowed configuration\n"
31  << indent_1() << "---------------------\n";
32 
33  std::string printedConfig{describe(li.allowed_config(), prefix)};
34  if (!type_spec.empty()) {
35  replace_type(printedConfig, li.short_spec(), regex_for_spec(type_spec));
36  }
37  result << printedConfig;
38  return result.str();
39  }
40 }
std::regex regex_for_spec(std::string const &)
static QCString result
std::string string
Definition: nybbler.cc:12
void replace_type(std::string &str, std::string const &spec, std::regex const &r)
cet::exempt_ptr< fhicl::ConfigurationTable const > allowed_config() const
Definition: LibraryInfo.h:58
std::string describe(cet::exempt_ptr< fhicl::ConfigurationTable const > pb, std::string const &prefix)
Definition: describe.cc:6
std::string indent_1()
std::string print_allowed_configuration(LibraryInfo const &li, std::string const &prefix, std::string const &type_spec)
std::string print_header(LibraryInfo const &li, std::string const &type_spec)
std::string bold_fontify(std::string const &s)
Definition: bold_fontify.h:8
std::string const & short_spec() const
Definition: LibraryInfo.h:43
std::string const & long_spec() const
Definition: LibraryInfo.h:48