123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- #ifndef BASE_STRINGS_ESCAPE_H_
- #define BASE_STRINGS_ESCAPE_H_
- #include <stdint.h>
- #include <set>
- #include <string>
- #include "base/base_export.h"
- #include "base/strings/string16.h"
- #include "base/strings/string_piece.h"
- #include "base/strings/utf_offset_string_conversions.h"
- namespace base {
- class UnescapeRule {
- public:
-
-
- typedef uint32_t Type;
- enum {
-
- NONE = 0,
-
-
-
-
-
- NORMAL = 1 << 0,
-
-
-
-
- SPACES = 1 << 1,
-
-
-
-
-
- PATH_SEPARATORS = 1 << 2,
-
-
-
-
-
-
- URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS = 1 << 3,
-
- REPLACE_PLUS_WITH_SPACE = 1 << 4,
- };
- };
- BASE_EXPORT std::string UnescapeURLComponent(StringPiece escaped_text,
- UnescapeRule::Type rules);
- BASE_EXPORT string16 UnescapeAndDecodeUTF8URLComponentWithAdjustments(
- StringPiece text,
- UnescapeRule::Type rules,
- OffsetAdjuster::Adjustments* adjustments);
- BASE_EXPORT std::string UnescapeBinaryURLComponent(
- StringPiece escaped_text,
- UnescapeRule::Type rules = UnescapeRule::NORMAL);
- BASE_EXPORT bool UnescapeBinaryURLComponentSafe(StringPiece escaped_text,
- bool fail_on_path_separators,
- std::string* unescaped_text);
- BASE_EXPORT bool ContainsEncodedBytes(StringPiece escaped_text,
- const std::set<unsigned char>& bytes);
- }
- #endif
|