You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libcutefish/files/file_enumerator.h

31 lines
1.1 KiB
C++

// SPDX-FileCopyrightText: 2026 Reion Wong <reionwong@gmail.com>
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <cstdint>
#include <functional>
#include <string>
#include <vector>
#include "cutefish/files/file_item.h"
#include "cutefish/files/operation_context.h"
namespace cutefish::files {
class FileEnumerator
{
public:
// The items of a folder, or of every trash for trash:/, not yet prepared.
static FileItemList list(const Url& url, bool hidden = true, OperationContext* context = nullptr);
// The prepared files at any depth under url, nearest first, whose names contain
// every word, ignoring case. Folders that cannot be read are skipped; links and
// kernel file systems are not followed. found sees each file before it is added.
static FileItemList search(const Url& url, const std::vector<std::string>& words, bool hidden,
OperationContext* context = nullptr,
const std::function<void(FileItem&)>& found = {});
static uint64_t size(const std::string& path, OperationContext& context);
};
} // namespace cutefish::files