OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // Initializes the object. This will call through to one of the backend | 52 // Initializes the object. This will call through to one of the backend |
53 // initializers below depending on whether the string's internal | 53 // initializers below depending on whether the string's internal |
54 // representation is 8 or 16 bit. | 54 // representation is 8 or 16 bit. |
55 void init(const KURL& base, const String& relative, | 55 void init(const KURL& base, const String& relative, |
56 const TextEncoding* queryEncoding); | 56 const TextEncoding* queryEncoding); |
57 | 57 |
58 // Backend initializers. The query encoding parameters are optional and
can | 58 // Backend initializers. The query encoding parameters are optional and
can |
59 // be NULL (this implies UTF-8). These initializers require that the obj
ect | 59 // be NULL (this implies UTF-8). These initializers require that the obj
ect |
60 // has just been created and the strings are NULL. Do not call on an | 60 // has just been created and the strings are NULL. Do not call on an |
61 // already-constructed object. | 61 // already-constructed object. |
62 void init(const KURL& base, const char* rel, int relLen, | 62 void init(const KURL& base, const char* rel, int relLength, |
63 const TextEncoding* queryEncoding); | 63 const TextEncoding* queryEncoding); |
64 void init(const KURL& base, const UChar* rel, int relLen, | 64 void init(const KURL& base, const UChar* rel, int relLength, |
65 const TextEncoding* queryEncoding); | 65 const TextEncoding* queryEncoding); |
66 | 66 |
67 // Does a deep copy to the given output object. | 67 // Does a deep copy to the given output object. |
68 void copyTo(KURLGooglePrivate* dest) const; | 68 void copyTo(KURLGooglePrivate* dest) const; |
69 | 69 |
70 // Returns the substring of the input identified by the given component. | 70 // Returns the substring of the input identified by the given component. |
71 String componentString(const url_parse::Component&) const; | 71 String componentString(const url_parse::Component&) const; |
72 | 72 |
73 // Replaces the given components, modifying the current URL. The current | 73 // Replaces the given components, modifying the current URL. The current |
74 // URL must be valid. | 74 // URL must be valid. |
75 typedef url_canon::Replacements<url_parse::UTF16Char> Replacements; | 75 typedef url_canon::Replacements<url_parse::UTF16Char> Replacements; |
76 void replaceComponents(const Replacements&); | 76 void replaceComponents(const Replacements&); |
77 | 77 |
78 // Setters for the data. Using the ASCII version when you know the | 78 // Setters for the data. Using the ASCII version when you know the |
79 // data is ASCII will be slightly more efficient. The UTF-8 version | 79 // data is ASCII will be slightly more efficient. The UTF-8 version |
80 // will always be correct if the caller is unsure. | 80 // will always be correct if the caller is unsure. |
81 void setUtf8(const char* data, int dataLen); | 81 void setUtf8(const char* data, int dataLength); |
82 void setAscii(const char* data, int dataLen); | 82 void setAscii(const char* data, int dataLength); |
83 | 83 |
84 // TODO(brettw) we can support an additional optimization. Make this | 84 // TODO(brettw) we can support an additional optimization. Make this |
85 // buffer support both optinal Strings and UTF-8 data. This way, we can
use | 85 // buffer support both optinal Strings and UTF-8 data. This way, we can
use |
86 // the optimization from the original KURL which uses = with the origina
l | 86 // the optimization from the original KURL which uses = with the origina
l |
87 // string when canonicalization did not change it. This allows the strin
gs | 87 // string when canonicalization did not change it. This allows the strin
gs |
88 // to share a buffer internally, and saves a malloc. | 88 // to share a buffer internally, and saves a malloc. |
89 | 89 |
90 // Getters for the data. | 90 // Getters for the data. |
91 const CString& utf8String() const { return m_utf8; } | 91 const CString& utf8String() const { return m_utf8; } |
92 const String& string() const; | 92 const String& string() const; |
(...skipping 13 matching lines...) Expand all Loading... |
106 // hint (see setUtf8). | 106 // hint (see setUtf8). |
107 bool m_utf8IsASCII; | 107 bool m_utf8IsASCII; |
108 | 108 |
109 mutable bool m_stringIsValid; | 109 mutable bool m_stringIsValid; |
110 mutable String m_string; | 110 mutable String m_string; |
111 }; | 111 }; |
112 | 112 |
113 } // namespace WebCore | 113 } // namespace WebCore |
114 | 114 |
115 #endif | 115 #endif |
OLD | NEW |