Pretty Diagnostics
Create your own pretty diagnostics
Loading...
Searching...
No Matches
utils.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <iomanip>
4#include <string>
5#include <string_view>
6
7namespace pretty_diagnostics {
8
17std::string escape_string(std::string_view str);
18
19} // namespace pretty_diagnostics
20
21// BSD 3-Clause License
22//
23// Copyright (c) 2025, Timo Behrend
24//
25// Redistribution and use in source and binary forms, with or without
26// modification, are permitted provided that the following conditions are met:
27//
28// 1. Redistributions of source code must retain the above copyright notice, this
29// list of conditions and the following disclaimer.
30//
31// 2. Redistributions in binary form must reproduce the above copyright notice,
32// this list of conditions and the following disclaimer in the documentation
33// and/or other materials provided with the distribution.
34//
35// 3. Neither the name of the copyright holder nor the names of its
36// contributors may be used to endorse or promote products derived from
37// this software without specific prior written permission.
38//
39// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
40// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
42// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
43// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
44// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
45// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
46// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
47// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
48// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition: label.hpp:5
std::string escape_string(std::string_view str)
Escapes control characters and quotes in a string for safe display. For example, converts newlines to...