MockSegment.h 1.2 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
  10. {
  11. return false;
  12. }
  13. virtual size_t getIndex() const
  14. {
  15. return 0;
  16. }
  17. virtual int64_t getPosition() const
  18. {
  19. return 0;
  20. }
  21. virtual int64_t getPositionToWrite() const
  22. {
  23. return 0;
  24. }
  25. virtual int32_t getLength() const
  26. {
  27. return 0;
  28. }
  29. virtual int32_t getSegmentLength() const
  30. {
  31. return 0;
  32. }
  33. virtual int32_t getWrittenLength() const
  34. {
  35. return 0;
  36. }
  37. virtual void updateWrittenLength(int32_t bytes) {}
  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)
  42. {
  43. return false;
  44. }
  45. virtual bool isHashCalculated() const
  46. {
  47. return false;
  48. }
  49. virtual std::string getDigest()
  50. {
  51. return A2STR::NIL;
  52. }
  53. #endif // ENABLE_MESSAGE_DIGEST
  54. virtual void clear() {}
  55. virtual SharedHandle<Piece> getPiece() const
  56. {
  57. return SharedHandle<Piece>();
  58. }
  59. };
  60. } // namespace aria2
  61. #endif // D_MOCK_SEGMENT_H