Octane v1.01.20 - The Open Compression Toolkit for C++ | http://octane.sourceforge.net/ |
#include <file_bitreader.hpp>
Inheritance diagram for file_bitreader:
This class opens a file and reads from it. Unlike the stream_bitreader it manages the file that it operates on, and thus hides the details of file access.
It adds the member function error(), which checks if there was an error opening the file in the constructor.
Definition at line 33 of file file_bitreader.hpp.
Public Member Functions | |
file_bitreader (const char *name) | |
Constructor. | |
file_bitreader (const char *name, size_t size_in_bits) | |
Constructor with size specification. | |
bool | error () const |
Check the state of the file. | |
bool | supports_seek () const |
Check if seek functions are supported. | |
Protected Member Functions | |
char | read_next_byte () |
Defines the method of reading a single byte of input. | |
void | set_position (size_t pos) |
Defines the method of setting the position for the next read. | |
Protected Attributes | |
std::ifstream | s |
|
Constructor. Sets the number of bits available to the size of the file.
Definition at line 39 of file file_bitreader.hpp. References bitreader::length.
00040 : s(name, std::ios::binary) 00041 { 00042 if (s) 00043 { 00044 length = 8 * s.seekg(0, std::ios::end).tellg(); 00045 s.seekg(0); 00046 } 00047 } |
|
Constructor with size specification.
Definition at line 51 of file file_bitreader.hpp.
00052 : bitreader(size_in_bits), s(name, std::ios::binary) { ; } |
|
Check the state of the file.
Reimplemented from bitreader. Definition at line 58 of file file_bitreader.hpp. Referenced by OctaneTester::CheckFilesAreIdentical(), OctaneTester::RunCommand_Compress(), OctaneTester::RunCommand_Decompress(), OctaneTester::RunCommand_LoadCompressor(), and OctaneTester::RunCommand_MakeState().
00058 { return !s; }
|
|
Check if seek functions are supported.
Implements bitreader. Definition at line 60 of file file_bitreader.hpp.
00060 { return true; } |
|
Defines the method of reading a single byte of input. Derived classes must implement this function.
Implements bitreader. Definition at line 63 of file file_bitreader.hpp.
00063 { char c; s.get(c); return c; } |
|
Defines the method of setting the position for the next read. Derived classes should implement this function if possible.
Reimplemented from bitreader. Definition at line 64 of file file_bitreader.hpp.
00064 { s.seekg((std::streamoff)pos); } |