newntui/activex/queriescombo/src/queriescomboctl.cpp
//---------------------------------------------------------------------------
// Form complete list of queries asking server for them. queries are 
// separated by {}
//---------------------------------------------------------------------------
Form complete list of queries asking server for them. queries are
separated by {}
Form complete list of queries asking server for them . queries are separated by {}
void CQueriesComboCtrl::FormQueriesList(void) {
int selElements;
CString serverCall;
CString serverResults;
CString rowList;
    if(m_Selection.GetLength()==0) selElements=0;
	else {
       serverCall.Format("size $%s",m_Selection);
	   EvaluateSync(serverCall,&serverResults);
	   selElements=atoi(serverResults);
	}
    if(selElements!=0) {
        if(m_Selection.GetLength()!=0) {
            serverCall.Format("get_queries -selection $%s",m_Selection);
	        EvaluateSync(serverCall,&rowList);
		} else  m_QueriesList="";
	} else {
         serverCall.Format("get_queries -categories %s",m_Categories);
	     EvaluateSync(serverCall,&rowList);
	}
	m_QueriesList="";
	BOOL inside;
	CString name;
	CString spaces;
	for(register i=0;i<rowList.GetLength();i++) {
		if(rowList[i]=='{') {
			inside=TRUE;
			name="";
	        spaces="";
			while(i<rowList.GetLength()-1 && rowList[i+1]==' ') i++;
			continue;
		}
		if(rowList[i]=='}') {
			inside=FALSE;
	        m_QueriesList+='{';
	        m_QueriesList+=name;
	        m_QueriesList+='}';
			continue;
		}
		if(inside==TRUE) {
			if(rowList[i]!=' ') {
				name+=spaces;
			    name+=rowList[i];
				spaces="";
			} else spaces+=" ";
		}
	}
}
void CQueriesComboCtrl :: FormQueriesList ( void ) { int selElements ; CString serverCall ; CString serverResults ; CString rowList ; if ( m_Selection . GetLength ( ) == 0 ) selElements = 0 ; else { serverCall . Format ( " " , m_Selection ) ; EvaluateSync ( serverCall , & serverResults ) ; selElements = atoi ( serverResults ) ; } if ( selElements != 0 ) { if ( m_Selection . GetLength ( ) != 0 ) { serverCall . Format ( " " , m_Selection ) ; EvaluateSync ( serverCall , & rowList ) ; } else m_QueriesList = " " ; } else { serverCall . Format ( " " , m_Categories ) ; EvaluateSync ( serverCall , & rowList ) ; } m_QueriesList = " " ; BOOL inside ; CString name ; CString spaces ; for ( register i = 0 ; i < rowList . GetLength ( ) ; i ++ ) { if ( rowList [ i ] == ' ' ) { inside = TRUE ; name = " " ; spaces = " " ; while ( i < rowList . GetLength ( ) - 1 && rowList [ i + 1 ] == ' ' ) i ++ ; continue ; } if ( rowList [ i ] == ' ' ) { inside = FALSE ; m_QueriesList += ' ' ; m_QueriesList += name ; m_QueriesList += ' ' ; continue ; } if ( inside == TRUE ) { if ( rowList [ i ] != ' ' ) { name += spaces ; name += rowList [ i ] ; spaces = " " ; } else spaces += " " ; } } }
Form complete list of queries asking server for them.
Form complete list of queries asking server for them .
// Queries the server for available queries for the specified selection. // Queries the server for all available queries for the specified categories // Removes unnessesary spaces // Entering query substring // removes spaces at the beginning // Exiting query substring - need to insert results into the list // Inserting new item into the list