mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-20 17:17:13 +02:00
Major plugin refactor and cleanup.
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
This commit is contained in:
92
vendor/POCO/Foundation/include/Poco/DirectoryIteratorStrategy.h
vendored
Normal file
92
vendor/POCO/Foundation/include/Poco/DirectoryIteratorStrategy.h
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
//
|
||||
// RecursiveDirectoryIteratorStategies.h
|
||||
//
|
||||
// Library: Foundation
|
||||
// Package: Filesystem
|
||||
// Module: RecursiveDirectoryIterator
|
||||
//
|
||||
// Definitions of the RecursiveDirectoryIterator stategy classes.
|
||||
//
|
||||
// Copyright (c) 2012, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef Foundation_RecursiveDirectoryIteratorStrategy_INCLUDED
|
||||
#define Foundation_RecursiveDirectoryIteratorStrategy_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/DirectoryIterator.h"
|
||||
#include <stack>
|
||||
#include <queue>
|
||||
#include <functional>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
|
||||
|
||||
class Foundation_API TraverseBase
|
||||
{
|
||||
public:
|
||||
using Stack = std::stack<DirectoryIterator>;
|
||||
using DepthFun = std::function<UInt16(const Stack&)>;
|
||||
|
||||
enum
|
||||
{
|
||||
D_INFINITE = 0 /// Special value for infinite traverse depth.
|
||||
};
|
||||
|
||||
TraverseBase(DepthFun depthDeterminer, UInt16 maxDepth = D_INFINITE);
|
||||
|
||||
protected:
|
||||
bool isFiniteDepth();
|
||||
bool isDirectory(Poco::File& file);
|
||||
|
||||
DepthFun _depthDeterminer;
|
||||
UInt16 _maxDepth;
|
||||
DirectoryIterator _itEnd;
|
||||
|
||||
private:
|
||||
TraverseBase();
|
||||
TraverseBase(const TraverseBase&);
|
||||
TraverseBase& operator=(const TraverseBase&);
|
||||
};
|
||||
|
||||
|
||||
class Foundation_API ChildrenFirstTraverse: public TraverseBase
|
||||
{
|
||||
public:
|
||||
ChildrenFirstTraverse(DepthFun depthDeterminer, UInt16 maxDepth = D_INFINITE);
|
||||
|
||||
const std::string next(Stack* itStack, bool* isFinished);
|
||||
|
||||
private:
|
||||
ChildrenFirstTraverse();
|
||||
ChildrenFirstTraverse(const ChildrenFirstTraverse&);
|
||||
ChildrenFirstTraverse& operator=(const ChildrenFirstTraverse&);
|
||||
};
|
||||
|
||||
|
||||
class Foundation_API SiblingsFirstTraverse: public TraverseBase
|
||||
{
|
||||
public:
|
||||
SiblingsFirstTraverse(DepthFun depthDeterminer, UInt16 maxDepth = D_INFINITE);
|
||||
|
||||
const std::string next(Stack* itStack, bool* isFinished);
|
||||
|
||||
private:
|
||||
SiblingsFirstTraverse();
|
||||
SiblingsFirstTraverse(const SiblingsFirstTraverse&);
|
||||
SiblingsFirstTraverse& operator=(const SiblingsFirstTraverse&);
|
||||
|
||||
std::stack<std::queue<std::string>> _dirsStack;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
|
||||
#endif // Foundation_RecursiveDirectoryIteratorStrategy_INCLUDED
|
Reference in New Issue
Block a user