|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2004-10-26 13:54:38
At 02:10 PM 10/25/2004, Peter Dimov wrote:
>... I certainly wouldn't mind a filesystem
>_warning_ for nonportable paths, if we find a suitable delivery
mechanism.
Interesting! A fresh perspective.
Let's see what can be done within the current design. A adaptor function
could intercept what otherwise would be errors and turn them into warnings:
bool warn_nonportable_name( std::string const & name )
{
if ( !fs::portable_name( name ) )
boost::issue_warning( "Warning, path contains non-portable name: "
+ p );
return true;
}
Because the adaptor always returns true, an error exception is never
thrown. This function could become the new default, or could be explicitly
coded like any name_check function.
What should issue_warning() do? How about something similar to
throw_exception():
namespace boost
{
#ifdef BOOST_USER_WARNINGS
void issue_warning( std::string const & msg ); // user defined
#else
void issue_warning( std::string const & msg )
{
std::clog << msg << '\n';
}
#endif
}
Does that capture what you had in mind?
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk