OLD | NEW |
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 #ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_H_ | 5 #ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_H_ |
6 #define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_H_ | 6 #define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "net/base/net_api.h" | 15 #include "net/base/net_export.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 struct FtpDirectoryListingEntry { | 19 struct FtpDirectoryListingEntry { |
20 enum Type { | 20 enum Type { |
21 UNKNOWN, | 21 UNKNOWN, |
22 FILE, | 22 FILE, |
23 DIRECTORY, | 23 DIRECTORY, |
24 SYMLINK, | 24 SYMLINK, |
25 }; | 25 }; |
26 | 26 |
27 FtpDirectoryListingEntry(); | 27 FtpDirectoryListingEntry(); |
28 | 28 |
29 Type type; | 29 Type type; |
30 string16 name; // Name (UTF-16-encoded). | 30 string16 name; // Name (UTF-16-encoded). |
31 std::string raw_name; // Name in original character encoding. | 31 std::string raw_name; // Name in original character encoding. |
32 int64 size; // File size, in bytes. -1 if not applicable. | 32 int64 size; // File size, in bytes. -1 if not applicable. |
33 | 33 |
34 // Last modified time, in local time zone. | 34 // Last modified time, in local time zone. |
35 base::Time last_modified; | 35 base::Time last_modified; |
36 }; | 36 }; |
37 | 37 |
38 // Parses an FTP directory listing |text|. On success fills in |entries|. | 38 // Parses an FTP directory listing |text|. On success fills in |entries|. |
39 // Returns network error code. | 39 // Returns network error code. |
40 NET_API int ParseFtpDirectoryListing( | 40 NET_EXPORT int ParseFtpDirectoryListing( |
41 const std::string& text, | 41 const std::string& text, |
42 const base::Time& current_time, | 42 const base::Time& current_time, |
43 std::vector<FtpDirectoryListingEntry>* entries); | 43 std::vector<FtpDirectoryListingEntry>* entries); |
44 | 44 |
45 } // namespace net | 45 } // namespace net |
46 | 46 |
47 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_H_ | 47 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_H_ |
OLD | NEW |