ROSE 0.11.145.147
Escape.h
1#ifndef ROSE_StringUtility_Escape_H
2#define ROSE_StringUtility_Escape_H
3#include <RoseFirst.h>
4#include <rosedll.h>
5
6#include <string>
7
8namespace Rose {
9namespace StringUtility {
10
12// Character-escaping functions
14
18ROSE_UTIL_API std::string htmlEscape(const std::string&);
19
32ROSE_UTIL_API std::string cEscape(const std::string&, char context = '"');
33ROSE_UTIL_API std::string cEscape(char, char context = '\'');
44ROSE_UTIL_API std::string cUnescape(const std::string&);
45
49ROSE_UTIL_API std::string bourneEscape(const std::string&);
50
54ROSE_UTIL_API std::string yamlEscape(const std::string&);
55
59ROSE_UTIL_API std::string jsonEscape(const std::string&);
60
64ROSE_UTIL_API std::string csvEscape(const std::string&);
65
66// [Robb Matzke 2016-05-06]: I am deprecating escapeNewLineCharaters because:
67// 1. Its name is spelled wrong: "Charater"
68// 2. "newline" in this context is a single word and should be capitalized as "Newline" not "NewLine"
69// 3. Its name is misleading because it also escapes double quotes.
70// 4. It escapes newlines using "l" rather than the more customary "n".
71// I would just remove it, but it seems to be used in some projects and the tutorial.
72
77ROSE_UTIL_API std::string escapeNewLineCharaters(const std::string&);
78
79// DQ (12/8/2016): This is ued in the generation of dot files.
80ROSE_UTIL_API std::string escapeNewlineAndDoubleQuoteCharacters(const std::string&);
81
82} // namespace
83} // namespace
84
85#endif
ROSE_UTIL_API std::string escapeNewLineCharaters(const std::string &)
Escapes line feeds and double quotes.
ROSE_UTIL_API std::string cEscape(const std::string &, char context='"')
Escapes characters that are special to C/C++.
ROSE_UTIL_API std::string cUnescape(const std::string &)
Unescapes C++ string literals.
ROSE_UTIL_API std::string yamlEscape(const std::string &)
Escapes characters that are special to YAML strings.
ROSE_UTIL_API std::string htmlEscape(const std::string &)
Escapes HTML special characters.
ROSE_UTIL_API std::string csvEscape(const std::string &)
Escapes characters that are special in CSV tables.
ROSE_UTIL_API std::string bourneEscape(const std::string &)
Escapes characters that are special to the Bourne shell.
ROSE_UTIL_API std::string jsonEscape(const std::string &)
Escapes characters that are special inside a JSON string.
The ROSE library.