MockSegment.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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
  10. {
  11. return false;
  12. }
  13. virtual size_t getIndex() const CXX11_OVERRIDE
  14. {
  15. return 0;
  16. }
  17. virtual int64_t getPosition() const CXX11_OVERRIDE
  18. {
  19. return 0;
  20. }
  21. virtual int64_t getPositionToWrite() const CXX11_OVERRIDE
  22. {
  23. return 0;
  24. }
  25. virtual int64_t getLength() const CXX11_OVERRIDE
  26. {
  27. return 0;
  28. }
  29. virtual int64_t getSegmentLength() const CXX11_OVERRIDE
  30. {
  31. return 0;
  32. }
  33. virtual int64_t getWrittenLength() const CXX11_OVERRIDE
  34. {
  35. return 0;
  36. }
  37. virtual void updateWrittenLength(int64_t bytes) CXX11_OVERRIDE {}
  38. // `begin' is a offset inside this segment.
  39. virtual bool updateHash
  40. (int64_t begin, const unsigned char* data, size_t dataLength) CXX11_OVERRIDE
  41. {
  42. return false;
  43. }
  44. virtual bool isHashCalculated() const CXX11_OVERRIDE
  45. {
  46. return false;
  47. }
  48. virtual std::string getDigest() CXX11_OVERRIDE
  49. {
  50. return A2STR::NIL;
  51. }
  52. virtual void clear(WrDiskCache* diskCache) CXX11_OVERRIDE {}
  53. virtual std::shared_ptr<Piece> getPiece() const CXX11_OVERRIDE
  54. {
  55. return std::shared_ptr<Piece>(new Piece());
  56. }
  57. };
  58. } // namespace aria2
  59. #endif // D_MOCK_SEGMENT_H