MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / print_snippet

Method print_snippet

src/backward.h:4147–4174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4145 }
4146
4147 void print_snippet(
4148 std::ostream& os,
4149 const char* indent,
4150 const ResolvedTrace::SourceLoc& source_loc,
4151 Colorize& colorize,
4152 Color::type color_code,
4153 int context_size)
4154 {
4155 using namespace std;
4156 typedef SnippetFactory::lines_t lines_t;
4157
4158 lines_t lines =
4159 _snippets.get_snippet(source_loc.filename, source_loc.line, static_cast<unsigned>(context_size));
4160
4161 for (lines_t::const_iterator it = lines.begin(); it != lines.end(); ++it) {
4162 if (it->first == source_loc.line) {
4163 colorize.set_color(color_code);
4164 os << indent << ">";
4165 }
4166 else {
4167 os << indent << " ";
4168 }
4169 os << std::setw(4) << it->first << ": " << it->second << "\n";
4170 if (it->first == source_loc.line) {
4171 colorize.set_color(Color::reset);
4172 }
4173 }
4174 }
4175
4176 void print_source_loc(
4177 std::ostream& os,

Callers

nothing calls this directly

Calls 4

get_snippetMethod · 0.80
set_colorMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected