Files
nostalgia/deps/ox/src/ox/fs/filesystem/pathiterator.hpp
Gary Talent 9f338a7429
All checks were successful
Build / build (push) Successful in 3m18s
[ox] Run liccor
2025-01-08 23:03:05 -06:00

53 lines
1003 B
C++

/*
* Copyright 2015 - 2025 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#pragma once
#include <ox/std/std.hpp>
namespace ox {
constexpr std::size_t MaxFileNameLength = 255;
class PathIterator {
private:
const char *m_path = nullptr;
std::size_t m_iterator = 0;
std::size_t m_maxSize = 0;
public:
PathIterator(const char *path, std::size_t maxSize, std::size_t iterator = 0);
PathIterator(const char *path);
PathIterator(StringViewCR path);
Error dirPath(char *pathOut, std::size_t pathOutSize);
Error next(StringView &fileName);
Error get(StringView &fileName);
Result<std::size_t> nextSize() const;
[[nodiscard]]
bool hasNext() const;
[[nodiscard]]
bool valid() const;
[[nodiscard]]
PathIterator next() const;
[[nodiscard]]
const char *fullPath() const;
};
}