As anticipated, winstl::basic_findfile_sequence, which is described in detail in Extended STL, volume 1, now defines, and responds to, the member constant throwOnAccessFailure. In the case of an access failure an instance of winstl::access_exception is thrown.
This allows for better response in cases where access may be denied.
Musings of an STL-extension library designer (who's renowned for producing high-quality software with low-quality documentation).
Showing posts with label findfile_sequence. Show all posts
Showing posts with label findfile_sequence. Show all posts
Tuesday, January 12, 2010
Saturday, November 21, 2009
STLSoft 1.9.88 imminent
I'm just preparing a new release of recls, and in the process have needed to enhance winstl::basic_findfile_sequence, adding a new throwOnAccessFailure flag, which (as should be obvious from the name), causes an exception to be thrown in the event of access failure. This will allow consistent behaviour between recls (C/C++) and the new recls 100% .NET library.
Friday, May 15, 2009
Catching up with developments ... 1.9.82
I've been lax in the blogging - too much to do, too little time - but will try and catch up.
The latest release includes a fix to allow winstl::findfile_sequence - a facade over the FindFirstFile/FindNextFile API to be used with std::copy and the IOStreams, as in:
#include <stlsoft/iterators/ostream_iterator.hpp>
#include <winstl/filesystem/findfile_sequence.hpp>
#include <iostream>
#include <stdlib.h>
int main()
{
typedef winstl::findfile_sequence seq_t;
{ // 1. enumerate all contents (except dots dirs)
seq_t entries("*.*");
std::cout << "\n1:\n";
std::copy( entries.begin(), entries.end()
, stlsoft::ostream_iterator<seq_t::value_type>(std::cout, "\t", "\n"));
}
{ // 2. enumerate all contents (including dots dirs)
seq_t entries("*.*", seq_t::includeDots);
std::cout << "\n2:\n";
std::copy( entries.begin(), entries.end()
, stlsoft::ostream_iterator<seq_t::value_type>(std::cout, "\t", "\n"));
}
{ // 3. enumerate all files, displaying only the relative path
seq_t files("*.*", seq_t::files | seq_t::relativePath);
std::cout << "\n3:\n";
std::copy( files.begin(), files.end()
, stlsoft::ostream_iterator<seq_t::value_type>(std::cout, "\t", "\n"));
}
{ // 4. enumerate all directories
seq_t directories("*.*", seq_t::directories);
std::cout << "\n4:\n";
std::copy( directories.begin(), directories.end()
, stlsoft::ostream_iterator<seq_t::value_type>(std::cout, "\t", "\n"));
}
{ // 5. enumerate all files beginning with 'f' and with either extension .h or .hpp
seq_t files("f*.h|f*.hpp", '|', seq_t::files);
std::cout << "\n5:\n";
std::copy( files.begin(), files.end()
, stlsoft::ostream_iterator<seq_t::value_type>(std::cout, "\t", "\n"));
}
{ // 6. enumerate all .exe files in the windows directory and all dlls in the system directory that begin with 'm', skipping any hidden files
seq_t files("C:\\windows", "*.exe;system32/m*.dll", ';', seq_t::files | seq_t::skipHiddenFiles);
std::cout << "\n6:\n";
std::copy( files.begin(), files.end()
, stlsoft::ostream_iterator<seq_t::value_type>(std::cout, "\t", "\n"));
}
return EXIT_SUCCESS;
}
/* ///////////////////////////// end of file //////////////////////////// */
Subscribe to:
Posts (Atom)