xref: /haiku/headers/os/package/RepositoryConfig.h (revision 1a3518cf757c2da8006753f83962da5935bbc82b)
1 /*
2  * Copyright 2011-2018, Haiku, Inc.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _PACKAGE__REPOSITORY_CONFIG_H_
6 #define _PACKAGE__REPOSITORY_CONFIG_H_
7 
8 
9 #include <Entry.h>
10 #include <String.h>
11 
12 
13 namespace BPackageKit {
14 
15 
16 class BRepositoryConfig {
17 public:
18 								BRepositoryConfig();
19 								BRepositoryConfig(const BString& name,
20 									const BString& url, uint8 priority);
21 								BRepositoryConfig(const BEntry& entry);
22 	virtual						~BRepositoryConfig();
23 
24 			status_t			Store(const BEntry& entry) const;
25 
26 			status_t			SetTo(const BEntry& entry);
27 			status_t			InitCheck() const;
28 
29 			const BString&		Name() const;
30 			const BString&		BaseURL() const;
31 			const BString&		Identifier() const;
32 			uint8				Priority() const;
33 			bool				IsUserSpecific() const;
34 
35 			const BEntry&		Entry() const;
36 
37 			BString				PackagesURL() const;
38 
39 			void				SetName(const BString& name);
40 			void				SetBaseURL(const BString& url);
41 			void				SetIdentifier(const BString& url);
42 			void				SetPriority(uint8 priority);
43 			void				SetIsUserSpecific(bool isUserSpecific);
44 
45 public:
46 	static	const uint8			kUnsetPriority = 0;
47 
48 private:
49 			status_t			fInitStatus;
50 
51 			BString				fName;
52 			BString				fBaseURL;
53 				// this URL is the URL that can be used to access the data of
54 				// the repository - it points to a single mirror.
55 			BString				fIdentifier;
56 				// an identifier for the repository that is consistent across
57 				// mirrors. Usually a tag: or uuid: URI.
58 			uint8				fPriority;
59 			bool				fIsUserSpecific;
60 
61 			BEntry				fEntry;
62 };
63 
64 
65 }	// namespace BPackageKit
66 
67 
68 #endif // _PACKAGE__REPOSITORY_CONFIG_H_
69