| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef URL_URL_PARSE_H_ | 5 #ifndef URL_URL_PARSE_H_ |
| 6 #define URL_URL_PARSE_H_ | 6 #define URL_URL_PARSE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 // following the last slash. | 325 // following the last slash. |
| 326 // | 326 // |
| 327 // The 8-bit version requires UTF-8 encoding. | 327 // The 8-bit version requires UTF-8 encoding. |
| 328 URL_EXPORT void ExtractFileName(const char* url, | 328 URL_EXPORT void ExtractFileName(const char* url, |
| 329 const Component& path, | 329 const Component& path, |
| 330 Component* file_name); | 330 Component* file_name); |
| 331 URL_EXPORT void ExtractFileName(const base::char16* url, | 331 URL_EXPORT void ExtractFileName(const base::char16* url, |
| 332 const Component& path, | 332 const Component& path, |
| 333 Component* file_name); | 333 Component* file_name); |
| 334 | 334 |
| 335 // Extracts the range of the file extension in the given url. It uses |
| 336 // ExtractFileName() to extract the file name first. The file extension is |
| 337 // defined all characters following the last dot in the file name, unless the |
| 338 // last dot is the first character of the file name. |
| 339 // |
| 340 // The file extension will be empty if the file name is empty or there is no |
| 341 // extension in the file name. |
| 342 URL_EXPORT void ExtractFileExtension(const char* url, |
| 343 const Component& path, |
| 344 Component* file_extension); |
| 345 URL_EXPORT void ExtractFileExtension(const base::char16* url, |
| 346 const Component& path, |
| 347 Component* file_extension); |
| 348 |
| 335 // Extract the first key/value from the range defined by |*query|. Updates | 349 // Extract the first key/value from the range defined by |*query|. Updates |
| 336 // |*query| to start at the end of the extracted key/value pair. This is | 350 // |*query| to start at the end of the extracted key/value pair. This is |
| 337 // designed for use in a loop: you can keep calling it with the same query | 351 // designed for use in a loop: you can keep calling it with the same query |
| 338 // object and it will iterate over all items in the query. | 352 // object and it will iterate over all items in the query. |
| 339 // | 353 // |
| 340 // Some key/value pairs may have the key, the value, or both be empty (for | 354 // Some key/value pairs may have the key, the value, or both be empty (for |
| 341 // example, the query string "?&"). These will be returned. Note that an empty | 355 // example, the query string "?&"). These will be returned. Note that an empty |
| 342 // last parameter "foo.com?" or foo.com?a&" will not be returned, this case | 356 // last parameter "foo.com?" or foo.com?a&" will not be returned, this case |
| 343 // is the same as "done." | 357 // is the same as "done." |
| 344 // | 358 // |
| 345 // The initial query component should not include the '?' (this is the default | 359 // The initial query component should not include the '?' (this is the default |
| 346 // for parsed URLs). | 360 // for parsed URLs). |
| 347 // | 361 // |
| 348 // If no key/value are found |*key| and |*value| will be unchanged and it will | 362 // If no key/value are found |*key| and |*value| will be unchanged and it will |
| 349 // return false. | 363 // return false. |
| 350 URL_EXPORT bool ExtractQueryKeyValue(const char* url, | 364 URL_EXPORT bool ExtractQueryKeyValue(const char* url, |
| 351 Component* query, | 365 Component* query, |
| 352 Component* key, | 366 Component* key, |
| 353 Component* value); | 367 Component* value); |
| 354 URL_EXPORT bool ExtractQueryKeyValue(const base::char16* url, | 368 URL_EXPORT bool ExtractQueryKeyValue(const base::char16* url, |
| 355 Component* query, | 369 Component* query, |
| 356 Component* key, | 370 Component* key, |
| 357 Component* value); | 371 Component* value); |
| 358 | 372 |
| 359 } // namespace url_parse | 373 } // namespace url_parse |
| 360 | 374 |
| 361 #endif // URL_URL_PARSE_H_ | 375 #endif // URL_URL_PARSE_H_ |
| OLD | NEW |