示例#1
0
  precipitation *precipitationDao::findById(ull *aid, int size_a)
  {
    // //set id values for sql select queries
    // for (int i = 0; i < size_a; ++i)
    //   aull_t[i] = aid[i];
    
    // //sql query with oracle pro*C/C++ 
    // SELECT precipitation_type, precipitation_name INTO :aus_t, :ac20_t FROM precipitation WHERE precipitation_id = :aull_t;

    precipitation *pc, *apc = new precipitation[size_a];

    for (int i = 0; i < size_a; ++i) {
      pc = findById(aid[i]);
      //set new object with selected values
      apc[i].setId(pc->getId());
      apc[i].setPointId(pc->getPointId());
      apc[i].setType(pc->getType());
      apc[i].setDateTime(pc->getDateTime());
      apc[i].setPrediction(pc->getPrediction());
      apc[i].setQuantity(pc->getQuantity());
      apc[i].setFrequency(pc->getFrequency());
    }
    
    return apc;
  }
示例#2
0
void PlasmaLnfPage::winnowThemes()
{
    auto plasmaThemes = plasma_themes();
    bool winnowed = true;
    int winnow_index = 0;
    while ( winnowed )
    {
        winnowed = false;
        winnow_index = 0;

        for ( auto& enabled_theme : m_enabledThemes )
        {
            ThemeInfo* t = plasmaThemes.findById( enabled_theme.id );
            if ( t == nullptr )
            {
                cDebug() << "Removing" << enabled_theme.id;
                winnowed = true;
                break;
            }
            ++winnow_index;
        }

        if ( winnowed )
        {
            m_enabledThemes.removeAt( winnow_index );
        }
    }
}
示例#3
0
void Playtree::onAppend( playlist_add_t *p_add )
{
    Iterator it_node = findById( p_add->i_node );
    if( it_node != m_children.end() )
    {
        playlist_Lock( m_pPlaylist );
        playlist_item_t *pItem =
            playlist_ItemGetById( m_pPlaylist, p_add->i_item );
        if( !pItem )
        {
            playlist_Unlock( m_pPlaylist );
            return;
        }

        int pos;
        for( pos = 0; pos < pItem->p_parent->i_children; pos++ )
            if( pItem->p_parent->pp_children[pos] == pItem ) break;

        UString *pName = getTitle( pItem->p_input );
        playlist_item_t* current = playlist_CurrentPlayingItem( m_pPlaylist );

        Iterator it = it_node->add(
            p_add->i_item, UStringPtr( pName ), false, pItem == current,
            false, pItem->i_flags & PLAYLIST_RO_FLAG, pos );

        m_allItems[pItem->i_id] = &*it;

        playlist_Unlock( m_pPlaylist );

        tree_update descr(
            tree_update::ItemInserted,
            IteratorVisible( it, this ) );
        notify( &descr );
    }
}
示例#4
0
  humidity *humidityDao::findById(ull *aid, int size_a)
  {
    // //set id values for sql select queries
    // for (int i = 0; i < size_a; ++i)
    //   aull_t[i] = aid[i];
    
    // //sql query with oracle pro*C/C++ 
    // SELECT humidity_type, humidity_name INTO :aus_t, :ac20_t FROM humidity WHERE humidity_id = :aull_t;

    humidity *hm, *ahm = new humidity[size_a];

    for (int i = 0; i < size_a; ++i) {
      hm = findById(aid[i]);
      //set new object with selected values
      ahm[i].setId(hm->getId());
      ahm[i].setPointId(hm->getPointId());
      ahm[i].setDateTime(hm->getDateTime());
      ahm[i].setPrediction(hm->getPrediction());
      ahm[i].setAbsolute(hm->getAbsolute());
      ahm[i].setRelative(hm->getRelative());
      ahm[i].setSpecific(hm->getSpecific());
    }
    
    return ahm;
  }
示例#5
0
int Overlays::play(const Common::String &name, int loopId, int loopForever, int startNow, int a6) {
	int id = mix_id(name);
	int index = findById(id);
	if (index < 0) {
		index = findEmpty();
		if (index < 0) {
			return index;
		}
		_videos[index].id = id;
		_videos[index].vqaPlayer = new VQAPlayer(_vm, &_vm->_surfaceGame);

		// repeat forever
		_videos[index].vqaPlayer->setBeginAndEndFrame(0, 0, -1, kLoopSetModeJustStart, nullptr, nullptr);
		_videos[index].loaded = true;
	}

	Common::String resourceName = Common::String::format("%s.VQA", name.c_str());
	_videos[index].vqaPlayer->open(resourceName);
	_videos[index].vqaPlayer->setLoop(
		loopId,
		loopForever ? -1 : 0,
		startNow ? kLoopSetModeImmediate : kLoopSetModeEnqueue,
		nullptr, nullptr);

	return index;
}
示例#6
0
void Playtree::onUpdateItem( int id )
{
    Iterator it = findById( id );
    if( it != m_children.end() )
    {
        // Update the item
        playlist_Lock( m_pPlaylist );
        playlist_item_t *pNode =
            playlist_ItemGetById( m_pPlaylist, it->getId() );
        if( !pNode )
        {
            playlist_Unlock( m_pPlaylist );
            return;
        }

        UString *pName = new UString( getIntf(), pNode->p_input->psz_name );
        playlist_Unlock( m_pPlaylist );

        if( *pName != *(it->getString()) )
        {
            it->setString( UStringPtr( pName ) );

            tree_update descr(
                tree_update::ItemUpdated, IteratorVisible( it, this ) );
            notify( &descr );
        }
    }
    else
    {
        msg_Warn( getIntf(), "cannot find node with id %d", id );
    }
}
示例#7
0
void Overlays::remove(const Common::String &name) {
	int id = mix_id(name);
	int index = findById(id);
	if (index >= 0) {
		resetSingle(index);
	}
}
示例#8
0
void QuickOpenManager::showById(const QString &id)
{
    IQuickOpen *i = findById(id);
    if (i) {
        setCurrentFilter(i);
        showPopup();
    }
}
示例#9
0
/**
 * @brief GameObjectRepository::getGameObjectById Retrieve the instance of a class inherithing
 * GameObject by its id (e.g. an instance of Character).
 * @param id Id of the GameObject to retrieve.
 * @return Object from a class inheriting GameObject.
 */
GameObject *GameObjectRepository::getGameObjectById(int id) {
    DBItem gameObjectDbItem = findById(id);
    GameObjectType type = (GameObjectType) gameObjectDbItem.getHashMap().value("type").toInt();

    GameObjectSubRepository *repository = getRepositoryByGameObjectType(type);
    GameObject *gameObject = repository->getFullGameObject(id);

    return gameObject;
}
示例#10
0
bool DNAAlphabetRegistryImpl::registerAlphabet(const DNAAlphabet* a) {
    if (findById(a->getId())!=NULL) {
        return false;
    }
    alphabets.push_back(a);
    //WARN: original order for equal alphabets must not be changed (DNA must be before RNA)
    qStableSort(alphabets.begin(), alphabets.end(), alphabetComplexityComparator);
    return true;
}
示例#11
0
QObject* SignalSlotConnection::findById(QQmlContext *context, QObject *obj, QString id)
{
    if(id == context->nameForObject(obj)) return obj;
    for(QObject* child: obj->children())
    {
        if(id == context->nameForObject(child)) return child;
    }
    if(obj->parent()) return findById(context, obj->parent(), id);
    return NULL;
}
示例#12
0
void AnnotationState::addAnnotation(const Annotation &annotation)
{
	// Make sure ID is unique
	if(findById(annotation.id)>=0) {
		qWarning("Cannot add annotation: ID (%d) not unique!", annotation.id);
		return;
	}

	m_annotations.append(annotation);
	emit annotationChanged(annotation);
}
示例#13
0
void AnnotationState::changeAnnotation(int id, const QString &newtext, const QColor &bgcolor)
{
	int idx = findById(id);
	if(idx<0) {
		qWarning("Cannot change annotation: ID %d not found!", id);
		return;
	}
	m_annotations[idx].text = newtext;
	m_annotations[idx].background = bgcolor;
	emit annotationChanged(m_annotations[idx]);
}
示例#14
0
void AnnotationState::reshapeAnnotation(int id, const QRect &newrect)
{
	int idx = findById(id);
	if(idx<0) {
		qWarning("Cannot reshape annotation: ID %d not found!", id);
		return;
	}

	m_annotations[idx].rect = newrect;
	emit annotationChanged(m_annotations[idx]);
}
示例#15
0
void AnnotationState::deleteAnnotation(int id)
{
	int idx = findById(id);
	if(idx<0) {
		qWarning("Cannot remove annotation: ID %d not found!", id);
		return;
	}

	m_annotations.removeAt(idx);
	emit annotationDeleted(id);
}
示例#16
0
char* getKey()
{
  printf("getKey:start\n");
  FILE* config = fopen("config","r");
  char keystore[30];
  char id[30];
  char key[30];
  char vector[30];
  fscanf(config,"%s %s %s %s",&keystore,&id,&key,&vector);
  printf("dane z configa: %s %s %s %s\n",keystore,id,key,vector);
  return findById(keystore,key,vector,id,0);
}
示例#17
0
char* getVector()
 {
   printf("getVector:start\n");
   FILE* config = fopen("config","r");
   char keystore[30];
   char id[30];
   char key[30];
   char vector[30];
   fscanf(config,"%s %s %s %s",keystore,id,key,vector);
   FILE* keystoreFile=fopen(keystore,"r");
   printf("getVector:fopen\n");
   return findById(keystoreFile,key,vector,id,0);
}
示例#18
0
bool
GVNumModel::getSelectedNumber(GVRegisteredNumber &num)
{
    if (!findById (m_selectedId, num)) {
        if (m_dialBack.count () != 0) {
            num = m_dialBack[0];
        } else {
            return (false);
        }
    }

    return (true);
}//GVNumModel::getSelectedNumber
示例#19
0
void PlasmaLnfPage::updateThemeNames()
{
    auto plasmaThemes = plasma_themes();
    for ( auto& enabled_theme : m_enabledThemes )
    {
        ThemeInfo* t = plasmaThemes.findById( enabled_theme.id );
        if ( t != nullptr )
        {
            enabled_theme.name = t->name;
            enabled_theme.description = t->description;
        }
    }
}
示例#20
0
    bool AlbumPart::sync() {
        AlbumPart* albumPart = findById(id);
        if (!albumPart) {
            if (!albumId && album) {
                album->sync();
                albumId = album->getId();
            }
        }
        if (!albumPart) albumPart = findByPosAndAlbumId(getPos(), getAlbumId());
        if (!albumPart) return true;

        // check fields
        bool needsUpdate = false;
        boost::regex decimal("(-?\\d+)\\.?\\d*");
        boost::smatch match1;
        boost::smatch match2;
        if (id != albumPart->getId()) {
            if (id) {
                LOG(INFO) << "updating albumPart " << id << " id from " << albumPart->getId() << " to " << id;
                needsUpdate = true;
            } else {
                id = albumPart->getId();
            }
        }
        if (pos.compare(albumPart->getPos())  && (!boost::regex_match(pos, match1, decimal) || !boost::regex_match(albumPart->getPos(), match2, decimal) || match1[1].str().compare(match2[1].str()))) {
            if (!pos.empty()) {
                LOG(INFO) << "updating albumPart " << id << " pos from " << albumPart->getPos() << " to " << pos;
                needsUpdate = true;
            } else {
                pos = albumPart->getPos();
            }
        }
        if (name.compare(albumPart->getName())  && (!boost::regex_match(name, match1, decimal) || !boost::regex_match(albumPart->getName(), match2, decimal) || match1[1].str().compare(match2[1].str()))) {
            if (!name.empty()) {
                LOG(INFO) << "updating albumPart " << id << " name from " << albumPart->getName() << " to " << name;
                needsUpdate = true;
            } else {
                name = albumPart->getName();
            }
        }
        if (albumId != albumPart->getAlbumId()) {
            if (albumId) {
                LOG(INFO) << "updating albumPart " << id << " albumId from " << albumPart->getAlbumId() << " to " << albumId;
                needsUpdate = true;
            } else {
                albumId = albumPart->getAlbumId();
            }
        }
        if (album) needsUpdate |= album->sync();
        return needsUpdate;
    }
示例#21
0
int
GVNumModel::getSelectedIndex()
{
    int index;
    bool dialBack;

    if (!findById (m_selectedId, dialBack, index)) {
        index = -1;
    } else {
        if (!dialBack) {
            index += m_dialBack.count ();
        }
    }

    return (index);
}//GVNumModel::getSelectedIndex
示例#22
0
bool
GVNumModel::findById(const QString &id, GVRegisteredNumber &num)
{
    bool dialBack;
    int index;

    if (!findById (id, dialBack, index)) {
        return (false);
    }

    if (dialBack) {
        num = m_dialBack[index];
    } else {
        num = m_dialOut[index];
    }

    return (true);
}//GVNumModel::findById
示例#23
0
void SharedNotebookTable::sync(qint32 l, SharedNotebook sharedNotebook){
    qint32 lid = l;
    if (lid == 0)
        lid= findById(sharedNotebook.id);

    if (lid > 0) {
        QSqlQuery query;
        // Delete the old record
        query.prepare("Delete from DataStore where lid=:lid and key>=3300 and key <3400");
        query.bindValue(":lid", lid);
        query.exec();
    } else {
        ConfigStore cs;
        lid = cs.incrementLidCounter();
    }

    add(lid, sharedNotebook, false);
}
skelPoseAction * skelPoseActionList::addAction(string _name, int _id) {
	skelPoseAction * result;
	int i = findById(_id);
	if(i > -1) {
		result = actions[i];
	} else {
		i = findByName(_name);
		if(i > -1) {
			result = actions[i];
		} else {
			result = new skelPoseAction();
			result->name = _name;
			result->id = _id;
			actions.push_back(result);
		}
	}
		 
	return result;
}
示例#25
0
文件: world.cpp 项目: theanonym/pukan
bool World::createMouseJoint(const Vec2f & mousePos)
{
   Body * body = findFirstByPos(mousePos);
   if(body == nullptr || body->getId() == 1 || !body->isDynamic())
      return false;

   body->getB2Body()->SetAwake(true);

   b2MouseJointDef jd;
   jd.bodyA = findById(1)->getB2Body(); // Не используется
   jd.bodyB = body->getB2Body();
   jd.target = mousePos.toB2Pos();
   jd.collideConnected = true;
   jd.maxForce = body->getB2Body()->GetMass() * 1000;

   _mouseJoint = static_cast<b2MouseJoint *>(getB2World()->CreateJoint(&jd));

   return true;
}
示例#26
0
文件: Tab.cpp 项目: CRasterImage/Lamp
void ActiveThreadTab::worldTreeHasNewPosts(TabRef tab_ref,
                                           const std::list<ChattyPostDataRef>& new_posts)
{
   trackPositionBeforeChange();

   bool something_changed = false;

   if(m_threads.size() > 0)
   {
      chatty_post_id thread_id = m_threads.front()->getPostDataRef()->m_thread_id;

      for(std::list<ChattyPostDataRef>::const_iterator it = new_posts.begin();
          it != new_posts.end();
          it++)
      {
         if((*it)->m_thread_id == thread_id)
         {
            PostRef parent = findById((*it)->m_parent_id);
            if(parent != nullptr)
            {
               PostRef child = ReplyPost::create(tab_ref);
               child->fromChattyPostData(child, *it, false, false);
               parent->addChild(child);
               child->setMe(child);
               child->setParent(parent);
               something_changed = true;
            }
         }
      }
   }
   
   if(something_changed)
   {
      updateShape(m_window_size);
      updatePositionAfterChange();
      toolbarNeedsUpdate();
      needsRedraw();
   }
   else
   {
      cancelPositionTracking();
   }
}
示例#27
0
void Playtree::onUpdateCurrent( bool b_active )
{
    if( b_active )
    {
        playlist_Lock( m_pPlaylist );

        playlist_item_t* current = playlist_CurrentPlayingItem( m_pPlaylist );
        if( !current )
        {
            playlist_Unlock( m_pPlaylist );
            return;
        }

        Iterator it = findById( current->i_id );
        if( it != m_children.end() )
        {
            it->setPlaying( true );

            tree_update descr(
                tree_update::ItemUpdated, IteratorVisible( it, this ) );
            notify( &descr );
        }

        playlist_Unlock( m_pPlaylist );
    }
    else
    {
        for( Iterator it = m_children.begin(); it != m_children.end();
             it = getNextItem( it ) )
        {
            if( it->isPlaying() )
            {
                it->setPlaying( false );

                tree_update descr(
                    tree_update::ItemUpdated, IteratorVisible( it, this ) );
                notify( &descr );
                break;
            }
        }
    }
}
示例#28
0
boost::optional<FreeMonStorageState> FreeMonStorage::read(OperationContext* opCtx) {
    BSONObj deleteKey = BSON("_id" << kFreeMonDocIdKey);
    BSONElement elementKey = deleteKey.firstElement();

    auto storageInterface = repl::StorageInterface::get(opCtx);

    AutoGetCollectionForRead autoRead(opCtx, NamespaceString::kServerConfigurationNamespace);

    auto swObj = storageInterface->findById(
        opCtx, NamespaceString::kServerConfigurationNamespace, elementKey);
    if (!swObj.isOK()) {
        if (swObj.getStatus() == ErrorCodes::NoSuchKey ||
            swObj.getStatus() == ErrorCodes::NamespaceNotFound) {
            return {};
        }

        uassertStatusOK(swObj.getStatus());
    }

    return FreeMonStorageState::parse(IDLParserErrorContext("FreeMonStorage"), swObj.getValue());
}
示例#29
0
void Playtree::onDelete( int i_id )
{
    Iterator it = findById( i_id ) ;
    if( it != m_children.end() )
    {
        VarTree* parent = it->parent();
        if( parent )
        {
            tree_update descr(
                tree_update::DeletingItem, IteratorVisible( it, this ) );
            notify( &descr );

            parent->removeChild( it );
            m_allItems.erase( i_id );

            tree_update descr2(
                tree_update::ItemDeleted, end() );
            notify( &descr2 );
        }
    }
}
  stationDelegation *stationDelegationDao::findById(ull *aid, int size_a)
  {
    // //set id values for sql select queries
    // for (int i = 0; i < size_a; ++i)
    //   aull_t[i] = aid[i];
    
    // //sql query with oracle pro*C/C++ 
    // SELECT stationDelegation_type, stationDelegation_name INTO :aus_t, :ac20_t FROM stationDelegation WHERE stationDelegation_id = :aull_t;

    stationDelegation *sd, *asd = new stationDelegation[size_a];

    for (int i = 0; i < size_a; ++i) {
      sd = findById(aid[i]);
      //set new object with selected values
      asd[i].setId(sd->getId());
      asd[i].setRsmcId(sd->getRsmcId());
      asd[i].setPointId(sd->getPointId());
    }
    
    return asd;
  }