1 /* 2 * Copyright 2011, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _PACKAGE__REQUEST_H_ 6 #define _PACKAGE__REQUEST_H_ 7 8 9 #include <SupportDefs.h> 10 11 #include <package/Job.h> 12 13 14 namespace BPackageKit { 15 16 17 class BContext; 18 namespace BPrivate { 19 class JobQueue; 20 } 21 22 23 class BRequest : protected BJobStateListener { 24 public: 25 BRequest(const BContext& context); 26 virtual ~BRequest(); 27 28 status_t InitCheck() const; 29 30 virtual status_t CreateInitialJobs() = 0; 31 32 BJob* PopRunnableJob(); 33 34 status_t Process(bool failIfCanceledOnly = false); 35 36 protected: 37 status_t QueueJob(BJob* job); 38 39 const BContext& fContext; 40 41 protected: 42 status_t fInitStatus; 43 BPrivate::JobQueue* fJobQueue; 44 }; 45 46 47 } // namespace BPackageKit 48 49 50 #endif // _PACKAGE__REQUEST_H_ 51