xref: /haiku/src/apps/haikudepot/server/PopulatePkgSizesProcess.h (revision 9a6a20d4689307142a7ed26a1437ba47e244e73f)
1 /*
2  * Copyright 2023, Andrew Lindesay <apl@lindesay.co.nz>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef POPULATE_PKG_SIZES_PROCESS_H
6 #define POPULATE_PKG_SIZES_PROCESS_H
7 
8 #include <String.h>
9 
10 #include "AbstractProcess.h"
11 #include "Model.h"
12 
13 
14 /*!	This service will investigate any packages that do not have a size in the
15 	model. For these packages, it will attempt to derive a size based on the
16 	locally present package file.
17  */
18 
19 class PopulatePkgSizesProcess : public AbstractProcess {
20 public:
21 								PopulatePkgSizesProcess(Model* model);
22 	virtual						~PopulatePkgSizesProcess();
23 
24 	virtual	const char*			Name() const;
25 	virtual	const char*			Description() const;
26 
27 protected:
28 	virtual	status_t			RunInternal();
29 
30 private:
31 			off_t				_DeriveSize(const PackageInfoRef modelInfo) const;
32 
33 private:
34 			Model*				fModel;
35 };
36 
37 
38 #endif // POPULATE_PKG_SIZES_PROCESS_H
39