Пример #1
0
BlockReaderList NxsReader::FindAllBlocksByTitleNoPrioritization(const BlockReaderList & chosenBlockList, const char *title)
{
    BlockReaderList found;
    if (chosenBlockList.empty() || title == NULL)
    {
        found = chosenBlockList;
    }
    else
    {
        bool emptyTitle = strlen(title) == 0;
        for (BlockReaderList::const_iterator cblIt = chosenBlockList.begin(); cblIt != chosenBlockList.end(); ++cblIt)
        {
            NxsBlock * b = *cblIt;
            std::vector<std::string> v = this->GetAllTitlesForBlock(b);
            for (std::vector<std::string>::const_iterator vIt = v.begin(); vIt != v.end(); ++vIt)
            {
                const std::string & n = *vIt;
                if ((emptyTitle && n.empty()) || (NxsString::case_insensitive_equals(title, n.c_str())))
                {
                    found.push_back(b);
                    break;
                }
            }
        }
    }
    return found;

}
Пример #2
0
void NxsReader::DeleteBlocksFromFactories()
	{
	BlockReaderList saved;
	std::set<NxsBlock *> todel;
	for (BlockReaderList::iterator bIt = blocksInOrder.begin(); bIt != blocksInOrder.end(); ++bIt)
		{
		NxsBlock * b  = *bIt;
		if (BlockIsASingeltonReader(b))
			saved.push_back(b);
		else
			todel.insert(b);
		}
	for (std::set<NxsBlock *>::iterator d = todel.begin(); d != todel.end(); ++d) 
		{
		
		delete *d;
		}
	blocksInOrder = saved;
	lastExecuteBlocksInOrder = saved;
	}
Пример #3
0
/*! Returns the set of blocks that have been created from factories, and
    removes reference to from the NxsReader's collections.
 */
std::set<NxsBlock *> NxsReader::RemoveBlocksFromFactoriesFromUsedBlockLists()
{
    std::set<NxsBlock *> todel;
    BlockReaderList saved;
    for (BlockReaderList::iterator bIt = blocksInOrder.begin(); bIt != blocksInOrder.end(); ++bIt)
    {
        NxsBlock * b  = *bIt;
        if (BlockIsASingeltonReader(b))
        {
            saved.push_back(b);
        }
        else
        {
            todel.insert(b);
        }
    }
    for (std::set<NxsBlock *>::iterator d = todel.begin(); d != todel.end(); ++d)
    {
        RemoveBlockFromUsedBlockList(*d);
    }
    return todel;
}