Important: The information in this document is obsolete and should not be used for new development.
PostDownloadRequest
Requests the download of data referenced by Cyberdog item to disk and registers a completion notification function.
CDDownloadRequestID PostDownloadRequest (in CyberItem item, in FSSpecPtr destSpec, in ODBoolean decomp, in DownloadCompletionUPP completionProc, in Ptr completionProcData);
item
- The
CyberItem
object that specifies the data to be downloaded to disk.destSpec
- A pointer to a file specification that specifies the file in which to save the data.
decomp
kODTrue
if the download part should attempt to decompress the downloaded data before saving it to the file; otherwise,kODFalse
.completionProc
- A pointer to a programmer-defined function that Cyberdog calls when the data has been downloaded to disk.
completionProcData
- A pointer to data that is passed to the callback function specified by
completionProc
.- return value
- An ID that uniquely identifies the download request.
DISCUSSION
This method adds a Cyberdog item to this download part's queue. Ifnil
is specified for thedestSpec
parameter, the download part decides where to save the data. To cancel a download request, you call theCancelRequest
method, passing the ID returned by this method.This method is similar to
DownloadCyberItem
except that it allows you to control whether the downloaded data is decompressed and to specify a callback function called by Cyberdog when the download operation is complete. The data pointed to by thecompletionProc
parameter is passed to the callback function.The following type is used for download completion functions. The callback function takes five parameters: an environment parameter, a pointer to a Cyberdog item, an event code that describes the results of the download, a pointer to a file specification, and a pointer to some data.
The
typedef void (* DownloadCompletionProcPtr) (
Environment* ev,
CyberItem* item,
CDDownloadEvent eventCode,
FSSpec* destFile,
Ptr userDataPtr);MyDownloadCompleted
programmer-defined function (page 191) illusrates the form of a download completion function.If you subclass
CyberDownloadExtension
, you must override this method. Your override must not call its inherited method; that is, your override method must implement this method's functionality completely.SEE ALSO
TheDownloadCyberItem
method (page 214).