xref: /haiku/headers/os/package/PackageInfoSet.h (revision 7ee53ed3bd2222305c93a4959f8c587c373ed97c)
1 /*
2  * Copyright 2011, Haiku, Inc.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _PACKAGE_PACKAGE_INFO_SET_H_
6 #define _PACKAGE_PACKAGE_INFO_SET_H_
7 
8 
9 #include <SupportDefs.h>
10 
11 
12 namespace BPackageKit {
13 
14 
15 class BPackageInfo;
16 
17 
18 class BPackageInfoSet {
19 public:
20 			class Iterator;
21 
22 public:
23 								BPackageInfoSet();
24 	virtual						~BPackageInfoSet();
25 
26 			status_t			Init();
27 
28 			status_t			AddInfo(const BPackageInfo& info);
29 			void				MakeEmpty();
30 
31 			uint32				CountInfos() const;
32 			Iterator			GetIterator() const;
33 
34 private:
35 			struct PackageInfo;
36 			struct PackageInfoHashDefinition;
37 			struct PackageMap;
38 
39 			friend class Iterator;
40 
41 private:
42 			PackageMap*			fPackageMap;
43 };
44 
45 
46 class BPackageInfoSet::Iterator {
47 public:
48 								Iterator();
49 								Iterator(const BPackageInfoSet* set);
50 
51 			bool				HasNext() const;
52 			const BPackageInfo*	Next();
53 
54 private:
55 			friend class BRepositoryCache;
56 
57 private:
58 			const BPackageInfoSet* fSet;
59 			PackageInfo*		fNextInfo;
60 };
61 
62 
63 }	// namespace BPackageKit
64 
65 
66 #endif // _PACKAGE_PACKAGE_INFO_SET_H_
67