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

hiliteMatches(): Style fixes, pass more stuff by reference

This commit is contained in:
Eelco Dolstra 2022-01-24 14:47:34 +01:00
parent 4530574363
commit 7afbdf2545
3 changed files with 30 additions and 19 deletions

View file

@ -156,12 +156,15 @@ 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(const std::string &s, std::vector<std::smatch> matches, std::string prefix, std::string postfix);
/* 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);
}