57 theDirectoryName(dirname),
78 theDirectoryName = dirname;
80 return (dirname.
isDir());
92 struct _finddata_t c_file;
96 if( (
theData = _findfirst( dirName.
c_str(), &c_file )) != 0L )
100 temp = theDirectoryName.dirCat(c_file.name);
103 while (!fileMatched(temp))
106 if (_findnext(
theData, &c_file ) == 0 )
108 temp = theDirectoryName.dirCat(c_file.name);
120 filename = temp.
trim();
122 return (filename!=
"");
127 struct _finddata_t c_file;
128 bool matches =
false;
134 if (_findnext(
theData, &c_file ) == 0 )
136 temp = theDirectoryName.
dirCat(c_file.name);
137 matches = fileMatched(temp);
150 filename = temp.
trim();
153 return (matches&&(filename!=
""));
156 bool ossimDirectory::fileMatched(
ossimFilename &filename)
const 158 bool matches =
false;
161 if ( (filename.
file() ==
"..") || (filename.
file() ==
".") )
182 return theDirectoryName.isDir();
281 std::vector<ossimFilename>& result,
282 bool bExcludeExactMatch )
284 bool bSuccess =
false;
286 bool bFoundCandidate =
getFirst( candidate );
287 int compareSize =
static_cast<int>( filename.
length() );
289 while( bFoundCandidate ==
true )
293 bool bFoundEquivalent = _strnicmp( filename.
c_str(), candidate.
c_str(),
294 compareSize ) == 0 ?
true :
false;
298 bool bFoundEquivalent = strncasecmp( filename.
c_str(), candidate.
c_str(),
299 compareSize ) == 0 ?
true :
false;
302 if ( bFoundEquivalent ==
true )
304 bool bFoundExact = ( filename == candidate.
c_str() ) ?
true :
false;
305 bool bShouldExclude = ( bFoundExact ==
true &&
306 bExcludeExactMatch ==
true ) ?
true :
false;
308 if ( bShouldExclude ==
false )
311 result.push_back( candidate );
315 bFoundCandidate =
getNext( candidate );
void clear()
Erases the entire container.
bool getFirst(ossimFilename &filename, int flags=OSSIM_DIR_DEFAULT)
void findAllFilesThatMatch(std::vector< ossimFilename > &result, const ossimString ®ularExpressionPattern, int flags=OSSIM_DIR_DEFAULT)
bool getNext(ossimFilename &filename) const
void push_back(char c)
Equivalent to insert(end(), c).
std::string::size_type length() const
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
void compile(const char *)
bool open(const ossimFilename &dir)
ossimFilename dirCat(const ossimFilename &file) const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
ossimFilename file() const
bool read(ossimFilename &filename)
ossimDirectoryData * theData
bool findCaseInsensitiveEquivalents(const ossimFilename &filename, std::vector< ossimFilename > &result, bool bExcludeExactMatch=true)