ASIProgressDelegate.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // ASIProgressDelegate.h
  3. // Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
  4. //
  5. // Created by Ben Copsey on 13/04/2010.
  6. // Copyright 2010 All-Seeing Interactive. All rights reserved.
  7. //
  8. @class ASIHTTPRequest;
  9. @protocol ASIProgressDelegate <NSObject>
  10. @optional
  11. // These methods are used to update UIProgressViews (iPhone OS) or NSProgressIndicators (Mac OS X)
  12. // If you are using a custom progress delegate, you may find it easier to implement didReceiveBytes / didSendBytes instead
  13. #if TARGET_OS_IPHONE
  14. - (void)setProgress:(float)newProgress;
  15. #else
  16. - (void)setDoubleValue:(double)newProgress;
  17. - (void)setMaxValue:(double)newMax;
  18. #endif
  19. // Called when the request receives some data - bytes is the length of that data
  20. - (void)request:(ASIHTTPRequest *)request didReceiveBytes:(long long)bytes;
  21. // Called when the request sends some data
  22. // The first 32KB (128KB on older platforms) of data sent is not included in this amount because of limitations with the CFNetwork API
  23. // bytes may be less than zero if a request needs to remove upload progress (probably because the request needs to run again)
  24. - (void)request:(ASIHTTPRequest *)request didSendBytes:(long long)bytes;
  25. // Called when a request needs to change the length of the content to download
  26. - (void)request:(ASIHTTPRequest *)request incrementDownloadSizeBy:(long long)newLength;
  27. // Called when a request needs to change the length of the content to upload
  28. // newLength may be less than zero when a request needs to remove the size of the internal buffer from progress tracking
  29. - (void)request:(ASIHTTPRequest *)request incrementUploadSizeBy:(long long)newLength;
  30. @end