diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/poco/Foundation/include/Poco/DirectoryIteratorStrategy.h | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/poco/Foundation/include/Poco/DirectoryIteratorStrategy.h')
-rw-r--r-- | contrib/libs/poco/Foundation/include/Poco/DirectoryIteratorStrategy.h | 184 |
1 files changed, 92 insertions, 92 deletions
diff --git a/contrib/libs/poco/Foundation/include/Poco/DirectoryIteratorStrategy.h b/contrib/libs/poco/Foundation/include/Poco/DirectoryIteratorStrategy.h index 4591f7c607..ff02277c04 100644 --- a/contrib/libs/poco/Foundation/include/Poco/DirectoryIteratorStrategy.h +++ b/contrib/libs/poco/Foundation/include/Poco/DirectoryIteratorStrategy.h @@ -1,92 +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: - typedef std::stack<DirectoryIterator> Stack; - typedef std::function<UInt16(const Stack&)> DepthFunPtr; - - enum - { - D_INFINITE = 0 /// Special value for infinite traverse depth. - }; - - TraverseBase(DepthFunPtr depthDeterminer, UInt16 maxDepth = D_INFINITE); - -protected: - bool isFiniteDepth(); - bool isDirectory(Poco::File& file); - - DepthFunPtr _depthDeterminer; - UInt16 _maxDepth; - DirectoryIterator _itEnd; - -private: - TraverseBase(); - TraverseBase(const TraverseBase&); - TraverseBase& operator=(const TraverseBase&); -}; - - -class Foundation_API ChildrenFirstTraverse: public TraverseBase -{ -public: - ChildrenFirstTraverse(DepthFunPtr 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(DepthFunPtr 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 +// +// 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: + typedef std::stack<DirectoryIterator> Stack; + typedef std::function<UInt16(const Stack&)> DepthFunPtr; + + enum + { + D_INFINITE = 0 /// Special value for infinite traverse depth. + }; + + TraverseBase(DepthFunPtr depthDeterminer, UInt16 maxDepth = D_INFINITE); + +protected: + bool isFiniteDepth(); + bool isDirectory(Poco::File& file); + + DepthFunPtr _depthDeterminer; + UInt16 _maxDepth; + DirectoryIterator _itEnd; + +private: + TraverseBase(); + TraverseBase(const TraverseBase&); + TraverseBase& operator=(const TraverseBase&); +}; + + +class Foundation_API ChildrenFirstTraverse: public TraverseBase +{ +public: + ChildrenFirstTraverse(DepthFunPtr 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(DepthFunPtr 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 |