Update of /cvsroot/massiv/massiv/src/core/filesys
In directory sc8-pr-cvs1:/tmp/cvs-serv32695
Modified Files:
file_system_impl.h file_system.h file_system.cpp
Added Files:
file_system_iterator.h
Log Message:
Original FileSystem iterators modified to enable easy extension to Volume iterators.
--- NEW FILE: file_system_iterator.h ---
/** @file file_system_iterator.h
* Interface class for traversing through the filesystem directory graph.
*/
/*
* begin : Thu Feb 27 2003
* copyright : (C) 2002 by Marek Svantner
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef _FILE_SYSTEM_ITERATOR_H_
#define _FILE_SYSTEM_ITERATOR_H_
#include "file_system.h"
#include "types.h"
#include <string>
namespace Massiv {
namespace Core {
namespace Test { class FsEnumerationTest; }
/**
* Provides interface to enable platform independent traversing through
* arbitrary filesystem directory graph. This interface is implemented
* by architecture-dependend class in the arch directory.
*
* @code
* {
* FileSystem::iterator it( FileSystem::open_directory( "../dir", "*" ) );
* // Note that components of paths are always separated using '/'.
* // However, absolute path specification might still be different
* // on Windows and Linux (c:/temp or /tmp, respectively).
* // Fixme: Is it worth to separate components by '\' on Windows?
*
* while( it.is_valid() )
* {
* if( it.is_directory() )
* {
* std::cout << it.name() << "\t\tDIR" << std::endl;
* }
* else
* {
* std::cout << it.name() << "\t\t" << it.size() << std::endl;
* }
*
* it++;
* }
* } // Iterator's binding with '../dir' is abolished here
* @endcode
*
* @note If files or directories are created or deleted while the
* iterator is valid, it is not ensured that the newly created
* items will be also enumerated or that the deleted ones won't
* be enumerated even after deleting.
*/
namespace FileSystem
{
// Note: implementation of the following routines and implementation
// of the platform - independent file system iterator class
// is in the 'arch' subdirectory.
/**
* Returns iterator bound with the actual directory and the given
* mask. This iterator can be used for enumerating files in the
* actual directory.
* @param mask Mask describing files that should be enumerated. May
* contain wildcards, i.e. * and ?.
*/
FileSystemIterator open_current_directory
(
const std::string & mask
);
/**
* Returns iterator bound with a given directory and mask that can be
* used for enumerating files in the directory.
* @param path Path specifying the directory to be open.
* @param mask Mask describing files that should be enumerated. May
* contain wildcards, i.e. * and ?.
*
* @return Iterator bound with the specified path and mask.
*/
FileSystemIterator open_directory
(
const std::string & path,
const std::string & mask
);
/**
* @return Path to the current (actual) directory in a string.
*/
std::string get_current_directory();
/**
* Changes current directory.
* @param path Specifies the prospective actual directory. Absolute or
* relative.
*
* @exception ExCannotChangeDirectory Wrong or non-existent directory
* name was given.
*/
void set_current_directory
(
const std::string & path
);
/**
* Normalizes path, i.e. ensures that all slashes are turned into
* backslashes and that the path is concluded with '\'.
* @param path The path to be normalized.
*/
void normalize_path
(
std::string & path
);
/**
* Creates directory given by a specified path. If more directories
* contained in the path don't exist, all of the will be created.
*
* @param path Specifies a directory to be created. Can be either
* absolute or relative (taken relatively to the actual directory).
*
* @note If more directories has to be created, no atomicity is
* ensured (some of the directories may be created and others
* not if some error occures).
*/
void create_directory
(
const std::string & path
);
/**
* Deletes directory given by a specified path.
* @param path Specifies a directory to be deleted. Can be either
* absolute or relative (taken relatively to the actual directory).
* @param mode Specifies whether the directory should be deleted even
* if it contains some other directories or files. Its values
* may be:
* <ul>
* <li><b>FileSystem::DELETE_DIRS_RECURSIVE:</b> If the deleted
* directory contains other directories, they will be deleted
* recursively. However, directories containing one or more
* 'regular' files will not be deleted.
* <li><b>FileSystem::DELETE_ALL_RECURSIVE:</b> The directory will
* be deleted even with all subdirectories and contained files.
* <li><b>FileSystem::DELETE_EMPTY:</b> The directory will be
* deleted only if it is empty.
* </ul>
* @exception ExNotADirectory @c path does not specify a directory.
*/
void delete_directory
(
const std::string & path,
DirectoryDeleteMode mode = DELETE_EMPTY
);
}; // namespace FileSystem
}; // namespace Massiv::Core
}; // namespace Massiv
#endif // _FILE_SYSTEM_H_
Index: file_system_impl.h
===================================================================
RCS file: /cvsroot/massiv/massiv/src/core/filesys/file_system_impl.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** file_system_impl.h 19 Feb 2003 01:18:31 -0000 1.4
--- file_system_impl.h 2 Mar 2003 21:33:55 -0000 1.5
***************
*** 34,39 ****
)
{
! assert( it_arch );
! it_arch->bind_actual( mask );
}
--- 34,39 ----
)
{
! assert( it_base );
! it_base->bind_actual( mask );
}
***************
*** 45,50 ****
)
{
! assert( it_arch );
! it_arch->bind( path, mask );
}
--- 45,50 ----
)
{
! assert( it_base );
! it_base->bind( path, mask );
}
***************
*** 52,57 ****
inline void FileSystem::FileSystemIterator::unbind()
{
! assert( it_arch );
! it_arch->unbind();
}
--- 52,57 ----
inline void FileSystem::FileSystemIterator::unbind()
{
! assert( it_base );
! it_base->unbind();
}
***************
*** 72,82 ****
)
{
! if( it_arch )
{
! it_arch->release();
}
! it_arch = it.it_arch;
! it_arch->add_ref();
return *this;
--- 72,82 ----
)
{
! if( it_base )
{
! it_base->release();
}
! it_base = it.it_base;
! it_base->add_ref();
return *this;
***************
*** 87,92 ****
FileSystem::FileSystemIterator::next()
{
! assert( it_arch );
! it_arch->next();
return *this;
}
--- 87,92 ----
FileSystem::FileSystemIterator::next()
{
! assert( it_base );
! it_base->next();
return *this;
}
***************
*** 96,101 ****
FileSystem::FileSystemIterator::operator++( int )
{
! assert( it_arch );
! it_arch->next();
return *this;
}
--- 96,101 ----
FileSystem::FileSystemIterator::operator++( int )
{
! assert( it_base );
! it_base->next();
return *this;
}
***************
*** 105,110 ****
FileSystem::FileSystemIterator::rewind()
{
! assert( it_arch );
! it_arch->rewind();
return *this;
}
--- 105,110 ----
FileSystem::FileSystemIterator::rewind()
{
! assert( it_base );
! it_base->rewind();
return *this;
}
***************
*** 113,120 ****
inline FileSystem::FileSystemIterator FileSystem::FileSystemIterator::enter()
{
! assert( it_arch );
! FileSystemIteratorArch * it_arch_new = it_arch->enter();
! FileSystemIterator it_new( it_arch_new );
return it_new;
}
--- 113,120 ----
inline FileSystem::FileSystemIterator FileSystem::FileSystemIterator::enter()
{
! assert( it_base );
! FileSystemIteratorBase * it_base_new = it_base->enter();
! FileSystemIterator it_new( it_base_new );
return it_new;
}
***************
*** 124,130 ****
FileSystem::FileSystemIterator::descend()
{
! assert( it_arch );
! it_arch->descend();
return *this;
}
--- 124,130 ----
FileSystem::FileSystemIterator::descend()
{
! assert( it_base );
! it_base->descend();
return *this;
}
***************
*** 133,140 ****
inline FileSystem::FileSystemIterator FileSystem::FileSystemIterator::leave()
{
! assert( it_arch );
! FileSystemIteratorArch * it_arch_new = it_arch->leave();
! FileSystemIterator it_new( it_arch_new );
return it_new;
}
--- 133,140 ----
inline FileSystem::FileSystemIterator FileSystem::FileSystemIterator::leave()
{
! assert( it_base );
! FileSystemIteratorBase * it_base_new = it_base->leave();
! FileSystemIterator it_new( it_base_new );
return it_new;
}
***************
*** 144,150 ****
FileSystem::FileSystemIterator::ascend()
{
! assert( it_arch );
! it_arch->ascend();
return *this;
}
--- 144,150 ----
FileSystem::FileSystemIterator::ascend()
{
! assert( it_base );
! it_base->ascend();
return *this;
}
***************
*** 153,158 ****
inline bool FileSystem::FileSystemIterator::is_valid() const
{
! assert( it_arch );
! return it_arch->is_valid();
}
--- 153,164 ----
inline bool FileSystem::FileSystemIterator::is_valid() const
{
! if( !it_base )
! {
! return false;
! }
! else
! {
! return it_base->is_valid();
! }
}
***************
*** 160,165 ****
inline bool FileSystem::FileSystemIterator::is_file() const
{
! assert( it_arch );
! return it_arch->is_file();
}
--- 166,171 ----
inline bool FileSystem::FileSystemIterator::is_file() const
{
! assert( it_base );
! return it_base->is_file();
}
***************
*** 167,172 ****
inline bool FileSystem::FileSystemIterator::is_directory() const
{
! assert( it_arch );
! return it_arch->is_directory();
}
--- 173,178 ----
inline bool FileSystem::FileSystemIterator::is_directory() const
{
! assert( it_base );
! return it_base->is_directory();
}
***************
*** 174,179 ****
inline bool FileSystem::FileSystemIterator::is_trivial_directory() const
{
! assert( it_arch );
! return it_arch->is_trivial_directory();
}
--- 180,185 ----
inline bool FileSystem::FileSystemIterator::is_trivial_directory() const
{
! assert( it_base );
! return it_base->is_trivial_directory();
}
***************
*** 181,186 ****
inline std::string FileSystem::FileSystemIterator::name() const
{
! assert( it_arch );
! return it_arch->name();
}
--- 187,192 ----
inline std::string FileSystem::FileSystemIterator::name() const
{
! assert( it_base );
! return it_base->name();
}
***************
*** 188,193 ****
inline UInt64 FileSystem::FileSystemIterator::size() const
{
! assert( it_arch );
! return it_arch->size();
}
--- 194,199 ----
inline UInt64 FileSystem::FileSystemIterator::size() const
{
! assert( it_base );
! return it_base->size();
}
***************
*** 198,203 ****
)
{
! assert( it_arch );
! it_arch->create_directory( path );
}
--- 204,209 ----
)
{
! assert( it_base );
! it_base->create_directory( path );
}
***************
*** 209,222 ****
)
{
! assert( it_arch );
! it_arch->delete_directory( path, mode );
}
! inline const char * const
FileSystem::FileSystemIterator::get_absolute_directory()
{
! assert( it_arch );
! return it_arch->get_absolute_directory();
}
--- 215,228 ----
)
{
! assert( it_base );
! it_base->delete_directory( path, mode );
}
! std::string
FileSystem::FileSystemIterator::get_absolute_directory()
{
! assert( it_base );
! return it_base->get_absolute_directory();
}
***************
*** 224,229 ****
inline bool FileSystem::FileSystemIterator::is_in_root() const
{
! assert( it_arch );
! return it_arch->is_in_root();
}
--- 230,235 ----
inline bool FileSystem::FileSystemIterator::is_in_root() const
{
! assert( it_base );
! return it_base->is_in_root();
}
Index: file_system.h
===================================================================
RCS file: /cvsroot/massiv/massiv/src/core/filesys/file_system.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** file_system.h 19 Feb 2003 01:18:31 -0000 1.5
--- file_system.h 2 Mar 2003 21:33:55 -0000 1.6
***************
*** 26,140 ****
namespace Core {
! namespace Test { class FsEnumerationTest; }
/**
! * Provides interface to enable platform independent traversing through
! * arbitrary filesystem directory graph. This interface is implemented
! * by architecture-dependend class in the arch directory.
! *
! * @code
! * {
! * FileSystem::iterator it( FileSystem::open_directory( "../dir", "*" ) );
! * // Note that components of paths are always separated using '/'.
! * // However, absolute path specification might still be different
! * // on Windows and Linux (c:/temp or /tmp, respectively).
! * // Fixme: Is it worth to separate components by '\' on Windows?
! *
! * while( it.is_valid() )
! * {
! * if( it.is_directory() )
! * {
! * std::cout << it.name() << "\t\tDIR" << std::endl;
! * }
! * else
! * {
! * std::cout << it.name() << "\t\t" << it.size() << std::endl;
! * }
! *
! * it++;
! * }
! * } // Iterator's binding with '../dir' is abolished here
! * @endcode
! *
! * @note If files or directories are created or deleted while the
! * iterator is valid, it is not ensured that the newly created
! * items will be also enumerated or that the deleted ones won't
! * be enumerated even after deleting.
*/
! class FileSystem
{
- public:
-
class FileSystemIterator;
! class FileSystemIteratorArch;
typedef FileSystemIterator iterator;
- private:
-
- /* This class should be never constructed. */
- NO_DEFAULT_CONSTRUCTOR( FileSystem );
- NO_COPY_CONSTRUCTOR( FileSystem );
- NO_ASSIGNMENT_OPERATOR( FileSystem );
-
- public:
-
- /**
- * Returns iterator bound with the actual directory and the given
- * mask. This iterator can be used for enumerating files in the
- * actual directory.
- * @param mask Mask describing files that should be enumerated. May
- * contain wildcards, i.e. * and ?.
- */
- static FileSystemIterator open_current_directory
- (
- const std::string & mask
- );
-
- /**
- * Returns iterator bound with a given directory and mask that can be
- * used for enumerating files in the directory.
- * @param path Path specifying the directory to be open.
- * @param mask Mask describing files that should be enumerated. May
- * contain wildcards, i.e. * and ?.
- *
- * @return Iterator bound with the specified path and mask.
- */
- static FileSystemIterator open_directory
- (
- const std::string & path,
- const std::string & mask
- );
-
- /**
- * @return Path to the current (actual) directory in a string.
- */
- static std::string get_current_directory();
-
- /**
- * Changes current directory.
- * @param path Specifies the prospective actual directory. Absolute or
- * relative.
- *
- * @exception ExCannotChangeDirectory Wrong or non-existent directory
- * name was given.
- */
- static void set_current_directory
- (
- const std::string & path
- );
-
- /**
- * Normalizes path, i.e. ensures that all slashes are turned into
- * backslashes and that the path is concluded with '\'.
- * @param path The path to be normalized.
- */
- static void normalize_path
- (
- std::string & path
- );
-
- public:
/**@enum EDirectoryDeleteMode
--- 26,42 ----
namespace Core {
! namespace Test { class FsEnumerationTest; class VolumeEnumerationTest; }
/**
! * Contains common definitions and interfaces for all file system iterators.
*/
! namespace FileSystem
{
class FileSystemIterator;
! class FileSystemIteratorBase;
typedef FileSystemIterator iterator;
/**@enum EDirectoryDeleteMode
***************
*** 154,201 ****
}; // enum DirectoryDeleteMode
- public:
-
- /**
- * Creates directory given by a specified path. If more directories
- * contained in the path don't exist, all of the will be created.
- *
- * @param path Specifies a directory to be created. Can be either
- * absolute or relative (taken relatively to the actual directory).
- *
- * @note If more directories has to be created, no atomicity is
- * ensured (some of the directories may be created and others
- * not if some error occures).
- */
- static void create_directory
- (
- const std::string & path
- );
- /**
- * Deletes directory given by a specified path.
- * @param path Specifies a directory to be deleted. Can be either
- * absolute or relative (taken relatively to the actual directory).
- * @param mode Specifies whether the directory should be deleted even
- * if it contains some other directories or files. Its values
- * may be:
- * <ul>
- * <li><b>FileSystem::DELETE_DIRS_RECURSIVE:</b> If the deleted
- * directory contains other directories, they will be deleted
- * recursively. However, directories containing one or more
- * 'regular' files will not be deleted.
- * <li><b>FileSystem::DELETE_ALL_RECURSIVE:</b> The directory will
- * be deleted even with all subdirectories and contained files.
- * <li><b>FileSystem::DELETE_EMPTY:</b> The directory will be
- * deleted only if it is empty.
- * </ul>
- * @exception ExNotADirectory @c path does not specify a directory.
- */
- static void delete_directory
- (
- const std::string & path,
- DirectoryDeleteMode mode = DELETE_EMPTY
- );
! public:
/**
--- 56,63 ----
}; // enum DirectoryDeleteMode
! // FileSystemIterator interface definition
! // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
***************
*** 207,210 ****
--- 69,73 ----
{
friend class Massiv::Core::Test::FsEnumerationTest;
+ friend class Massiv::Core::Test::VolumeEnumerationTest;
public:
***************
*** 225,229 ****
FileSystemIterator
(
! FileSystemIteratorArch * it
);
--- 88,92 ----
FileSystemIterator
(
! FileSystemIteratorBase * it
);
***************
*** 463,466 ****
--- 326,330 ----
*
* @exception ExInvalidFsIterator Iterator is invalid.
+ * @exception ExCannotCreateDirectory
*
* @note If more directories has to be created, no atomicity is
***************
*** 505,509 ****
* @exception ExInvalidFsIterator Iterator is invalid.
*/
! inline const char * const get_absolute_directory();
/**
--- 369,373 ----
* @exception ExInvalidFsIterator Iterator is invalid.
*/
! inline std::string get_absolute_directory();
/**
***************
*** 516,529 ****
private:
! FileSystemIteratorArch * it_arch;
/**< Points actualy to the FileSystemIteratorWin32 or
! FileSystemIteratorUnix, according to platform.<br>
! Invariant: @a it_arch must always contain an address
! of an instance of FileSystemIteratorArch descendant! */
}; // class FileSystemIterator
- public:
/**
* Represents a "pointer" to a specific point of the filesystem
--- 380,396 ----
private:
! FileSystemIteratorBase * it_base;
/**< Points actualy to the FileSystemIteratorWin32 or
! FileSystemIteratorUnix (according to platform), or
! even it can point to some other implementation class
! for any obscure filesystem :)<br> */
}; // class FileSystemIterator
+
+ // FileSystemIteratorBase interface definition
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
/**
* Represents a "pointer" to a specific point of the filesystem
***************
*** 531,537 ****
* about the item and traversing through the directory structure.
*/
! class FileSystemIteratorArch
{
friend class Massiv::Core::Test::FsEnumerationTest;
public:
--- 398,405 ----
* about the item and traversing through the directory structure.
*/
! class FileSystemIteratorBase
{
friend class Massiv::Core::Test::FsEnumerationTest;
+ friend class Massiv::Core::Test::VolumeEnumerationTest;
public:
***************
*** 540,544 ****
* Default constructor. Initializes the iterator as invalid.
*/
! FileSystemIteratorArch();
/**
--- 408,412 ----
* Default constructor. Initializes the iterator as invalid.
*/
! FileSystemIteratorBase();
/**
***************
*** 548,552 ****
* directory of this process.
*/
! FileSystemIteratorArch
(
const std::string & mask
--- 416,420 ----
* directory of this process.
*/
! FileSystemIteratorBase
(
const std::string & mask
***************
*** 558,562 ****
* exist.
*/
! FileSystemIteratorArch
(
const std::string & path,
--- 426,430 ----
* exist.
*/
! FileSystemIteratorBase
(
const std::string & path,
***************
*** 569,577 ****
* Destructor.
*/
! virtual ~FileSystemIteratorArch();
private:
! NO_ASSIGNMENT_OPERATOR( FileSystemIteratorArch );
public:
--- 437,445 ----
* Destructor.
*/
! virtual ~FileSystemIteratorBase();
private:
! NO_ASSIGNMENT_OPERATOR( FileSystemIteratorBase );
public:
***************
*** 622,626 ****
* @exception ExInvalidFsIterator Iterator is invalid.
*/
! virtual FileSystemIteratorArch * next() = 0;
/**
--- 490,494 ----
* @exception ExInvalidFsIterator Iterator is invalid.
*/
! virtual FileSystemIteratorBase * next() = 0;
/**
***************
*** 633,637 ****
* the directory the iterator had been bound with.
*/
! virtual FileSystemIteratorArch * rewind() = 0;
public:
--- 501,505 ----
* the directory the iterator had been bound with.
*/
! virtual FileSystemIteratorBase * rewind() = 0;
public:
***************
*** 651,655 ****
* the directory the iterator had been pointing to.
*/
! virtual FileSystemIteratorArch * enter() = 0;
/**
--- 519,523 ----
* the directory the iterator had been pointing to.
*/
! virtual FileSystemIteratorBase * enter() = 0;
/**
***************
*** 663,667 ****
* the directory the iterator had been pointing to.
*/
! virtual FileSystemIteratorArch * descend() = 0;
/**
--- 531,535 ----
* the directory the iterator had been pointing to.
*/
! virtual FileSystemIteratorBase * descend() = 0;
/**
***************
*** 679,683 ****
* the directory the iterator had been pointing to.
*/
! virtual FileSystemIteratorArch * leave() = 0;
/**
--- 547,551 ----
* the directory the iterator had been pointing to.
*/
! virtual FileSystemIteratorBase * leave() = 0;
/**
***************
*** 689,693 ****
* the directory the iterator had been pointing to.
*/
! virtual FileSystemIteratorArch * ascend() = 0;
public:
--- 557,561 ----
* the directory the iterator had been pointing to.
*/
! virtual FileSystemIteratorBase * ascend() = 0;
public:
***************
*** 741,744 ****
--- 609,613 ----
*
* @exception ExInvalidFsIterator Iterator is invalid.
+ * @exception ExCannotCreateDirectory
*
* @note If more directories has to be created, no atomicity is
***************
*** 773,777 ****
* @exception ExInvalidFsIterator Iterator is invalid.
*/
! virtual const char * const get_absolute_directory() const = 0;
/**
--- 642,646 ----
* @exception ExInvalidFsIterator Iterator is invalid.
*/
! virtual std::string get_absolute_directory() const = 0;
/**
***************
*** 801,809 ****
directory. */
- std::string path;
- /**< Path that was given for binding the iterator with a
- directory. Before storing the path here, all '/' are
- converted to '\\' and the path is terminated by '\\'. */
-
std::string mask;
/**< Mask for filtering files. */
--- 670,673 ----
***************
*** 816,825 ****
to 0, the object will delete itself. */
! }; // class FileSystemIteratorArch
! }; // class FileSystem
! }; // namespace Core
}; // namespace Massiv
--- 680,689 ----
to 0, the object will delete itself. */
! }; // class FileSystemIteratorBase
! }; // namespace FileSystem
! }; // namespace Massiv::Core
}; // namespace Massiv
Index: file_system.cpp
===================================================================
RCS file: /cvsroot/massiv/massiv/src/core/filesys/file_system.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** file_system.cpp 19 Feb 2003 01:18:32 -0000 1.3
--- file_system.cpp 2 Mar 2003 21:33:56 -0000 1.4
***************
*** 28,35 ****
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FileSystem::FileSystemIterator::FileSystemIterator
(
! FileSystemIteratorArch * it
! ) : it_arch( it )
{
it->add_ref();
--- 28,41 ----
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ FileSystem::FileSystemIterator::FileSystemIterator()
+ : it_base( NULL )
+ {
+ }
+
+
FileSystem::FileSystemIterator::FileSystemIterator
(
! FileSystemIteratorBase * it
! ) : it_base( it )
{
it->add_ref();
***************
*** 40,46 ****
(
const FileSystemIterator & src
! ) : it_arch( src.it_arch )
{
! src.it_arch->add_ref();
}
--- 46,52 ----
(
const FileSystemIterator & src
! ) : it_base( src.it_base )
{
! src.it_base->add_ref();
}
***************
*** 48,52 ****
FileSystem::FileSystemIterator::~FileSystemIterator()
{
! it_arch->release();
}
--- 54,61 ----
FileSystem::FileSystemIterator::~FileSystemIterator()
{
! if( it_base )
! {
! it_base->release();
! }
}
***************
*** 59,75 ****
bool result = true;
! if( it_arch->is_valid() && it.it_arch->is_valid() )
{
! if( strcmp
! (
! it_arch->get_absolute_directory(),
! it.it_arch->get_absolute_directory()
! )
! )
{
result = false;
}
else
! if( it_arch->name() != it.it_arch->name() )
{
result = false;
--- 68,92 ----
bool result = true;
! if( ( it_base == NULL ) || ( it.it_base == NULL ) )
{
! if( it_base == it.it_base )
! {
! result = true;
! }
! else
! {
! result = false;
! }
! }
! else
! if( it_base->is_valid() && it.it_base->is_valid() )
! {
! if( it_base->get_absolute_directory() !=
! it.it_base->get_absolute_directory() )
{
result = false;
}
else
! if( it_base->name() != it.it_base->name() )
{
result = false;
***************
*** 78,82 ****
else
{
! if( it_arch->is_valid() || it.it_arch->is_valid() )
{
// exactly one of the iterators is valid
--- 95,99 ----
else
{
! if( it_base->is_valid() || it.it_base->is_valid() )
{
// exactly one of the iterators is valid
***************
*** 90,99 ****
! // FileSystem::FileSystemIteratorArch implementation
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! FileSystem::FileSystemIteratorArch::FileSystemIteratorArch()
: valid_flag( false ),
- path( "" ),
mask( "" ),
ref_counter( 0 )
--- 107,115 ----
! // FileSystem::FileSystemIteratorBase implementation
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
! FileSystem::FileSystemIteratorBase::FileSystemIteratorBase()
: valid_flag( false ),
mask( "" ),
ref_counter( 0 )
***************
*** 102,106 ****
! FileSystem::FileSystemIteratorArch::FileSystemIteratorArch
(
const std::string & mask
--- 118,122 ----
! FileSystem::FileSystemIteratorBase::FileSystemIteratorBase
(
const std::string & mask
***************
*** 112,116 ****
! FileSystem::FileSystemIteratorArch::FileSystemIteratorArch
(
const std::string & path,
--- 128,132 ----
! FileSystem::FileSystemIteratorBase::FileSystemIteratorBase
(
const std::string & path,
***************
*** 123,127 ****
! FileSystem::FileSystemIteratorArch::~FileSystemIteratorArch()
{
assert( ref_counter <= 0 );
--- 139,143 ----
! FileSystem::FileSystemIteratorBase::~FileSystemIteratorBase()
{
assert( ref_counter <= 0 );
***************
*** 129,133 ****
! void FileSystem::FileSystemIteratorArch::add_ref()
{
ref_counter++;
--- 145,149 ----
! void FileSystem::FileSystemIteratorBase::add_ref()
{
ref_counter++;
***************
*** 135,139 ****
! void FileSystem::FileSystemIteratorArch::release()
{
ref_counter--;
--- 151,155 ----
! void FileSystem::FileSystemIteratorBase::release()
{
ref_counter--;
|