2011-01-21 22:18:58 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2011, Haiku, Inc.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2011-01-25 17:07:27 +00:00
|
|
|
#ifndef _PACKAGE__REPOSITORY_CONFIG_H_
|
|
|
|
#define _PACKAGE__REPOSITORY_CONFIG_H_
|
2011-01-21 22:18:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
#include <Archivable.h>
|
2011-01-24 20:48:03 +00:00
|
|
|
#include <Entry.h>
|
2011-01-21 22:18:58 +00:00
|
|
|
#include <String.h>
|
|
|
|
|
|
|
|
|
|
|
|
class BEntry;
|
|
|
|
|
|
|
|
|
2011-01-25 17:07:27 +00:00
|
|
|
namespace BPackageKit {
|
2011-01-21 22:18:58 +00:00
|
|
|
|
|
|
|
|
2011-01-25 17:07:27 +00:00
|
|
|
class BRepositoryConfig : public BArchivable {
|
2011-01-21 22:18:58 +00:00
|
|
|
typedef BArchivable inherited;
|
|
|
|
|
|
|
|
public:
|
2011-01-25 17:07:27 +00:00
|
|
|
BRepositoryConfig();
|
|
|
|
BRepositoryConfig(const BString& name,
|
2011-01-21 22:18:58 +00:00
|
|
|
const BString& url,
|
|
|
|
uint8 priority = kDefaultPriority);
|
2011-01-25 17:07:27 +00:00
|
|
|
BRepositoryConfig(const BEntry& entry);
|
|
|
|
BRepositoryConfig(BMessage* data);
|
|
|
|
virtual ~BRepositoryConfig();
|
2011-01-21 22:18:58 +00:00
|
|
|
|
|
|
|
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
|
|
|
|
|
|
|
status_t StoreAsConfigFile(const BEntry& entry) const;
|
|
|
|
|
2011-01-24 20:48:03 +00:00
|
|
|
status_t SetTo(const BEntry& entry);
|
|
|
|
status_t SetTo(const BMessage* data);
|
2011-01-21 22:18:58 +00:00
|
|
|
status_t InitCheck() const;
|
|
|
|
|
|
|
|
const BString& Name() const;
|
|
|
|
const BString& URL() const;
|
|
|
|
uint8 Priority() const;
|
|
|
|
bool IsUserSpecific() const;
|
|
|
|
|
2011-01-24 20:48:03 +00:00
|
|
|
const BEntry& Entry() const;
|
|
|
|
|
2011-01-21 22:18:58 +00:00
|
|
|
void SetName(const BString& name);
|
|
|
|
void SetURL(const BString& url);
|
|
|
|
void SetPriority(uint8 priority);
|
|
|
|
void SetIsUserSpecific(bool isUserSpecific);
|
|
|
|
|
|
|
|
public:
|
2011-01-25 17:07:27 +00:00
|
|
|
static BRepositoryConfig* Instantiate(BMessage* data);
|
2011-01-21 22:18:58 +00:00
|
|
|
|
2011-01-24 20:48:03 +00:00
|
|
|
static const uint8 kDefaultPriority;
|
2011-01-21 22:18:58 +00:00
|
|
|
static const char* kNameField;
|
|
|
|
static const char* kURLField;
|
|
|
|
static const char* kPriorityField;
|
|
|
|
|
|
|
|
private:
|
|
|
|
status_t fInitStatus;
|
|
|
|
|
|
|
|
BString fName;
|
|
|
|
BString fURL;
|
|
|
|
uint8 fPriority;
|
|
|
|
bool fIsUserSpecific;
|
2011-01-24 20:48:03 +00:00
|
|
|
|
|
|
|
BEntry fEntry;
|
2011-01-21 22:18:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-25 17:07:27 +00:00
|
|
|
} // namespace BPackageKit
|
2011-01-21 22:18:58 +00:00
|
|
|
|
|
|
|
|
2011-01-25 17:07:27 +00:00
|
|
|
#endif // _PACKAGE__REPOSITORY_CONFIG_H_
|