Skip to content

Commit

Permalink
2008-02-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Browse files Browse the repository at this point in the history
	Removed "using namespace std;" from all sources. Appended std:: 
prefix to c++
	standard classes.
	Included string.h where mem* function are used.
  • Loading branch information
tatsuhiro-t committed Feb 8, 2008
1 parent d82e183 commit 1b7c198
Show file tree
Hide file tree
Showing 801 changed files with 12,032 additions and 8,635 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2008-02-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Removed "using namespace std;" from all sources. Appended std:: prefix to c++
standard classes.
Included string.h where mem* function are used.

2008-02-06 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Create directory before saving DHT routing table.
Expand Down
44 changes: 25 additions & 19 deletions src/Directory.h → src/AbstractAuthResolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,35 @@
* files in the program, then also delete it here.
*/
/* copyright --> */
#ifndef _D_DIRECTORY_H_
#define _D_DIRECTORY_H_
#include "AbstractAuthResolver.h"
#include "AuthConfig.h"

#include "common.h"
#include <string>
#include <deque>
namespace aria2 {

class Directory {
AbstractAuthResolver::AbstractAuthResolver():
_userDefinedAuthConfig(0),
_defaultAuthConfig(new AuthConfig()) {}

typedef deque<Directory*> Files;
AbstractAuthResolver::~AbstractAuthResolver() {}

private:
string name;
Files files;
public:
Directory(const string& name);
Directory();
~Directory();
void AbstractAuthResolver::setUserDefinedAuthConfig(const AuthConfigHandle& authConfig)
{
_userDefinedAuthConfig = authConfig;
}

void createDir(const string& parentDir, bool recursive) const;
void addFile(Directory* directory);
};
AuthConfigHandle AbstractAuthResolver::getUserDefinedAuthConfig() const
{
return _userDefinedAuthConfig;
}

typedef SharedHandle<Directory> DirectoryHandle;
void AbstractAuthResolver::setDefaultAuthConfig(const AuthConfigHandle& authConfig)
{
_defaultAuthConfig = authConfig;
}

#endif // _D_DIRECTORY_H_
AuthConfigHandle AbstractAuthResolver::getDefaultAuthConfig() const
{
return _defaultAuthConfig;
}

} // namespace aria2
35 changes: 12 additions & 23 deletions src/AbstractAuthResolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,42 +37,31 @@

#include "AuthResolver.h"

namespace aria2 {

class AbstractAuthResolver : public AuthResolver {
protected:

AuthConfigHandle _userDefinedAuthConfig;
SharedHandle<AuthConfig> _userDefinedAuthConfig;

AuthConfigHandle _defaultAuthConfig;
SharedHandle<AuthConfig> _defaultAuthConfig;

public:
AbstractAuthResolver():_userDefinedAuthConfig(0),
_defaultAuthConfig(new AuthConfig())
{}

virtual ~AbstractAuthResolver() {}
AbstractAuthResolver();

void setUserDefinedAuthConfig(const AuthConfigHandle& authConfig)
{
_userDefinedAuthConfig = authConfig;
}
virtual ~AbstractAuthResolver();

AuthConfigHandle getUserDefinedAuthConfig() const
{
return _userDefinedAuthConfig;
}
void setUserDefinedAuthConfig(const SharedHandle<AuthConfig>& authConfig);

void setDefaultAuthConfig(const AuthConfigHandle& authConfig)
{
_defaultAuthConfig = authConfig;
}
SharedHandle<AuthConfig> getUserDefinedAuthConfig() const;

AuthConfigHandle getDefaultAuthConfig() const
{
return _defaultAuthConfig;
}
void setDefaultAuthConfig(const SharedHandle<AuthConfig>& authConfig);

SharedHandle<AuthConfig> getDefaultAuthConfig() const;
};

typedef SharedHandle<AbstractAuthResolver> AbstractAuthResolverHandle;

} // namespace aria2

#endif // _D_ABSTRACT_AUTH_RESOLVER_H_
10 changes: 7 additions & 3 deletions src/AbstractBtEventListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,23 @@

#include "BtEventListener.h"

namespace aria2 {

class AbstractBtEventListener : public BtEventListener {
public:
virtual ~AbstractBtEventListener() {}

virtual bool canHandle(const BtEventHandle& event) = 0;
virtual bool canHandle(const SharedHandle<BtEvent>& event) = 0;

virtual void handleEventInternal(const BtEventHandle& event) = 0;
virtual void handleEventInternal(const SharedHandle<BtEvent>& event) = 0;

virtual void handleEvent(const BtEventHandle& event) {
virtual void handleEvent(const SharedHandle<BtEvent>& event) {
if(canHandle(event)) {
handleEventInternal(event);
}
}
};

} // namespace aria2

#endif // _D_ABSTRACT_BT_EVENT_LISTENER_H_
134 changes: 134 additions & 0 deletions src/AbstractBtMessage.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/* <!-- 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 --> */
#include "AbstractBtMessage.h"
#include "Peer.h"
#include "BtContext.h"
#include "PieceStorage.h"
#include "BtRegistry.h"
#include "BtEventListener.h"
#include "BtMessageValidator.h"
#include "LogFactory.h"
#include "Logger.h"

namespace aria2 {

AbstractBtMessage::AbstractBtMessage():sendingInProgress(false),
invalidate(false),
uploading(false),
cuid(0),
btContext(0),
pieceStorage(0),
peer(0),
validator(0),
logger(LogFactory::getInstance())
{}

AbstractBtMessage::~AbstractBtMessage() {}

SharedHandle<Peer> AbstractBtMessage::getPeer() const
{
return peer;
}

void AbstractBtMessage::setPeer(const SharedHandle<Peer>& peer)
{
this->peer = peer;
}

bool AbstractBtMessage::validate(std::deque<std::string>& errors)
{
if(validator.get()) {
return validator->validate(errors);
} else {
return true;
}
}

void AbstractBtMessage::handleEvent(const SharedHandle<BtEvent>& event)
{
for(std::deque<SharedHandle<BtEventListener> >::iterator itr = listeners.begin();
itr != listeners.end(); ++itr) {
(*itr)->handleEvent(event);
}
}

void
AbstractBtMessage::addEventListener(const SharedHandle<BtEventListener>& listener)
{
listeners.push_back(listener);
}

void
AbstractBtMessage::setBtMessageValidator(const SharedHandle<BtMessageValidator>& validator) {
this->validator = validator;
}

SharedHandle<BtMessageValidator> AbstractBtMessage::getBtMessageValidator() const
{
return validator;
}

void AbstractBtMessage::setBtContext(const SharedHandle<BtContext>& btContext)
{
this->btContext = btContext;
this->pieceStorage = PIECE_STORAGE(btContext);
}

SharedHandle<BtContext> AbstractBtMessage::getBtContext() const
{
return btContext;
}

void AbstractBtMessage::setBtMessageDispatcher(const WeakHandle<BtMessageDispatcher>& dispatcher)
{
this->dispatcher = dispatcher;
}

void AbstractBtMessage::setPeerConnection(const WeakHandle<PeerConnection>& peerConnection)
{
this->peerConnection = peerConnection;
}

void AbstractBtMessage::setBtMessageFactory(const WeakHandle<BtMessageFactory>& factory)
{
this->messageFactory = factory;
}

void AbstractBtMessage::setBtRequestFactory(const WeakHandle<BtRequestFactory>& factory)
{
this->requestFactory = factory;
}

} // namespace aria2
Loading

0 comments on commit 1b7c198

Please sign in to comment.