configBitstreamParser: introduce a buffer for unprocessed file content

This commit is contained in:
Gwenhael Goavec-Merou 2021-01-24 18:16:09 +01:00
parent cd625d4c99
commit 46beaea14d
2 changed files with 3 additions and 1 deletions

View File

@ -10,7 +10,7 @@ ConfigBitstreamParser::ConfigBitstreamParser(const string &filename, int mode,
bool verbose):
_filename(filename), _bit_length(0),
_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()) {
cerr << "Error: fail to open " << _filename << endl;
@ -20,6 +20,7 @@ ConfigBitstreamParser::ConfigBitstreamParser(const string &filename, int mode,
_file_size = _fd.tellg();
_fd.seekg(0, _fd.beg);
_raw_data.resize(_file_size);
_bit_data.reserve(_file_size);
}

View File

@ -29,6 +29,7 @@ class ConfigBitstreamParser {
bool _verbose;
std::ifstream _fd;
std::string _bit_data;
std::string _raw_data; /**< unprocessed file content */
std::map<std::string, std::string> _hdr;
};