SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWDirectoryIterator< RWCString > Struct Reference

Provides a specialization of the class template for RWCString, with recursive iteration of subdirectories. More...

#include <rw/directory.h>

Inherits RWHandle.

Public Types

typedef RWCString value_type
 

Public Member Functions

 RWDirectoryIterator ()
 
 RWDirectoryIterator (const char *cs, int depth=0)
 
 RWDirectoryIterator (const RWDirectoryIterator &it)
 
 RWDirectoryIterator (RWDirectoryIterator &&it)
 
 ~RWDirectoryIterator ()
 
value_typeoperator* () const
 
RWDirectoryIteratoroperator++ ()
 
RWDirectoryIterator operator++ (int)
 
RWDirectoryIteratoroperator= (const RWDirectoryIterator &)
 
RWDirectoryIteratoroperator= (RWDirectoryIterator &&it)
 
void swap (RWDirectoryIterator &it)
 

Private Member Functions

RWDirectoryRecursiveIteratorImp & body ()
 
const RWDirectoryRecursiveIteratorImp & body () const
 

Friends

bool operator!= (const RWDirectoryIterator< RWCString > &, const RWDirectoryIterator< RWCString > &)
 
bool operator== (const RWDirectoryIterator< RWCString > &, const RWDirectoryIterator< RWCString > &)
 

Detailed Description

The Essential Tools library provides two specializations of the class template: this class, RWDirectoryIterator<RWCString>, for RWCString with recursive iteration of subdirectories; and RWDirectoryIterator<const char*> for const char* which acts like a flat iterator , i.e. no iteration of subdirectories. Neither follow symbolic links.

Both iterators are refinements of the Input Iterator concept. One limitation is that they are usable only in single-pass algorithms.

The nature of the API for manipulating files and directories requires special attention to synchronization issues. These classes are:

  • Assignable
  • Copy Constructible
  • Equality Comparable
Synopsis
#include <rw/directory.h>
RWDirectoryIterator<RWCString> it;
Persistence
None

Member Typedef Documentation

◆ value_type

typedef RWCString RWDirectoryIterator< RWCString >::value_type

Typedef for the type on which self is specialized.

Constructor & Destructor Documentation

◆ RWDirectoryIterator() [1/4]

RWDirectoryIterator< RWCString >::RWDirectoryIterator ( )

Constructs an iterator that compares equal with any past-the-end iterator.

◆ RWDirectoryIterator() [2/4]

RWDirectoryIterator< RWCString >::RWDirectoryIterator ( const char * cs,
int depth = 0 )
explicit

Constructs an iterator over the content of the directory name passed as argument cs. The depth argument controls how deep to iterate within the directory hierarchy. The default is to behave as a flat iterator. Passing an argument value of -1 iterates to the full depth of the hierarchy.

Exceptions
RWInternalError one of its derived types, thrown if the argument is not a directory.

◆ RWDirectoryIterator() [3/4]

RWDirectoryIterator< RWCString >::RWDirectoryIterator ( const RWDirectoryIterator< RWCString > & it)

Constructs an iterator that is a copy of the iterator passed as the argument. Dereferencing each iterator yields identical results, yet they will not compare equal. See the equality comparison operators.

◆ RWDirectoryIterator() [4/4]

RWDirectoryIterator< RWCString >::RWDirectoryIterator ( RWDirectoryIterator< RWCString > && it)

Move constructor. The constructed iterator takes ownership of the data owned by it.

Condition:
This method is available only on platforms with rvalue reference support.

◆ ~RWDirectoryIterator()

Destroys the object.

Member Function Documentation

◆ body() [1/2]

RWDirectoryRecursiveIteratorImp & RWDirectoryIterator< RWCString >::body ( )
private

Returns a reference to the underlying implementation type.

◆ body() [2/2]

const RWDirectoryRecursiveIteratorImp & RWDirectoryIterator< RWCString >::body ( ) const
private

Returns a reference to the underlying implementation type.

◆ operator*()

value_type & RWDirectoryIterator< RWCString >::operator* ( ) const

Dereferencing operator. Returns the file name.

◆ operator++() [1/2]

Prefix increment operator. Returns a reference to this object.

◆ operator++() [2/2]

Postfix increment operator. Returns an iterator that points to the entry previous to the increment operation.

◆ operator=() [1/2]

Assignment operator. Performs the assignment of the value of the argument. Note that the objects will not compare equal unless they are both past-the-end iterators.

◆ operator=() [2/2]

Move assignment. Self takes ownership of the data owned by it.

Condition:
This method is available only on platforms with rvalue reference support.

◆ swap()

Swaps the data owned by self with the data owned by it.

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const RWDirectoryIterator< RWCString > & ,
const RWDirectoryIterator< RWCString > &  )
friend

Inequality operator. Equivalent to logical negation of corresponding equality operator.

◆ operator==

bool operator== ( const RWDirectoryIterator< RWCString > & ,
const RWDirectoryIterator< RWCString > &  )
friend

Equality operator. Tests equality between the two RWDirectoryIterator<RWCString> objects passed as parameters. Only past-the-end iterators compare equal.

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.