updated c_escape(); added TokenDefinition::getCString()
This commit is contained in:
parent
7756bd696b
commit
31c35a9335
@ -13,7 +13,7 @@ static string c_escape(const string & orig)
|
|||||||
string result;
|
string result;
|
||||||
for (string::const_iterator it = orig.begin(); it != orig.end(); it++)
|
for (string::const_iterator it = orig.begin(); it != orig.end(); it++)
|
||||||
{
|
{
|
||||||
if (*it == '\\')
|
if (*it == '\\' || *it == '"')
|
||||||
result += '\\';
|
result += '\\';
|
||||||
result += *it;
|
result += *it;
|
||||||
}
|
}
|
||||||
@ -37,3 +37,8 @@ bool TokenDefinition::create(const string & name,
|
|||||||
pcre_free(re);
|
pcre_free(re);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string TokenDefinition::getCString() const
|
||||||
|
{
|
||||||
|
return c_escape(m_definition);
|
||||||
|
}
|
||||||
|
@ -9,6 +9,7 @@ class TokenDefinition
|
|||||||
public:
|
public:
|
||||||
bool create(const std::string & name,
|
bool create(const std::string & name,
|
||||||
const std::string & definition, const std::string & flags);
|
const std::string & definition, const std::string & flags);
|
||||||
|
std::string getCString() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user