TrackerRequest.cpp

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 2006-2007 by Peter Dimov.
00004 
00005 This file is part of Calitko (http://www.calitko.org).
00006 
00007 Calitko is free software; you can redistribute it and/or modify
00008 it under the terms of the GNU General Public License as published by
00009 the Free Software Foundation; either version 2 of the License, or
00010 (at your option) any later version.
00011 
00012 Calitko is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Calitko; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 
00021 */
00022 
00023 #include "Qt.h"
00024 #include "TrackerRequest.h"
00025 #include "Imports.cpp"
00026 
00028 
00045 TrackerRequest::TrackerRequest (const Uri &announceUrl,
00046                                 const PeerInfo &peerInfo,
00047                                 const Torrent::InfoHash &infoHash,
00048                                 quint64 uploaded,
00049                                 quint64 downloaded,
00050                                 quint64 left,
00051                                 bool compact,
00052                                 Event event,
00053                                 uint numWant,
00054                                 QByteArray key,
00055                                 QByteArray trackerId)
00056     : d (new PrivateData())
00057 {
00058     Q_ASSERT (!announceUrl.scheme().isEmpty());
00059     Q_ASSERT (!announceUrl.authority().isEmpty());
00060 
00061     d->announceUrl = announceUrl;
00062     d->peerInfo = peerInfo;
00063     d->infoHash = infoHash;
00064     d->uploaded = uploaded;
00065     d->downloaded = downloaded;
00066     d->left = left;
00067     d->compact = compact;
00068     d->event = event;
00069     d->numWant = numWant;
00070     d->key = key;
00071     d->trackerId = trackerId;
00072 }
00073 
00075 
00078 TrackerRequest::~TrackerRequest()
00079 {
00080 }
00081 
00083 
00088 TrackerRequest::TrackerRequest (const TrackerRequest &other)
00089     : d (other.d)
00090 {
00091 }
00092 
00094 
00098 TrackerRequest & TrackerRequest::operator= (const TrackerRequest &other)
00099 {
00100     d = other.d;
00101     return *this;
00102 }
00103 
00105 
00109 bool TrackerRequest::operator== (const TrackerRequest &other) const
00110 {
00111     return (d->announceUrl == other.d->announceUrl) &&
00112            (d->peerInfo == other.d->peerInfo) &&
00113            (d->infoHash == other.d->infoHash) &&
00114            (d->uploaded == other.d->uploaded) &&
00115            (d->downloaded == other.d->downloaded) &&
00116            (d->left == other.d->left) &&
00117            (d->compact == other.d->compact) &&
00118            (d->event == other.d->event) &&
00119            (d->numWant == other.d->numWant) &&
00120            (d->key == other.d->key) &&
00121            (d->trackerId == other.d->trackerId);
00122 }
00123 
00125 
00129 bool TrackerRequest::operator!= (const TrackerRequest &other) const
00130 {
00131     return !(*this == other);
00132 }