blob: 3fd0d322c2b74113bfb9492e854588d86c5e6fd8 [file]
// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
// source code is governed by a BSD-style license that can be found in the
// LICENSE file.
#ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_LS_H_
#define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_LS_H_
#include <queue>
#include "net/ftp/ftp_directory_listing_parser.h"
namespace net {
// Parser for "ls -l"-style directory listing.
class FtpDirectoryListingParserLs : public FtpDirectoryListingParser {
public:
FtpDirectoryListingParserLs();
// FtpDirectoryListingParser methods:
virtual FtpServerType GetServerType() const { return SERVER_LS; }
virtual bool ConsumeLine(const string16& line);
virtual bool OnEndOfInput();
virtual bool EntryAvailable() const;
virtual FtpDirectoryListingEntry PopEntry();
private:
bool received_nonempty_line_;
// True after we have received a "total n" listing header, where n is an
// integer. Only one such header is allowed per listing.
bool received_total_line_;
std::queue<FtpDirectoryListingEntry> entries_;
DISALLOW_COPY_AND_ASSIGN(FtpDirectoryListingParserLs);
};
} // namespace net
#endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_LS_H_