Advertisement
Guest User

Untitled

a guest
Apr 10th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.88 KB | None | 0 0
  1. struct DirIterator
  2. {
  3. private:
  4.     RefCounted!(DirIteratorImpl, RefCountedAutoInitialize.no) impl;
  5.     this(string pathname, SpanMode mode, bool followSymlink)
  6.     {
  7.         impl = typeof(impl)(pathname, mode, followSymlink);
  8.     }
  9. public:
  10.     @property bool empty(){ return impl.empty; }
  11.     @property DirEntry front(){ return impl.front; }
  12.     void popFront(){ impl.popFront(); }
  13.     int opApply(int delegate(ref string name) dg)
  14.     {
  15.         writeln("we're in oppapply");
  16.         foreach(DirEntry v; impl.refCountedPayload)
  17.         {
  18.             string s = v.name;
  19.             if(dg(s))
  20.                 return 1;
  21.         }
  22.         return 0;
  23.     }
  24.     int opApply(int delegate(ref DirEntry name) dg)
  25.     {
  26.         writeln("we're in oppapply");
  27.         foreach(DirEntry v; impl.refCountedPayload)
  28.             if(dg(v))
  29.                 return 1;
  30.         return 0;
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement