当前位置: 首页>>代码示例>>C++>>正文


C++ list::empty方法代码示例

本文整理汇总了C++中std::list::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ list::empty方法的具体用法?C++ list::empty怎么用?C++ list::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在std::list的用法示例。


在下文中一共展示了list::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: graph_explore_BC

void const_graph_visitort::graph_explore_BC(
  event_grapht &egraph,
  event_idt next,
  std::list<event_idt> &old_path,
  std::set<unsigned> &edges,
  bool porw)
{
  /* TODO: restricts to C_1 U ... U C_n for perf improvement */
  assert(!old_path.empty());

  fence_inserter.instrumenter.message.debug() << "(BC) explore "
                                              << old_path.front()
                                              << " --...--> " << next
                                              << messaget::eom;

  if(visited_nodes.find(next)!=visited_nodes.end())
     return;
  visited_nodes.insert(next);

  /* if all the incoming pos were already visited, add */
  bool no_other_pos = true;
  for(wmm_grapht::edgest::const_iterator it=
    egraph.po_out(next).begin();
    it!=egraph.po_out(next).end();
    ++it)
    if(visited_nodes.find(it->first)==visited_nodes.end())
    {
      no_other_pos = false;
      break;
    }

  if(egraph.po_out(next).empty() || no_other_pos)
  {
    /* inserts all the pos collected from old_path in edges */
    std::list<event_idt>::const_iterator it=old_path.begin();
    std::list<event_idt>::const_iterator next_it=it;
    ++next_it;
    for( ; next_it!=old_path.end() && it!=old_path.end(); ++it, ++next_it)
    {
      const abstract_eventt &e1=egraph[*it];
      const abstract_eventt &e2=egraph[*next_it];
      if(!porw ||
         (e1.operation==abstract_eventt::operationt::Read &&
          e2.operation==abstract_eventt::operationt::Write))
        edges.insert(fence_inserter.add_edge(edget(*it, *next_it)));
    }
    assert(it!=old_path.end());
  }
  else
  {
    for(wmm_grapht::edgest::const_iterator
      next_it=egraph.po_out(next).begin();
      next_it!=egraph.po_out(next).end();
      ++next_it)
    {
      old_path.push_back/*front*/(next_it->first);
      graph_explore_BC(egraph, next_it->first, old_path, edges);
      old_path.pop_back/*front*/();
    }
  }
}
开发者ID:danpoe,项目名称:cbmc,代码行数:61,代码来源:graph_visitor.cpp

示例2: main

// where everything begins...
int main(int argc, char** argv)
{
  const unsigned ONECHAR_ARG = 3, TWOCHAR_ARG = 4;

  // check that syntax is ok
  if (argc < 3)
  {
    std::cerr << "syntax: regress [OPTIONS] <xml file> <output file>" << std::endl;
    return -1;
  }

  // get all options
  for (int i=1; i< argc-2; i++)
  {
    // get the option
    std::string option(argv[i]);

    // process options
    if (option.find("-oi") != std::string::npos)
      OUTPUT_ITER_NUM = true;
    else if (option.find("-or") != std::string::npos)
      OUTPUT_SIM_RATE = true;
    else if (option.find("-s=") != std::string::npos)
    {
      STEP_SIZE = std::atof(&argv[i][ONECHAR_ARG]);
      assert(STEP_SIZE >= 0.0 && STEP_SIZE < 1);
    }
    else if (option.find("-mi=") != std::string::npos)
    {
      MAX_ITER = std::atoi(&argv[i][TWOCHAR_ARG]);
      assert(MAX_ITER > 0);
    }
    else if (option.find("-mt=") != std::string::npos)
    {
      MAX_TIME = std::atof(&argv[i][TWOCHAR_ARG]);
      assert(MAX_TIME > 0);
    }
    else if (option.find("-p=") != std::string::npos)
      read_plugin(&argv[i][ONECHAR_ARG]);
  }

  // setup the simulation 
  READ_MAP = XMLReader::read(std::string(argv[argc-2]));

  // get the (only) simulation object
  boost::shared_ptr<Simulator> s;
  for (std::map<std::string, BasePtr>::const_iterator i = READ_MAP.begin(); i != READ_MAP.end(); i++)
  {
    s = boost::dynamic_pointer_cast<Simulator>(i->second);
    if (s)
      break;
  }

  // make sure that a simulator was found
  if (!s)
  {
    std::cerr << "regress: no simulator found in " << argv[argc-2] << std::endl;
    return -1;
  } 

  // setup the output file
  outfile.open(argv[argc-1]);

  // call the initializers, if any
  if (!INIT.empty())
  {
    BOOST_FOREACH(init_t i, INIT)
      (*i)(NULL, READ_MAP, STEP_SIZE);
  }

  // begin timing
  start_time = clock();

  // begin rendering
  while (step((void*) &s))
  {
  }

  // close the loaded library
  if (HANDLE)
    dlclose(HANDLE);

  // write the number of clock ticks elapsed
  clock_t end_time = clock();
  Real elapsed = (end_time - start_time) / (Real) CLOCKS_PER_SEC;
  outfile << elapsed << std::endl;

  // close the output file
  outfile.close();
}
开发者ID:erwincoumans,项目名称:Moby,代码行数:91,代码来源:regress.cpp

示例3: extract_peers_from_bootstrap_nodes_dat

void extract_peers_from_bootstrap_nodes_dat(const unsigned char *buffer, std::list<Contact *>& bootstrap_list)
{
    /*
        The header is so composed:
          uint32_t reserved0          set to zero
          uint32_t reserved1          set to 0x00000003
          uint32_t bootstrap_edition  nodes.dat bootstrap version
          uint32_t num_entries        number of entries in the file
    */

    if(!bootstrap_list.empty())
        return;

    uint32_t reserved0 = *(uint32_t *)&(buffer[0]);
    uint32_t reserved1 = *(uint32_t *)&(buffer[4]);
    uint32_t num_entries = *(uint32_t *)&(buffer[12]);

    if(reserved0 != 0 || reserved1 != 3)
        // wow: this bootstrap nodes.dat is invalid
        return;

    unsigned char *peer = (unsigned char *)&(buffer[16]);

    /*
        The peer is so composed:
          uint64_t low_peer_id        128-bit peer identifier (MD4 of node ID)
          uint64_t high_peer_id
          uint32_t peer_ip            IP address of the peer
          uint16_t udp_port           peer UDP port number
          uint16_t tcp_port           peer TCP port number
          unsigned char version       peer contact version
    */

    for(unsigned int i = 0; i < num_entries; i++, peer += 25)
    {
        uint32_t peer_ip = ntohl(*(uint32_t *)&(peer[16]));
        uint16_t udp_port = *(uint16_t *)&(peer[20]);
        uint16_t tcp_port = *(uint16_t *)&(peer[22]);
        unsigned char version = peer[24];

        if(version > 7)
        {
            // Only the 50 closest nodes, please
            uint128_t distance(Kad::get_instance().get_client_id());
            uint128_t peer_id = uint128_t::get_from_buffer(peer);
            distance ^= peer_id;

            if(bootstrap_list.size() < 50 || bootstrap_list.back()->get_distance() > distance)
            {
                Contact *new_peer = new Contact(uint128_t::get_from_buffer(peer),
                                                peer_ip,
                                                udp_port,
                                                tcp_port,
                                                version,
                                                0,
                                                false);

                bool peer_added = false;
                for(std::list<Contact *>::iterator peerIt = bootstrap_list.begin();
                    peerIt != bootstrap_list.end();
                    peerIt++)
                {
                    if((*peerIt)->get_distance() > distance)
                    {
                        bootstrap_list.insert(peerIt, new_peer);
                        peer_added = true;
                        break;
                    }
                }

                if(!peer_added)
                {
                    bootstrap_list.push_back(new_peer);
                }
                else if(bootstrap_list.size() > 50)
                {
                    delete bootstrap_list.back();
                    bootstrap_list.pop_back();
                }
            }
        }
    }
}
开发者ID:gbmaster,项目名称:botnet,代码行数:83,代码来源:nodes_dat.cpp

示例4: UpdateAI

        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            _DoAggroPulse(diff);
            events.Update(diff);
            ConstructTimer += diff;

            if (me->HasUnitState(UNIT_STAT_CASTING))
                return;

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    case EVENT_JET:
                        me->MonsterTextEmote(EMOTE_JETS, 0, true);
                        DoCastAOE(SPELL_FLAME_JETS);
                        events.DelayEvents(5000, 1);
                        events.ScheduleEvent(EVENT_JET, urand(35000, 40000));
                        break;
                    case EVENT_SLAG_POT:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true))
                        {
                            DoScriptText(SAY_SLAG_POT, me);
                            SlagPotGUID = target->GetGUID();
                            DoCast(target, SPELL_GRAB);
                            events.ScheduleEvent(EVENT_GRAB_POT, 500);
                        }
                        events.ScheduleEvent(EVENT_SLAG_POT, RAID_MODE(30000, 15000), 1);
                        break;
                    case EVENT_GRAB_POT:
                        if (Unit* SlagPotTarget = Unit::GetUnit(*me, SlagPotGUID))
                        {
                            SlagPotTarget->CastCustomSpell(SPELL_GRAB_ENTER_VEHICLE, SPELLVALUE_BASE_POINT0, 1, me, true);
                            events.ScheduleEvent(EVENT_CHANGE_POT, 1000);
                        }
                        break;
                    case EVENT_CHANGE_POT:
                        if (Unit* SlagPotTarget = Unit::GetUnit(*me, SlagPotGUID))
                        {
                            SlagPotTarget->AddAura(SPELL_SLAG_POT, SlagPotTarget);
                            SlagPotTarget->ExitVehicle();
                            SlagPotTarget->CastCustomSpell(SPELL_GRAB_ENTER_VEHICLE, SPELLVALUE_BASE_POINT0, 2, me, true);
                            SlagPotTarget->ClearUnitState(UNIT_STAT_ONVEHICLE); // Hack
                            SlagPotGUID = 0;
                        }
                        break;
                    case EVENT_SCORCH:
                        DoScriptText(RAND(SAY_SCORCH_1, SAY_SCORCH_2), me);
                        if (Unit* target = me->getVictim())
                            me->SummonCreature(NPC_GROUND_SCORCH, *target, TEMPSUMMON_TIMED_DESPAWN, 45000);
                        DoCast(SPELL_SCORCH);
                        events.ScheduleEvent(EVENT_SCORCH, 25000);
                        break;
                    case EVENT_CONSTRUCT:
                    {
                        DoScriptText(SAY_SUMMON, me);
                        if (!creatureList.empty())
                        {
                            std::list<Creature*>::iterator itr = creatureList.begin();
                            std::advance(itr, urand(0, creatureList.size()-1));
                            if (Creature* construct = (*itr))
                            {
                                construct->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM);
                                construct->SetReactState(REACT_AGGRESSIVE);
                                construct->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED | UNIT_FLAG_DISABLE_MOVE);
                                construct->AI()->AttackStart(me->getVictim());
                                construct->AI()->DoZoneInCombat();
                                DoCast(me, SPELL_STRENGTH, true);
                                creatureList.erase(itr);
                            }
                        }
                        DoCast(SPELL_ACTIVATE_CONSTRUCT);
                        events.ScheduleEvent(EVENT_CONSTRUCT, RAID_MODE(40000, 30000));
                        break;
                    }
                    case EVENT_BERSERK:
                        DoCast(me, SPELL_BERSERK, true);
                        DoScriptText(SAY_BERSERK, me);
                        break;
                }
            }
            DoMeleeAttackIfReady();
        }
开发者ID:Expecto,项目名称:chaoscore,代码行数:86,代码来源:boss_ignis.cpp

示例5: finish

void VDAVIOutputSegmentedVideoStream::finish() {
	mbEnded = true;
	if (!mPendingRuns.empty())
		mPendingRuns.back().mbClosed = true;
}
开发者ID:KGE-INC,项目名称:modplus,代码行数:5,代码来源:AVIOutputSegmented.cpp

示例6: trackingFinished

void
TrackerHelper::trackMarkers(const std::list<TrackMarkerPtr >& markers,
                             int start,
                             int end,
                             int frameStep,
                             OverlaySupport* overlayInteract)
{
    if ( markers.empty() ) {
        Q_EMIT trackingFinished();
        return;
    }

    TrackerParamsProviderPtr provider = _imp->provider.lock();
    if (!provider) {
        Q_EMIT trackingFinished();
        return;
    }

    NodePtr trackerNode = provider->getTrackerNode();
    if (!trackerNode) {
        Q_EMIT trackingFinished();
        return;
    }

    if (trackerNode->hasMandatoryInputDisconnected()) {
        Q_EMIT trackingFinished();
        return;
    }

    ViewerInstancePtr viewer;
    if (overlayInteract) {
        viewer = overlayInteract->getInternalViewerNode();
    }


    // The channels we are going to use for tracking
    bool enabledChannels[3];
    provider->getTrackChannels(&enabledChannels[0], &enabledChannels[1], &enabledChannels[2]);


    double formatWidth, formatHeight;
    Format f;
    trackerNode->getApp()->getProject()->getProjectDefaultFormat(&f);
    formatWidth = f.width();
    formatHeight = f.height();

    bool autoKeyingOnEnabledParamEnabled = provider->canDisableMarkersAutomatically();

    /// The accessor and its cache is local to a track operation, it is wiped once the whole sequence track is finished.
    boost::shared_ptr<TrackerFrameAccessor> accessor( new TrackerFrameAccessor(trackerNode, enabledChannels, formatHeight) );
    boost::shared_ptr<mv::AutoTrack> trackContext( new mv::AutoTrack( accessor.get() ) );
    std::vector<TrackMarkerAndOptionsPtr > trackAndOptions;
    mv::TrackRegionOptions mvOptions;
    /*
     Get the global parameters for the LivMV track: pre-blur sigma, No iterations, normalized intensities, etc...
     */
    _imp->beginLibMVOptionsForTrack(&mvOptions);

    /*
     For the given markers, do the following:
     - Get the "User" keyframes that have been set and create a LibMV marker for each keyframe as well as for the "start" time
     - Set the "per-track" parameters that were given by the user, that is the mv::TrackRegionOptions
     - t->mvMarker will contain the marker that evolves throughout the tracking
     */
    int trackIndex = 0;
    for (std::list<TrackMarkerPtr >::const_iterator it = markers.begin(); it != markers.end(); ++it, ++trackIndex) {

        if (autoKeyingOnEnabledParamEnabled) {
            (*it)->setEnabledAtTime(start, true);
        }

        TrackMarkerAndOptionsPtr t(new TrackMarkerAndOptions);
        t->natronMarker = *it;

        int mode_i = (*it)->getMotionModelKnob()->getValue();
        mvOptions.mode = motionModelIndexToLivMVMode(mode_i);

        // Set a keyframe on the marker to initialize its position
        {
            KnobDoublePtr centerKnob = (*it)->getCenterKnob();
            std::vector<double> values(2);
            values[0] = centerKnob->getValueAtTime(start, DimIdx(0));
            values[1] = centerKnob->getValueAtTime(start, DimIdx(1));
            centerKnob->setValueAtTimeAcrossDimensions(start, values);
        }

        // For a translation warp, we do not need to add an animation curve for the pattern which stays constant.
        if (mvOptions.mode != libmv::TrackRegionOptions::TRANSLATION) {
            KnobDoublePtr patternCorners[4];
            patternCorners[0] = (*it)->getPatternBtmLeftKnob();
            patternCorners[1] = (*it)->getPatternBtmRightKnob();
            patternCorners[2] = (*it)->getPatternTopRightKnob();
            patternCorners[3] = (*it)->getPatternTopLeftKnob();
            for (int c = 0; c < 4; ++c) {
                KnobDoublePtr k = patternCorners[c];
                std::vector<double> values(2);
                values[0] = k->getValueAtTime(start, DimIdx(0));
                values[1] = k->getValueAtTime(start, DimIdx(1));
                k->setValueAcrossDimensions(values);
            }
//.........这里部分代码省略.........
开发者ID:azerupi,项目名称:Natron,代码行数:101,代码来源:TrackerHelper.cpp

示例7: CountTargets

 void CountTargets(std::list<WorldObject*>& targetList)
 {
     _didHit = !targetList.empty();
 }
开发者ID:Ksenon,项目名称:multi_realm_cell,代码行数:4,代码来源:spell_mage.cpp

示例8: XMLException

std::string StringUtil::getXMLData2(std::string xml,std::string xml_uppercase, std::list<std::string> listnodes)
{
	if(listnodes.empty())
		return xml;

	long elements = 0;
	std::string node = *(listnodes.begin());
	listnodes.pop_front();

	std::vector<std::string> vec = StringUtil::split(node,"=");

	if(vec.size() == 1)
	{
		elements = 1;
	}
	else
	{
		elements = StringUtil::longValue(vec[1]) + 1;
	}

	node = vec[0];

	std::string node_ini = "<" + node;
	std::string node_fin = "</" + node;

	while(elements > 1)
	{
		elements--;


		std::string::size_type pos_fin = xml_uppercase.find(node_fin);
		if(pos_fin == std::string::npos)
		{
			throw new exceptions::XMLException(-1,"Bad tag format1: " + node);
		}

		std::string::size_type pos_fin_mayor = xml_uppercase.find(">",pos_fin);
		if(pos_fin_mayor == std::string::npos)
		{
			throw new exceptions::XMLException(-1,"Bad tag format2: " + node);
		}

		xml = xml.substr(pos_fin_mayor + 1);
		xml_uppercase = xml_uppercase.substr(pos_fin_mayor + 1);
	}

	std::string::size_type pos_ini = xml_uppercase.find(node_ini);
	std::string::size_type pos_fin = xml_uppercase.find(node_fin);

	if((pos_ini == std::string::npos)||(pos_fin == std::string::npos))
	{
		throw new exceptions::XMLException(-1,"Bad tag name: " + node);
	}

	std::string::size_type pos_ini_mayor = xml_uppercase.find(">",pos_ini);
	
	if(pos_ini_mayor == std::string::npos)
	{
		throw new exceptions::XMLException(-1,"Bad tag format3: " + node);
	}

	xml = xml.substr(pos_ini_mayor + 1,pos_fin - pos_ini_mayor - 1);
	xml_uppercase = xml_uppercase.substr(pos_ini_mayor + 1,pos_fin - pos_ini_mayor - 1);

	return getXMLData2(xml,xml_uppercase,listnodes);
}
开发者ID:veladan,项目名称:StreamLib,代码行数:66,代码来源:StringUtil.cpp

示例9: match

matcher_status single_char_test_matcher::match(const std::list<char>& input)
{
    assert(!input.empty());
    return match(input.begin(), input.end());
}
开发者ID:scopeview,项目名称:parser,代码行数:5,代码来源:matcher_of_single_char_test.cpp

示例10: ranking

// Use Deb's "Fast Nondominated Sorting" (2002)
// Ref.: "A fast and elitist multiobjective genetic algorithm: NSGA-II"
void ranking(const std::list<solution> &population, std::vector< std::list<solution> > *output, bool feasible){
	if( population.empty() ) return;
	vector<solution> solutions(population.begin(), population.end() );

	vector< list<int> > intOutput;
	intOutput.resize(solutions.size() + 2);  // start from 1, end with null Qi 
	output->resize(1);

	// record each solutions' dominated solution
	vector< list<int> > dominated;
	dominated.resize(solutions.size());

	// record # of solutions dominate this solution
	vector<int> counter;
	counter.resize(solutions.size());

	// record the rank of solutions
	vector<int> rank;
	rank.resize(solutions.size());

	
	// for each solution
	for(unsigned int p = 0; p < solutions.size(); p++){
		for(unsigned int q = 0; q < solutions.size(); q++){
			if( feasible ){
				if( solution::fdominate(solutions[p], solutions[q]) ){
					dominated[p].push_back(q);  // Add q to the set of solutions dominated by p
				}else if( solution::fdominate(solutions[q], solutions[p]) ){
					counter[p]++;
				}
			}else{
				if( solution::idominate(solutions[p], solutions[q]) ){
					dominated[p].push_back(q);  // Add q to the set of solutions dominated by p
				}else if( solution::idominate(solutions[q], solutions[p]) ){
					counter[p]++;
				}
			}
		}
		
		if(counter[p] == 0){  // p belongs to the first front
			rank[p] = 1;
			intOutput[1].push_back(p);
			(*output)[0].push_back(solutions[p]);
		}
	}

	int curRank = 1;
	while( intOutput[curRank].size() > 0 ){
		list<int> Qi;  // Used to store the members of the next front
		list<solution> Qs;

		for(list<int>::iterator p = intOutput[curRank].begin(); p != intOutput[curRank].end(); p++){
		for(list<int>::iterator q = dominated[(*p)].begin(); q != dominated[(*p)].end(); q++){
			counter[(*q)]--;
			if(counter[(*q)] == 0){  // q belongs to the next front
				rank[(*q)] = curRank + 1;
				Qi.push_back(*q);
				Qs.push_back(solutions[(*q)]);
			}
		}}

		curRank++;
		intOutput[curRank] = Qi;
		if(Qi.size() > 0) output->push_back(Qs);
	}

	// remove duplicate solution in same rank
	for(unsigned int rank = 0; rank < output->size(); ++rank){
		(*output)[rank].sort();
		(*output)[rank].unique();
	}
}
开发者ID:adzen,项目名称:VRPTW,代码行数:74,代码来源:evolution.cpp

示例11: RecursiveDelete

bool CLocalFileSystem::RecursiveDelete(std::list<wxString> dirsToVisit, wxWindow* parent)
{
	// Under Windows use SHFileOperation to delete files and directories.
	// Under other systems, we have to recurse into subdirectories manually
	// to delete all contents.

#ifdef __WXMSW__
	// SHFileOperation accepts a list of null-terminated strings. Go through all
	// paths to get the required buffer length

	;
	int len = 1; // String list terminated by empty string

	for (std::list<wxString>::const_iterator const_iter = dirsToVisit.begin(); const_iter != dirsToVisit.end(); const_iter++)
		len += const_iter->Length() + 1;

	// Allocate memory
	wxChar* pBuffer = new wxChar[len];
	wxChar* p = pBuffer;

	for (std::list<wxString>::iterator iter = dirsToVisit.begin(); iter != dirsToVisit.end(); iter++)
	{
		wxString& path = *iter;
		if (path.Last() == wxFileName::GetPathSeparator())
			path.RemoveLast();
		if (GetFileType(path) == unknown)
			continue;

		_tcscpy(p, path);
		p += path.Length() + 1;
	}
	if (p != pBuffer)
	{
		*p = 0;

		// Now we can delete the files in the buffer
		SHFILEOPSTRUCT op;
		memset(&op, 0, sizeof(op));
		op.hwnd = parent ? (HWND)parent->GetHandle() : 0;
		op.wFunc = FO_DELETE;
		op.pFrom = pBuffer;

		if (parent)
		{
			// Move to trash if shift is not pressed, else delete
			op.fFlags = wxGetKeyState(WXK_SHIFT) ? 0 : FOF_ALLOWUNDO;
		}
		else
			op.fFlags = FOF_NOCONFIRMATION;

		SHFileOperation(&op);
	}
	delete [] pBuffer;

	return true;
#else
	if (parent)
	{
		if (wxMessageBox(_("Really delete all selected files and/or directories?"), _("Confirmation needed"), wxICON_QUESTION | wxYES_NO, parent) != wxYES)
			return true;
	}

	for (std::list<wxString>::iterator iter = dirsToVisit.begin(); iter != dirsToVisit.end(); iter++)
	{
		wxString& path = *iter;
		if (path.Last() == wxFileName::GetPathSeparator() && path != wxFileName::GetPathSeparator())
			path.RemoveLast();
	}

	bool encodingError = false;

	// Remember the directories to delete after recursing into them
	std::list<wxString> dirsToDelete;

	// Process all dirctories that have to be visited
	while (!dirsToVisit.empty())
	{
		const wxString path = dirsToVisit.front();
		dirsToVisit.pop_front();
		dirsToDelete.push_front(path);

		if (GetFileType(path) != dir)
		{
			wxRemoveFile(path);
			continue;
		}

		wxDir dir;
		if (!dir.Open(path))
			continue;

		// Depending on underlying platform, wxDir does not handle
		// changes to the directory contents very well.
		// See bug [ 1946574 ]
		// To work around this, delete files after enumerating everything in current directory
		std::list<wxString> filesToDelete;

		wxString file;
		for (bool found = dir.GetFirst(&file); found; found = dir.GetNext(&file))
		{
//.........这里部分代码省略.........
开发者ID:idgaf,项目名称:FileZilla3,代码行数:101,代码来源:local_filesys.cpp

示例12: reinit


//.........这里部分代码省略.........
                k++;
                /* check whether it's closer than any before */
                if (dsq < dsq_max[closest_n-1])
                {
                    int j;
                    for(j=closest_n - 1; j >= 0; j--)
                    {
                        if (dsq < dsq_max[j])
                        {
                            // shift everything one place up
                            if (j < closest_n - 1)
                            {
                                dsq_max[j+1] = dsq_max[j];
                                closest[j+1] = closest[j];
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                    // we always overshoot by 1
                    j++;
                    dsq_max[j] = dsq;
                    closest[j] = &(*i);
                }
            }
            for(int i=0;i<closest_n;i++)
            {
                /*printf("closest[%d], dsq=%g, p=%p\n", i, sqrt(dsq_max[i]),
                       closest[i]);
                fflush(stdout);*/
                // add the anchors
                if (spare_anchor_list.empty())
                {
                    for(int i=0;i<1000;i++)
                    {
                        spare_anchor_list.push_back(anchor());
                    }
                }

                rvec lcom;
                closest[i]->get_com(lcom);
                std::list<anchor>::iterator newelem=spare_anchor_list.begin();
                newelem->reinit(closest[i], 1., lcom);
                anchors.splice(anchors.begin(), spare_anchor_list, newelem);
                com_weight += 1.;
                anchor_d += sqrt(dsq_max[i]);
            }
            anchor_d /= com_weight;
        }
        else
        {
            for(deque<mol>::const_iterator i=ref_mols.begin(); 
                i!=ref_mols.end(); ++i)
            {
                rvec dxvec;
                rvec lcom;
                i->get_com(lcom);

                // calculate distance vector
                pbc_dx(pbc, r, lcom, dxvec); 
                // and calculate distance to base weights on
                real dsq;
                switch(evdir)
                {
开发者ID:kassonlab,项目名称:persistence-exchange-analysis,代码行数:67,代码来源:event.cpp

示例13: UpdateAI

        void UpdateAI(uint32 diff) override
        {
            events.Update(diff);
            while (uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                case EVENT_START: //Begin script if playersInvolved is not empty
                {
                    updatePlayerList();
                    if (playersInvolved.empty())
                        events.ScheduleEvent(1, 600);
                    else
                    {
                        me->MonsterSay("Keep those creatures at bay while I meditate. We'll soon have the answers we seek...", LANG_UNIVERSAL, 0);
                        me->SetReactState(REACT_PASSIVE);
                        timer = 0;
                        events.ScheduleEvent(EVENT_SPAWN_MOBS, 5000); //spawn mobs
                        events.ScheduleEvent(EVENT_PROGRESS, 1000); //update time
                        events.ScheduleEvent(EVENT_END, 90000); //end quest
                    }
                    break;
                }
                case EVENT_SPAWN_MOBS: //Spawn 3 mobs
                {
                    updatePlayerList();
                    for(int i = 0; i < std::max((int)playersInvolved.size()*3,3); i++)
                    {
                        if (TempSummon* temp = me->SummonCreature(59637, 1144.55f, 3435.65f, 104.97f, 3.3f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000))
                        {
                            if (temp->AI())
                                temp->AI()->AttackStart(me);

                            temp->AddThreat(me, 250.0f);
                            temp->GetMotionMaster()->Clear();
                            temp->GetMotionMaster()->MoveChase(me);
                        }
                    }
                    events.ScheduleEvent(EVENT_SPAWN_MOBS, 20000); //spawn mobs
                    break;
                }
                case EVENT_PROGRESS: //update energy
                {
                    timer++;

                    if (timer == 25 && !lifei)
                    {
                        if (lifei = me->SummonCreature(54856, 1130.162231f, 3435.905518f, 105.496597f, 0.0f,TEMPSUMMON_MANUAL_DESPAWN))
                            lifei->MonsterSay("The way of the Tushui... enlightenment through patience and mediation... the principled life", LANG_UNIVERSAL, 0);
                    }

                    if (timer == 30)
                        if (lifei)
                            lifei->MonsterSay("It is good to see you again, Aysa. You've come with respect, and so I shall give you the answers you seek.", LANG_UNIVERSAL, 0);

                    if (timer == 42)
                        if (lifei)
                            lifei->MonsterSay("Huo, the spirit of fire, is known for his hunger. He wants for tinder to eat. He needs the caress of the wind to rouse him.", LANG_UNIVERSAL, 0);

                    if (timer == 54)
                        if (lifei)
                            lifei->MonsterSay("If you find these things and bring them to his cave, on the far side of Wu-Song Village, you will face a challenge within.", LANG_UNIVERSAL, 0);

                    if (timer == 66)
                        if (lifei)
                            lifei->MonsterSay("Overcome that challenge, and you shall be graced by Huo's presence. Rekindle his flame, and if your spirit is pure, he shall follow you.", LANG_UNIVERSAL, 0);

                    if (timer == 78)
                        if (lifei)
                            lifei->MonsterSay("Go, children. We shall meet again very soon.", LANG_UNIVERSAL, 0);

                    if (timer == 85)
                    {
                        if (lifei)
                            lifei->UnSummon();

                        lifei = NULL;
                    }

                    updatePlayerList();
                    for (auto player: playersInvolved)
                    {
                        if (!player->HasAura(116421))
                            player->CastSpell(player, 116421);

                        player->ModifyPower(POWER_ALTERNATE_POWER, timer/25);
                        player->SetMaxPower(POWER_ALTERNATE_POWER, 90);
                    }

                    events.ScheduleEvent(EVENT_PROGRESS, 1000);
                    break;
                }
                case EVENT_END: //script end
                {
                    if (lifei)
                    {
                        lifei->UnSummon();
                        lifei = NULL;
                    }
                    events.ScheduleEvent(EVENT_START, 10000);
//.........这里部分代码省略.........
开发者ID:Fiver,项目名称:SkyFire.548,代码行数:101,代码来源:WanderingIsland_North.cpp

示例14: hexchat_plugin_deinit

int hexchat_plugin_deinit(hexchat_plugin *plugin_handle)
{
	/******************************************/
	/****** Remove the Icon from the tray *****/
	/******************************************/
	StopBlink(g_hXchatWnd, 1, g_hIcons[0]);
	RemoveIcon(g_hXchatWnd, 1);
	
	/*******************************************/
	/*******************************************/
	/*******************************************/
	if(g_dwPrefs & (1<<PREF_DNSIT))
	{
		DWORD dwStyle;
		dwStyle = GetWindowLong(g_hXchatWnd, GWL_STYLE);
		dwStyle &= ~(1<<WS_CHILD);
		SetWindowLongPtr(g_hXchatWnd, GWL_STYLE, (LONG_PTR)dwStyle);
		SetWindowLongPtr(g_hXchatWnd, GWL_HWNDPARENT, NULL);
	}

	/******************************************/
	/****** Unload our resources **************/
	/******************************************/
	DestroyMenu(g_hTrayMenu);

	for(int i = 0; i <= 11; i++)
	{
		DestroyIcon(g_hIcons[i]);
	}

	/******************************************/
	/****** Remove our window hook ************/
	/******************************************/
	SetWindowLongPtr(g_hXchatWnd, GWLP_WNDPROC, (LONG_PTR)g_hOldProc);

	/******************************************/
	/****** Remove our hotkey, and destroy ****/
	/****** the window that receives its   ****/
	/****** messages                       ****/
	/******************************************/
	UnregisterHotKey(g_hHotkeyWnd, 1);
	DestroyWindow(g_hHotkeyWnd);
	DestroyWindow(g_hPrefDlg);

	/******************************************/
	/************* Clean up Isle 7 ************/
	/******************************************/
	if(sdAlertNum())
	{
		sdCloseAlerts();
	}
	/******************************************/
	/****** remove our hexchat_hook_*s **********/
	/******************************************/
	while(!g_vHooks.empty())
	{
		if(g_vHooks.back() != NULL)
		{
			hexchat_unhook(ph, g_vHooks.back());
		}
		g_vHooks.pop_back();
	}

	return 1;
}
开发者ID:fuzzmz,项目名称:hexchat,代码行数:65,代码来源:hextray.cpp

示例15: clear

 void clear() noexcept {
     assert(!m_chunks.empty());
     m_chunks.erase(std::next(m_chunks.begin()), m_chunks.end());
     m_chunks.front().clear();
 }
开发者ID:tomhughes,项目名称:libosmium,代码行数:5,代码来源:string_table.hpp


注:本文中的std::list::empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。