コード例 #1
0
ファイル: alto_directory.cpp プロジェクト: Yale-LANS/ALTO
void ResourceEntry::insertAccept(std::string acts)
{
	if (Find("accepts") != End())
	{
		InfoResArray& array = (InfoResArray&)((Array&)(*this)["prop-types"]);
		array.insert(acts);
	}
	else
	{
		std::vector<std::string> v_acts(1, acts);
		setAccepts(v_acts);
	}
}
コード例 #2
0
ファイル: testbuildc.cpp プロジェクト: huffman/CRUDASM7
	// This is called when a tree has built.
	void update()
	{
		assert(root != NULL);
		setAccepts();
		
		//root->print();
		//std::cout << std::endl;
		
		//--
		NFAState *next = nfa->getStartState();
		for(std::list<CNode *>::iterator i = root->children.begin();
			i != root->children.end(); ++i
		)
		{
			CNode *node = *i;
			if(node->children.empty())
			{
				NFAState *tmp = nfa->newState();
				next->addEdge(tmp, node->value);
				if(node->accept)
					tmp->makeFinal(acceptStr, acceptFlags);
				next = tmp;
			}
			else
			{
				NFAState *tmp = next;
				std::list<CNode *>::iterator j = node->children.begin();
				for(unsigned i = 1; i < node->children.size(); ++i, ++j)
				{
					NFAState *tmp2 = nfa->newState();
					tmp->addEdge(tmp2, (*j)->value);
					tmp = tmp2;
				}
				tmp->addEdge(next, node->children.back()->value);
			}
		}
		//--
	}