Beispiel #1
0
MappingTable StringPrep::RangeTableToMappingTable(
	RangeTable rangeTable,
	UTF32String mapTo)
{
	typedef std::pair<unsigned, UTF32String> pair;
	MappingTable m;

	for(RangeTable::const_iterator i = rangeTable.begin();
		i != rangeTable.end(); i++)
	{
		for(unsigned j = i->first; j <= i->second; j++)
		{
			m.insert(pair(j,mapTo));
		}
	}
	return m;
}
Beispiel #2
0
MappingTable StringPrep::GenerateMappingTable(
	const unsigned* mappingArray,
	unsigned mappingArraySize,
	unsigned separator)
{
	typedef std::pair<unsigned, UTF32String> pair;
	MappingTable m;
	unsigned i = 0;

	while(i < mappingArraySize)
	{
		unsigned key = mappingArray[i];
		i += 2;

		UTF32String value;
		for(;mappingArray[i] != separator && i < mappingArraySize; i++)
			value.push_back(mappingArray[i]);

		m.insert(pair(key, value));
	}
	return m;
}