Vcsn  2.2
Be Rational
escape.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <iosfwd>
4 #include <sstream>
5 #include <string>
6 #include <vector>
7 
8 #include <vcsn/misc/export.hh>
9 
10 namespace vcsn LIBVCSN_API
11 {
13  std::ostream& str_escape(std::ostream& os, const std::string& str,
14  const char* special = nullptr);
15 
17  std::string str_escape(const std::string& c,
18  const char* special = nullptr);
19 
21  template <typename T>
22  std::string str_escape(const std::vector<T>& s,
23  const char* special = nullptr)
24  {
25  std::ostringstream o;
26  for (const auto& c: s)
27  str_escape(o, c, special);
28  return o.str();
29  }
30 
33  std::ostream& str_escape(std::ostream& os, int c,
34  const char* special = nullptr);
35 
37  std::string str_escape(int c,
38  const char* special = nullptr);
39 }
Definition: a-star.hh:8
std::ostringstream os
The output stream: the corresponding C++ snippet to compile.
Definition: translate.cc:382
std::ostream & str_escape(std::ostream &os, const std::string &str, const char *special=nullptr)
Output a string, escaping special characters.
Definition: escape.cc:54
#define LIBVCSN_API
Definition: export.hh:8