SeqAn3 3.2.0
The Modern C++ library for sequence analysis.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
pretty_print.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2022, Knut Reinert & MPI für molekulare Genetik
4// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6// -----------------------------------------------------------------------------------------------------
7
13#pragma once
14
15#include <string>
16
18
19namespace seqan3::detail
20{
21
22// ----------------------------------------------------------------------------
23// make_printable
24// ----------------------------------------------------------------------------
25
48inline std::string make_printable(char const c)
49{
50 switch (c)
51 {
52 case '\0':
53 return "'\\0'";
54 case '\t':
55 return "'\\t'";
56 case '\n':
57 return "'\\n'";
58 case '\v':
59 return "'\\v'";
60 case '\f':
61 return "'\\f'";
62 case '\r':
63 return "'\\r'";
64 case static_cast<char>(127):
65 return "'DEL'";
66 default:
67 {
68 if ((c >= static_cast<char>(1) && c <= static_cast<char>(8))
69 || (c >= static_cast<char>(14) && c <= static_cast<char>(31)))
70 return "'CTRL'";
71 else
72 return {'\'', c, '\''};
73 }
74 }
75}
76
77} // namespace seqan3::detail
Provides platform and dependency checks.