xref: /haiku/src/apps/packageinstaller/PackageInfo.h (revision b671e9bbdbd10268a042b4f4cc4317ccd03d105e)
1 /*
2  * Copyright (c) 2007, Haiku, Inc.
3  * Distributed under the terms of the MIT license.
4  *
5  * Author:
6  *		Łukasz 'Sil2100' Zemczak <sil2100@vexillium.org>
7  */
8 #ifndef PACKAGEINFO_H
9 #define PACKAGEINFO_H
10 
11 #include "PackageItem.h"
12 #include <List.h>
13 #include <String.h>
14 #include <File.h>
15 #include <DataIO.h>
16 #include <Path.h>
17 
18 
19 struct pkg_profile;
20 
21 
22 class PackageInfo {
23 	public:
24 		PackageInfo();
25 		PackageInfo(const entry_ref *ref);
26 		~PackageInfo();
27 
28 		const char *GetName() { return fName.String(); }
29 		const char *GetDescription() { return fDescription.String(); }
30 		const char *GetShortDescription() { return fShortDesc.String(); }
31 		const char *GetVersion() { return fVersion.String(); }
32 		const char *GetDisclaimer() { return fDisclaimer.String(); }
33 		BMallocIO *GetSplashScreen() { return fHasImage ? &fImage : NULL; }
34 		int32 GetProfileCount() { return fProfiles.CountItems(); }
35 		pkg_profile *GetProfile(int32 num) { return static_cast<pkg_profile *>(fProfiles.ItemAt(num)); }
36 
37 		status_t Parse();
38 		status_t InitCheck() { return fStatus; }
39 
40 	private:
41 		void _AddItem(PackageItem *item, uint64 size, uint32 groups,
42 			uint32 path, uint32 cust);
43 
44 		status_t fStatus;
45 
46 		BFile *fPackageFile;
47 		BString fName;
48 		BString fDescription;
49 		BList fProfiles;
50 
51 		BString fShortDesc;
52 		BString fDeveloper;
53 		BString fVersion;
54 		BString fDisclaimer;
55 		BMallocIO fImage;
56 		bool fHasImage;
57 
58 		BList fFiles; // Holds all files in the package
59 };
60 
61 
62 // #pragma mark -
63 
64 
65 struct pkg_profile {
66 	pkg_profile() : items(10), space_needed(0), path_type(P_SYSTEM_PATH) {}
67 	~pkg_profile() {}
68 
69 	BString name;
70 	BString description;
71 	BList items;
72 	uint64 space_needed;
73 
74 	uint8 path_type;
75 };
76 
77 #endif
78 
79