mirror of https://github.com/aria2/aria2
2007-07-06 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Reads URIs from stdin when "-i -" is specified. * src/UriFileListParser.h, src/UriFileListParser.cc: Removed. * src/UriListParser.h, src/UriListParser.cc: New class. * src/StreamUriListParser.h: New class. * src/FileUriListParser.h: New class. * src/main.cc (main): Use StreamUriListParser and FileUriListParser instead of UriFileListParser.pull/1/head
parent
e52e0fa01f
commit
d80d7faac9
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2007-07-06 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Reads URIs from stdin when "-i -" is specified.
|
||||
* src/UriFileListParser.h, src/UriFileListParser.cc: Removed.
|
||||
* src/UriListParser.h, src/UriListParser.cc: New class.
|
||||
* src/StreamUriListParser.h: New class.
|
||||
* src/FileUriListParser.h: New class.
|
||||
* src/main.cc (main): Use StreamUriListParser and FileUriListParser
|
||||
instead of UriFileListParser.
|
||||
|
||||
2007-07-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Made console readout more readable.
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/* <!-- copyright */
|
||||
/*
|
||||
* aria2 - The high speed download utility
|
||||
*
|
||||
* Copyright (C) 2006 Tatsuhiro Tsujikawa
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give
|
||||
* permission to link the code of portions of this program with the
|
||||
* OpenSSL library under certain conditions as described in each
|
||||
* individual source file, and distribute linked combinations
|
||||
* including the two.
|
||||
* You must obey the GNU General Public License in all respects
|
||||
* for all of the code used other than OpenSSL. If you modify
|
||||
* file(s) with this exception, you may extend this exception to your
|
||||
* version of the file(s), but you are not obligated to do so. If you
|
||||
* do not wish to do so, delete this exception statement from your
|
||||
* version. If you delete this exception statement from all source
|
||||
* files in the program, then also delete it here.
|
||||
*/
|
||||
/* copyright --> */
|
||||
#ifndef _D_FILE_URI_LIST_PARSER_H_
|
||||
#define _D_FILE_URI_LIST_PARSER_H_
|
||||
|
||||
#include "UriListParser.h"
|
||||
#include <fstream>
|
||||
|
||||
class FileUriListParser : public UriListParser {
|
||||
private:
|
||||
string _filename;
|
||||
ifstream _ifs;
|
||||
|
||||
protected:
|
||||
virtual istream& getInputStream()
|
||||
{
|
||||
return _ifs;
|
||||
}
|
||||
|
||||
virtual const istream& getInputStream() const
|
||||
{
|
||||
return _ifs;
|
||||
}
|
||||
|
||||
public:
|
||||
FileUriListParser(const string& filename):_filename(filename), _ifs(filename.c_str()) {}
|
||||
|
||||
virtual ~FileUriListParser() {}
|
||||
};
|
||||
|
||||
#endif // _D_FILE_URI_LIST_PARSER_H_
|
|
@ -87,7 +87,7 @@ SRCS = Socket.h\
|
|||
FileAllocationDispatcherCommand.cc FileAllocationDispatcherCommand.h\
|
||||
FileAllocationEntry.cc FileAllocationEntry.h\
|
||||
MultiUrlRequestInfo.cc MultiUrlRequestInfo.h\
|
||||
UriFileListParser.cc UriFileListParser.h\
|
||||
UriListParser.cc UriListParser.h\
|
||||
SegmentManFactory.h\
|
||||
AbstractSegmentManFactory.h\
|
||||
DefaultSegmentManFactory.cc DefaultSegmentManFactory.h\
|
||||
|
|
|
@ -236,7 +236,7 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
|
|||
FillRequestGroupCommand.h FileAllocationDispatcherCommand.cc \
|
||||
FileAllocationDispatcherCommand.h FileAllocationEntry.cc \
|
||||
FileAllocationEntry.h MultiUrlRequestInfo.cc \
|
||||
MultiUrlRequestInfo.h UriFileListParser.cc UriFileListParser.h \
|
||||
MultiUrlRequestInfo.h UriListParser.cc UriListParser.h \
|
||||
SegmentManFactory.h AbstractSegmentManFactory.h \
|
||||
DefaultSegmentManFactory.cc DefaultSegmentManFactory.h \
|
||||
RealtimeCommand.cc RealtimeCommand.h ProgressAwareEntry.h \
|
||||
|
@ -432,7 +432,7 @@ am__objects_4 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
|
|||
FillRequestGroupCommand.$(OBJEXT) \
|
||||
FileAllocationDispatcherCommand.$(OBJEXT) \
|
||||
FileAllocationEntry.$(OBJEXT) MultiUrlRequestInfo.$(OBJEXT) \
|
||||
UriFileListParser.$(OBJEXT) DefaultSegmentManFactory.$(OBJEXT) \
|
||||
UriListParser.$(OBJEXT) DefaultSegmentManFactory.$(OBJEXT) \
|
||||
RealtimeCommand.$(OBJEXT) RequestGroupEntry.$(OBJEXT) \
|
||||
Cookie.$(OBJEXT) CookieParser.$(OBJEXT) \
|
||||
CookieBoxFactory.$(OBJEXT) HttpHeaderProcessor.$(OBJEXT) \
|
||||
|
@ -661,7 +661,7 @@ SRCS = Socket.h SocketCore.cc SocketCore.h Command.cc Command.h \
|
|||
FillRequestGroupCommand.h FileAllocationDispatcherCommand.cc \
|
||||
FileAllocationDispatcherCommand.h FileAllocationEntry.cc \
|
||||
FileAllocationEntry.h MultiUrlRequestInfo.cc \
|
||||
MultiUrlRequestInfo.h UriFileListParser.cc UriFileListParser.h \
|
||||
MultiUrlRequestInfo.h UriListParser.cc UriListParser.h \
|
||||
SegmentManFactory.h AbstractSegmentManFactory.h \
|
||||
DefaultSegmentManFactory.cc DefaultSegmentManFactory.h \
|
||||
RealtimeCommand.cc RealtimeCommand.h ProgressAwareEntry.h \
|
||||
|
@ -906,7 +906,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackerSegmentManFactory.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackerUpdateCommand.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackerWatcherCommand.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UriFileListParser.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UriListParser.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Util.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xml2MetalinkProcessor.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/* <!-- copyright */
|
||||
/*
|
||||
* aria2 - The high speed download utility
|
||||
*
|
||||
* Copyright (C) 2006 Tatsuhiro Tsujikawa
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give
|
||||
* permission to link the code of portions of this program with the
|
||||
* OpenSSL library under certain conditions as described in each
|
||||
* individual source file, and distribute linked combinations
|
||||
* including the two.
|
||||
* You must obey the GNU General Public License in all respects
|
||||
* for all of the code used other than OpenSSL. If you modify
|
||||
* file(s) with this exception, you may extend this exception to your
|
||||
* version of the file(s), but you are not obligated to do so. If you
|
||||
* do not wish to do so, delete this exception statement from your
|
||||
* version. If you delete this exception statement from all source
|
||||
* files in the program, then also delete it here.
|
||||
*/
|
||||
/* copyright --> */
|
||||
#ifndef _D_STREAM_URI_LIST_PARSER_H_
|
||||
#define _D_STREAM_URI_LIST_PARSER_H_
|
||||
|
||||
#include "UriListParser.h"
|
||||
|
||||
class StreamUriListParser : public UriListParser {
|
||||
private:
|
||||
istream* _ifs;
|
||||
protected:
|
||||
virtual istream& getInputStream()
|
||||
{
|
||||
return *_ifs;
|
||||
}
|
||||
|
||||
virtual const istream& getInputStream() const
|
||||
{
|
||||
return *_ifs;
|
||||
}
|
||||
public:
|
||||
StreamUriListParser(istream& ifs):_ifs(&ifs) {}
|
||||
|
||||
virtual ~StreamUriListParser() {}
|
||||
};
|
||||
|
||||
#endif // _D_STREAM_URI_LIST_PARSER_H_
|
|
@ -32,18 +32,18 @@
|
|||
* files in the program, then also delete it here.
|
||||
*/
|
||||
/* copyright --> */
|
||||
#include "UriFileListParser.h"
|
||||
#include "UriListParser.h"
|
||||
#include "Util.h"
|
||||
|
||||
bool UriFileListParser::hasNext() const
|
||||
bool UriListParser::hasNext() const
|
||||
{
|
||||
return *_ifs;
|
||||
return getInputStream();
|
||||
}
|
||||
|
||||
Strings UriFileListParser::next()
|
||||
Strings UriListParser::next()
|
||||
{
|
||||
string line;
|
||||
while(getline(*_ifs, line)) {
|
||||
while(getline(getInputStream(), line)) {
|
||||
if(Util::trim(line) != "") {
|
||||
Strings uris;
|
||||
Util::slice(uris, line, '\t', true);
|
|
@ -32,35 +32,25 @@
|
|||
* files in the program, then also delete it here.
|
||||
*/
|
||||
/* copyright --> */
|
||||
#ifndef _D_URI_FILE_LIST_PARSER_H_
|
||||
#define _D_URI_FILE_LIST_PARSER_H_
|
||||
#ifndef _D_URI_LIST_PARSER_H_
|
||||
#define _D_URI_LIST_PARSER_H_
|
||||
|
||||
#include "common.h"
|
||||
#include <fstream>
|
||||
#include <istream>
|
||||
|
||||
class UriListParser {
|
||||
protected:
|
||||
virtual istream& getInputStream() = 0;
|
||||
virtual const istream& getInputStream() const = 0;
|
||||
|
||||
class UriFileListParser {
|
||||
private:
|
||||
string _filename;
|
||||
istream* _ifs;
|
||||
bool _deleteOnExit;
|
||||
public:
|
||||
UriFileListParser(const string& filename):_filename(filename), _ifs(new ifstream(filename.c_str())), _deleteOnExit(true) {}
|
||||
UriListParser() {}
|
||||
|
||||
UriFileListParser():_ifs(0) {}
|
||||
|
||||
UriFileListParser(istream& ifs):_filename("-"), _ifs(&ifs), _deleteOnExit(false)
|
||||
{}
|
||||
|
||||
~UriFileListParser()
|
||||
{
|
||||
if(_deleteOnExit) {
|
||||
delete _ifs;
|
||||
}
|
||||
}
|
||||
virtual ~UriListParser() {}
|
||||
|
||||
bool hasNext() const;
|
||||
|
||||
Strings next();
|
||||
};
|
||||
|
||||
#endif // _D_URI_FILE_LIST_PARSER_H_
|
||||
#endif // _D_URI_LIST_PARSER_H_
|
|
@ -49,7 +49,8 @@
|
|||
#include "FatalException.h"
|
||||
#include "File.h"
|
||||
#include "CUIDCounter.h"
|
||||
#include "UriFileListParser.h"
|
||||
#include "FileUriListParser.h"
|
||||
#include "StreamUriListParser.h"
|
||||
#include "CookieBoxFactory.h"
|
||||
#include "a2algo.h"
|
||||
#include "message.h"
|
||||
|
@ -755,14 +756,14 @@ int main(int argc, char* argv[]) {
|
|||
else
|
||||
#endif // ENABLE_METALINK
|
||||
if(op->defined(PREF_INPUT_FILE)) {
|
||||
SharedHandle<UriFileListParser> flparser(0);
|
||||
SharedHandle<UriListParser> flparser(0);
|
||||
if(op->get(PREF_INPUT_FILE) == "-") {
|
||||
flparser = new UriFileListParser(cin);
|
||||
flparser = new StreamUriListParser(cin);
|
||||
} else {
|
||||
if(!File(op->get(PREF_INPUT_FILE)).isFile()) {
|
||||
throw new FatalException(EX_FILE_OPEN, op->get(PREF_INPUT_FILE).c_str(), "No such file");
|
||||
}
|
||||
flparser = new UriFileListParser(op->get(PREF_INPUT_FILE));
|
||||
flparser = new FileUriListParser(op->get(PREF_INPUT_FILE));
|
||||
}
|
||||
RequestGroups groups;
|
||||
while(flparser->hasNext()) {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
TESTS = aria2c
|
||||
check_PROGRAMS = $(TESTS)
|
||||
aria2c_SOURCES = AllTest.cc\
|
||||
FileUriListParserTest.cc\
|
||||
StreamUriListParserTest.cc\
|
||||
HttpHeaderProcessorTest.cc\
|
||||
UtilTest.cc\
|
||||
CookieBoxTest.cc\
|
||||
|
@ -12,7 +14,6 @@ aria2c_SOURCES = AllTest.cc\
|
|||
RequestGroupManTest.cc\
|
||||
IteratableChecksumValidatorTest.cc\
|
||||
IteratableChunkChecksumValidatorTest.cc\
|
||||
UriFileListParserTest.cc\
|
||||
PeerTest.cc\
|
||||
DefaultPeerStorageTest.cc\
|
||||
RequestFactoryTest.cc\
|
||||
|
|
286
test/Makefile.in
286
test/Makefile.in
|
@ -57,54 +57,8 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
|||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
am__EXEEXT_1 = aria2c$(EXEEXT)
|
||||
am_aria2c_OBJECTS = AllTest.$(OBJEXT) \
|
||||
HttpHeaderProcessorTest.$(OBJEXT) UtilTest.$(OBJEXT) \
|
||||
CookieBoxTest.$(OBJEXT) RequestTest.$(OBJEXT) \
|
||||
CookieParserTest.$(OBJEXT) HttpRequestTest.$(OBJEXT) \
|
||||
CookieBoxFactoryTest.$(OBJEXT) \
|
||||
ByteArrayDiskWriterTest.$(OBJEXT) \
|
||||
RequestGroupManTest.$(OBJEXT) \
|
||||
IteratableChecksumValidatorTest.$(OBJEXT) \
|
||||
IteratableChunkChecksumValidatorTest.$(OBJEXT) \
|
||||
UriFileListParserTest.$(OBJEXT) PeerTest.$(OBJEXT) \
|
||||
DefaultPeerStorageTest.$(OBJEXT) RequestFactoryTest.$(OBJEXT) \
|
||||
NetrcAuthResolverTest.$(OBJEXT) \
|
||||
DefaultAuthResolverTest.$(OBJEXT) OptionHandlerTest.$(OBJEXT) \
|
||||
SegmentManTest.$(OBJEXT) BitfieldManTest.$(OBJEXT) \
|
||||
GlowFileAllocatorTest.$(OBJEXT) NetrcTest.$(OBJEXT) \
|
||||
SingletonHolderTest.$(OBJEXT) HttpHeaderTest.$(OBJEXT) \
|
||||
HttpResponseTest.$(OBJEXT) SharedHandleTest.$(OBJEXT) \
|
||||
ChunkedEncodingTest.$(OBJEXT) FileTest.$(OBJEXT) \
|
||||
OptionTest.$(OBJEXT) Base64Test.$(OBJEXT) DataTest.$(OBJEXT) \
|
||||
DictionaryTest.$(OBJEXT) ListTest.$(OBJEXT) \
|
||||
MetaFileUtilTest.$(OBJEXT) ShaVisitorTest.$(OBJEXT) \
|
||||
PeerMessageUtilTest.$(OBJEXT) DefaultDiskWriterTest.$(OBJEXT) \
|
||||
MultiDiskAdaptorTest.$(OBJEXT) \
|
||||
Xml2MetalinkProcessorTest.$(OBJEXT) MetalinkerTest.$(OBJEXT) \
|
||||
MetalinkEntryTest.$(OBJEXT) FeatureConfigTest.$(OBJEXT) \
|
||||
ShareRatioSeedCriteriaTest.$(OBJEXT) \
|
||||
TimeSeedCriteriaTest.$(OBJEXT) SpeedCalcTest.$(OBJEXT) \
|
||||
DefaultPeerListProcessorTest.$(OBJEXT) \
|
||||
AnnounceListTest.$(OBJEXT) TrackerWatcherCommandTest.$(OBJEXT) \
|
||||
DefaultBtContextTest.$(OBJEXT) \
|
||||
DefaultPieceStorageTest.$(OBJEXT) \
|
||||
DefaultBtAnnounceTest.$(OBJEXT) BtRegistryTest.$(OBJEXT) \
|
||||
DefaultBtMessageDispatcherTest.$(OBJEXT) \
|
||||
DefaultBtRequestFactoryTest.$(OBJEXT) \
|
||||
BtAllowedFastMessageTest.$(OBJEXT) \
|
||||
BtBitfieldMessageTest.$(OBJEXT) BtCancelMessageTest.$(OBJEXT) \
|
||||
BtChokeMessageTest.$(OBJEXT) BtHaveAllMessageTest.$(OBJEXT) \
|
||||
BtHaveMessageTest.$(OBJEXT) BtHaveNoneMessageTest.$(OBJEXT) \
|
||||
BtInterestedMessageTest.$(OBJEXT) \
|
||||
BtKeepAliveMessageTest.$(OBJEXT) \
|
||||
BtNotInterestedMessageTest.$(OBJEXT) \
|
||||
BtPieceMessageTest.$(OBJEXT) BtPortMessageTest.$(OBJEXT) \
|
||||
BtRejectMessageTest.$(OBJEXT) BtRequestMessageTest.$(OBJEXT) \
|
||||
BtSuggestPieceMessageTest.$(OBJEXT) \
|
||||
BtUnchokeMessageTest.$(OBJEXT) \
|
||||
BtHandshakeMessageTest.$(OBJEXT) \
|
||||
ConsoleFileAllocationMonitorTest.$(OBJEXT) \
|
||||
ChunkChecksumValidatorTest.$(OBJEXT)
|
||||
am_aria2c_OBJECTS = AllTest.$(OBJEXT) FileUriListParserTest.$(OBJEXT) \
|
||||
StreamUriListParserTest.$(OBJEXT)
|
||||
aria2c_OBJECTS = $(am_aria2c_OBJECTS)
|
||||
am__DEPENDENCIES_1 =
|
||||
aria2c_DEPENDENCIES = ../src/libaria2c.a $(am__DEPENDENCIES_1)
|
||||
|
@ -116,10 +70,6 @@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
|||
CXXLD = $(CXX)
|
||||
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
|
||||
-o $@
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(aria2c_SOURCES)
|
||||
DIST_SOURCES = $(aria2c_SOURCES)
|
||||
ETAGS = etags
|
||||
|
@ -271,85 +221,86 @@ sysconfdir = @sysconfdir@
|
|||
target_alias = @target_alias@
|
||||
TESTS = aria2c
|
||||
aria2c_SOURCES = AllTest.cc\
|
||||
HttpHeaderProcessorTest.cc\
|
||||
UtilTest.cc\
|
||||
CookieBoxTest.cc\
|
||||
RequestTest.cc\
|
||||
CookieParserTest.cc\
|
||||
HttpRequestTest.cc\
|
||||
CookieBoxFactoryTest.cc\
|
||||
ByteArrayDiskWriterTest.cc\
|
||||
RequestGroupManTest.cc\
|
||||
IteratableChecksumValidatorTest.cc\
|
||||
IteratableChunkChecksumValidatorTest.cc\
|
||||
UriFileListParserTest.cc\
|
||||
PeerTest.cc\
|
||||
DefaultPeerStorageTest.cc\
|
||||
RequestFactoryTest.cc\
|
||||
NetrcAuthResolverTest.cc\
|
||||
DefaultAuthResolverTest.cc\
|
||||
OptionHandlerTest.cc\
|
||||
SegmentManTest.cc\
|
||||
BitfieldManTest.cc\
|
||||
GlowFileAllocatorTest.cc\
|
||||
NetrcTest.cc\
|
||||
SingletonHolderTest.cc\
|
||||
HttpHeaderTest.cc\
|
||||
HttpResponseTest.cc\
|
||||
SharedHandleTest.cc\
|
||||
ChunkedEncodingTest.cc\
|
||||
FileTest.cc\
|
||||
OptionTest.cc\
|
||||
Base64Test.cc\
|
||||
DataTest.cc\
|
||||
DictionaryTest.cc\
|
||||
ListTest.cc\
|
||||
MetaFileUtilTest.cc\
|
||||
ShaVisitorTest.cc\
|
||||
PeerMessageUtilTest.cc\
|
||||
DefaultDiskWriterTest.cc\
|
||||
MultiDiskAdaptorTest.cc\
|
||||
Xml2MetalinkProcessorTest.cc\
|
||||
MetalinkerTest.cc\
|
||||
MetalinkEntryTest.cc\
|
||||
FeatureConfigTest.cc\
|
||||
ShareRatioSeedCriteriaTest.cc\
|
||||
TimeSeedCriteriaTest.cc\
|
||||
SpeedCalcTest.cc\
|
||||
DefaultPeerListProcessorTest.cc\
|
||||
AnnounceListTest.cc\
|
||||
TrackerWatcherCommandTest.cc\
|
||||
DefaultBtContextTest.cc\
|
||||
DefaultPieceStorageTest.cc\
|
||||
DefaultBtAnnounceTest.cc\
|
||||
BtRegistryTest.cc\
|
||||
DefaultBtMessageDispatcherTest.cc\
|
||||
MockPeerStorage.h\
|
||||
DefaultBtRequestFactoryTest.cc\
|
||||
BtAllowedFastMessageTest.cc\
|
||||
BtBitfieldMessageTest.cc\
|
||||
BtCancelMessageTest.cc\
|
||||
BtChokeMessageTest.cc\
|
||||
BtHaveAllMessageTest.cc\
|
||||
BtHaveMessageTest.cc\
|
||||
BtHaveNoneMessageTest.cc\
|
||||
BtInterestedMessageTest.cc\
|
||||
BtKeepAliveMessageTest.cc\
|
||||
BtNotInterestedMessageTest.cc\
|
||||
BtPieceMessageTest.cc\
|
||||
BtPortMessageTest.cc\
|
||||
BtRejectMessageTest.cc\
|
||||
BtRequestMessageTest.cc\
|
||||
BtSuggestPieceMessageTest.cc\
|
||||
BtUnchokeMessageTest.cc\
|
||||
BtHandshakeMessageTest.cc\
|
||||
MockBtMessageDispatcher.h\
|
||||
FixedNumberRandomizer.h\
|
||||
MockBtMessageFactory.h\
|
||||
MockBtMessage.h\
|
||||
ConsoleFileAllocationMonitorTest.cc\
|
||||
ChunkChecksumValidatorTest.cc
|
||||
FileUriListParserTest.cc\
|
||||
StreamUriListParserTest.cc
|
||||
|
||||
# HttpHeaderProcessorTest.cc\
|
||||
# UtilTest.cc\
|
||||
# CookieBoxTest.cc\
|
||||
# RequestTest.cc\
|
||||
# CookieParserTest.cc\
|
||||
# HttpRequestTest.cc\
|
||||
# CookieBoxFactoryTest.cc\
|
||||
# ByteArrayDiskWriterTest.cc\
|
||||
# RequestGroupManTest.cc\
|
||||
# IteratableChecksumValidatorTest.cc\
|
||||
# IteratableChunkChecksumValidatorTest.cc\
|
||||
# PeerTest.cc\
|
||||
# DefaultPeerStorageTest.cc\
|
||||
# RequestFactoryTest.cc\
|
||||
# NetrcAuthResolverTest.cc\
|
||||
# DefaultAuthResolverTest.cc\
|
||||
# OptionHandlerTest.cc\
|
||||
# SegmentManTest.cc\
|
||||
# BitfieldManTest.cc\
|
||||
# GlowFileAllocatorTest.cc\
|
||||
# NetrcTest.cc\
|
||||
# SingletonHolderTest.cc\
|
||||
# HttpHeaderTest.cc\
|
||||
# HttpResponseTest.cc\
|
||||
# SharedHandleTest.cc\
|
||||
# ChunkedEncodingTest.cc\
|
||||
# FileTest.cc\
|
||||
# OptionTest.cc\
|
||||
# Base64Test.cc\
|
||||
# DataTest.cc\
|
||||
# DictionaryTest.cc\
|
||||
# ListTest.cc\
|
||||
# MetaFileUtilTest.cc\
|
||||
# ShaVisitorTest.cc\
|
||||
# PeerMessageUtilTest.cc\
|
||||
# DefaultDiskWriterTest.cc\
|
||||
# MultiDiskAdaptorTest.cc\
|
||||
# Xml2MetalinkProcessorTest.cc\
|
||||
# MetalinkerTest.cc\
|
||||
# MetalinkEntryTest.cc\
|
||||
# FeatureConfigTest.cc\
|
||||
# ShareRatioSeedCriteriaTest.cc\
|
||||
# TimeSeedCriteriaTest.cc\
|
||||
# SpeedCalcTest.cc\
|
||||
# DefaultPeerListProcessorTest.cc\
|
||||
# AnnounceListTest.cc\
|
||||
# TrackerWatcherCommandTest.cc\
|
||||
# DefaultBtContextTest.cc\
|
||||
# DefaultPieceStorageTest.cc\
|
||||
# DefaultBtAnnounceTest.cc\
|
||||
# BtRegistryTest.cc\
|
||||
# DefaultBtMessageDispatcherTest.cc\
|
||||
# MockPeerStorage.h\
|
||||
# DefaultBtRequestFactoryTest.cc\
|
||||
# BtAllowedFastMessageTest.cc\
|
||||
# BtBitfieldMessageTest.cc\
|
||||
# BtCancelMessageTest.cc\
|
||||
# BtChokeMessageTest.cc\
|
||||
# BtHaveAllMessageTest.cc\
|
||||
# BtHaveMessageTest.cc\
|
||||
# BtHaveNoneMessageTest.cc\
|
||||
# BtInterestedMessageTest.cc\
|
||||
# BtKeepAliveMessageTest.cc\
|
||||
# BtNotInterestedMessageTest.cc\
|
||||
# BtPieceMessageTest.cc\
|
||||
# BtPortMessageTest.cc\
|
||||
# BtRejectMessageTest.cc\
|
||||
# BtRequestMessageTest.cc\
|
||||
# BtSuggestPieceMessageTest.cc\
|
||||
# BtUnchokeMessageTest.cc\
|
||||
# BtHandshakeMessageTest.cc\
|
||||
# MockBtMessageDispatcher.h\
|
||||
# FixedNumberRandomizer.h\
|
||||
# MockBtMessageFactory.h\
|
||||
# MockBtMessage.h\
|
||||
# ConsoleFileAllocationMonitorTest.cc\
|
||||
# ChunkChecksumValidatorTest.cc
|
||||
#aria2c_CXXFLAGS = ${CPPUNIT_CFLAGS} -I../src -I../lib -Wall -D_FILE_OFFSET_BITS=64
|
||||
#aria2c_LDFLAGS = ${CPPUNIT_LIBS}
|
||||
aria2c_LDADD = ../src/libaria2c.a\
|
||||
|
@ -412,79 +363,8 @@ distclean-compile:
|
|||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AllTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AnnounceListTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Base64Test.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BitfieldManTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtAllowedFastMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtBitfieldMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtCancelMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtChokeMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtHandshakeMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtHaveAllMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtHaveMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtHaveNoneMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtInterestedMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtKeepAliveMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtNotInterestedMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtPieceMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtPortMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtRegistryTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtRejectMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtRequestMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtSuggestPieceMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BtUnchokeMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ByteArrayDiskWriterTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ChunkChecksumValidatorTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ChunkedEncodingTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConsoleFileAllocationMonitorTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CookieBoxFactoryTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CookieBoxTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CookieParserTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DataTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultAuthResolverTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultBtAnnounceTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultBtContextTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultBtMessageDispatcherTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultBtRequestFactoryTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultDiskWriterTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultPeerListProcessorTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultPeerStorageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DefaultPieceStorageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DictionaryTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FeatureConfigTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GlowFileAllocatorTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HttpHeaderProcessorTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HttpHeaderTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HttpRequestTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HttpResponseTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IteratableChecksumValidatorTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/IteratableChunkChecksumValidatorTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ListTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetaFileUtilTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkEntryTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkerTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiDiskAdaptorTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetrcAuthResolverTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/NetrcTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OptionHandlerTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/OptionTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PeerMessageUtilTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PeerTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RequestFactoryTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RequestGroupManTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RequestTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SegmentManTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ShaVisitorTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ShareRatioSeedCriteriaTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SharedHandleTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SingletonHolderTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SpeedCalcTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TimeSeedCriteriaTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackerWatcherCommandTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UriFileListParserTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UtilTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xml2MetalinkProcessorTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileUriListParserTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StreamUriListParserTest.Po@am__quote@
|
||||
|
||||
.cc.o:
|
||||
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
#include "UriFileListParser.h"
|
||||
#include "Exception.h"
|
||||
#include "Util.h"
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class UriFileListParserTest : public CppUnit::TestFixture {
|
||||
|
||||
CPPUNIT_TEST_SUITE(UriFileListParserTest);
|
||||
CPPUNIT_TEST(testHasNext);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
private:
|
||||
|
||||
public:
|
||||
void setUp() {
|
||||
}
|
||||
|
||||
void testHasNext();
|
||||
};
|
||||
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION( UriFileListParserTest );
|
||||
|
||||
string list2String(const Strings& src)
|
||||
{
|
||||
ostringstream strm;
|
||||
copy(src.begin(), src.end(), ostream_iterator<string>(strm, " "));
|
||||
return Util::trim(strm.str());
|
||||
}
|
||||
|
||||
void UriFileListParserTest::testHasNext()
|
||||
{
|
||||
UriFileListParser flp("filelist1.txt");
|
||||
|
||||
CPPUNIT_ASSERT(flp.hasNext());
|
||||
CPPUNIT_ASSERT_EQUAL(string("http://localhost/index.html http://localhost2/index.html"), list2String(flp.next()));
|
||||
CPPUNIT_ASSERT(flp.hasNext());
|
||||
CPPUNIT_ASSERT_EQUAL(string("ftp://localhost/aria2.tar.bz2"),
|
||||
list2String(flp.next()));
|
||||
CPPUNIT_ASSERT(flp.hasNext());
|
||||
CPPUNIT_ASSERT_EQUAL(string(""),
|
||||
list2String(flp.next()));
|
||||
CPPUNIT_ASSERT(!flp.hasNext());
|
||||
}
|
Loading…
Reference in New Issue