void Nepomuk::NewResourceDialog::newResourceSlot() { if( d->m_index == 1 ) { Nepomuk::Resource newResource( d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Person() ); d->m_nofResource.addIsRelated( newResource ); } else if( d->m_index == 2 ) { Nepomuk::Resource newResource( d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Project() ); d->m_nofResource.addIsRelated( newResource ); } else if( d->m_index == 3 ) { Nepomuk::Resource newResource( d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Task() ); d->m_nofResource.addIsRelated( newResource ); } else if( d->m_index == 4 ) { Nepomuk::Resource newResource( d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Location() ); d->m_nofResource.addIsRelated( newResource ); } }
// Add a new Resource (if the name is not used yet) to the Resources list // Add ACL to the resource bool EntityManager_AddResource(EntityManager *entityManager, const char *name) { resourceData *entity = NULL; AclS *acl = NULL; if (entityManager == NULL || name == NULL) { snprintf(errStr, sizeof(errStr), "EntityManager_AddResource entityManager (isNull %d) and user name '%s' must not be NULL", entityManager == NULL, name); return false; } if (checkAddValidParams(entityManager, name) == false) return false; if (newResource(&entity, name) == false) return false; if (ItemsList_AddItem(entityManager->Resources, name, entity) == false) { freeGroup(entity); return false; } Acl_New(&acl); EntityManager_RegisterProperty(entityManager, name, ACL_PROPERTY_NAME, (void *)acl); return true; }
GLint ShaderProgram::createProgram(const char* pVertexSource, const char* pFragmentSource) { GLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSource); if (!vertexShader) { ALOGE("couldn't load the vertex shader!"); return -1; } GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource); if (!pixelShader) { ALOGE("couldn't load the pixel shader!"); return -1; } GLuint program = glCreateProgram(); if (program) { glAttachShader(program, vertexShader); GLUtils::checkGlError("glAttachShader vertex"); glAttachShader(program, pixelShader); GLUtils::checkGlError("glAttachShader pixel"); glLinkProgram(program); GLint linkStatus = GL_FALSE; glGetProgramiv(program, GL_LINK_STATUS, &linkStatus); if (linkStatus != GL_TRUE) { GLint bufLength = 0; glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength); if (bufLength) { char* buf = (char*) malloc(bufLength); if (buf) { glGetProgramInfoLog(program, bufLength, 0, buf); ALOGE("could not link program:\n%s\n", buf); free(buf); } } glDeleteProgram(program); program = -1; } } ShaderResource newResource(program, vertexShader, pixelShader); m_resources.append(newResource); return program; }
SharedPointer < Type > SoundResourceManager < Type > ::CreateInst() { SharedPointer < Type > newResource( new Type( m_pDev ) ); return newResource; }
SharedPointer < Type > GUIResourceManager < Type > ::CreateInst() { SharedPointer < Type > newResource( new Type() ); return newResource; }
void ResourceBase::load() { resource = newResource(id); }