Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ippTestFolder.cpp

Go to the documentation of this file.
00001 // 
00002 // DISCLAIMER: 
00003 //  This software was produced by the National Institute of Standards 
00004 //  and Technology (NIST), an agency of the U.S. government, and by statute is 
00005 //  not subject to copyright in the United States.  Recipients of this 
00006 //  software assume all responsibility associated with its operation,
00007 //  modification,maintenance, and subsequent redistribution. 
00008 //
00009 //  See NIST Administration Manual 4.09.07 b and Appendix I. 
00010 #include "ippTestFolder.h"
00011 
00012 #include "shlwapi.h"
00013 #pragma comment(lib,"shlwapi.lib")
00014 #include "windows.h"
00015 
00016 
00017 
00018 std::string test_file_folder()
00019 {
00020   TCHAR szFolder[MAX_PATH];
00021   // get this executable file name 
00022   ::GetModuleFileName(NULL,szFolder,MAX_PATH);
00023   ::PathRemoveFileSpec(szFolder);
00024   ::PathRemoveFileSpec(szFolder);
00025   ::PathAppend(szFolder,"I++test_files");
00026   return szFolder;
00027 }
00028 
00029 
00030 ippTestFolder::ippTestFolder()
00031   : _hFindFile(INVALID_HANDLE_VALUE)
00032 {
00033 
00034 }
00035 
00036 ippTestFolder::~ippTestFolder()
00037 {
00038   if (_hFindFile!= INVALID_HANDLE_VALUE){
00039     FindClose(_hFindFile);
00040   }
00041 }
00042 
00043 bool ippTestFolder::find_first_file(const char* folder,const char* filepattern)
00044 {
00045   _folder = folder;
00046   TCHAR buffer[MAX_PATH];
00047   memcpy(buffer,_folder.c_str(),_folder.length()+1);
00048   ::PathAppend(buffer,filepattern);
00049   _hFindFile = FindFirstFile(buffer,&_data);
00050  return (_hFindFile!= INVALID_HANDLE_VALUE);
00051 }
00052 
00053 std::string ippTestFolder::current_filename() const
00054 {
00055   if (_hFindFile== INVALID_HANDLE_VALUE) return "";
00056 
00057   TCHAR buffer[MAX_PATH];
00058   memcpy(buffer,_folder.c_str(),_folder.length()+1);
00059   ::PathAppend(buffer,_data.cFileName);
00060   return buffer;
00061 }
00062 
00063 bool ippTestFolder::next()
00064 {
00065   if (!FindNextFile(_hFindFile,&_data) ) {
00066     return false;
00067   }
00068   return true;
00069 }

Generated on Wed Nov 8 00:20:09 2006 for IPPDME by  doxygen 1.4.1