MockSegment.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef D_MOCK_SEGMENT_H
  2. #define D_MOCK_SEGMENT_H
  3. #include "Segment.h"
  4. #include "Piece.h"
  5. #include "A2STR.h"
  6. namespace aria2 {
  7. class MockSegment : public Segment {
  8. public:
  9. virtual bool complete() const CXX11_OVERRIDE { return false; }
  10. virtual size_t getIndex() const CXX11_OVERRIDE { return 0; }
  11. virtual int64_t getPosition() const CXX11_OVERRIDE { return 0; }
  12. virtual int64_t getPositionToWrite() const CXX11_OVERRIDE { return 0; }
  13. virtual int64_t getLength() const CXX11_OVERRIDE { return 0; }
  14. virtual int64_t getSegmentLength() const CXX11_OVERRIDE { return 0; }
  15. virtual int64_t getWrittenLength() const CXX11_OVERRIDE { return 0; }
  16. virtual void updateWrittenLength(int64_t bytes) CXX11_OVERRIDE {}
  17. // `begin' is a offset inside this segment.
  18. virtual bool updateHash(int64_t begin, const unsigned char* data,
  19. size_t dataLength) CXX11_OVERRIDE
  20. {
  21. return false;
  22. }
  23. virtual bool isHashCalculated() const CXX11_OVERRIDE { return false; }
  24. virtual std::string getDigest() CXX11_OVERRIDE { return A2STR::NIL; }
  25. virtual void clear(WrDiskCache* diskCache) CXX11_OVERRIDE {}
  26. virtual std::shared_ptr<Piece> getPiece() const CXX11_OVERRIDE
  27. {
  28. return std::shared_ptr<Piece>(new Piece());
  29. }
  30. };
  31. } // namespace aria2
  32. #endif // D_MOCK_SEGMENT_H