Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: net/ftp/ftp_util.cc

Issue 12087091: Move string tokenizer to base/strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/dns/dns_hosts.cc ('k') | net/http/http_auth.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "net/ftp/ftp_util.h" 5 #include "net/ftp/ftp_util.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/i18n/case_conversion.h" 10 #include "base/i18n/case_conversion.h"
11 #include "base/i18n/char_iterator.h" 11 #include "base/i18n/char_iterator.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/string_piece.h" 15 #include "base/string_piece.h"
16 #include "base/string_split.h" 16 #include "base/string_split.h"
17 #include "base/string_tokenizer.h"
18 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "base/strings/string_tokenizer.h"
19 #include "base/time.h" 19 #include "base/time.h"
20 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
21 #include "third_party/icu/public/common/unicode/uchar.h" 21 #include "third_party/icu/public/common/unicode/uchar.h"
22 #include "third_party/icu/public/i18n/unicode/datefmt.h" 22 #include "third_party/icu/public/i18n/unicode/datefmt.h"
23 #include "third_party/icu/public/i18n/unicode/dtfmtsym.h" 23 #include "third_party/icu/public/i18n/unicode/dtfmtsym.h"
24 24
25 using base::StringPiece16; 25 using base::StringPiece16;
26 26
27 // For examples of Unix<->VMS path conversions, see the unit test file. On VMS 27 // For examples of Unix<->VMS path conversions, see the unit test file. On VMS
28 // a path looks differently depending on whether it's a file or directory. 28 // a path looks differently depending on whether it's a file or directory.
29 29
30 namespace net { 30 namespace net {
31 31
32 // static 32 // static
33 std::string FtpUtil::UnixFilePathToVMS(const std::string& unix_path) { 33 std::string FtpUtil::UnixFilePathToVMS(const std::string& unix_path) {
34 if (unix_path.empty()) 34 if (unix_path.empty())
35 return std::string(); 35 return std::string();
36 36
37 StringTokenizer tokenizer(unix_path, "/"); 37 base::StringTokenizer tokenizer(unix_path, "/");
38 std::vector<std::string> tokens; 38 std::vector<std::string> tokens;
39 while (tokenizer.GetNext()) 39 while (tokenizer.GetNext())
40 tokens.push_back(tokenizer.token()); 40 tokens.push_back(tokenizer.token());
41 41
42 if (unix_path[0] == '/') { 42 if (unix_path[0] == '/') {
43 // It's an absolute path. 43 // It's an absolute path.
44 44
45 if (tokens.empty()) { 45 if (tokens.empty()) {
46 DCHECK_EQ(1U, unix_path.length()); 46 DCHECK_EQ(1U, unix_path.length());
47 return "[]"; 47 return "[]";
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 while (!iter.end() && !u_isspace(iter.get())) 346 while (!iter.end() && !u_isspace(iter.get()))
347 iter.Advance(); 347 iter.Advance();
348 } 348 }
349 349
350 string16 result(text.substr(iter.array_pos())); 350 string16 result(text.substr(iter.array_pos()));
351 TrimWhitespace(result, TRIM_ALL, &result); 351 TrimWhitespace(result, TRIM_ALL, &result);
352 return result; 352 return result;
353 } 353 }
354 354
355 } // namespace 355 } // namespace
OLDNEW
« no previous file with comments | « net/dns/dns_hosts.cc ('k') | net/http/http_auth.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698