xref: /haiku/src/apps/haikudepot/packagemodel/DepotInfo.h (revision 82bfaa954dcfd90582fb2c1a0e918971eea57091)
1 /*
2  * Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>.
3  * Copyright 2016-2023, Andrew Lindesay <apl@lindesay.co.nz>.
4  * All rights reserved. Distributed under the terms of the MIT License.
5  */
6 #ifndef DEPOT_INFO_H
7 #define DEPOT_INFO_H
8 
9 #include <vector>
10 
11 #include <String.h>
12 #include <Referenceable.h>
13 
14 #include "PackageInfo.h"
15 
16 
17 class DepotInfo : public BReferenceable {
18 public:
19 								DepotInfo();
20 								DepotInfo(const BString& name);
21 								DepotInfo(const DepotInfo& other);
22 
23 			DepotInfo&			operator=(const DepotInfo& other);
24 			bool				operator==(const DepotInfo& other) const;
25 			bool				operator!=(const DepotInfo& other) const;
26 
27 			const BString&		Name() const
28 									{ return fName; }
29 
30 			void				SetIdentifier(const BString& value);
31 			const BString&		Identifier() const
32 									{ return fIdentifier; }
33 
34 			int32				CountPackages() const;
35 			PackageInfoRef		PackageAtIndex(int32 index);
36 			void				AddPackage(PackageInfoRef& package);
37 			PackageInfoRef		PackageByName(const BString& packageName);
38 			bool				HasPackage(const BString& packageName);
39 
40 			void				SyncPackagesFromDepot(
41 									const BReference<DepotInfo>& other);
42 
43 			bool				HasAnyProminentPackages() const;
44 
45 			void				SetWebAppRepositoryCode(const BString& code);
46 			const BString&		WebAppRepositoryCode() const
47 									{ return fWebAppRepositoryCode; }
48 
49 			void				SetWebAppRepositorySourceCode(
50 									const BString& code);
51 			const BString&		WebAppRepositorySourceCode() const
52 									{ return fWebAppRepositorySourceCode; }
53 
54 private:
55 			BString				fName;
56 			BString				fIdentifier;
57 			std::vector<PackageInfoRef>
58 								fPackages;
59 			BString				fWebAppRepositoryCode;
60 			BString				fWebAppRepositorySourceCode;
61 };
62 
63 
64 typedef BReference<DepotInfo> DepotInfoRef;
65 
66 
67 #endif // DEPOT_INFO_H
68