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 using BPrivate::JobQueue; 22 23 24 class BRequest : protected BJobStateListener { 25 public: 26 BRequest(const BContext& context); 27 virtual ~BRequest(); 28 29 status_t InitCheck() const; 30 31 virtual status_t CreateInitialJobs() = 0; 32 33 BJob* PopRunnableJob(); 34 35 status_t Process(bool failIfCanceledOnly = false); 36 37 protected: 38 status_t QueueJob(BJob* job); 39 40 const BContext& fContext; 41 42 protected: 43 status_t fInitStatus; 44 JobQueue* fJobQueue; 45 }; 46 47 48 } // namespace BPackageKit 49 50 51 #endif // _PACKAGE__REQUEST_H_ 52