remove deprecated std::pointer_to_unary_function

This commit is contained in:
Günter Obiltschnig 2020-01-04 11:28:24 +01:00
parent 4ec5d35060
commit 50e9d35c3c
3 changed files with 9 additions and 9 deletions

View File

@ -32,20 +32,20 @@ class Foundation_API TraverseBase
{ {
public: public:
typedef std::stack<DirectoryIterator> Stack; typedef std::stack<DirectoryIterator> Stack;
typedef std::pointer_to_unary_function<const Stack&, UInt16> DepthFunPtr; typedef std::function<UInt16(const Stack&)> DepthFun;
enum enum
{ {
D_INFINITE = 0 /// Special value for infinite traverse depth. D_INFINITE = 0 /// Special value for infinite traverse depth.
}; };
TraverseBase(DepthFunPtr depthDeterminer, UInt16 maxDepth = D_INFINITE); TraverseBase(DepthFun depthDeterminer, UInt16 maxDepth = D_INFINITE);
protected: protected:
bool isFiniteDepth(); bool isFiniteDepth();
bool isDirectory(Poco::File& file); bool isDirectory(Poco::File& file);
DepthFunPtr _depthDeterminer; DepthFun _depthDeterminer;
UInt16 _maxDepth; UInt16 _maxDepth;
DirectoryIterator _itEnd; DirectoryIterator _itEnd;
@ -59,7 +59,7 @@ private:
class Foundation_API ChildrenFirstTraverse: public TraverseBase class Foundation_API ChildrenFirstTraverse: public TraverseBase
{ {
public: public:
ChildrenFirstTraverse(DepthFunPtr depthDeterminer, UInt16 maxDepth = D_INFINITE); ChildrenFirstTraverse(DepthFun depthDeterminer, UInt16 maxDepth = D_INFINITE);
const std::string next(Stack* itStack, bool* isFinished); const std::string next(Stack* itStack, bool* isFinished);
@ -73,7 +73,7 @@ private:
class Foundation_API SiblingsFirstTraverse: public TraverseBase class Foundation_API SiblingsFirstTraverse: public TraverseBase
{ {
public: public:
SiblingsFirstTraverse(DepthFunPtr depthDeterminer, UInt16 maxDepth = D_INFINITE); SiblingsFirstTraverse(DepthFun depthDeterminer, UInt16 maxDepth = D_INFINITE);
const std::string next(Stack* itStack, bool* isFinished); const std::string next(Stack* itStack, bool* isFinished);

View File

@ -41,7 +41,7 @@ public:
}; };
RecursiveDirectoryIteratorImpl(const std::string& path, UInt16 maxDepth = D_INFINITE) RecursiveDirectoryIteratorImpl(const std::string& path, UInt16 maxDepth = D_INFINITE)
: _maxDepth(maxDepth), _traverseStrategy(std::ptr_fun(depthFun), _maxDepth), _isFinished(false), _rc(1) : _maxDepth(maxDepth), _traverseStrategy(depthFun, _maxDepth), _isFinished(false), _rc(1)
{ {
_itStack.push(DirectoryIterator(path)); _itStack.push(DirectoryIterator(path));
_current = _itStack.top()->path(); _current = _itStack.top()->path();

View File

@ -21,7 +21,7 @@ namespace Poco {
// //
// TraverseBase // TraverseBase
// //
TraverseBase::TraverseBase(DepthFunPtr depthDeterminer, UInt16 maxDepth) TraverseBase::TraverseBase(DepthFun depthDeterminer, UInt16 maxDepth)
: _depthDeterminer(depthDeterminer), _maxDepth(maxDepth) : _depthDeterminer(depthDeterminer), _maxDepth(maxDepth)
{ {
} }
@ -49,7 +49,7 @@ bool TraverseBase::isDirectory(Poco::File& file)
// //
// ChildrenFirstTraverse // ChildrenFirstTraverse
// //
ChildrenFirstTraverse::ChildrenFirstTraverse(DepthFunPtr depthDeterminer, UInt16 maxDepth) ChildrenFirstTraverse::ChildrenFirstTraverse(DepthFun depthDeterminer, UInt16 maxDepth)
: TraverseBase(depthDeterminer, maxDepth) : TraverseBase(depthDeterminer, maxDepth)
{ {
} }
@ -106,7 +106,7 @@ const std::string ChildrenFirstTraverse::next(Stack* itStack, bool* isFinished)
// //
// SiblingsFirstTraverse // SiblingsFirstTraverse
// //
SiblingsFirstTraverse::SiblingsFirstTraverse(DepthFunPtr depthDeterminer, UInt16 maxDepth) SiblingsFirstTraverse::SiblingsFirstTraverse(DepthFun depthDeterminer, UInt16 maxDepth)
: TraverseBase(depthDeterminer, maxDepth) : TraverseBase(depthDeterminer, maxDepth)
{ {
_dirsStack.push(std::queue<std::string>()); _dirsStack.push(std::queue<std::string>());