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