2008-05-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Defined static const std::string IP("ip"), PORT("port") and use 
them
	instead of string literals.
	* src/DefaultPeerListProcessor.cc
	* src/DefaultPeerListProcessor.h
pull/1/head
Tatsuhiro Tsujikawa 2008-05-14 12:15:39 +00:00
parent 9d24736208
commit 1aeefb5c4b
3 changed files with 17 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2008-05-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Defined static const std::string IP("ip"), PORT("port") and use them
instead of string literals.
* src/DefaultPeerListProcessor.cc
* src/DefaultPeerListProcessor.h
2008-05-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> 2008-05-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Made string literals for torrent file processing static const Made string literals for torrent file processing static const

View File

@ -40,6 +40,10 @@
namespace aria2 { namespace aria2 {
const std::string DefaultPeerListProcessor::IP("ip");
const std::string DefaultPeerListProcessor::PORT("port");
DefaultPeerListProcessor::DefaultPeerListProcessor() {} DefaultPeerListProcessor::DefaultPeerListProcessor() {}
DefaultPeerListProcessor::~DefaultPeerListProcessor() {} DefaultPeerListProcessor::~DefaultPeerListProcessor() {}
@ -63,8 +67,8 @@ void DefaultPeerListProcessor::extractPeer
if(!peerDic) { if(!peerDic) {
break; break;
} }
const Data* ip = dynamic_cast<const Data*>(peerDic->get("ip")); const Data* ip = dynamic_cast<const Data*>(peerDic->get(IP));
const Data* port = dynamic_cast<const Data*>(peerDic->get("port")); const Data* port = dynamic_cast<const Data*>(peerDic->get(PORT));
if(!ip || !port || !port->isNumber()) { if(!ip || !port || !port->isNumber()) {
continue; continue;
} }

View File

@ -40,6 +40,10 @@
namespace aria2 { namespace aria2 {
class DefaultPeerListProcessor : public PeerListProcessor { class DefaultPeerListProcessor : public PeerListProcessor {
private:
static const std::string IP;
static const std::string PORT;
public: public:
DefaultPeerListProcessor(); DefaultPeerListProcessor();