OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 NET_FTP_FTP_UTIL_H_ | 5 #ifndef NET_FTP_FTP_UTIL_H_ |
6 #define NET_FTP_FTP_UTIL_H_ | 6 #define NET_FTP_FTP_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class Time; | 14 class Time; |
15 } | 15 } |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 class FtpUtil { | 19 class FtpUtil { |
20 public: | 20 public: |
21 // Convert Unix file path to VMS path (must be a file, and not a directory). | 21 // Convert Unix file path to VMS path (must be a file, and not a directory). |
22 static std::string UnixFilePathToVMS(const std::string& unix_path); | 22 static std::string UnixFilePathToVMS(const std::string& unix_path); |
23 | 23 |
24 // Convert Unix directory path to VMS path (must be a directory). | 24 // Convert Unix directory path to VMS path (must be a directory). |
25 static std::string UnixDirectoryPathToVMS(const std::string& unix_path); | 25 static std::string UnixDirectoryPathToVMS(const std::string& unix_path); |
26 | 26 |
27 // Convert VMS path to Unix-style path. | 27 // Convert VMS path to Unix-style path. |
28 static std::string VMSPathToUnix(const std::string& vms_path); | 28 static std::string VMSPathToUnix(const std::string& vms_path); |
29 | 29 |
30 // Convert three-letter month abbreviation (like Nov) to its number (in range | 30 // Convert abbreviated month (like Nov) to its number (in range 1-12). |
eroman
2011/03/16 00:46:45
nit: We should be using tense like "Converts" for
Paweł Hajdan Jr.
2011/03/16 20:17:28
Done.
| |
31 // 1-12). | 31 // Note: in some locales abbreviations are more than three letters long, |
32 static bool ThreeLetterMonthToNumber(const string16& text, int* number); | 32 // and this function also handles them correctly. |
33 static bool AbbreviatedMonthToNumber(const string16& text, int* number); | |
33 | 34 |
34 // Convert a "ls -l" date listing to time. The listing comes in three columns. | 35 // Convert a "ls -l" date listing to time. The listing comes in three columns. |
35 // The first one contains month, the second one contains day of month. | 36 // The first one contains month, the second one contains day of month. |
36 // The first one is either a time (and then we guess the year based | 37 // The first one is either a time (and then we guess the year based |
37 // on |current_time|), or is a year (and then we don't know the time). | 38 // on |current_time|), or is a year (and then we don't know the time). |
38 static bool LsDateListingToTime(const string16& month, | 39 static bool LsDateListingToTime(const string16& month, |
39 const string16& day, | 40 const string16& day, |
40 const string16& rest, | 41 const string16& rest, |
41 const base::Time& current_time, | 42 const base::Time& current_time, |
42 base::Time* result); | 43 base::Time* result); |
43 | 44 |
44 // Skip |columns| columns from |text| (whitespace-delimited), and return the | 45 // Skip |columns| columns from |text| (whitespace-delimited), and return the |
45 // remaining part, without leading/trailing whitespace. | 46 // remaining part, without leading/trailing whitespace. |
46 static string16 GetStringPartAfterColumns(const string16& text, int columns); | 47 static string16 GetStringPartAfterColumns(const string16& text, int columns); |
47 }; | 48 }; |
48 | 49 |
49 } // namespace net | 50 } // namespace net |
50 | 51 |
51 #endif // NET_FTP_FTP_UTIL_H_ | 52 #endif // NET_FTP_FTP_UTIL_H_ |
OLD | NEW |