22 #if defined( USE_FILE_PROVIDER )
35 std::string
const & filename_a,
36 std::ios_base::openmode open_mode
46 #if defined( USE_FILE_PROVIDER )
48 if ( (open_mode & std::ios_base::out ) ) {
49 throw(
"Cannot open output file in istream inline file provider " );
52 if ( !provider->
get_istream( filename_a , &file_provider_stream ) ) {
53 std::cerr <<
"Cannot find inline file: " << filename_a << std::endl;
54 file_provider_stream = &bad_stream;
55 file_provider_stream->setstate( ios_base::failbit | ios_base::badbit );
58 #ifdef __native_client__
64 if ( file_provider_stream->good() ) {
73 if ( ( open_mode & ios_base::ate ) ||
74 ( open_mode & ios_base::app ) ||
75 ( ( open_mode & ios_base::in ) &&
76 ( open_mode & ios_base::out ) ) ) {
87 open_ifstream( filename_a +
".gz", ios_base::in|ios_base::binary );
117 std::string
const &
name,
118 std::ios_base::openmode open_mode
128 for ( ; i!=ie; ++i ) {
131 ios_base::in|ios_base::binary );
ocstream cerr(std::cerr)
Wrapper around std::cerr.
bool get_istream(const std::string &filename, std::istream **the_stream)
Platform independent operations on files (except I/O)
std::string filename_
File name.
std::ifstream if_stream_
File stream.
static Inline_File_Provider * get_instance()
Safely instantiate a singleton class in a (possibly) multithreaded context.
void close()
Close the ifstream and reset the state.
Input file stream wrapper for uncompressed and compressed files.
std::string file_extension(std::string const &filename)
Extension of a File Name.
std::vector with 1-based indexing
void open_ifstream(std::string const &name, std::ios_base::openmode open_mode)
Helper function for opening files with alternative search paths.
bool trytry_ifstream_open(std::ifstream &ifstream_, std::string const &name, std::ios_base::openmode open_mode)
Try to open file a few times just in case it is locked (from BOINC LIB)
bool is_gzip() const
returns true if it is a gzip file
rule< Scanner, string_closure::context_t > name
static vector1< std::string > alternative_search_paths_
Alternative search paths This initialized by the option system -in:path:path Notice that izstream can...
void open(std::string const &filename_a, std::ios_base::openmode open_mode=std::ios_base::in)
Open a file.
zlib_stream::zip_istream * zip_stream_p_
Zip file stream pointer (owning)
basic_zip_istream< char > zip_istream
Compression compression_
Compression state.