#ifndef FILESTOR_H #define FILESTOR_H ///////////////////////////////////////////////////////////////////// // fileStor.h - Store and retrieve files and their associated // // ver 1.0 paths. Store each unique file and path only // // once. // // Language: Visual C++ ver 6.0 // // Platform: Micron dual pentium pro 200, Windows NT 4.0 // // Application: CRI_OOD, S'99, Project #2 example. // // Author: Jim Fawcett, CST 2-187, Syracuse University // // (315) 443-3948, fawcett@ecs.syr.edu // ///////////////////////////////////////////////////////////////////// /* Class Operations: ================= The file store class stores files and paths, saving only one unique copy of each. Files are stored in a map with file name key and an associated list of iterators pointing to the corresponding paths on which that file name can be found. Paths are stored in a set and the file's iterator list holds iterators on that set. Public Interface: ================= fileStor fs; // construct an empty fileStor object fs.add("file1","path1"); // add file name and its path to store int num = fs.files(); // return number of unique files in fileMap int num = fs.paths(); // return number of unique paths in pathSet fs.display(); // show each file and its paths fileMap fm = fs.FileMap(); // return fileMap pathSet ps = fs.PathSet(); // return pathSet ///////////////////////////////////////////////////////////////////// // Build Process // ///////////////////////////////////////////////////////////////////// // Required Files: // // fileStor.h, fileStor.cpp // // // // Command Line Compiler Invocation: // // cl /GX /DTEST_FILESTOR fileStor.cpp // ///////////////////////////////////////////////////////////////////// Maintenance History: ==================== ver 1.0, 27 April 1999 - first release */ // #pragma warning(disable : 4786) #pragma warning(disable : 4503) // dangerous #include #include #include #include typedef std::set< std::string > pathSet; typedef std::list itrList; typedef std::map< std::string, itrList > fileMap; class fileStor { public: virtual ~fileStor(); fileStor& add(const std::string &file, const std::string &path); virtual void display(); virtual void showFiles(); virtual void showPaths(); long int files(); long int paths(); fileMap& FileMap(); pathSet& PathSet(); protected: fileMap _files; pathSet _paths; }; inline fileStor::~fileStor() { } inline long int fileStor::files() { return _files.size(); } inline long int fileStor::paths() { return _paths.size(); } inline fileMap& fileStor::FileMap() { return _files; } inline pathSet& fileStor::PathSet() { return _paths; } #endif