| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 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 | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_LS_H_ | 5 #ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_LS_H_ |
| 6 #define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_LS_H_ | 6 #define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_LS_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "net/ftp/ftp_directory_listing_parser.h" | 10 #include "net/ftp/ftp_directory_listing_parser.h" |
| 11 | 11 |
| 12 namespace net { | 12 namespace net { |
| 13 | 13 |
| 14 // Parser for "ls -l"-style directory listing. | 14 // Parser for "ls -l"-style directory listing. |
| 15 class FtpDirectoryListingParserLs : public FtpDirectoryListingParser { | 15 class FtpDirectoryListingParserLs : public FtpDirectoryListingParser { |
| 16 public: | 16 public: |
| 17 FtpDirectoryListingParserLs(); | 17 FtpDirectoryListingParserLs(); |
| 18 | 18 |
| 19 // FtpDirectoryListingParser methods: | 19 // FtpDirectoryListingParser methods: |
| 20 virtual FtpServerType GetServerType() const { return SERVER_LS; } | 20 virtual FtpServerType GetServerType() const { return SERVER_LS; } |
| 21 virtual bool ConsumeLine(const string16& line); | 21 virtual bool ConsumeLine(const string16& line); |
| 22 virtual bool OnEndOfInput(); | 22 virtual bool OnEndOfInput(); |
| 23 virtual bool EntryAvailable() const; | 23 virtual bool EntryAvailable() const; |
| 24 virtual FtpDirectoryListingEntry PopEntry(); | 24 virtual FtpDirectoryListingEntry PopEntry(); |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 bool received_nonempty_line_; | 27 bool received_nonempty_line_; |
| 28 | 28 |
| 29 // True after we have received a "total n" listing header, where n is an |
| 30 // integer. Only one such header is allowed per listing. |
| 31 bool received_total_line_; |
| 32 |
| 29 std::queue<FtpDirectoryListingEntry> entries_; | 33 std::queue<FtpDirectoryListingEntry> entries_; |
| 30 | 34 |
| 31 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserLs); | 35 DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserLs); |
| 32 }; | 36 }; |
| 33 | 37 |
| 34 } // namespace net | 38 } // namespace net |
| 35 | 39 |
| 36 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_LS_H_ | 40 #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_LS_H_ |
| OLD | NEW |