diff options
| author | Stefan Boberg <[email protected]> | 2023-05-02 10:01:47 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-02 10:01:47 +0200 |
| commit | 075d17f8ada47e990fe94606c3d21df409223465 (patch) | |
| tree | e50549b766a2f3c354798a54ff73404217b4c9af /src/zenstore/hashkeyset.cpp | |
| parent | fix: bundle shouldn't append content zip to zen (diff) | |
| download | zen-075d17f8ada47e990fe94606c3d21df409223465.tar.xz zen-075d17f8ada47e990fe94606c3d21df409223465.zip | |
moved source directories into `/src` (#264)
* moved source directories into `/src`
* updated bundle.lua for new `src` path
* moved some docs, icon
* removed old test trees
Diffstat (limited to 'src/zenstore/hashkeyset.cpp')
| -rw-r--r-- | src/zenstore/hashkeyset.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/zenstore/hashkeyset.cpp b/src/zenstore/hashkeyset.cpp new file mode 100644 index 000000000..a5436f5cb --- /dev/null +++ b/src/zenstore/hashkeyset.cpp @@ -0,0 +1,60 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +#include <zenstore/hashkeyset.h> + +////////////////////////////////////////////////////////////////////////// + +namespace zen { + +void +HashKeySet::AddHashToSet(const IoHash& HashToAdd) +{ + m_HashSet.insert(HashToAdd); +} + +void +HashKeySet::AddHashesToSet(std::span<const IoHash> HashesToAdd) +{ + m_HashSet.insert(HashesToAdd.begin(), HashesToAdd.end()); +} + +void +HashKeySet::RemoveHashesIf(std::function<bool(const IoHash& CandidateHash)>&& Predicate) +{ + for (auto It = begin(m_HashSet), ItEnd = end(m_HashSet); It != ItEnd;) + { + if (Predicate(*It)) + { + It = m_HashSet.erase(It); + } + else + { + ++It; + } + } +} + +void +HashKeySet::IterateHashes(std::function<void(const IoHash& Hash)>&& Callback) const +{ + for (auto It = begin(m_HashSet), ItEnd = end(m_HashSet); It != ItEnd; ++It) + { + Callback(*It); + } +} + +////////////////////////////////////////////////////////////////////////// +// +// Testing related code follows... +// + +#if ZEN_WITH_TESTS + +void +hashkeyset_forcelink() +{ +} + +#endif + +} // namespace zen |