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