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 }
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
Definition: wvstring.h:93
bool isnull() const
returns true if this string is null
Definition: wvstring.h:290
WvGlob()
Construct an empty glob object.
Definition: wvglob.cc:9