Exemplo n.º 1
0
daeBool
daeDefaultIDRefResolver::resolveElement(daeIDRef& idref, daeString typeNameHint)
{
	if (idref.getState() == daeIDRef::id_loaded)
		idref.validate();
	
	daeElement* resolved = NULL;
	int status;

	daeString id = idref.getID();

	if ( idref.getContainer() == NULL ) 
	{
		char msg[128];
		sprintf(msg,"daeDefaultIDRefResolver::resolveElement() - failed to resolve %s%s\n",idref.getID(), ". IDRef needs a container element!" );
		daeErrorHandler::get()->handleWarning( msg );
		return false;
	}

	status = _database->getElement( &resolved, 0, id, typeNameHint, idref.getContainer()->getDocumentURI()->getURI() );

	idref.setElement( resolved );

	if (status||(resolved==NULL)) {
		idref.setState( daeIDRef::id_failed_id_not_found );
		char msg[128];
		sprintf(msg,"daeDefaultIDRefResolver::resolveElement() - failed to resolve %s\n",idref.getID());
		daeErrorHandler::get()->handleWarning( msg );
		return false;
	}

	idref.setState( daeIDRef::id_success );
	return true;
}
Exemplo n.º 2
0
void
daeIDRef::copyFrom(daeIDRef& copyFrom)
{
	element = copyFrom.element;
	setID(copyFrom.getID());
	state = copyFrom.state;
	container = copyFrom.container;
}
Exemplo n.º 3
0
daeIDRef::daeIDRef(daeIDRef& copyFrom)
{
	initialize();
	element = copyFrom.element;
	setID(copyFrom.getID());
	state = copyFrom.state;
	container = copyFrom.container;
}
Exemplo n.º 4
0
void
daeIDRefResolver::attemptResolveID(daeIDRef& id)
{
//Contributed by Nus - Wed, 08 Nov 2006
	// int i,cnt = (int)_KnownResolvers.getCount();
	int i,cnt = (int)_KnownResolvers->getCount();
//-------------------------------

//	daeBool foundProtocol = false;
	for(i=0;i<cnt;i++)
//Contributed by Nus - Wed, 08 Nov 2006
		// if (_KnownResolvers[i]->resolveID(id))
		if ((*_KnownResolvers)[i]->resolveID(id))
//-----------------------------
			return;

#if defined(_DEBUG) && defined(WIN32)
	char msg[128];
	sprintf(msg,"daeIDRefResolver::attemptResolveID(%s) - failed\n",id.getID());
	daeErrorHandler::get()->handleWarning( msg );
#endif
			
}
Exemplo n.º 5
0
bool daeIDRef::operator==(const daeIDRef& other) const {
	return (!strcmp(other.getID(), getID()));
}