1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 21:01:16 +02:00

Move hiliteMatches into a separate header

This is mostly so that we don't #include <regex> everywhere (which
adds quite a bit of compilation time).
This commit is contained in:
Eelco Dolstra 2022-04-21 11:58:40 +02:00
parent 684e679e07
commit f05e1f6fbb
4 changed files with 22 additions and 16 deletions

View file

@ -2,7 +2,6 @@
#include <boost/format.hpp>
#include <string>
#include <regex>
#include "ansicolor.hh"
@ -155,15 +154,4 @@ inline hintformat hintfmt(std::string plain_string)
return hintfmt("%s", normaltxt(plain_string));
}
/* Highlight all the given matches in the given string `s` by wrapping
them between `prefix` and `postfix`.
If some matches overlap, then their union will be wrapped rather
than the individual matches. */
std::string hiliteMatches(
std::string_view s,
std::vector<std::smatch> matches,
std::string_view prefix,
std::string_view postfix);
}