configBitstreamParser: introduce a buffer for unprocessed file content
This commit is contained in:
parent
cd625d4c99
commit
46beaea14d
|
|
@ -10,7 +10,7 @@ ConfigBitstreamParser::ConfigBitstreamParser(const string &filename, int mode,
|
||||||
bool verbose):
|
bool verbose):
|
||||||
_filename(filename), _bit_length(0),
|
_filename(filename), _bit_length(0),
|
||||||
_file_size(0), _verbose(verbose), _fd(filename,
|
_file_size(0), _verbose(verbose), _fd(filename,
|
||||||
ifstream::in | (ios_base::openmode)mode), _bit_data(), _hdr()
|
ifstream::in | (ios_base::openmode)mode), _bit_data(), _raw_data(), _hdr()
|
||||||
{
|
{
|
||||||
if (!_fd.is_open()) {
|
if (!_fd.is_open()) {
|
||||||
cerr << "Error: fail to open " << _filename << endl;
|
cerr << "Error: fail to open " << _filename << endl;
|
||||||
|
|
@ -20,6 +20,7 @@ ConfigBitstreamParser::ConfigBitstreamParser(const string &filename, int mode,
|
||||||
_file_size = _fd.tellg();
|
_file_size = _fd.tellg();
|
||||||
_fd.seekg(0, _fd.beg);
|
_fd.seekg(0, _fd.beg);
|
||||||
|
|
||||||
|
_raw_data.resize(_file_size);
|
||||||
_bit_data.reserve(_file_size);
|
_bit_data.reserve(_file_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ class ConfigBitstreamParser {
|
||||||
bool _verbose;
|
bool _verbose;
|
||||||
std::ifstream _fd;
|
std::ifstream _fd;
|
||||||
std::string _bit_data;
|
std::string _bit_data;
|
||||||
|
std::string _raw_data; /**< unprocessed file content */
|
||||||
std::map<std::string, std::string> _hdr;
|
std::map<std::string, std::string> _hdr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue