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


C++ List::Clear方法代码示例

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


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

示例1: get_processes

int get_processes ( List &processes , List &uptimes )
{
  PROCESSENTRY32 process;
  HANDLE handle;
  HANDLE phandle;
  int mypid;
  int ret = TRUE;

/* Getting my process ID */
  mypid = GetCurrentProcessId ();

/* Cleaning list */
  processes.Clear ();
  uptimes.Clear ();

/* Getting process list */
  handle = CreateToolhelp32Snapshot ( TH32CS_SNAPALL , 0 );

/* Initializing structure */
  process.dwSize = sizeof ( PROCESSENTRY32 );

/* Getting first process */
  Process32First ( handle , &process );

/* Adding the PID */
  processes.Add ( ( void * ) process.th32ProcessID );

/* Getting the uptime of this process */
  uptimes.Add ( ( void * ) get_process_uptime ( process.th32ProcessID ) );

/* Getting the rest of the processes */
  while ( Process32Next ( handle , &process ) == TRUE )
  {
  /* If it's not me */
    if ( mypid != process.th32ProcessID )
    {
    /* Adding the PID */
      processes.Add ( ( void * ) process.th32ProcessID );

    /* Getting the uptime of this process */
      uptimes.Add ( ( void * ) get_process_uptime ( process.th32ProcessID ) );
    }
  }

/* Ordering process list */
  processes.SortCouple ( uptimes );

/* Closing handle */
  CloseHandle ( handle );

  return ( ret );
}
开发者ID:CoreSecurity,项目名称:Embarcadero-Workaround,代码行数:52,代码来源:Embarcadero-Workaround.cpp

示例2: ExportCurveLoop

int StepFileWriter::ExportCurveLoop(SBezierLoop *loop, bool inner) {
    if(loop->l.n < 1) oops();

    List<int> listOfTrims;
    ZERO(&listOfTrims);

    SBezier *sb = &(loop->l.elem[loop->l.n - 1]);

    // Generate "exactly closed" contours, with the same vertex id for the
    // finish of a previous edge and the start of the next one. So we need
    // the finish of the last Bezier in the loop before we start our process.
    fprintf(f, "#%d=CARTESIAN_POINT('',(%.10f,%.10f,%.10f));\n",
        id, CO(sb->Finish()));
    fprintf(f, "#%d=VERTEX_POINT('',#%d);\n", id+1, id);
    int lastFinish = id + 1, prevFinish = lastFinish;
    id += 2;

    for(sb = loop->l.First(); sb; sb = loop->l.NextAfter(sb)) {
        int curveId = ExportCurve(sb);

        int thisFinish;
        if(loop->l.NextAfter(sb) != NULL) {
            fprintf(f, "#%d=CARTESIAN_POINT('',(%.10f,%.10f,%.10f));\n",
                id, CO(sb->Finish()));
            fprintf(f, "#%d=VERTEX_POINT('',#%d);\n", id+1, id);
            thisFinish = id + 1;
            id += 2;
        } else {
            thisFinish = lastFinish;
        }

        fprintf(f, "#%d=EDGE_CURVE('',#%d,#%d,#%d,%s);\n",
            id, prevFinish, thisFinish, curveId, ".T.");
        fprintf(f, "#%d=ORIENTED_EDGE('',*,*,#%d,.T.);\n",
            id+1, id);

        int oe = id+1;
        listOfTrims.Add(&oe);
        id += 2;

        prevFinish = thisFinish;
    }

    fprintf(f, "#%d=EDGE_LOOP('',(", id);
    int *oe;
    for(oe = listOfTrims.First(); oe; oe = listOfTrims.NextAfter(oe)) {
        fprintf(f, "#%d", *oe);
        if(listOfTrims.NextAfter(oe) != NULL) fprintf(f, ",");
    }
    fprintf(f, "));\n");

    int fb = id + 1;
        fprintf(f, "#%d=%s('',#%d,.T.);\n",
            fb, inner ? "FACE_BOUND" : "FACE_OUTER_BOUND", id);

    id += 2;
    listOfTrims.Clear();

    return fb;
}
开发者ID:astarasikov,项目名称:solvespace,代码行数:60,代码来源:exportstep.cpp

示例3: FixConstraintsForPointBeingDeleted

void GraphicsWindow::FixConstraintsForPointBeingDeleted(hEntity hpt) {
    List<hEntity> ld;
    ZERO(&ld);

    Constraint *c;
    SK.constraint.ClearTags();
    for(c = SK.constraint.First(); c; c = SK.constraint.NextAfter(c)) {
        if(c->type != Constraint::POINTS_COINCIDENT) continue;
        if(c->group.v != SS.GW.activeGroup.v) continue;

        if(c->ptA.v == hpt.v) {
            ld.Add(&(c->ptB));
            c->tag = 1;
        }
        if(c->ptB.v == hpt.v) {
            ld.Add(&(c->ptA));
            c->tag = 1;
        }
    }
    // These would get removed anyways when we regenerated, but do it now;
    // that way subsequent calls of this function (if multiple coincident
    // points are getting deleted) will work correctly.
    SK.constraint.RemoveTagged();

    // If more than one point was constrained coincident with hpt, then
    // those two points were implicitly coincident with each other. By
    // deleting hpt (and all constraints that mention it), we will delete
    // that relationship. So put it back here now.
    int i;
    for(i = 1; i < ld.n; i++) {
        Constraint::ConstrainCoincident(ld.elem[i-1], ld.elem[i]);
    }
    ld.Clear();
}
开发者ID:BBBSnowball,项目名称:python-solvespace,代码行数:34,代码来源:modify.cpp

示例4: GetIntList

void  XElement::GetIntList(CTSTR lpName, List<int> &IntList) const
{
    assert(lpName);

    IntList.Clear();

    for(DWORD i=0; i<SubItems.Num(); i++)
    {
        if(!SubItems[i]->IsData()) continue;

        XDataItem *item = static_cast<XDataItem*>(SubItems[i]);
        if(item->strName.CompareI(lpName))
        {
            CTSTR lpValue = item->strData;

            if( (*LPWORD(lpValue) == 'x0') ||
                (*LPWORD(lpValue) == 'X0') )
            {
                IntList << tstring_base_to_uint(lpValue+2, NULL, 16);
            }
            else if(scmpi(lpValue, TEXT("true")) == 0)
                IntList << 1;
            else if(scmpi(lpValue, TEXT("false")) == 0)
                IntList << 0;
            else
                IntList << tstring_base_to_uint(lpValue, NULL, 0);
        }
    }
}
开发者ID:SeargeDP,项目名称:OBS,代码行数:29,代码来源:XConfig.cpp

示例5: ClearActions

    void ClearActions() {
        for(size_t i = 0; i < actions_.Count(); i++) {
            delete actions_[i];
        }

        actions_.Clear();
    }
开发者ID:UIKit0,项目名称:ObjectExtrusion3D,代码行数:7,代码来源:Storyboard.hpp

示例6: TestSerialization

void TestSerialization() {
    Stream stream(L"test.dat", true);
    List<int> l;
    l.Add(1);
    l.Add(2);
    l.Add(3);
    l.Serialize(stream);
    l.Clear();
    stream.Close();

    stream.Open(L"test.dat");
    l.Deserialize(stream);

    List<Point> b;
    b.Add(Point(1, 2, 3));
    b.Add(Point(4, 5, 6));
    b.Add(Point(7, 8, 9));
    stream.Close();
    stream.Open(L"test.dat", true);
    b.Serialize(stream);
    
    stream.Close();

    stream.Open(L"test.dat");
    b.Deserialize(stream);
}
开发者ID:UIKit0,项目名称:ObjectExtrusion3D,代码行数:26,代码来源:Tests.hpp

示例7: GetVideoOutputTypes

bool GetVideoOutputTypes(const List<MediaOutputInfo> &outputList, UINT width, UINT height, UINT64 frameInterval, List<VideoOutputType> &types)
{
    types.Clear();

    UINT64 closestIntervalDifference = 0xFFFFFFFFFFFFFFFFLL;
    UINT64 bestFrameInterval = 0;

    for(UINT i=0; i<outputList.Num(); i++)
    {
        MediaOutputInfo &outputInfo = outputList[i];
        VIDEOINFOHEADER *pVih = reinterpret_cast<VIDEOINFOHEADER*>(outputInfo.mediaType->pbFormat);

        if( outputInfo.minCX <= width                    && outputInfo.maxCX >= width &&
            outputInfo.minCY <= height                   && outputInfo.maxCY >= height &&
            outputInfo.minFrameInterval <= frameInterval && outputInfo.maxFrameInterval >= frameInterval)
        {
            int priority = inputPriority[(UINT)outputInfo.videoType];
            if(priority == -1)
                continue;

            types.SafeAdd(outputInfo.videoType);
        }
    }

    return types.Num() != 0;
}
开发者ID:AndrewHolder,项目名称:OBS,代码行数:26,代码来源:MediaInfoStuff.cpp

示例8: Parse

bool StringPropertySet::Parse(const StringRef& str)
{
	RETURN_TRUE_IF_EMPTY(str);
	//Key=Value,...
	List<StringRef> outPairs;
	StringParser::Split(str, ",", outPairs);

	List<StringRef> keyValuePair;
	for (auto& optionPair : outPairs)
	{
		keyValuePair.Clear();
		StringParser::Split(optionPair, "=", keyValuePair);
		if (keyValuePair.Count() == 2)
		{
			Add(keyValuePair[0], keyValuePair[1]);
		}
		else if (keyValuePair.Count() == 1)
		{
			Add(keyValuePair[0], HeapString::Empty);
		}
		else
		{
			Log::FormatError("Invalid attribute str:{} in {}", optionPair.c_str(), str.c_str());
			return false;
		}
	}

	return true;
}
开发者ID:xuxiaowei007,项目名称:Medusa,代码行数:29,代码来源:StringPropertySet.cpp

示例9: ClearData

 inline void ClearData()
 {
     for(UINT i=0; i<windowData.Num(); i++)
         windowData[i].strClass.Clear();
     windowData.Clear();
     adminWindows.Clear();
 }
开发者ID:Demiguise,项目名称:OBS,代码行数:7,代码来源:GraphicsCapture.cpp

示例10: FinishSpellCheckerService

ECode CTextServicesManagerService::FinishSpellCheckerService(
    /* [in] */ ISpellCheckerSessionListener* listener)
{
    if (!CalledFromValidUser()) {
        return NOERROR;
    }

    if (DBG) {
        Slogger::D(TAG, "FinishSpellCheckerService");
    }

    {
        AutoLock lock(mSpellCheckerMapLock);
        List<AutoPtr<SpellCheckerBindGroup> > removeList;
        ManagedSpellCheckerBindGroupMapIt it = mSpellCheckerBindGroups.Begin();
        for (; it != mSpellCheckerBindGroups.End(); ++it) {
            AutoPtr<SpellCheckerBindGroup> group = it->mSecond;
            if (group == NULL) continue;
            removeList.PushBack(group);
        }

        List<AutoPtr<SpellCheckerBindGroup> >::Iterator it2 = removeList.Begin();
        for (; it2 != removeList.End(); ++it2) {
            ((*it2).Get())->RemoveListener(listener);
        }
        removeList.Clear();
    }

    return NOERROR;
}
开发者ID:imace,项目名称:ElastosRDK5_0,代码行数:30,代码来源:CTextServicesManagerService.cpp

示例11: Parse

	static void Parse(const Regex& regexEec, vint order, const WString& electron, vint& notationOrder, WString& notationName, List<ElementElectron>& ecs)
	{
		if(order<=2)
		{
			notationOrder=0;
			notationName=L"";
		}
		else if(order<=10)
		{
			notationOrder=2;
			notationName=L"[He]";
		}
		else if(order<=18)
		{
			notationOrder=10;
			notationName=L"[Ne]";
		}
		else if(order<=36)
		{
			notationOrder=18;
			notationName=L"[Ar]";
		}
		else if(order<=54)
		{
			notationOrder=36;
			notationName=L"[Kr]";
		}
		else if(order<=86)
		{
			notationOrder=54;
			notationName=L"[Xe]";
		}
		else
		{
			notationOrder=86;
			notationName=L"[Rn]";
		}

		ecs.Clear();
		RegexMatch::List matches;
		regexEec.Search(electron, matches);
		FOREACH(Ptr<RegexMatch>, match, matches)
		{
			ElementElectron ec;
			ec.level=wtoi(match->Groups()[L"level"].Get(0).Value());
			ec.type=match->Groups()[L"type"].Get(0).Value()[0];
			ec.count=wtoi(match->Groups()[L"count"].Get(0).Value());
			ec.typeOrder=-1;

			switch(ec.type)
			{
			case L's': ec.typeOrder=0; break;
			case L'p': ec.typeOrder=1; break;
			case L'd': ec.typeOrder=2; break;
			case L'f': ec.typeOrder=3; break;
			}

			ecs.Add(ec);
		}
开发者ID:hooloong,项目名称:gac,代码行数:59,代码来源:Main.cpp

示例12: Initialize

bool FileSystem::Initialize(CoderList readonlyPathCoder, CoderList writablePathCoder, const MemoryByteData& key /*= MemoryByteData::Empty*/)
{
	//read only path
	StringRef readonlyPath = System::Instance().ReadonlyPath();

	IPackage* readonlyDirectoryPackage = new DirectoryPackage(readonlyPath, PackagePriority::App, 0, true);
	readonlyDirectoryPackage->SetKey(key);
	readonlyDirectoryPackage->SetFlags(PackageFlags::Readonly);
	readonlyDirectoryPackage->SetCoders(readonlyPathCoder);
	readonlyDirectoryPackage->Initialize();
	mPackages.Add(readonlyDirectoryPackage);

	//read only package
	List<HeapString> outFiles;
	Directory::GetFiles(readonlyPath, outFiles, true);
	for (HeapString& file : outFiles)
	{
		FileType fileType = FileInfo::ExtractType(file);
		if (PackageFactory::IsPackage(fileType))
		{
			IPackage* package = PackageFactory::Create(fileType, file, PackagePriority::App, 0);
			package->SetKey(key);
			package->Initialize();
			mPackages.Add(package); 
		}
	}

	//writable path
	StringRef writablePath = System::Instance().WritablePath();
	IPackage* writableDirectoryPackage = new DirectoryPackage(writablePath, PackagePriority::Downloaded, 0, true);
	writableDirectoryPackage->SetFlags(PackageFlags::None);
	writableDirectoryPackage->SetCoders(writablePathCoder);
	writableDirectoryPackage->SetKey(key);
	writableDirectoryPackage->Initialize();
	mPackages.Add(writableDirectoryPackage);
	//writable package

	outFiles.Clear();
	Directory::GetFiles(writablePath, outFiles, true);
	for (HeapString& file : outFiles)
	{
		FileType fileType = FileInfo::ExtractType(file);
		if (PackageFactory::IsPackage(fileType))
		{
			IPackage* package = PackageFactory::Create(fileType, file, PackagePriority::Downloaded, 0);
			package->SetKey(key);
			package->Initialize();
			mPackages.Add(package);
		}
	}

	ReloadTagItems();
	ApplyTagHelper(PublishTarget::MatchAll);

	return true;
}
开发者ID:johndpope,项目名称:Medusa,代码行数:56,代码来源:FileSystem.cpp

示例13: MakePwlInto

void SBezier::MakePwlInto(SContour *sc, double chordTol) {
    List<Vector> lv;
    ZERO(&lv);
    MakePwlInto(&lv, chordTol);
    int i;
    for(i = 0; i < lv.n; i++) {
        sc->AddPoint(lv.elem[i]);
    }
    lv.Clear();
}
开发者ID:ThorsenRune,项目名称:solvespace,代码行数:10,代码来源:ratpoly.cpp

示例14: DestroyChibiLoopTree

void  Triangulator::DestroyChibiLoopTree(List<ChibiLoopNode> &LoopNodeList)
{
    for(int i=0; i<LoopNodeList.Num(); i++)
    {
        ChibiLoopNode &loopNode = LoopNodeList[i];

        if(loopNode.Children.Num())
            DestroyChibiLoopTree(loopNode.Children);
    }
    LoopNodeList.Clear();
}
开发者ID:alanzw,项目名称:JimEngine,代码行数:11,代码来源:Triangulator.cpp

示例15: BezierAsPwl

void VectorFileWriter::BezierAsPwl(SBezier *sb) {
    List<Vector> lv;
    ZERO(&lv);
    sb->MakePwlInto(&lv, SS.ChordTolMm() / SS.exportScale);
    int i;
    for(i = 1; i < lv.n; i++) {
        SBezier sb = SBezier::From(lv.elem[i-1], lv.elem[i]);
        Bezier(&sb);
    }
    lv.Clear();
}
开发者ID:BBBSnowball,项目名称:python-solvespace,代码行数:11,代码来源:export.cpp


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