Пример #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);
}
Пример #24
0
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
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
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 );
        }
    }
}
Пример #30
0
  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;
  }