2011-07-17 01:11:25 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2011, Haiku, Inc.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _PACKAGE_PACKAGE_INFO_SET_H_
|
|
|
|
#define _PACKAGE_PACKAGE_INFO_SET_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace BPackageKit {
|
|
|
|
|
|
|
|
|
|
|
|
class BPackageInfo;
|
|
|
|
|
|
|
|
|
|
|
|
class BPackageInfoSet {
|
|
|
|
public:
|
|
|
|
class Iterator;
|
|
|
|
|
|
|
|
public:
|
|
|
|
BPackageInfoSet();
|
2013-04-13 04:08:43 +04:00
|
|
|
BPackageInfoSet(const BPackageInfoSet& other);
|
2011-07-17 01:11:25 +04:00
|
|
|
virtual ~BPackageInfoSet();
|
|
|
|
|
|
|
|
status_t AddInfo(const BPackageInfo& info);
|
|
|
|
void MakeEmpty();
|
|
|
|
|
|
|
|
uint32 CountInfos() const;
|
|
|
|
Iterator GetIterator() const;
|
|
|
|
|
2013-04-13 04:08:43 +04:00
|
|
|
BPackageInfoSet& operator=(const BPackageInfoSet& other);
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool _CopyOnWrite();
|
|
|
|
|
2011-07-17 01:11:25 +04:00
|
|
|
private:
|
|
|
|
struct PackageInfo;
|
|
|
|
struct PackageInfoHashDefinition;
|
|
|
|
struct PackageMap;
|
|
|
|
|
|
|
|
friend class Iterator;
|
|
|
|
|
|
|
|
private:
|
|
|
|
PackageMap* fPackageMap;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class BPackageInfoSet::Iterator {
|
|
|
|
public:
|
2013-04-14 18:47:01 +04:00
|
|
|
Iterator(const PackageMap* map = NULL);
|
2011-07-17 01:11:25 +04:00
|
|
|
|
|
|
|
bool HasNext() const;
|
|
|
|
const BPackageInfo* Next();
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class BRepositoryCache;
|
|
|
|
|
|
|
|
private:
|
2013-04-13 04:08:43 +04:00
|
|
|
const PackageMap* fMap;
|
2011-07-17 01:11:25 +04:00
|
|
|
PackageInfo* fNextInfo;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _PACKAGE_PACKAGE_INFO_SET_H_
|