예제 #1
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);
}
예제 #2
0
파일: 2dafile.cpp 프로젝트: cc9cii/xoreos
void TwoDAFile::readHeaders2a(Common::SeekableReadStream &twoda,
                              Common::StreamTokenizer &tokenize) {

	tokenize.getTokens(twoda, _headers);

	tokenize.nextChunk(twoda);
}
예제 #3
0
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);
	}
}
예제 #4
0
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];
}
예제 #5
0
파일: 2dafile.cpp 프로젝트: cc9cii/xoreos
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);
}
예제 #6
0
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);
}
예제 #7
0
파일: 2dafile.cpp 프로젝트: cc9cii/xoreos
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);
	}
}