newntui/discovermdi/src/qatree.cpp
//---------------------------------------------------------------------------------------
// This internal function designed to query the current node and to 
// receve it's complete child list. If node has children the child list
// will be the string with child names separated by "\n", if node has no
// childeren the result string will be empty. The node you are asking for
// the children must be defined as a string in the "from" parameter and
// must be the complete path to the tree node starting with "/" and 
// separated by "/".
// NOTE: All childs will be returned in it's internal names. Use sev_get
// with "name" parameter to convert it into readable name.
//---------------------------------------------------------------------------------------
This internal function designed to query the current node and to
receve it's complete child list. If node has children the child list
will be the string with child names separated by "\n", if node has no
childeren the result string will be empty.
This internal function designed to query the current node and to receve it ' s complete child list . If node has children the child list will be the string with child names separated by " \ n " if node has no childeren the result string will be empty .
int CQATree::QueryChildren(CString & from, CString & list) {
register i;
CString query;
CString result;
BSTR sysQuery;
int amount;
    query.Format("set tmp [sev_get {%s} children]",from);
    sysQuery=query.AllocSysString();
    DataSourceAccessSync(&sysQuery);
	SysFreeString(sysQuery);
    query="llength $tmp";
    sysQuery=query.AllocSysString();
    result=DataSourceAccessSync(&sysQuery);
	SysFreeString(sysQuery);
	list="";
	amount=atoi(result);
	for(i=0;i<amount;i++) {
        query.Format("lindex $tmp %d",i);
        sysQuery=query.AllocSysString();
        result=DataSourceAccessSync(&sysQuery);
	    SysFreeString(sysQuery);
		list+=result;
		list+="\n";
	}
	return amount;
}
int CQATree :: QueryChildren ( CString & from , CString & list ) { register i ; CString query ; CString result ; BSTR sysQuery ; int amount ; query . Format ( " " , from ) ; sysQuery = query . AllocSysString ( ) ; DataSourceAccessSync ( & sysQuery ) ; SysFreeString ( sysQuery ) ; query = " " ; sysQuery = query . AllocSysString ( ) ; result = DataSourceAccessSync ( & sysQuery ) ; SysFreeString ( sysQuery ) ; list = " " ; amount = atoi ( result ) ; for ( i = 0 ; i < amount ; i ++ ) { query . Format ( " " , i ) ; sysQuery = query . AllocSysString ( ) ; result = DataSourceAccessSync ( & sysQuery ) ; SysFreeString ( sysQuery ) ; list += result ; list += " \n " ; } return amount ; }
This internal function designed to query the current node and to
receve it's complete child list.
This internal function designed to query the current node and to receve it ' s complete child list .
// This will fill "tmp" TCL list with all childeren internal names. // This will return the number of the elements in the list