Ejemplo n.º 1
0
ChainList<int> *ListView::getSelectedParams()
{
	static ChainList<int> list;
	LVITEM item;
	item.iItem=-1; item.iSubItem=0;
	item.mask=LVIF_PARAM; item.lParam=-1;
	list.clear();
	while((item.iItem=ListView_GetNextItem(hwndList,item.iItem,LVNI_SELECTED))!=-1){
		ListView_GetItem(hwndList,&item);
		list.put(-1,item.lParam);
	}
	return &list;
}
Ejemplo n.º 2
0
static void processCompoundPattern( const PatternMatchState & state, TransitionList & newTransitions ) {
	const Node & currentNode = state.getCurrentNode();

	if ( state.isComplete() ) { // Сопоставление завершено
		Match::AttributesMap attributes;

		state.context.addAttributes( attributes, state.getAlternative().getBindings() ); // Строим набор аттрибутов

		for ( uint i = 0; i < newTransitions.size(); ++ i ) {
			Match & match = static_cast<Match&>( *newTransitions[i] );

			if ( match.equals( state.getAlternative().getPattern(), state.startNode, currentNode, attributes ) ) {
				match.addVariant( state.releaseVariant() );
				return; // Если сопоставление уже было найдено
			}
		}

		newTransitions.push_back( new Match( state.startNode, currentNode, state.getAlternative().getPattern(), state.releaseVariant(), attributes ) ); // TODO Optimize

		return;
	}

	ChainList chains;

	if ( const AnnotationMatcher * curMatcher = dynamic_cast<const AnnotationMatcher *>( &state.getCurrentMatcher() ) ) {
		TransitionList nextTransitions = curMatcher->buildTransitions( currentNode, state.context );

		for ( uint i = 0, sz = nextTransitions.size(); i < sz; ++ i ) {
			PatternMatchState temp_state( state, nextTransitions[ i ], i == sz );
			processCompoundPattern( temp_state, newTransitions );
		}
	} else {
		const AnnotationChainMatcher & chainMatcher = static_cast<const AnnotationChainMatcher &>( state.getCurrentMatcher() );

		chains.clear();
		chainMatcher.buildChains( state.getCurrentNode(), state.context, chains );

		for ( uint i = 0, sz = chains.size(); i < sz; ++ i ) {
			PatternMatchState temp_state( state, chains[i].first, chains[i].second, i == sz - 1  );
			processCompoundPattern( temp_state, newTransitions);
		}
	}
}