isHostname (false),
length (0),
bytesRead (0),
+ bytesToRead (0),
connection (NULL)
{
}
void Chunk::setEndByte (size_t endByte)
{
this->endByte = endByte;
+ if (endByte > startByte)
+ bytesToRead = endByte - startByte;
}
void Chunk::setStartByte (size_t startByte)
{
this->startByte = startByte;
+ if (endByte > startByte)
+ bytesToRead = endByte - startByte;
}
void Chunk::setUrl (const std::string& url )
{
{
this->bytesRead = bytes;
}
+
+void Chunk::setBytesToRead (uint64_t bytes)
+{
+ bytesToRead = bytes;
+}
+
uint64_t Chunk::getBytesToRead () const
{
- return this->length - this->bytesRead;
+ return length - bytesRead;
}
+
size_t Chunk::getPercentDownloaded () const
{
return (size_t)(((float)this->bytesRead / this->length) * 100);
void setConnection (IHTTPConnection *connection);
void setBytesRead (uint64_t bytes);
+ void setBytesToRead (uint64_t bytes);
void setLength (uint64_t length);
void setEndByte (size_t endByte);
void setStartByte (size_t startByte);
bool isHostname;
uint64_t length;
uint64_t bytesRead;
+ uint64_t bytesToRead;
IHTTPConnection *connection;
};
}