mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 18:42:41 +01:00
fixed GH# 236: Bug in RecursiveDirectoryIterator
This commit is contained in:
@@ -36,8 +36,9 @@
|
||||
//
|
||||
|
||||
|
||||
#ifndef Foundation_RecursiveDirectoryIteratorStrategy_INCLUDE
|
||||
#define Foundation_RecursiveDirectoryIteratorStrategy_INCLUDE
|
||||
#ifndef Foundation_RecursiveDirectoryIteratorStrategy_INCLUDED
|
||||
#define Foundation_RecursiveDirectoryIteratorStrategy_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/DirectoryIterator.h"
|
||||
@@ -46,8 +47,8 @@
|
||||
#include <functional>
|
||||
|
||||
|
||||
namespace Poco
|
||||
{
|
||||
namespace Poco {
|
||||
|
||||
|
||||
class Foundation_API TraverseBase
|
||||
{
|
||||
@@ -57,14 +58,14 @@ public:
|
||||
|
||||
enum
|
||||
{
|
||||
D_INFINITE = 0
|
||||
D_INFINITE = 0 /// Special value for infinite traverse depth.
|
||||
};
|
||||
/// Constant for infinite traverse depth.
|
||||
|
||||
TraverseBase(DepthFunPtr depthDeterminer, UInt16 maxDepth = D_INFINITE);
|
||||
|
||||
protected:
|
||||
bool isFiniteDepth();
|
||||
bool isDirectory(Poco::File& file);
|
||||
|
||||
DepthFunPtr _depthDeterminer;
|
||||
UInt16 _maxDepth;
|
||||
@@ -109,4 +110,5 @@ private:
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
#endif // Foundation_RecursiveDirectoryIteratorStrategy_INCLUDE
|
||||
|
||||
#endif // Foundation_RecursiveDirectoryIteratorStrategy_INCLUDED
|
||||
|
||||
@@ -36,8 +36,9 @@
|
||||
//
|
||||
|
||||
|
||||
#ifndef Foundation_RecursiveDirectoryIterator_INCLUDE
|
||||
#define Foundation_RecursiveDirectoryIterator_INCLUDE
|
||||
#ifndef Foundation_RecursiveDirectoryIterator_INCLUDED
|
||||
#define Foundation_RecursiveDirectoryIterator_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "Poco/File.h"
|
||||
@@ -123,7 +124,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
~RecursiveDirectoryIterator()
|
||||
/// Destroys the DirectoryIterator.
|
||||
{
|
||||
@@ -156,7 +156,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
MyType& operator =(const MyType& it)
|
||||
MyType& operator = (const MyType& it)
|
||||
{
|
||||
if (_pImpl)
|
||||
_pImpl->release();
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
MyType& operator =(const File& file)
|
||||
MyType& operator = (const File& file)
|
||||
{
|
||||
if (_pImpl)
|
||||
_pImpl->release();
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
MyType& operator =(const Path& path)
|
||||
MyType& operator = (const Path& path)
|
||||
{
|
||||
if (_pImpl)
|
||||
_pImpl->release();
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
MyType& operator =(const std::string& path)
|
||||
MyType& operator = (const std::string& path)
|
||||
{
|
||||
if (_pImpl)
|
||||
_pImpl->release();
|
||||
@@ -201,7 +201,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
MyType& operator ++()
|
||||
MyType& operator ++ ()
|
||||
{
|
||||
if (_pImpl)
|
||||
{
|
||||
@@ -211,7 +211,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
const File& operator *() const
|
||||
const File& operator * () const
|
||||
{
|
||||
return _file;
|
||||
}
|
||||
@@ -221,17 +221,16 @@ public:
|
||||
return _file;
|
||||
}
|
||||
|
||||
const File* operator ->() const
|
||||
const File* operator -> () const
|
||||
{
|
||||
return &_file;
|
||||
}
|
||||
|
||||
File* operator ->()
|
||||
File* operator -> ()
|
||||
{
|
||||
return &_file;
|
||||
}
|
||||
|
||||
|
||||
template<class T1, class T2>
|
||||
friend inline bool operator ==(const RecursiveDirectoryIterator<T1>& a, const RecursiveDirectoryIterator<T2>& b);
|
||||
template<class T1, class T2>
|
||||
@@ -271,4 +270,5 @@ typedef RecursiveDirectoryIterator<SiblingsFirstTraverse> SiblingsFirstRecursive
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
#endif // Foundation_RecursiveDirectoryIterator_INCLUDE
|
||||
|
||||
#endif // Foundation_RecursiveDirectoryIterator_INCLUDED
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
//
|
||||
|
||||
|
||||
#ifndef Foundation_RecursiveDirectoryIteratorImpl_INCLUDE
|
||||
#define Foundation_RecursiveDirectoryIteratorImpl_INCLUDE
|
||||
#ifndef Foundation_RecursiveDirectoryIteratorImpl_INCLUDED
|
||||
#define Foundation_RecursiveDirectoryIteratorImpl_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
@@ -59,9 +59,8 @@ class RecursiveDirectoryIteratorImpl
|
||||
public:
|
||||
enum
|
||||
{
|
||||
D_INFINITE = 0
|
||||
D_INFINITE = 0 /// Special value for infinite traverse depth.
|
||||
};
|
||||
/// Constant for infinite traverse depth.
|
||||
|
||||
RecursiveDirectoryIteratorImpl(const std::string& path, UInt16 maxDepth = D_INFINITE)
|
||||
: _maxDepth(maxDepth), _traverseStrategy(std::ptr_fun(depthFun), _maxDepth), _isFinished(false), _rc(1)
|
||||
@@ -130,4 +129,5 @@ private:
|
||||
|
||||
} // namespace Poco
|
||||
|
||||
#endif // Foundation_RecursiveDirectoryIteratorImpl_INCLUDE
|
||||
|
||||
#endif // Foundation_RecursiveDirectoryIteratorImpl_INCLUDED
|
||||
|
||||
Reference in New Issue
Block a user