mirror of
https://review.haiku-os.org/haiku
synced 2025-01-31 10:47:14 +01:00
76 lines
1.7 KiB
C
76 lines
1.7 KiB
C
|
/*
|
||
|
* Copyright (c) 2007, Haiku, Inc.
|
||
|
* Distributed under the terms of the MIT license.
|
||
|
*
|
||
|
* Author:
|
||
|
* Łukasz 'Sil2100' Zemczak <sil2100@vexillium.org>
|
||
|
*/
|
||
|
#ifndef INSTALLEDPACKAGEINFO_H
|
||
|
#define INSTALLEDPACKAGEINFO_H
|
||
|
|
||
|
#include <File.h>
|
||
|
#include <String.h>
|
||
|
#include <List.h>
|
||
|
#include <Path.h>
|
||
|
|
||
|
|
||
|
#define P_BUSY_TRIES 10
|
||
|
|
||
|
enum {
|
||
|
P_PACKAGE_INFO = 'ppki'
|
||
|
};
|
||
|
|
||
|
extern const char * kPackagesDir;
|
||
|
|
||
|
|
||
|
// Useful function for fetching the package name and version without parsing all
|
||
|
// other data
|
||
|
const char * info_get_package_name(const char *filename);
|
||
|
const char * info_get_package_version(const char *filename);
|
||
|
|
||
|
|
||
|
class InstalledPackageInfo {
|
||
|
public:
|
||
|
InstalledPackageInfo();
|
||
|
InstalledPackageInfo(const char *packageName, const char *version = NULL,
|
||
|
bool create = false);
|
||
|
~InstalledPackageInfo();
|
||
|
|
||
|
status_t InitCheck();
|
||
|
status_t SetTo(const char *packageName, const char *version = NULL,
|
||
|
bool create = false);
|
||
|
|
||
|
void SetName(const char *name) { fName = name; }
|
||
|
const char *GetName() { return fName.String(); }
|
||
|
void SetDescription(const char *description) { fDescription = description; }
|
||
|
const char *GetDescription() { return fDescription.String(); }
|
||
|
//void SetVersion(const char *version) { fVersion = version; }
|
||
|
const char *GetVersion() { return fVersion.String(); }
|
||
|
void SetSpaceNeeded(uint64 size) { fSpaceNeeded = size; }
|
||
|
uint64 GetSpaceNeeded() { return fSpaceNeeded; }
|
||
|
|
||
|
status_t AddItem(const char *itemName);
|
||
|
|
||
|
status_t Uninstall();
|
||
|
status_t Save();
|
||
|
|
||
|
private:
|
||
|
void _ClearItemList();
|
||
|
|
||
|
status_t fStatus;
|
||
|
bool fIsUpToDate;
|
||
|
bool fCreate;
|
||
|
|
||
|
BString fName;
|
||
|
BString fDescription;
|
||
|
BString fVersion;
|
||
|
uint64 fSpaceNeeded;
|
||
|
BList fInstalledItems;
|
||
|
|
||
|
BPath fPathToInfo;
|
||
|
};
|
||
|
|
||
|
|
||
|
#endif
|
||
|
|