Add escape functionality to rjp++

This commit is contained in:
rexy712 2020-07-19 08:48:10 -07:00
parent ad2138ba5d
commit bf098ac96a
2 changed files with 31 additions and 20 deletions

View File

@ -47,6 +47,9 @@ namespace rjp{
string& operator=(RJP_value* r);
};
string escape(const rexy::string_base& str);
string escape(const char* c);
}
#endif

View File

@ -46,4 +46,12 @@ namespace rjp{
str->length = 0;
return *this;
}
string escape(const rexy::string_base& str){
return escape(str.c_str());
}
string escape(const char* c){
RJP_string tmp = rjp_escape(c);
return string(rexy::steal<char*>(tmp.value), tmp.length);
}
}