mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 11:54:01 +00:00
Enhanced the escape_xml function to escape quotes if necessary.
This commit is contained in:
parent
01c0480771
commit
99d2e62869
@ -885,7 +885,8 @@ unescape(const string &source) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
escape_xml(const string &source) {
|
escape_xml(const string &source,
|
||||||
|
bool escape_quotes) {
|
||||||
string dst;
|
string dst;
|
||||||
string::const_iterator src;
|
string::const_iterator src;
|
||||||
|
|
||||||
@ -897,6 +898,8 @@ escape_xml(const string &source) {
|
|||||||
dst += ">";
|
dst += ">";
|
||||||
else if (*src == '<')
|
else if (*src == '<')
|
||||||
dst += "<";
|
dst += "<";
|
||||||
|
else if (escape_quotes && (*src == '"'))
|
||||||
|
dst += """;
|
||||||
else
|
else
|
||||||
dst += *src;
|
dst += *src;
|
||||||
src++;
|
src++;
|
||||||
|
@ -225,7 +225,7 @@ string MTX_DLL_API join(const char *pattern, vector<string> &strings);
|
|||||||
void MTX_DLL_API strip(string &s, bool newlines = false);
|
void MTX_DLL_API strip(string &s, bool newlines = false);
|
||||||
void MTX_DLL_API strip(vector<string> &v, bool newlines = false);
|
void MTX_DLL_API strip(vector<string> &v, bool newlines = false);
|
||||||
string MTX_DLL_API escape(const string &src);
|
string MTX_DLL_API escape(const string &src);
|
||||||
string MTX_DLL_API escape_xml(const string &src);
|
string MTX_DLL_API escape_xml(const string &src, bool escape_quotes = false);
|
||||||
string MTX_DLL_API unescape(const string &src);
|
string MTX_DLL_API unescape(const string &src);
|
||||||
bool MTX_DLL_API starts_with(const string &s, const char *start,
|
bool MTX_DLL_API starts_with(const string &s, const char *start,
|
||||||
int maxlen = -1);
|
int maxlen = -1);
|
||||||
|
Loading…
Reference in New Issue
Block a user