// This is a grab-bag file for string utilities involved in escaping and // unescaping strings in various ways. Who knew there were so many? // // There are more escaping functions in: // webutil/html/tagutils.h (Escaping strings for HTML, PRE, JavaScript, etc.) // webutil/url/url.h (Escaping for URL's, both RFC-2396 and other methods) // template/template_modifiers.h (All sorts of stuff) // util/regexp/re2/re2.h (Escaping for literals within regular expressions // - see RE2::QuoteMeta). // And probably many more places, as well. #ifndef DYNAMIC_DEPTH_INTERNAL_STRINGS_ESCAPING_H_ // NOLINT #define DYNAMIC_DEPTH_INTERNAL_STRINGS_ESCAPING_H_ // NOLINT #include // For ptrdiff_t. #include #include "base/port.h" namespace dynamic_depth { // ---------------------------------------------------------------------- // Base64Unescape() // Converts "src" which is encoded in Base64 to its binary equivalent and // writes it to "dest". If src contains invalid characters, dest is cleared // and the function returns false. Returns true on success. // ---------------------------------------------------------------------- bool Base64Unescape(const string& src, string* dest); // ---------------------------------------------------------------------- // WebSafeBase64Unescape() // This is a variation of Base64Unescape which uses '-' instead of '+', and // '_' instead of '/'. src is not null terminated, instead specify len. I // recommend that slen