mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
fbdb46f5cb
Reviewed By: chadaustin Differential Revision: D17872966 fbshipit-source-id: cd60a364a2146f0dadbeca693b1d4a5d7c97ff63
64 lines
1.2 KiB
C++
64 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This software may be used and distributed according to the terms of the
|
|
* GNU General Public License version 2.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "folly/portability/Windows.h"
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
class WinStore;
|
|
struct FileMetadata;
|
|
|
|
class Enumerator {
|
|
public:
|
|
Enumerator(const Enumerator&) = delete;
|
|
Enumerator& operator=(const Enumerator&) = delete;
|
|
|
|
Enumerator(
|
|
const GUID& enumerationId,
|
|
const std::wstring& path,
|
|
std::vector<FileMetadata> entryList);
|
|
|
|
Enumerator() = delete;
|
|
|
|
const FileMetadata* current();
|
|
|
|
void advance() {
|
|
++listIndex_;
|
|
}
|
|
|
|
void restart() {
|
|
listIndex_ = 0;
|
|
}
|
|
|
|
bool isSearchExpressionEmpty() const {
|
|
return searchExpression_.empty();
|
|
}
|
|
|
|
void saveExpression(std::wstring searchExpression) noexcept {
|
|
searchExpression_ = std::move(searchExpression);
|
|
}
|
|
|
|
private:
|
|
std::wstring path_;
|
|
std::wstring searchExpression_;
|
|
std::vector<FileMetadata> metadataList_;
|
|
|
|
//
|
|
// use the listIndex_ to return entries when the enumeration is done over
|
|
// multiple calls
|
|
//
|
|
size_t listIndex_ = 0;
|
|
};
|
|
} // namespace eden
|
|
} // namespace facebook
|