WvStreams
wvglobdiriter.cc
1 /*
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4  *
5  * Globbing directory iterator.
6  *
7  */
8 
9 #include "wvglobdiriter.h"
10 #include "wvglob.h"
11 
12 WvGlobDirIter::WvGlobDirIter( WvStringParm dirname, WvStringParm glob_str,
13  bool _recurse, bool _skip_mounts, size_t sizeof_stat )
14  : WvDirIter(dirname, _recurse, _skip_mounts, sizeof_stat), glob(NULL)
15 {
16  if (!glob_str.isnull())
17  {
18  glob = new WvGlob(glob_str);
19  if (!glob->isok())
20  {
21  delete glob;
22  glob = NULL;
23  }
24  }
25 }
26 
27 WvGlobDirIter::~WvGlobDirIter()
28 {
29  if (glob) delete glob;
30 }
31 
32 bool WvGlobDirIter::next()
33 {
34  bool result;
35 
36  do
37  {
38  result = WvDirIter::next();
39  } while (result && glob && !glob->match(ptr()->relname));
40 
41  return result;
42 }
WvGlob::WvGlob
WvGlob()
Construct an empty glob object.
Definition: wvglob.cc:9
WvDirIter
Definition: wvdiriter.h:31
WvRegex::match
bool match(WvStringParm string, WVREGEX_REGS_DECL) const
Match a given string against the compiled regular expression.
Definition: wvregex.h:183