NAME
OTC_Directory -
Iterator interface to system directory routines.
SYNOPSIS
#include <OTC/files/directry.hh>
class OTC_Directory
{
public:
static os_typespec* get_os_typespec();
OTC_Directory(OTC_String const& theName);
OTC_Directory(OTC_Directory const& theDir);
inline OTC_Directory& operator=(OTC_String const& theName);
inline OTC_Directory& operator=(OTC_Directory const& theDir);
inline OTC_String const& name() const;
OTC_Boolean isSearchable() const;
OTC_Iterator<OTC_String> files() const;
OTC_Iterator<OTC_String> files(char const* thePattern) const;
};
CLASS TYPE
Concrete
DESCRIPTION
The OTC_Directory class is a wrapper around the opendir(3),
readdir(3) system calls.
INITIALISATION
OTC_Directory(OTC_String const& theName);
Creates an instance of this class for the
directory theName. Note that theName
is used as is, ie. leading and trailing
whitespace is not removed. If this is
required it should be done before hand.
OTC_Directory(OTC_Directory const& theDir);
Creates another class for the directory
theDir.
inline OTC_Directory& operator=(OTC_String const& theName);
Initialises this directory to now
reference the directory given by
theName.
inline OTC_Directory& operator=(OTC_Directory const& theDir);
Initialises this directory to now
reference the directory given by
theDir.
QUERY
inline OTC_String const& name() const;
Returns the name of the directory.
OTC_Boolean isSearchable() const;
Returns OTCLIB_TRUE if the file named by
the string to the constructor is actually
a directory and that the directory exists
and is searchable. This is determined by
trying to open it as a directory.
FILES
OTC_Iterator<OTC_String> files() const;
Returns an iterator over a snapshot of the
names of the files in this directory. Any
changes made to the directory while this
iterator is active will not be reflected
in the iterator. If the directory is not
searchable then a null iterator is
returned.
OTC_Iterator<OTC_String> files(char const* thePattern) const;
Returns an iterator over a snapshot of the
names of the files in this directory which
match the glob pattern thePattern. Any
changes made to the directory while this
iterator is active will not be reflected
in the iterator. If the directory is not
searchable then a null iterator is
returned.
LIBRARY
OTC
AUTHOR(S)
Graham Dumpleton
COPYRIGHT
Copyright 1991 1992 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED