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; }
void daeIDRef::copyFrom(daeIDRef& copyFrom) { element = copyFrom.element; setID(copyFrom.getID()); state = copyFrom.state; container = copyFrom.container; }
daeIDRef::daeIDRef(daeIDRef& copyFrom) { initialize(); element = copyFrom.element; setID(copyFrom.getID()); state = copyFrom.state; container = copyFrom.container; }
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 }
bool daeIDRef::operator==(const daeIDRef& other) const { return (!strcmp(other.getID(), getID())); }