10 #include <boost/filesystem/operations.hpp> 11 #include <boost/filesystem/exception.hpp> 12 #include <boost/bind.hpp> 13 #include <boost/next_prior.hpp> 25 return !std::isalpha ( *x.begin(), std::locale::classic() )
33 return x.find (
'.' ) != std::string::npos;
47 const string& library_name,
48 const path& full_path )
50 std::string
const leaf ( full_path.leaf() );
52 if ( leaf.size() > 31 )
55 error ( library_name, full_path,
"filename > 31 chars" );
58 if ( std::count ( leaf.begin(), leaf.end(),
'.' ) > 1 )
61 error ( library_name, full_path,
"filename contains more than one dot character ('.')" );
64 if ( *leaf.rbegin() ==
'.' )
67 error ( library_name, full_path,
"filename ends with the dot character ('.')" );
70 path
const relative_path ( relative_to ( full_path, filesystem::initial_path() ), &filesystem::no_check );
72 if ( std::find_if ( relative_path.begin(), relative_path.end(), boost::bind ( &aux::starts_with_nonalpha, _1 ) )
73 != relative_path.end() )
76 error ( library_name, full_path,
"leading character of one of the path compontents is not alphabetic" );
79 if ( std::find_if ( relative_path.begin(), boost::prior ( relative_path.end() )
80 , boost::bind ( &aux::contains_dot, _1 ) ) != boost::prior ( relative_path.end() ) )
83 error ( library_name, full_path,
"directory name contains the dot character ('.')" );
86 if ( std::distance ( relative_path.begin(), boost::prior ( relative_path.end() ) ) >= 8 )
89 error ( library_name, full_path,
"file's directory depth will exceed 8 levels if placed on a CD" );
92 if ( relative_path.string().size() > ( 100 - string (
"boost_X_XX_X/" ).size() ) )
95 error ( library_name, full_path,
"file path will be > 100 chars if placed on a CD" );
100 path
const check_portability ( relative_path.string(), &filesystem::portable_name );
102 catch ( filesystem::filesystem_error
const& )
105 error ( library_name, full_path,
"nonportable path" );
112 std::cout <<
" " << m_long_name_errors <<
" " << desc() <<
'\n';
bool starts_with_nonalpha(std::string const &x)
virtual ~long_name_check()
bool contains_dot(std::string const &x)