/////////////////////////////////////////////////////////////////////// // Test.h - Test file for CSE687 - Project 3 - Spring 2008 // // ver 1.0 // // Language: Visual C++, ver 5.0 // // Platform: Dell Dimension 8300, Windows XP Pro, SP1 // // Application: CSE687 Project 3 - Test File, Spring 2004 // // Author: CSE687 TAs, Syracuse University // // nsaxena@syr.edu // /////////////////////////////////////////////////////////////////////// ///////////////////////// PUBLIC INTERFACE //////////////////////////// /* Test.h: Contains two global functions template void getFiles(std::string lStrPath, V &lFilesCont) - This is a templatized function which expects a directory path and an STL container (vector / list)as a parameter. The function scans the directory for the list of files and stores them in the provided STL contanier. void getFilesRecursive(std::string lStrPath, std::list> &lListFiles) - This is a generic global function which expects a directory path and a list> as a parameter. The function scans each of the sub-directories for the list of files and stores them in a vector. These vector are then added to the list data-structure. */ ///////////////////////// VERSION HISTORY //////////////////////////// // ver 1.0 - Released 03/30/2008 /* Header Files */ #include "FileInfo.h" #include #include #include #include /* @name: getFiles @param: std::string &lStrPath, STL Container @return: void @desc: Scans the input directory (lStrPath) and stores the name of files in the provided STL container (passed by ref). */ template void getFiles(std::string lStrPath, V &lFilesCont) { try { fileInfo lFileObj; std::string lStrCurrDir; /* String the Old Directory Path */ lStrCurrDir = lFileObj.getPath(); /* Setting the directory path */ lFileObj.setPath(lStrPath); if(!lFileObj.firstFile("*.*")) return; while(lFileObj.nextFile()) if(!lFileObj.isDirectory()) lFilesCont.push_back(lFileObj.name()); /* Restoring the Old Path */ lFileObj.setPath(lStrCurrDir); } catch(std::exception& e) { std::cout<<"\nException in getFiles :: "<