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

Side by Side Diff: net/ftp/ftp_directory_listing_parser_vms.h

Issue 465035: Split FTP LIST parsing code into individual files for each listing style. (Closed)
Patch Set: fix Created 11 years 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
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file.
4
5 #ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_VMS_H_
6 #define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_VMS_H_
7
8 #include <queue>
9
10 #include "net/ftp/ftp_directory_listing_parser.h"
11
12 namespace net {
13
14 // Parser for VMS-style directory listing (including variants).
15 class FtpDirectoryListingParserVms : public FtpDirectoryListingParser {
16 public:
17 FtpDirectoryListingParserVms();
18
19 // FtpDirectoryListingParser methods:
20 virtual FtpServerType GetServerType() const { return SERVER_VMS; }
21 virtual bool ConsumeLine(const string16& line);
22 virtual bool OnEndOfInput();
23 virtual bool EntryAvailable() const;
24 virtual FtpDirectoryListingEntry PopEntry();
25
26 private:
27 // Consumes listing line which is expected to be a directory listing entry
28 // (and not a comment etc). Returns true on success.
29 bool ConsumeEntryLine(const string16& line);
30
31 enum State {
32 STATE_INITIAL,
33
34 // Indicates that we have received the header, like this:
35 // Directory SYS$SYSDEVICE:[ANONYMOUS]
36 STATE_RECEIVED_HEADER,
37
38 // Indicates that we have received the first listing entry, like this:
39 // MADGOAT.DIR;1 2 9-MAY-2001 22:23:44.85
40 STATE_ENTRIES,
41
42 // Indicates that we have received the last listing entry.
43 STATE_RECEIVED_LAST_ENTRY,
44
45 // Indicates that we have successfully received all parts of the listing.
46 STATE_END,
47 } state_;
48
49 // VMS can use two physical lines if the filename is long. The first line will
50 // contain the filename, and the second line everything else. Store the
51 // filename until we receive the next line.
52 string16 last_filename_;
53 bool last_is_directory_;
54
55 std::queue<FtpDirectoryListingEntry> entries_;
56
57 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserVms);
58 };
59
60 } // namespace net
61
62 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_VMS_H_
OLDNEW
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_unittest.h ('k') | net/ftp/ftp_directory_listing_parser_vms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698