MockSegment.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 int32_t getLength() const CXX11_OVERRIDE
  26. {
  27. return 0;
  28. }
  29. virtual int32_t getSegmentLength() const CXX11_OVERRIDE
  30. {
  31. return 0;
  32. }
  33. virtual int32_t getWrittenLength() const CXX11_OVERRIDE
  34. {
  35. return 0;
  36. }
  37. virtual void updateWrittenLength(int32_t bytes) CXX11_OVERRIDE {}
  38. #ifdef ENABLE_MESSAGE_DIGEST
  39. // `begin' is a offset inside this segment.
  40. virtual bool updateHash
  41. (int32_t begin, const unsigned char* data, size_t dataLength) CXX11_OVERRIDE
  42. {
  43. return false;
  44. }
  45. virtual bool isHashCalculated() const CXX11_OVERRIDE
  46. {
  47. return false;
  48. }
  49. virtual std::string getDigest() CXX11_OVERRIDE
  50. {
  51. return A2STR::NIL;
  52. }
  53. #endif // ENABLE_MESSAGE_DIGEST
  54. virtual void clear(WrDiskCache* diskCache) CXX11_OVERRIDE {}
  55. virtual std::shared_ptr<Piece> getPiece() const CXX11_OVERRIDE
  56. {
  57. return std::shared_ptr<Piece>(new Piece());
  58. }
  59. };
  60. } // namespace aria2
  61. #endif // D_MOCK_SEGMENT_H