Пример #1
0
void CCSVWriter::WritePathList (std::ostream& os, const CPathDictionary& dictionary)
{
	// header

	os << "ID,ParentID,Element,FullPath\n";

	// content

	for (index_t i = 0, count = dictionary.size(); i < count; ++i)
	{
		os << i << ',' 
		   << (int)dictionary.GetParent(i) << ",\"" 
		   << dictionary.GetPathElement(i) << "\",\"" 
		   << CDictionaryBasedPath (&dictionary, i).GetPath().c_str()
		   << "\"\n";
	}
}
Пример #2
0
index_mapping_t CPathDictionary::Merge (const CPathDictionary& source)
{
    index_mapping_t result;
    result.insert (0, 0);
    result.insert ((index_t)NO_INDEX, (index_t)NO_INDEX);

    index_mapping_t elementMapping = pathElements.Merge (source.pathElements);
    for (index_t i = 1, count = source.size(); i < count; ++i)
    {
        const std::pair<index_t, index_t>& sourcePath = source.paths[i];

        std::pair<index_t, index_t> destEntry
            ( *result.find (sourcePath.first)
            , *elementMapping.find (sourcePath.second));

        result.insert (i, paths.AutoInsert (destEntry));
    }

    return result;
}