xref: /haiku/headers/os/package/RepositoryInfo.h (revision 002f37b0cca92e4cf72857c72ac95db5a8b09615)
1 /*
2  * Copyright 2011, 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 
17 namespace BPackageKit {
18 
19 
20 class BRepositoryInfo : public BArchivable {
21 	typedef	BArchivable			inherited;
22 
23 public:
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&		OriginalBaseURL() const;
37 			const BString&		Vendor() const;
38 			const BString&		Summary() const;
39 			uint8				Priority() const;
40 			BPackageArchitecture	Architecture() const;
41 			const BStringList&	LicenseNames() const;
42 			const BStringList&	LicenseTexts() const;
43 
44 			void				SetName(const BString& name);
45 			void				SetOriginalBaseURL(const BString& url);
46 			void				SetVendor(const BString& vendor);
47 			void				SetSummary(const BString& summary);
48 			void				SetPriority(uint8 priority);
49 			void				SetArchitecture(BPackageArchitecture arch);
50 
51 			status_t			AddLicense(const BString& licenseName,
52 									const BString& licenseText);
53 			void				ClearLicenses();
54 
55 public:
56 	static	BRepositoryInfo*	Instantiate(BMessage* data);
57 
58 	static	const uint8			kDefaultPriority;
59 
60 	static	const char* const	kNameField;
61 	static	const char* const	kURLField;
62 	static	const char* const	kVendorField;
63 	static	const char*	const	kSummaryField;
64 	static	const char*	const	kPriorityField;
65 	static	const char*	const	kArchitectureField;
66 	static	const char*	const	kLicenseNameField;
67 	static	const char*	const	kLicenseTextField;
68 
69 private:
70 			status_t			_SetTo(const BMessage* data);
71 			status_t			_SetTo(const BEntry& entry);
72 
73 private:
74 			status_t			fInitStatus;
75 
76 			BString				fName;
77 			BString				fOriginalBaseURL;
78 			BString				fVendor;
79 			BString				fSummary;
80 			uint8				fPriority;
81 			BPackageArchitecture	fArchitecture;
82 			BStringList			fLicenseNames;
83 			BStringList			fLicenseTexts;
84 };
85 
86 
87 }	// namespace BPackageKit
88 
89 
90 #endif // _PACKAGE__REPOSITORY_INFO_H_
91