Rename Dir to DirIterator

This commit is contained in:
Robert Knight 2011-08-24 11:53:02 +01:00
parent 887619f239
commit b4311d79a9
4 changed files with 14 additions and 14 deletions

View file

@ -21,7 +21,7 @@ endif()
add_definitions(-DTIXML_USE_STL)
set (SOURCES
Dir.cpp
DirIterator.cpp
FileOps.cpp
Log.cpp
ProcessUtils.cpp
@ -41,7 +41,7 @@ if (WIN32)
endif()
set (HEADERS
Dir.h
DirIterator.h
FileOps.h
Log.h
ProcessUtils.h

View file

@ -1,4 +1,4 @@
#include "Dir.h"
#include "DirIterator.h"
#include "Log.h"
#include "StringUtils.h"
@ -15,7 +15,7 @@ bool endsWith(const std::string& str, const char* text)
return str.find(text,str.size() - length) != 0;
}
Dir::Dir(const char* path)
DirIterator::DirIterator(const char* path)
{
m_path = path;
@ -37,7 +37,7 @@ Dir::Dir(const char* path)
#endif
}
Dir::~Dir()
DirIterator::~DirIterator()
{
#ifdef PLATFORM_UNIX
closedir(m_dir);
@ -46,7 +46,7 @@ Dir::~Dir()
#endif
}
bool Dir::next()
bool DirIterator::next()
{
#ifdef PLATFORM_UNIX
m_entry = readdir(m_dir);
@ -66,7 +66,7 @@ bool Dir::next()
#endif
}
std::string Dir::fileName() const
std::string DirIterator::fileName() const
{
#ifdef PLATFORM_UNIX
return m_entry->d_name;
@ -75,12 +75,12 @@ std::string Dir::fileName() const
#endif
}
std::string Dir::filePath() const
std::string DirIterator::filePath() const
{
return m_path + '/' + fileName();
}
bool Dir::isDir() const
bool DirIterator::isDir() const
{
#ifdef PLATFORM_UNIX
return m_entry->d_type == DT_DIR;

View file

@ -8,11 +8,11 @@
#include <dirent.h>
#endif
class Dir
class DirIterator
{
public:
Dir(const char* path);
~Dir();
DirIterator(const char* path);
~DirIterator();
// iterate to the next entry in the directory
bool next();

View file

@ -1,6 +1,6 @@
#include "FileOps.h"
#include "Dir.h"
#include "DirIterator.h"
#include "Log.h"
#include "Platform.h"
#include "StringUtils.h"
@ -266,7 +266,7 @@ void FileOps::touch(const char* path) throw (IOException)
void FileOps::rmdirRecursive(const char* path) throw (IOException)
{
// remove dir contents
Dir dir(path);
DirIterator dir(path);
while (dir.next())
{
std::string name = dir.fileName();