#ifndef FILEMGR_H #define FILEMGR_H /////////////////////////////////////////////////////////////////////////////////////// // FileMgr.h - Find all files on specified path or tree matching specified patterns // // // // Application: Project #1, CSE687 - Object Oriented Design, Spring 2014 // // Platform: Dell XPS 2720, Win 8.1, Visual Studio 2013 // // Author: Jim Fawcett, CST 4-187, Syracuse University // // (315) 443-3948, jfawcett@twcny.rr.com // /////////////////////////////////////////////////////////////////////////////////////// /* * Package Operations: * ------------------- * FileMgr uses the services of FileSystem to find files and stores its findings * efficiently in DataStore. * - Finds all files, matching a set of patterns, along with their paths. * - Stores each filename and path only once, using DataStore. * * User Interface: * changePath("/aPath"); * addPattern("*.h"); * search(); * * Required Files: * --------------- * FileMgr.h, FileMgr.cpp, FileSystem.h, FileSystem.cpp, * DataStore.h, DataStore.cpp, Utilities.h, Utilities.cpp * * Build Process: * -------------- * From the Visual Studio Developer's Command Prompt: * devenv VSHelp.sln /rebuild debug * * Maintenance History: * -------------------- * - Ver 1.0 : 1 Mar 2015 * first release */ #include #include #include #include #include class FileMgr { public: using Path = std::string; using Pattern = std::string; using Patterns = std::vector; using File = std::string; using Date = std::string; using DataStore = std::map>; FileMgr(const Path& path, DataStore& ds); bool changePath(const Path& path); void addPattern(const std::string& patt); void search(bool recurse = false); void find(const Path& path); std::string reformatDate(const Date& date); void display(); private: std::string randomString(); std::string keyFromDate(const Date& date); Date dateFromKey(const std::string& key); Path path_; Patterns patterns_; DataStore& store_; }; #endif