本文整理汇总了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 );
}
示例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;
}
示例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();
}
示例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);
}
}
}
示例5: ClearActions
void ClearActions() {
for(size_t i = 0; i < actions_.Count(); i++) {
delete actions_[i];
}
actions_.Clear();
}
示例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);
}
示例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;
}
示例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;
}
示例9: ClearData
inline void ClearData()
{
for(UINT i=0; i<windowData.Num(); i++)
windowData[i].strClass.Clear();
windowData.Clear();
adminWindows.Clear();
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}