Pull class BPackageInfoSet out of BRepositoryCache

This commit is contained in:
Ingo Weinhold
2011-11-25 06:19:47 +01:00
parent f96d3856e1
commit e35a99be4c
7 changed files with 326 additions and 204 deletions
@@ -0,0 +1,2 @@
#include <../os/package/PackageInfoSet.h>
+66
View File
@@ -0,0 +1,66 @@
/*
* 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();
virtual ~BPackageInfoSet();
status_t Init();
status_t AddInfo(const BPackageInfo& info);
void MakeEmpty();
uint32 CountInfos() const;
Iterator GetIterator() const;
private:
struct PackageInfo;
struct PackageInfoHashDefinition;
struct PackageMap;
friend class Iterator;
private:
PackageMap* fPackageMap;
};
class BPackageInfoSet::Iterator {
public:
Iterator();
Iterator(const BPackageInfoSet* set);
bool HasNext() const;
const BPackageInfo* Next();
private:
friend class BRepositoryCache;
private:
const BPackageInfoSet* fSet;
PackageInfo* fNextInfo;
};
} // namespace BPackageKit
#endif // _PACKAGE_PACKAGE_INFO_SET_H_
+3 -29
View File
@@ -9,18 +9,16 @@
#include <Entry.h>
#include <String.h>
#include <package/PackageInfoSet.h>
#include <package/RepositoryInfo.h>
namespace BPackageKit {
class BPackageInfo;
class BRepositoryCache {
public:
class Iterator;
typedef BPackageInfoSet::Iterator Iterator;
public:
BRepositoryCache();
@@ -38,39 +36,15 @@ public:
Iterator GetIterator() const;
private:
struct PackageInfo;
struct PackageInfoHashDefinition;
struct PackageMap;
struct RepositoryContentHandler;
struct StandardErrorOutput;
friend class Iterator;
private:
BEntry fEntry;
BRepositoryInfo fInfo;
bool fIsUserSpecific;
PackageMap* fPackageMap;
};
class BRepositoryCache::Iterator {
public:
Iterator();
bool HasNext() const;
const BPackageInfo* Next();
private:
Iterator(const BRepositoryCache* cache);
private:
friend class BRepositoryCache;
private:
const BRepositoryCache* fCache;
PackageInfo* fNextInfo;
BPackageInfoSet fPackages;
};