void TwoDAFile::readHeaders2a(Common::SeekableReadStream &twoda, Common::StreamTokenizer &tokenize) { tokenize.getTokens(twoda, _headers); tokenize.nextChunk(twoda); }
void TwoDAFile::readRows2a(Common::SeekableReadStream &twoda, Common::StreamTokenizer &tokenize) { /* And now read the individual cells in the rows. */ size_t columnCount = _headers.size(); while (!twoda.eos()) { TwoDARow *row = new TwoDARow(*this); // Skip the first token, which is the row index. It's implicit in the data anyway tokenize.skipToken(twoda); // Read all the cells in the row size_t count = tokenize.getTokens(twoda, row->_data, columnCount, columnCount); // And move to the next line tokenize.nextChunk(twoda); if (count == 0) { // Ignore empty lines delete row; continue; } _rows.push_back(row); } }
static Common::UString getFirst(Common::StreamTokenizer &tokenizer, Common::SeekableReadStream &stream) { std::vector<Common::UString> strings; tokenizer.getTokens(stream, strings); tokenizer.nextChunk(stream); if (strings.empty()) return ""; return strings[0]; }
void TwoDAFile::readHeaders2a(Common::SeekableReadStream &twoda, Common::StreamTokenizer &tokenize) { /* Read the column headers of an ASCII 2DA file. */ while (!twoda.eos() && (tokenize.getTokens(twoda, _headers) == 0)) tokenize.nextChunk(twoda); tokenize.nextChunk(twoda); }
void TwoDAFile::readDefault2a(Common::SeekableReadStream &twoda, Common::StreamTokenizer &tokenize) { std::vector<Common::UString> defaultRow; tokenize.getTokens(twoda, defaultRow, 2); if (defaultRow[0] == "Default:") _defaultString = defaultRow[1]; _defaultInt = parseInt(_defaultString); _defaultFloat = parseFloat(_defaultString); tokenize.nextChunk(twoda); }
void TwoDAFile::readDefault2a(Common::SeekableReadStream &twoda, Common::StreamTokenizer &tokenize) { /* ASCII 2DA files can have default values that are returned for cells * that don't exist. They are specified in the second line, optionally * preceded by "Default:". */ std::vector<Common::UString> defaultRow; tokenize.getTokens(twoda, defaultRow, 2); if (defaultRow[0].equalsIgnoreCase("Default:")) _defaultString = defaultRow[1]; _defaultInt = parseInt(_defaultString); _defaultFloat = parseFloat(_defaultString); tokenize.nextChunk(twoda); }
void TwoDAFile::readRows2a(Common::SeekableReadStream &twoda, Common::StreamTokenizer &tokenize) { uint32 columnCount = _headers.size(); while (!twoda.eos()) { TwoDARow *row = new TwoDARow(*this); tokenize.skipToken(twoda); int count = tokenize.getTokens(twoda, row->_data, columnCount, columnCount); tokenize.nextChunk(twoda); if (count == 0) { // Ignore empty lines delete row; continue; } _rows.push_back(row); } }