Ejemplo n.º 1
0
void MpCodecFactory::freeAllLoadedLibsAndCodec()
{
   OsSharedLibMgrBase* pShrMgr = OsSharedLibMgr::getOsSharedLibMgr();

   UtlHashBagIterator iter(mCodecsInfo);
   MpCodecSubInfo* pinfo;

   UtlHashBag libLoaded;
   UtlString* libName;

   while ((pinfo = (MpCodecSubInfo*)iter()))
   {  
      if ((!pinfo->getCodecCall()->isStatic()) && 
         (!libLoaded.find(&pinfo->getCodecCall()->getModuleName()))) {
         libLoaded.insert(const_cast<UtlString*>(&pinfo->getCodecCall()->getModuleName()));
      }    
   }

   UtlHashBagIterator iter2(libLoaded);
   while ((libName = (UtlString*)iter2()))
   {
      pShrMgr->unloadSharedLib(libName->data());
   }

   iter.reset();
   while ((pinfo = (MpCodecSubInfo*)iter()))
   {  
      if (!pinfo->getCodecCall()->isStatic()) {
         mCodecsInfo.remove(pinfo);
         delete pinfo;         
      }
   }

   mCodecInfoCacheValid = FALSE;
}
Ejemplo n.º 2
0
void XMLObjectCache::dumpForeignCache()
{
	TRACE_MESSAGE("****** Begin Foreign Object Instance Cache Dump ******");
	gthread_mutex_lock(&m_csForeign);

	
	GHashIterator iter2(m_cacheForeignAlternate);
	while (iter2())
	{
		DynamicXMLObject *pObj = (DynamicXMLObject *)iter2++;
		GString str;
		str.Format("Object In Alt-Index Cache - %s[%s]\n", pObj->GetObjectType(), pObj->GetObjectTag() );
		TRACE_MESSAGE((const char *)str);
	}
	
	TRACE_MESSAGE("-----------------------------------------------\n");
	
	
	GHashIterator iter(m_cacheForeign);
	while (iter())
	{
		DynamicXMLObject *pObj = (DynamicXMLObject *)iter++;
		GString str;
		str << "Object In Cache - " << (__int64)(void *)pObj;
		TRACE_MESSAGE((const char *)str);
	}

	gthread_mutex_unlock(&m_csForeign);
	TRACE_MESSAGE("****** End Foreign Object Instance Cache Dump ******");
}
Ejemplo n.º 3
0
// Current list view selection changed slot.
void qtractorMidiEventList::selectionChangedSlot (
	const QItemSelection& selected, const QItemSelection& deselected )
{
	qtractorMidiEditor *pEditor = m_pListView->editor();
	if (pEditor == NULL)
		return;

	if (m_iSelectUpdate > 0)
		return;

#ifdef CONFIG_DEBUG_0
	qDebug("qtractorMidiEventList[%p]::selectionChangedSlot()", this);
#endif

	++m_iSelectUpdate;

	m_pListView->setUpdatesEnabled(false);
	QListIterator<QModelIndex> iter1(selected.indexes());
	while (iter1.hasNext()) {
		const QModelIndex& index = iter1.next();
		if (index.column() == 0)
			pEditor->selectEvent(m_pListView->eventOfIndex(index), true);
	}
	QListIterator<QModelIndex> iter2(deselected.indexes());
	while (iter2.hasNext()) {
		const QModelIndex& index = iter2.next();
		if (index.column() == 0)
			pEditor->selectEvent(m_pListView->eventOfIndex(index), false);
	}
	m_pListView->setUpdatesEnabled(true);

	pEditor->selectionChangeNotify();
	
	--m_iSelectUpdate;
}
Ejemplo n.º 4
0
//-----------------------------------------------------------------------------
void UIViewFactory::collectRegisteredViewNames (std::list<const std::string*>& viewNames, IdStringPtr baseClassNameFilter) const
{
	ViewCreatorRegistry& registry = getCreatorRegistry ();
	ViewCreatorRegistry::const_iterator iter = registry.begin ();
	while (iter != registry.end ())
	{
		if (baseClassNameFilter)
		{
			bool found = false;
			ViewCreatorRegistry::const_iterator iter2 (iter);
			while (iter2 != registry.end () && (*iter2).second->getBaseViewName ())
			{
				if ((*iter2).first == baseClassNameFilter)
				{
					found = true;
					break;
				}
				iter2 = registry.find ((*iter2).second->getBaseViewName ());
			}
			if (!found)
			{
				iter++;
				continue;
			}
		}
//		if ((*iter).first != "CControl")
			viewNames.push_back (&(*iter).first);
		iter++;
	}
}
Ejemplo n.º 5
0
    void Scene::unloadCell (CellStoreCollection::iterator iter)
    {
        std::cout << "Unloading cell\n";
        ListAndResetObjects functor;

        (*iter)->forEach<ListAndResetObjects>(functor);
        for (std::vector<MWWorld::Ptr>::const_iterator iter2 (functor.mObjects.begin());
            iter2!=functor.mObjects.end(); ++iter2)
        {
            mPhysics->remove(*iter2);
        }

        if ((*iter)->getCell()->isExterior())
        {
            ESM::Land* land =
                MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
                    (*iter)->getCell()->getGridX(),
                    (*iter)->getCell()->getGridY()
                );
            if (land && land->mDataTypes&ESM::Land::DATA_VHGT)
                mPhysics->removeHeightField ((*iter)->getCell()->getGridX(), (*iter)->getCell()->getGridY());
        }

        MWBase::Environment::get().getMechanicsManager()->drop (*iter);

        mRendering.removeCell(*iter);
        MWBase::Environment::get().getWindowManager()->removeCell(*iter);

        MWBase::Environment::get().getWorld()->getLocalScripts().clearCell (*iter);

        MWBase::Environment::get().getSoundManager()->stopSound (*iter);
        mActiveCells.erase(*iter);
    }
Ejemplo n.º 6
0
    void Scene::unloadCell (CellStoreCollection::iterator iter)
    {
        std::cout << "Unloading cell\n";
        ListHandles functor;

        (*iter)->forEach<ListHandles>(functor);
        {
            // silence annoying g++ warning
            for (std::vector<Ogre::SceneNode*>::const_iterator iter2 (functor.mHandles.begin());
                iter2!=functor.mHandles.end(); ++iter2){
                 Ogre::SceneNode* node = *iter2;
                mPhysics->removeObject (node->getName());
            }

            if ((*iter)->mCell->isExterior())
            {
                ESM::Land* land =
                    MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
                        (*iter)->mCell->getGridX(),
                        (*iter)->mCell->getGridY()
                    );
                if (land)
                    mPhysics->removeHeightField( (*iter)->mCell->getGridX(), (*iter)->mCell->getGridY() );
            }
        }

        mRendering.removeCell(*iter);
       //mPhysics->removeObject("Unnamed_43");

        MWBase::Environment::get().getWorld()->getLocalScripts().clearCell (*iter);
        MWBase::Environment::get().getMechanicsManager()->drop (*iter);
        MWBase::Environment::get().getSoundManager()->stopSound (*iter);
        mActiveCells.erase(*iter);
    }
Ejemplo n.º 7
0
/*!
 *  \brief  全変数のダンプ
 *  \param[in]  line      行番号
 *  \param[in]  arg_list  マクロ実引数リスト
 *  \param[in]  p_ctx     マクロコンテキスト
 *  \retval     マクロ返却値
 *  マクロ実引数を指定した場合、その文字列属性で指定したファイルにダンプした文字列を追記する。
 *  ファイル名として、"stdout"を指定した場合は標準出力、"stderr"を指定した場合は標準エラーに出力する。
 *  ファイル名を省略した場合は"stderr"を指定したものとして振舞う。
 */
var_t bf_dump( text_line const& line, std::vector< var_t > const& arg_list, context const* p_ctx )
{
    std::size_t arity = arg_list.size();

    if ( arity > 1 )
    {
        error( line, _( "too many arguments for `%1%\'" ), "DUMP" );
    }

    std::string dump_str;

    // 全変数をなめる
    for ( std::map< std::string, var_t >::const_iterator iter( p_ctx->var_map.begin() ), last( p_ctx->var_map.end() );
            iter != last;
            ++iter )
    {
        dump_str += "$" + iter->first + "$ = { ";
        if ( !iter->second.empty() )
        {
            // 各変数の全要素
            for ( var_t::const_iterator iter2( iter->second.begin() ), last2( iter->second.end() );
                    iter2 != last2;
                    ++iter2 )
            {
                dump_str += "\"" + iter2->s + "\"(";
                if ( iter2->i ) // 値属性があれば...
                {
                    dump_str += boost::lexical_cast< std::string >( *iter2->i );
                }
                dump_str += "), ";
            }
        }
        dump_str += " }\n";
    }

    std::string filename( "stderr" );
    if ( arity == 1 )
    {
        filename = get_s( arg_list[0], p_ctx );
    }
    if ( filename == "stdout" )
    {
        fputs( dump_str.c_str(), stdout );
    }
    else if ( filename == "stderr" )
    {
        fputs( dump_str.c_str(), stderr );
    }
    else
    {
        std::FILE* stream = std::fopen( filename.c_str(), "a" );
        if ( stream != 0 )
        {
            fputs( dump_str.c_str(), stream );
            std::fclose( stream );
        }
    }
    element e;
    return var_t( 1, e );
}
Ejemplo n.º 8
0
void MeetingSetting::initPermittedSteps(const bool* const permitted) {
	// THIS WORKS CAUSE WE KNOW THAT PERMITTED STEPS CONTAINS EGO!
	if (lpPermittedSteps == 0) {
	lpSetting->initPermittedSteps(permitted);
		if (lpSetting->getPermittedSize() > 1) {
		ITieIterator* iter = lpSetting->getPermittedSteps();
		if(iter->actor() == ego()) {
			iter->next();
		}
			int pos = nextInt(lpSetting->getPermittedSize() - 1);
		while (pos != 0) {
			iter->next();
			if (iter->actor() != ego()) {
				--pos;
			}
		}
			SingleIterator iter1(ego());
			SingleIterator iter2(iter->actor());
			lpPermittedSteps = new UnionTieIterator(iter1, iter2);
		delete iter;
	} else {
		lpPermittedSteps = new SingleIterator(ego());
	}
	} else {
		LOGS(Priority::ERROR)<<"setting has not been terminated\n";
		throw "setting has not been terminated";
	}
}
Ejemplo n.º 9
0
bool ArrayData::equal(const ArrayData *v2, bool strict) const {
  assert(v2);

  if (this == v2) return true;
  auto const count1 = size();
  auto const count2 = v2->size();
  if (count1 != count2) return false;
  if (count1 == 0) return true;

  // prevent circular referenced objects/arrays or deep ones
  DECLARE_THREAD_INFO; check_recursion(info);

  if (strict) {
    for (ArrayIter iter1(this), iter2(v2); iter1; ++iter1, ++iter2) {
      assert(iter2);
      if (!same(iter1.first(), iter2.first())
          || !same(iter1.second(), iter2.secondRef())) return false;
    }
  } else {
    for (ArrayIter iter(this); iter; ++iter) {
      Variant key(iter.first());
      if (!v2->exists(key)) return false;
      if (!tvEqual(*iter.second().asTypedValue(),
                   *v2->get(key).asTypedValue())) {
        return false;
      }
    }
  }

  return true;
}
Ejemplo n.º 10
0
///////////////////////////////////////////////////////////////////////////////
// TestMutEx
///////////////////////////////////////////////////////////////////////////////
void cCmdLineParser::TestMutEx()
{
    std::list<std::pair<int,int> >::const_iterator i;
    cCmdLineIter iter1(*this), iter2(*this);
    for(i = mMutExList.begin(); i != mMutExList.end(); i++)
    {
        //TODO -- there is a much more efficent way to do this (using cFCOPropVector, for example)
        //      the command line is presumably small enough, tho, that it probably isn't a big
        //      deal to do it this way.
        iter1.SeekToArg(i->first);
        if(! iter1.Done())
        {
            iter2.SeekToArg(i->second);
            if(! iter2.Done())
            {
                // we have a mutual exclusion violation!
                throw eCmdLineMutEx( 
                    iter1.ActualParam() 
                        + _T(", ")
                        + iter2.ActualParam() );
            }
        }
    }

}
Ejemplo n.º 11
0
OA_ptr<DataFlowSet> ManagerReachingDefs::killSet(
    StmtHandle stmt, OA_ptr<DataFlowSet> xdfset)
{
    OA_ptr<ReachingDefsDFSet> x;
    x = xdfset.convert<ReachingDefsDFSet>();

    OA_ptr<ReachingDefsDFSet> killSet;
    killSet = new ReachingDefsDFSet();

    // Generate KILL code:
    OA_ptr<DataFlowSetImpl<StmtHandle > > set3;
    set3 = new DataFlowSetImpl<StmtHandle >();
    DataFlow::DataFlowSetImplIterator<StmtHandle >  iter2(x);
    StmtHandle iter2Val;

    for(; iter2.isValid(); iter2++) {
        iter2Val = iter2.current();
        OA_ptr<DataFlowSetImpl<Alias::AliasTag > > set4;
        set4 = new DataFlowSetImpl<Alias::AliasTag >(mStmt2MayDefMap[iter2Val]);
        OA_ptr<DataFlowSetImpl<Alias::AliasTag > > set5;
        set5 = new DataFlowSetImpl<Alias::AliasTag >(mStmt2MustDefMap[stmt]);
        bool cond2;
        cond2 = set4->isSubset(*set5);
        bool cond;
        cond = cond2;
        if(cond) {
            set3->insert(iter2Val);
        }
    }
    killSet = set3;

    return killSet;
}
Ejemplo n.º 12
0
 /*
 CHOP-662 was originally introduced to deal with crashes deleting files from
 a directory (VWR-25500). However, this introduced a crash looking for 
 old chat logs as the glob_to_regex function in lldiriterator wasn't escaping lots of regexp characters
 */
 void test_chop_662(void)
 {
     //  Check a selection of bad group names from the crash reports 
     LLDirIterator iter(".","+bad-group-name]+??-??.*");
     LLDirIterator iter1(".","))--@---bad-group-name2((??-??.*\\.txt");
     LLDirIterator iter2(".","__^v--x)Cuide d sua vida(x--v^__??-??.*"); 
 }
Ejemplo n.º 13
0
void export_named_dot(const SGraph *the_sgraph, ion *out,
                      suif_vector<String>* name_map) {
    out->printf("digraph foo {\nsize = \"8,10\";\n");

    SNodeIter iter(the_sgraph->get_node_iterator());
    // Print out nodes names and their labels
    for (; !iter.done(); iter.increment()) {
        SGraphNode node = iter.get();
        the_sgraph->print_node(out, node);
        out->printf(" [");
        out->printf("shape=box, label=\"");
        node_print(node, the_sgraph, out, name_map);
        out->printf("\"];\n");
    }

    iter = the_sgraph->get_node_iterator();
    // Print out each connecting edge
    for (; !iter.done(); iter.increment()) {
        SGraphNode from_node = iter.get();
        for (SNodeIter iter2(the_sgraph->get_node_successor_iterator(from_node));
                !iter2.done(); iter2.increment()) {
            SGraphNode to_node = iter2.get();
            the_sgraph->print_node(out, from_node);
            out->printf(" -> ");
            the_sgraph->print_node(out, to_node);
            //out->printf("%s", (*name_map)[to_node].c_str());
            out->printf("\n");
        }
    }
    out->printf("}\n");
}
Ejemplo n.º 14
0
int ArrayData::compare(const ArrayData *v2, bool strict) const {
  ASSERT(v2);

  int count1 = size();
  int count2 = v2->size();
  if (count1 < count2) return -1;
  if (count1 > count2) return 1;
  if (count1 == 0) return 0;

  if (strict) {
    for (ArrayIter iter1(this), iter2(v2); iter1 && iter2; ++iter1, ++iter2) {
      Variant key1(iter1.first());
      Variant key2(iter2.first());
      if (!key1.same(key2)) return 1; // or -1

      Variant value1(iter1.second());
      Variant value2(iter2.second());
      if (!value1.same(value2)) return 1; // or -1
    }
  } else {
    for (ArrayIter iter(this); iter; ++iter) {
      Variant key(iter.first());
      if (!v2->exists(key)) return 1;

      Variant value1(iter.second());
      Variant value2(v2->get(key));
      if (value1.more(value2)) return 1;
      if (value1.less(value2)) return -1;
    }
  }

  return 0;
}
Ejemplo n.º 15
0
void UndoManager::ModifyState(TrackList * l, double sel0, double sel1)
{
   // Delete current

   TrackListIterator iter(stack[current]->tracks);
   Track *t = iter.First();
   while (t) {
      delete t;
      t = iter.Next();
   }

   // Duplicate

   TrackList *tracksCopy = new TrackList();
   TrackListIterator iter2(l);
   t = iter2.First();
   while (t) {
      tracksCopy->Add(t->Duplicate());
      t = iter2.Next();
   }

   // Replace

   stack[current]->tracks = tracksCopy;
   stack[current]->sel0 = sel0;
   stack[current]->sel1 = sel1;
}
Ejemplo n.º 16
0
//-----------------------------------------------------------------------------
void UIViewFactory::collectRegisteredViewNames (StringPtrList& viewNames, IdStringPtr _baseClassNameFilter) const
{
	UTF8StringView baseClassNameFilter (_baseClassNameFilter);
	ViewCreatorRegistry& registry = getCreatorRegistry ();
	ViewCreatorRegistry::const_iterator iter = registry.begin ();
	while (iter != registry.end ())
	{
		if (baseClassNameFilter)
		{
			bool found = false;
			ViewCreatorRegistry::const_iterator iter2 (iter);
			while (iter2 != registry.end () && (*iter2).second->getBaseViewName ())
			{
				if (baseClassNameFilter == (*iter2).second->getViewName () || baseClassNameFilter == (*iter2).second->getBaseViewName ())
				{
					found = true;
					break;
				}
				iter2 = registry.find ((*iter2).second->getBaseViewName ());
			}
			if (!found)
			{
				iter++;
				continue;
			}
		}
		viewNames.push_back (&(*iter).first);
		iter++;
	}
	viewNames.sort (viewNamesSortFunc);
}
Ejemplo n.º 17
0
void AudacityProject::OnAlign(wxCommandEvent & event)
{
   double avg = 0.0;
   int num = 0;

   TrackListIterator iter(mTracks);
   VTrack *t = iter.First();

   while (t) {
      if (t->GetSelected()) {
         avg += t->GetOffset();
         num++;
      }

      t = iter.Next();
   }

   if (num) {
      avg /= num;

      TrackListIterator iter2(mTracks);
      t = iter2.First();

      while (t) {
         if (t->GetSelected())
            t->SetOffset(avg);

         t = iter2.Next();
      }
   }

   PushState(_("Aligned tracks"));

   mTrackPanel->Refresh(false);
}
Ejemplo n.º 18
0
bool ArrayData::equal(const ArrayData *v2, bool strict) const {
    ASSERT(v2);

    int count1 = size();
    int count2 = v2->size();
    if (count1 != count2) return false;
    if (count1 == 0) return true;

    // prevent circular referenced objects/arrays or deep ones
    DECLARE_THREAD_INFO;
    RECURSION_INJECTION;

    if (strict) {
        for (ArrayIter iter1(this), iter2(v2); iter1 && iter2; ++iter1, ++iter2) {
            Variant key1(iter1.first());
            Variant key2(iter2.first());
            if (!key1.same(key2)) return false;

            Variant value1(iter1.second());
            Variant value2(iter2.second());
            if (!value1.same(value2)) return false;
        }
    } else {
        for (ArrayIter iter(this); iter; ++iter) {
            Variant key(iter.first());
            if (!v2->exists(key)) return false;

            Variant value1(iter.second());
            Variant value2(v2->get(key));
            if (!value1.equal(value2)) return false;
        }
    }

    return true;
}
 void ComponentManager::removeComponent(Entity& entity, Component& component) {
     std::map<size_t, std::map<int, Component *> >::iterator iter(entitiesByComponentUid.find(getComponentUid(component)));
     if (iter != entitiesByComponentUid.end()) {
         std::map<int, Component *>::iterator iter2(iter->second.find(entity.id));
         if (iter2 != iter->second.end()) {
             iter->second.erase(iter2);
         }
     }
     entity.removeComponent(componentUidBitIds.find(getComponentUid(component))->second);
 }
// -----------------------------------------------------------------------------
// CTestDomCdl::TestCRITIteratorL
// -----------------------------------------------------------------------------
//
TInt CTestDomCdl::TestCRITIteratorL( CStifItemParser& /*aItem*/ ) 
    {
    CCdlRefs* cdlRefs = CCdlRefs::NewL();
    CCdlRefs::TIterator iter = cdlRefs->Begin();
    CleanupStack::PushL( cdlRefs );//push
    STIF_ASSERT_NOT_NULL( cdlRefs );
    CCdlRefs::TIterator iter2( iter );
    CleanupStack::PopAndDestroy();
    return KErrNone;
    }
Ejemplo n.º 21
0
bool SetJoystick::isSetEmpty()
{
    bool result = true;
    QHashIterator<int, JoyButton*> iter(buttons);
    while (iter.hasNext() && result)
    {
        JoyButton *button = iter.next().value();
        if (!button->isDefault())
        {
            result = false;
        }
    }

    QHashIterator<int, JoyAxis*> iter2(axes);
    while (iter2.hasNext() && result)
    {
        JoyAxis *axis = iter2.next().value();
        if (!axis->isDefault())
        {
            result = false;
        }
    }

    QHashIterator<int, JoyDPad*> iter3(hats);
    while (iter3.hasNext() && result)
    {
        JoyDPad *dpad = iter3.next().value();
        if (!dpad->isDefault())
        {
            result = false;
        }
    }

    QHashIterator<int, JoyControlStick*> iter4(sticks);
    while (iter4.hasNext() && result)
    {
        JoyControlStick *stick = iter4.next().value();
        if (!stick->isDefault())
        {
            result = false;
        }
    }

    QHashIterator<int, VDPad*> iter5(vdpads);
    while (iter5.hasNext() && result)
    {
        VDPad *vdpad = iter5.next().value();
        if (!vdpad->isDefault())
        {
            result = false;
        }
    }

    return result;
}
Ejemplo n.º 22
0
void CheckLineExtractionOne(IterT iter)
{
    IterT end;

    // At the start, we are on a newline, which is an empty
    //  string
    BOOST_TEST(iter.get_currentline() == string());
    BOOST_TEST(
        string(iter.get_currentline_begin(), iter.get_currentline_end())
        == string());

    ++iter; // a
    ++iter; // b
    ++iter; // c
    BOOST_TEST(iter.get_currentline() == line1);
    AssertIterString(
        iter.get_currentline_begin(),
        iter.get_currentline_end(),
        line1);

    ++iter; // d
    ++iter; // newline
    ++iter; // e

    // check that copy construction and assignment do
    //  not interfere with get_currentline
    IterT iter2(iter);
    IterT iter3;
    iter3 = iter;
    BOOST_TEST(iter2.get_currentline() == line2);
    BOOST_TEST(iter3.get_currentline() == line2);
    AssertIterString(
        iter2.get_currentline_begin(),
        iter2.get_currentline_end(),
        line2);
    AssertIterString(
        iter3.get_currentline_begin(),
        iter3.get_currentline_end(),
        line2);

    ++iter; // f
    ++iter; // g
    ++iter; // h
    ++iter; // newline

    // Check when the iterator is on a newline
    BOOST_TEST(iter.get_currentline() == line2);
    AssertIterString(
        iter.get_currentline_begin(),
        iter.get_currentline_end(),
        line2);

    ++iter;
    BOOST_TEST(iter == end);
}
Ejemplo n.º 23
0
 Glib::RefPtr<Gtk::Action> ActionManager::find_action_by_name(const std::string & n) const
 {
   Glib::ListHandle<Glib::RefPtr<Gtk::Action> > actions = m_main_window_actions->get_actions();
   for(Glib::ListHandle<Glib::RefPtr<Gtk::Action> >::const_iterator iter2(actions.begin()); 
       iter2 != actions.end(); ++iter2) {
     if((*iter2)->get_name() == n) {
       return *iter2;
     }
   }
   DBG_OUT("%s not found", n.c_str());
   return Glib::RefPtr<Gtk::Action>();      
 }
Ejemplo n.º 24
0
void CSoftManager::timerEvent(QTimerEvent *event)
{
	int id = event->timerId();

	{
		QMutexLocker locker(&m_reStartListMutex);
		QHashIterator<QString, QPair<int, int> > iter(m_reStartTask);
		while(iter.hasNext())
		{
			iter.next();
			if(iter.value().first == id)
			{
				//一个重启timer只需要执行一次
				killTimer(id);

				qDebug() << QString::fromLocal8Bit("%1 %2下载重启")
					.arg(iter.key()).arg(iter.value().second);

				Task task;
				{
					QMutexLocker locker(&m_SrcListMutex);
					task = m_pSrcTask.value(iter.key());
					m_pSrcTask.remove(iter.key());
				}
				
				AddTask(task);

				return;
			}
		}
	}
	
	{
		QMutexLocker locker(&m_reDecompressListMutex);
		QHashIterator<QString, QPair<int, int> > iter2(m_reDecompressTask);
		while(iter2.hasNext())
		{
			iter2.next();
			if(iter2.value().first == id)
			{
				//一个重启timer只需要执行一次
				killTimer(id);

				qDebug() << QString::fromLocal8Bit("%1 %2解压重启")
					.arg(iter2.key()).arg(iter2.value().second);

				SoftInstall(iter2.key());

				return;
			}
		}
	}
}
Ejemplo n.º 25
0
//________________________________________________________
void GFHistManager::SetHistsYTitle(const char* title, Int_t layer)
{
  if(!this->CheckDepth("SetHistsYTitle", layer, kFALSE)) return;

  TIter iter2(static_cast<TObjArray*>(fHistArrays->At(layer)));
  while(TObjArray* arr = static_cast<TObjArray*>(iter2.Next())){
    TIter iter(arr);// arr is GFHistArray* !
    while(TH1* hist = static_cast<TH1*>(iter.Next())){
      hist->SetYTitle(title);
    }
  }
}
Ejemplo n.º 26
0
//________________________________________________________
void GFHistManager::SetHistsLineColor(Color_t color, Int_t layer)
{
  if(!this->CheckDepth("SetHistsLineColor", layer, kFALSE)) return;

  TIter iter2(static_cast<TObjArray*>(fHistArrays->At(layer)));
  while(TObjArray* arr = static_cast<TObjArray*>(iter2.Next())){
    TIter iter(arr); // arr is GFHistArray* !
    while(TH1* hist = static_cast<TH1*>(iter.Next())){
      hist->SetLineColor(color);
    }
  }
}
Ejemplo n.º 27
0
///////////////////////////////////////////////////////////////////////////////
// TestDependency
///////////////////////////////////////////////////////////////////////////////
void cCmdLineParser::TestDependency()
{
    std::list< std::pair< std::pair< int, int>, bool > >::const_iterator i;
    cCmdLineIter iter1(*this), iter2(*this);

    for( i = mDependencyList.begin(); i != mDependencyList.end(); ++i)
    {
        iter1.SeekToArg( i->first.first );
        // was it on the command line?
        if( !iter1.Done() )
        {
            // it was, is the corresponding arg on the command line?
            iter2.SeekToArg( i->first.second );
            if( iter2.Done() ) // it wasn't, dependency error
            {
                TSTRING arg1, arg2, alias1, alias2;
                cCmdLineParser::LookupArgInfo( i->first.first, arg1, alias1 );
                cCmdLineParser::LookupArgInfo( i->first.second, arg2, alias2 );

                // determine in which form the user passed the arguments,
                // and construct the error message in the same form
                if ( iter1.ActualParam().length() == 2 )
                    throw eCmdLineDependency( _T("The switch -") + arg1 + _T(" requires -") + arg2 +_T(".") );
                else
                    throw eCmdLineDependency( _T("The switch --") + alias1 + _T(" requires --") + alias2 + _T(".") );
            }
        }
        else if( i->second )
        // only make this second check if the dependencies are MUTUAL,
        // as indicated (or not) by the bool value.
        {
            iter2.SeekToArg( i->first.second ); 
                // the first arg in the pair was not on the command line,
                // so just make sure the second isn't there...
            if( !iter2.Done() )
            {
                // arg2 appeared without arg1, so dependency error.
                TSTRING arg1, arg2, alias1, alias2;
                cCmdLineParser::LookupArgInfo( i->first.first, arg1, alias1 );
                cCmdLineParser::LookupArgInfo( i->first.second, arg2, alias2 );

                // determine in which form the user passed the arguments,
                // and construct the error message in the same form
                if ( iter1.ActualParam().length() == 2 )
                    throw eCmdLineDependency( _T("The switch -") + arg2 + _T(" requires -") + arg1 +_T(".") );
                else
                    throw eCmdLineDependency( _T("The switch --") + alias2 + _T(" requires --") + alias1 + _T(".") );
            }
        }

    } //end for
}
Ejemplo n.º 28
0
Array ArrayUtil::Combine(CArrRef keys, CArrRef values) {
  if (keys.size() != values.size()) {
    throw InvalidArgumentException("keys and values", "(not same count)");
  }
  if (keys.empty()) {
    throw InvalidArgumentException("keys and values", "(empty)");
  }

  Array ret = Array::Create();
  for (ArrayIter iter1(keys), iter2(values); iter1; ++iter1, ++iter2) {
    ret.set(iter1.second(), iter2.second());
  }
  return ret;
}
Ejemplo n.º 29
0
bool TestExtMailparse::test_mailparse_rfc822_parse_addresses() {
    static const StaticString
    s_display("display"),
              s_address("address"),
              s_is_group("is_group");
    Array addresses =
        CREATE_VECTOR2("\":sysmail\"@ Some-Group. Some-Org, Muhammed."
                       "(I am the greatest) Ali @(the)Vegas.WBA",
                       "\"strange\":\":sysmail\"@ Some-Group. Some-Org, Muhammed."
                       "(I am the greatest) Ali @(the)Vegas.WBA;");

    f_ob_start();

    for (ArrayIter iter(addresses); iter; ++iter) {
        Variant parsed = f_mailparse_rfc822_parse_addresses(iter.second());
        for (ArrayIter iter2(parsed); iter2; ++iter2) {
            Variant pair = iter2.second();
            echo(pair[s_display]);
            echo("\n");
            echo(pair[s_address]);
            echo("\n");
            if (pair[s_is_group].toBoolean()) {
                Variant sub = f_mailparse_rfc822_parse_addresses
                              (f_substr(pair[s_address], 1, f_strlen(pair[s_address]) - 2));
                for (ArrayIter iter3(sub); iter3; ++iter3) {
                    echo("   ");
                    echo(iter3.second()[s_address]);
                    echo("\n");
                }
            }
        }
        echo("...\n");
    }

    String output = f_ob_get_contents();
    f_ob_end_clean();
    VS(output,
       ":[email protected]\n"
       "\":sysmail\"@Some-Group.Some-Org\n"
       "I am the greatest the\n"
       "[email protected]\n"
       "...\n"
       "strange\n"
       ":\":sysmail\"@Some-Group.Some-Org,[email protected];\n"
       "   \":sysmail\"@Some-Group.Some-Org\n"
       "   [email protected]\n"
       "...\n");

    return Count(true);
}
Ejemplo n.º 30
0
int
ACE_TMAIN (int, ACE_TCHAR *[])
{
  ACE_Unbounded_Set<int> s1;

  ACE_ASSERT (s1.size () == 0);
  s1.insert_tail (10);
  s1.insert_tail (20);
  ACE_ASSERT (s1.size () == 2);

  ACE_Unbounded_Set<int> s2 (s1);
  ACE_ASSERT (s2.size () == 2);

  ACE_Unbounded_Set<int> s3;
  ACE_ASSERT (s3.size () == 0);

  s3 = s2;
  ACE_ASSERT (s3.size () == s2.size ());

  ACE_Unbounded_Set<int> s4 (s3);
  ACE_ASSERT (s4.size () == 2);

  int *ip = 0;

  ACE_DEBUG ((LM_DEBUG, "dumping s1\n"));
  for (ACE_Unbounded_Set_Iterator<int> iter1 (s1);
       iter1.next (ip) != 0;
       iter1.advance ())
    ACE_DEBUG ((LM_DEBUG, "item = %d\n", *ip));

  ACE_DEBUG ((LM_DEBUG, "dumping s2\n"));
  for (ACE_Unbounded_Set_Iterator<int> iter2 (s2);
       iter2.next (ip) != 0;
       iter2.advance ())
    ACE_DEBUG ((LM_DEBUG, "item = %d\n", *ip));

  ACE_DEBUG ((LM_DEBUG, "dumping s3\n"));
  for (ACE_Unbounded_Set_Iterator<int> iter3 (s3);
       iter3.next (ip) != 0;
       iter3.advance ())
    ACE_DEBUG ((LM_DEBUG, "item = %d\n", *ip));

  ACE_DEBUG ((LM_DEBUG, "dumping s4\n"));
  for (ACE_Unbounded_Set_Iterator<int> iter4 (s4);
       iter4.next (ip) != 0;
       iter4.advance ())
    ACE_DEBUG ((LM_DEBUG, "item = %d\n", *ip));

  return 0;
}