summaryrefslogtreecommitdiff
path: root/src/Range.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-11-14 07:17:55 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-11-14 07:17:55 +0000
commit1372ac51ade17bc27126449bf29f99c6c2cf7703 (patch)
tree974a54b86b20555c8822f651c7b3a53c0a072df3 /src/Range.h
parent93e5dbed325f29c1bf867a2847d3b839d545cfb2 (diff)
2010-11-14 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added .cc file for classes/structs that only provided by header file. Defined non-POD classes' ctor, dtor in .cc file. Moved implementation code in header file to .cc file for major classes/strucsts.
Diffstat (limited to 'src/Range.h')
-rw-r--r--src/Range.h35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/Range.h b/src/Range.h
index c3ed4b61..c43b99b2 100644
--- a/src/Range.h
+++ b/src/Range.h
@@ -36,6 +36,9 @@
#define D_RANGE_H
#include "common.h"
+
+#include <unistd.h>
+
#include "SharedHandle.h"
namespace aria2 {
@@ -46,22 +49,19 @@ private:
off_t endByte_;
uint64_t entityLength_;
public:
- Range():startByte_(0), endByte_(0), entityLength_(0) {}
+ Range();
- Range(off_t startByte, off_t endByte, uint64_t entityLength):
- startByte_(startByte), endByte_(endByte), entityLength_(entityLength) {}
+ Range(off_t startByte, off_t endByte, uint64_t entityLength);
- bool operator==(const Range& range) const
- {
- return startByte_ == range.startByte_ &&
- endByte_ == range.endByte_ &&
- entityLength_ == range.entityLength_;
- }
+ Range(const Range& c);
- bool operator!=(const Range& range) const
- {
- return !(*this == range);
- }
+ ~Range();
+
+ Range& operator=(const Range& c);
+
+ bool operator==(const Range& range) const;
+
+ bool operator!=(const Range& range) const;
off_t getStartByte() const
{
@@ -78,14 +78,7 @@ public:
return entityLength_;
}
- uint64_t getContentLength() const
- {
- if(endByte_ >= startByte_) {
- return endByte_-startByte_+1;
- } else {
- return 0;
- }
- }
+ uint64_t getContentLength() const;
};
typedef SharedHandle<Range> RangeHandle;