#ifndef NAV_H #define NAV_H /////////////////////////////////////////////////////////////// // nav.h -- recursively walk a directory tree // // ver 1.2 starting at a specified path // // // // Language: Visual C++, ver 5.0 // // Platform: Micron Dual Pentium 200, Windows NT 4.0 // // Application: CSE687 Project #1, S98 // // Author: Jim Fawcett, CST 2-187, (315) 443-3948 // // fawcett@neptune.syr.edu // /////////////////////////////////////////////////////////////// /* Manual Page ----------- class navig Operations: ----------------------- The navig class walks a directory (sub)tree. Root of the walk is passed to member function start. The root can be any valid path including "." and ".." navig nav; construct a navigator object dProc *pDisp = new userProc; create a user-defined display object publically derived from dProc nav.use(pDisp); use a user-defined display object nav.start(root); start a recursive walk at root When the walk is completed the starting directory will be restored. */ /////////////////////////////////////////////////////////////// // maintenance page // /////////////////////////////////////////////////////////////// // Build Process // // // // Files Required: // // nav.h, nav.cpp // // // // Building with Visual C++ , ver 5.0, from command line: // // cl -GX -DTEST_NAV nav.cpp // // // /////////////////////////////////////////////////////////////// /* Maintenance History =================== ver 1.2 : 27 Apr 99 - cosmetic changes to these pages ver 1.1 : 22 Apr 99 - cosmetic changes to walk and start functions ver 1.0 : 30 Jan 98 - first release */ // /////////////////////////////////////////////////////////////// // Declarations // /////////////////////////////////////////////////////////////// #include #include using namespace std; //----< default display processor >---------------------------- class dProc { public: virtual ~dProc() { } virtual void dirsProc(const char *dir); virtual void fileProc(const WIN32_FIND_DATA *fd); }; //----< directory navigator >---------------------------------- class navig { public: navig(); // save user's dir ~navig(); // restore user's dir void use(dProc *dp); // replace display proc'r void start(string dir); // start dir navigation private: string userDir; // user's working directory dProc *p; // provides extendable displays void walk(const string &dir); // directory walker }; #endif