Example #1
0
IntList * array2IntList( int * data ){
	int size = data[0];
	IntList * result = IntList::newL();
	int * iPtr = data+1;
	for(int i=0;i<size;i++){
		result->appendL( *iPtr++ );
	}
	return result;
}
Example #2
0
int * FiducialData::parseSequenceL( const char * in_fiducialSequence, bool& white ){
	// decode the string, which is assumed to be in the form
	// "a[0], a[1], .., a[N-1]"
	char stringcopy[512] = {0};
	char *tmp = stringcopy;
	strcpy(tmp, in_fiducialSequence);

	// strip [, {, or (
	while( (*tmp == '[' || *tmp == '{' || *tmp == '(' || *tmp == ' ') && *tmp != 0 ){
		tmp++;
	}
	
	white = false;
	IntList * result = IntList::newL();
	for(char * tok = strtok( tmp, "," );tok!=NULL;tok = strtok( NULL, "," )){
		if( atoi(tok)==0 && strchr(tok,'0')==NULL ){
			if( strchr(tok,'w')!=NULL || strchr(tok,'W')!=NULL ){
				white = true;
			}
		}else{
			result->appendL( atoi(tok) );
		}
	}
	
	if( result->getSize() < 2 ){
		delete result;
		return NULL;
	}

	#ifndef __SYMBIAN32__
	int * toReturn = new int[result->getSize()+1];
	#else
	int * toReturn = new (ELeave) int[result->getSize()+1];
	#endif
	
	int i=0;
	toReturn[i++] = result->getSize();
	for(result->reset();!(result->isNull());result->fwd()){
		toReturn[i++] = result->getData();
	}
	delete result;
	
	return toReturn;
}