SeqAn3  3.0.1
The Modern C++ library for sequence analysis.
pretty_print.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, 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 
17 #include <seqan3/core/platform.hpp>
18 
19 namespace seqan3::detail
20 {
21 
22 // ----------------------------------------------------------------------------
23 // make_printable
24 // ----------------------------------------------------------------------------
25 
48 inline std::string make_printable(char const c)
49 {
50  switch (c)
51  {
52  case '\0': return "'\\0'";
53  case '\t': return "'\\t'";
54  case '\n': return "'\\n'";
55  case '\v': return "'\\v'";
56  case '\f': return "'\\f'";
57  case '\r': return "'\\r'";
58  case static_cast<char>(127): return "'DEL'";
59  default:
60  {
61  if ((c >= static_cast<char>(1) && c <= static_cast<char>(8)) ||
62  (c >= static_cast<char>(14) && c <= static_cast<char>(31)))
63  return "'CTRL'";
64  else
65  return {'\'', c, '\''};
66  }
67  }
68 }
69 
70 } // namespace seqan3::detail
std::string
platform.hpp
Provides platform and dependency checks.
string