ENH: Redo implementation of itkDirectory to use kwsys (avoid duplicating code).

This commit is contained in:
Mathieu Malaterre 2006-03-06 10:12:02 -05:00
parent 174cad0994
commit 70e6fe3f9b
2 changed files with 16 additions and 5 deletions

View File

@ -55,13 +55,13 @@ Directory::~Directory()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
unsigned long Directory::GetNumberOfFiles() unsigned long Directory::GetNumberOfFiles() const
{ {
return static_cast<unsigned long>(this->Internal->Files.size()); return static_cast<unsigned long>(this->Internal->Files.size());
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* Directory::GetFile(unsigned long dindex) const char* Directory::GetFile(unsigned long dindex) const
{ {
if ( dindex >= this->Internal->Files.size() ) if ( dindex >= this->Internal->Files.size() )
{ {
@ -70,6 +70,12 @@ const char* Directory::GetFile(unsigned long dindex)
return this->Internal->Files[dindex].c_str(); return this->Internal->Files[dindex].c_str();
} }
//----------------------------------------------------------------------------
const char* Directory::GetPath() const
{
return this->Internal->Path.c_str();
}
} // namespace KWSYS_NAMESPACE } // namespace KWSYS_NAMESPACE
// First microsoft compilers // First microsoft compilers

View File

@ -45,12 +45,17 @@ public:
/** /**
* Return the number of files in the current directory. * Return the number of files in the current directory.
*/ */
unsigned long GetNumberOfFiles(); unsigned long GetNumberOfFiles() const;
/** /**
* Return the file at the given index, the indexing is 0 based * Return the file at the given index, the indexing is 0 based
*/ */
const char* GetFile(unsigned long); const char* GetFile(unsigned long) const;
/**
* Return the path to Open'ed directory
*/
const char* GetPath() const;
private: private:
// Private implementation details. // Private implementation details.