BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / apps / packageinstaller / InstalledPackageInfo.h
blob22819c3d1a9dd3ba7f602bb60eff2d9a0e2a04a0
1 /*
2 * Copyright (c) 2007, Haiku, Inc.
3 * Distributed under the terms of the MIT license.
5 * Author:
6 * Ɓukasz 'Sil2100' Zemczak <sil2100@vexillium.org>
7 */
8 #ifndef INSTALLED_PACKAGE_INFO_H
9 #define INSTALLED_PACKAGE_INFO_H
11 #include <File.h>
12 #include <String.h>
13 #include <List.h>
14 #include <Path.h>
17 #define P_BUSY_TRIES 10
19 enum {
20 P_PACKAGE_INFO = 'ppki'
23 extern const char * kPackagesDir;
26 // Useful function for fetching the package name and version without parsing all
27 // other data
28 status_t info_get_package_name(const char* filename, BString& name);
29 status_t info_get_package_version(const char* filename, BString& name);
32 class InstalledPackageInfo {
33 public:
34 InstalledPackageInfo();
35 InstalledPackageInfo(const char* packageName,
36 const char* version = NULL,
37 bool create = false);
38 ~InstalledPackageInfo();
40 status_t InitCheck();
41 status_t SetTo(const char* packageName,
42 const char* version = NULL,
43 bool create = false);
45 void SetName(const char* name)
46 { fName = name; }
47 const char* Name()
48 { return fName.String(); }
49 void SetDescription(const char* description)
50 { fDescription = description; }
51 const char* Description()
52 { return fDescription.String(); }
53 const char* Version()
54 { return fVersion.String(); }
55 void SetSpaceNeeded(uint64 size)
56 { fSpaceNeeded = size; }
57 uint64 SpaceNeeded()
58 { return fSpaceNeeded; }
60 status_t AddItem(const char* itemName);
62 status_t Uninstall();
63 status_t Save();
65 private:
66 void _ClearItemList();
68 private:
69 status_t fStatus;
70 bool fIsUpToDate;
71 bool fCreate;
73 BString fName;
74 BString fDescription;
75 BString fVersion;
76 uint64 fSpaceNeeded;
77 BList fInstalledItems;
79 BPath fPathToInfo;
83 #endif // INSTALLED_PACKAGE_INFO_H