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 3 // found in the LICENSE file. 4 5 #ifndef NET_FTP_FTP_UTIL_H_ 6 #define NET_FTP_FTP_UTIL_H_ 7 8 #include <string> 9 10 #include "base/string16.h" 11 12 namespace base { 13 class Time; 14 } 15 16 namespace net { 17 18 class FtpUtil { 19 public: 20 // Convert Unix file path to VMS path (must be a file, and not a directory). 21 static std::string UnixFilePathToVMS(const std::string& unix_path); 22 23 // Convert Unix directory path to VMS path (must be a directory). 24 static std::string UnixDirectoryPathToVMS(const std::string& unix_path); 25 26 // Convert VMS path to Unix-style path. 27 static std::string VMSPathToUnix(const std::string& vms_path); 28 29 // Convert three-letter month abbreviation (like Nov) to its number (in range 30 // 1-12). 31 static bool ThreeLetterMonthToNumber(const string16& text, int* number); 32 33 // Convert a "ls -l" date listing to time. The listing comes in three columns. 34 // The first one contains month, the second one contains day of month. 35 // The first one is either a time (and then the current year is assumed), 36 // or is a year (and then we don't know the time). 37 static bool LsDateListingToTime(const string16& month, 38 const string16& day, 39 const string16& rest, 40 base::Time* time); 41 42 // Skip |columns| columns from |text| (whitespace-delimited), and return the 43 // remaining part, without leading/trailing whitespace. 44 static string16 GetStringPartAfterColumns(const string16& text, int columns); 45 }; 46 47 } // namespace net 48 49 #endif // NET_FTP_FTP_UTIL_H_ 50