1/*
2 * Copyright 2011-2018, Haiku, Inc.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _PACKAGE__REPOSITORY_INFO_H_
6#define _PACKAGE__REPOSITORY_INFO_H_
7
8
9#include <Archivable.h>
10#include <Entry.h>
11#include <StringList.h>
12#include <String.h>
13
14#include <package/PackageArchitecture.h>
15
16
17namespace BPackageKit {
18
19
20class BRepositoryInfo : public BArchivable {
21	typedef	BArchivable			inherited;
22
23public:
24								BRepositoryInfo();
25								BRepositoryInfo(BMessage* data);
26								BRepositoryInfo(const BEntry& entry);
27	virtual						~BRepositoryInfo();
28
29	virtual	status_t			Archive(BMessage* data, bool deep = true) const;
30
31			status_t			SetTo(const BMessage* data);
32			status_t			SetTo(const BEntry& entry);
33			status_t			InitCheck() const;
34
35			const BString&		Name() const;
36			const BString&		BaseURL() const;
37			const BString&		URL() const;
38			const BString&		Vendor() const;
39			const BString&		Summary() const;
40			uint8				Priority() const;
41			BPackageArchitecture	Architecture() const;
42			const BStringList&	LicenseNames() const;
43			const BStringList&	LicenseTexts() const;
44
45			void				SetName(const BString& name);
46			void				SetBaseURL(const BString& url);
47			void				SetURL(const BString& url);
48			void				SetVendor(const BString& vendor);
49			void				SetSummary(const BString& summary);
50			void				SetPriority(uint8 priority);
51			void				SetArchitecture(BPackageArchitecture arch);
52
53			status_t			AddLicense(const BString& licenseName,
54									const BString& licenseText);
55			void				ClearLicenses();
56
57public:
58	static	BRepositoryInfo*	Instantiate(BMessage* data);
59
60	static	const uint8			kDefaultPriority;
61
62	static	const char* const	kNameField;
63	static	const char* const	kURLField;
64	static	const char* const	kBaseURLField;
65	static	const char* const	kVendorField;
66	static	const char*	const	kSummaryField;
67	static	const char*	const	kPriorityField;
68	static	const char*	const	kArchitectureField;
69	static	const char*	const	kLicenseNameField;
70	static	const char*	const	kLicenseTextField;
71
72private:
73			status_t			_SetTo(const BMessage* data);
74			status_t			_SetTo(const BEntry& entry);
75
76private:
77			status_t			fInitStatus;
78
79			BString				fName;
80			BString				fBaseURL;
81				// This is the URL to a single mirror.  This field is optional.
82			BString				fURL;
83				// This is an identifier for the repository that applies
84				// across mirrors.
85			BString				fVendor;
86			BString				fSummary;
87			uint8				fPriority;
88			BPackageArchitecture	fArchitecture;
89			BStringList			fLicenseNames;
90			BStringList			fLicenseTexts;
91};
92
93
94}	// namespace BPackageKit
95
96
97#endif // _PACKAGE__REPOSITORY_INFO_H_
98