haiku/headers/os/package/RepositoryCache.h
Ingo Weinhold 10e1bc5267 BRepositoryCache: Add iteration, etc.
* Remove InitCheck() and the initializing constructor.
* Rename PackageCount() to CountPackages().
* Use BOpenHashTable instead of HashMap for the internal PackageMap.
* Allow multiple packages with the same name. Equally named packages are
  in a singly linked list after the first package with that name.
* Add an Iterator inner class and a GetIterator() method, so one can now
  iterate through the packages in the repository.
2011-07-17 16:55:20 +02:00

81 lines
1.3 KiB
C++

/*
* Copyright 2011, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__REPOSITORY_CACHE_H_
#define _PACKAGE__REPOSITORY_CACHE_H_
#include <Entry.h>
#include <String.h>
#include <package/RepositoryInfo.h>
namespace BPackageKit {
class BPackageInfo;
class BRepositoryCache {
public:
class Iterator;
public:
BRepositoryCache();
virtual ~BRepositoryCache();
status_t SetTo(const BEntry& entry);
const BRepositoryInfo& Info() const;
const BEntry& Entry() const;
bool IsUserSpecific() const;
void SetIsUserSpecific(bool isUserSpecific);
uint32 CountPackages() const;
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;
};
} // namespace BPackageKit
#endif // _PACKAGE__REPOSITORY_CACHE_H_