mirror of
https://review.haiku-os.org/haiku
synced 2025-01-24 15:24:50 +01:00
10e1bc5267
* 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.
81 lines
1.3 KiB
C++
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_
|