void open_file( fs::ifstream& configuration_file ) const { configuration_file.open( path_to_configuration_file ); if ( !configuration_file.good() ) { notify( "Cannot open configuration file '" + path_to_configuration_file.string() + "', probably you have not permissions..." ); } else {} }
std::pair<bool, bool> bomUtf8Check(const FileUnit& file, bf::ifstream& strm) { if(!file.isExist()) { stdErr() << file.total << ": notExist" << std::endl; return std::make_pair(false, false); } ErrorCode ec; if(file.isDir()) { stdErr() << file.total << ": isDir" << std::endl; return std::make_pair(false, false); } strm.open(file.total); if(!strm) { stdErr() << file.total << ": openFailed" << std::endl; return std::make_pair(false, false); } std::istreambuf_iterator<char> const end; std::istreambuf_iterator<char> const strmItr(strm); const bool isBOM=utf8::starts_with_bom(strmItr, end); if(!isBOM) strm.seekg(0); auto const itr=std::istreambuf_iterator<char>(strm); const auto isValid=utf8::is_valid(itr, end); return std::make_pair(isBOM, isValid); }
cvs_iterator( const boost::filesystem::path & dir_path ) : dir_path(dir_path) { boost::filesystem::path entries_file_path( dir_path / "CVS/Entries" ); entries_file.open( entries_file_path ); if ( !entries_file ) throw std::string( "could not open: " ) + entries_file_path.string(); ++*this; }