platform_fs.h

00001 //
00002 // C++ Interface: platform_fs
00003 //
00004 // Description:
00005 //
00006 //
00007 // Author: André Simon <andre.simon1@gmx.de>, (C) 2004
00008 //
00009 // Copyright: See COPYING file that comes with this distribution
00010 //
00011 //
00012 #ifndef PLATFORM_FS__H__INCLUDED
00013 #define PLATFORM_FS__H__INCLUDED
00014 
00015 #include <string>
00016 #include <iostream>
00017 #include <vector>
00018 
00019 #ifdef USE_FN_MATCH
00020   #include <fnmatch.h>
00021 #endif
00022 
00023 namespace Platform
00024 {
00025         extern const char pathSeparator;
00026         //extern const std::string pathSeparatorStr;
00027 
00028         std::string getAppPath();
00029 
00033         bool getDirectoryEntries(std::vector<std::string> &fileList,
00034                            std::string wildcard,
00035                            bool recursiveSearch=false);
00036 
00037 #ifdef USE_FN_MATCH
00038   struct FnMatcher
00039   {
00040     FnMatcher(const char* pattern, int flags)
00041         : pattern_(pattern)
00042         , flags_(flags)
00043     {}
00044     bool operator()(const std::string& e) const {
00045           //  std::cout << "pattern: "<<pattern_<<  "   entry: "<<e.c_str()<< "  Res fn: " <<::fnmatch(pattern_, e.c_str(), FNM_PATHNAME)<< " \n";
00046         return ! ::fnmatch(pattern_, e.c_str(), flags_);
00047     }
00048    private:
00049     const char* pattern_;
00050     int flags_;
00051   };
00052 #endif
00053 }
00054 #endif

Generated on Fri Apr 27 13:12:36 2007 for Highlight Code Converter by  doxygen 1.5.2