xref: /haiku/src/apps/haikudepot/server/LocalPkgDataLoadProcess.h (revision dd2a1e350b303b855a50fd64e6cb55618be1ae6a)
1 /*
2  * Copyright 2018-2022, Andrew Lindesay <apl@lindesay.co.nz>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef LOCAL_PKG_DATA_LOAD_PROCESS__H
6 #define LOCAL_PKG_DATA_LOAD_PROCESS__H
7 
8 
9 #include "AbstractProcess.h"
10 
11 #include "Model.h"
12 #include "PackageInfo.h"
13 
14 #include <File.h>
15 #include <Path.h>
16 #include <String.h>
17 #include <Url.h>
18 
19 #include <package/RepositoryCache.h>
20 
21 
22 class PkgDataLoadState;
23 
24 
25 /*! This process will take the data from the locally stored repositories (HPKR)
26     and will extract the packages.  The packages are then loaded into the
27     HaikuDepot 'Model'.
28 */
29 
30 class LocalPkgDataLoadProcess : public AbstractProcess {
31 public:
32 								LocalPkgDataLoadProcess(
33 									PackageInfoListenerRef packageInfoListener,
34 									Model *model, bool force = false);
35 	virtual						~LocalPkgDataLoadProcess();
36 
37 			const char*			Name() const;
38 			const char*			Description() const;
39 
40 protected:
41 	virtual status_t			RunInternal();
42 
43 private:
44 			void				_NotifyError(const BString& messageText) const;
45 			off_t				_DeriveSize(const PackageInfoRef modelInfo) const;
46 
47 private:
48 			Model*				fModel;
49 			bool				fForce;
50 			PackageInfoListenerRef
51 								fPackageInfoListener;
52 };
53 
54 #endif // LOCAL_PKG_DATA_LOAD_PROCESS__H
55