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 BPackageInfoSet(const BPackageInfoSet& other); 25 virtual ~BPackageInfoSet(); 26 27 status_t AddInfo(const BPackageInfo& info); 28 void MakeEmpty(); 29 30 uint32 CountInfos() const; 31 Iterator GetIterator() const; 32 33 BPackageInfoSet& operator=(const BPackageInfoSet& other); 34 35 private: 36 bool _CopyOnWrite(); 37 38 private: 39 struct PackageInfo; 40 struct PackageInfoHashDefinition; 41 struct PackageMap; 42 43 friend class Iterator; 44 45 private: 46 PackageMap* fPackageMap; 47 }; 48 49 50 class BPackageInfoSet::Iterator { 51 public: 52 Iterator(const PackageMap* map = NULL); 53 54 bool HasNext() const; 55 const BPackageInfo* Next(); 56 57 private: 58 friend class BRepositoryCache; 59 60 private: 61 const PackageMap* fMap; 62 PackageInfo* fNextInfo; 63 }; 64 65 66 } // namespace BPackageKit 67 68 69 #endif // _PACKAGE_PACKAGE_INFO_SET_H_ 70