diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-18 18:29:36 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-18 18:29:36 +0000 |
commit | 13677b86fc97aeab327e476c7de42bc777a54ee4 (patch) | |
tree | 5e2682e91c0d09d63a6a54e36d9996fef5528e8d /net/base/escape.h | |
parent | d929a9dfff856658662a962fd4dabed66d1e0b2f (diff) | |
download | chromium_src-13677b86fc97aeab327e476c7de42bc777a54ee4.zip chromium_src-13677b86fc97aeab327e476c7de42bc777a54ee4.tar.gz chromium_src-13677b86fc97aeab327e476c7de42bc777a54ee4.tar.bz2 |
net: Add NET_API to net/base
BUG=76997
TEST=NONE
Review URL: http://codereview.chromium.org/6969077
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85785 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/escape.h')
-rw-r--r-- | net/base/escape.h | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/net/base/escape.h b/net/base/escape.h index d389d85..6590329 100644 --- a/net/base/escape.h +++ b/net/base/escape.h @@ -11,34 +11,35 @@ #include "base/basictypes.h" #include "base/string16.h" +#include "net/base/net_api.h" // Escaping -------------------------------------------------------------------- // Escape a file. This includes: // non-printable, non-7bit, and (including space) "#%:<>?[\]^`{|} -std::string EscapePath(const std::string& path); +NET_API std::string EscapePath(const std::string& path); // Escape application/x-www-form-urlencoded content. This includes: // non-printable, non-7bit, and (including space) ?>=<;+'&%$#"![\]^`{|} // Space is escaped as + and other special characters as %XX (hex). -std::string EscapeUrlEncodedData(const std::string& path); +NET_API std::string EscapeUrlEncodedData(const std::string& path); // Escape all non-ASCII input. -std::string EscapeNonASCII(const std::string& input); +NET_API std::string EscapeNonASCII(const std::string& input); // Escapes characters in text suitable for use as an external protocol handler // command. // We %XX everything except alphanumerics and %-_.!~*'() and the restricted // chracters (;/?:@&=+$,). -std::string EscapeExternalHandlerValue(const std::string& text); +NET_API std::string EscapeExternalHandlerValue(const std::string& text); // Append the given character to the output string, escaping the character if // the character would be interpretted as an HTML delimiter. -void AppendEscapedCharForHTML(char c, std::string* output); +NET_API void AppendEscapedCharForHTML(char c, std::string* output); // Escape chars that might cause this text to be interpretted as HTML tags. -std::string EscapeForHTML(const std::string& text); -string16 EscapeForHTML(const string16& text); +NET_API std::string EscapeForHTML(const std::string& text); +NET_API string16 EscapeForHTML(const string16& text); // Unescaping ------------------------------------------------------------------ @@ -92,10 +93,10 @@ class UnescapeRule { // which, after unescaping, is supposed to be interpreted as UTF-8, and then // converted into full UTF-16 chars. This function won't tell you if any // conversions need to take place, it only unescapes. -std::string UnescapeURLComponent(const std::string& escaped_text, - UnescapeRule::Type rules); -string16 UnescapeURLComponent(const string16& escaped_text, - UnescapeRule::Type rules); +NET_API std::string UnescapeURLComponent(const std::string& escaped_text, + UnescapeRule::Type rules); +NET_API string16 UnescapeURLComponent(const string16& escaped_text, + UnescapeRule::Type rules); // Unescapes the given substring as a URL, and then tries to interpret the // result as being encoded as UTF-8. If the result is convertable into UTF-8, it @@ -106,17 +107,18 @@ string16 UnescapeURLComponent(const string16& escaped_text, // decoding. If this isn't possible because an offset points past the end of // the source strings or into the middle of a multibyte sequence, the offending // offset will be set to string16::npos. |offset[s]_for_adjustment| may be NULL. -string16 UnescapeAndDecodeUTF8URLComponent(const std::string& text, - UnescapeRule::Type rules, - size_t* offset_for_adjustment); -string16 UnescapeAndDecodeUTF8URLComponentWithOffsets( +NET_API string16 UnescapeAndDecodeUTF8URLComponent( + const std::string& text, + UnescapeRule::Type rules, + size_t* offset_for_adjustment); +NET_API string16 UnescapeAndDecodeUTF8URLComponentWithOffsets( const std::string& text, UnescapeRule::Type rules, std::vector<size_t>* offsets_for_adjustment); // Unescape the following ampersand character codes from |text|: // < > & " ' -string16 UnescapeForHTML(const string16& text); +NET_API string16 UnescapeForHTML(const string16& text); // Deprecated ------------------------------------------------------------------ @@ -126,19 +128,20 @@ string16 UnescapeForHTML(const string16& text); // This is basically the same as encodeURIComponent in javascript. // For the string16 version, we do a conversion to charset before encoding the // string. If the charset doesn't exist, we return false. -std::string EscapeQueryParamValue(const std::string& text, bool use_plus); -bool EscapeQueryParamValue(const string16& text, const char* codepage, - bool use_plus, string16* escaped); +NET_API std::string EscapeQueryParamValue(const std::string& text, + bool use_plus); +NET_API bool EscapeQueryParamValue(const string16& text, const char* codepage, + bool use_plus, string16* escaped); // A specialized version of EscapeQueryParamValue for string16s that // assumes the codepage is UTF8. This is provided as a convenience. -string16 EscapeQueryParamValueUTF8(const string16& text, bool use_plus); +NET_API string16 EscapeQueryParamValueUTF8(const string16& text, bool use_plus); // Private Functions (Exposed for Unit Testing) -------------------------------- // A function called by std::for_each that will adjust any offset which occurs // after one or more encoded characters. -struct AdjustEncodingOffset { +struct NET_TEST AdjustEncodingOffset { typedef std::vector<size_t> Adjustments; explicit AdjustEncodingOffset(const Adjustments& adjustments); |