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


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

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


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

示例1: 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

示例2: TestList

void TestList() {
    List<int> a;
    a.Add(3);
    a.Add(5);
    assert(a.Count() == 2);
    assert(a.Contains(3));
    assert(a.Contains(5));
    assert(a[0] == 3);

    List<int> b(a);
    b.Add(a);
    assert(b.Count() == 4);
    a.Remove(3);
    assert(a.Count() == 1);
    assert(a.Contains(3) == false);
    assert(a[0] = 5);
    
    a.Insert(4, 0);
    a.Insert(6, 1);
    a.Insert(7, a.Count() - 1);
    assert(a[0] == 4);
    assert(a[1] == 6);
    assert(a[2] == 7);

    a.Remove(6);
    assert(a[2] == 5);
}
开发者ID:UIKit0,项目名称:ObjectExtrusion3D,代码行数:27,代码来源:Tests.hpp

示例3: Serialize

    //
    // Serialization.
    //
    virtual void Serialize(Stream &stream) const {
        // Only the actions are saved.
        stream.Write(actions_.Count());

        for(size_t i = 0; i < actions_.Count(); i++) {
            stream.Write((int)actions_[i]->Type());
            stream.Write(*actions_[i]);
        }
    }
开发者ID:UIKit0,项目名称:ObjectExtrusion3D,代码行数:12,代码来源:Storyboard.hpp

示例4: SearchDescendantClasses

void SearchDescendantClasses(ParsingSymbol* parent, ParsingSymbolManager* manager, List<ParsingSymbol*>& children)
{
	vint start = children.Count();
	SearchChildClasses(parent, manager->GetGlobal(), manager, children);
	vint end = children.Count();
	for (vint i = start; i < end; i++)
	{
		SearchDescendantClasses(children[i], manager, children);
	}
}
开发者ID:FlyingSwan999,项目名称:Vlpp,代码行数:10,代码来源:ParserGen_PrintType.cpp

示例5: WriteErrors

void WriteErrors(GuiResourceError::List& errors, const WString& resourceName)
{
	auto outputPath = FilePath(GetTestOutputPath()) / (resourceName + L".txt");
	auto baselinePath = FilePath(GetTestResourcePath()) / (resourceName + L".txt");

	List<WString> output;
	GuiResourceError::SortAndLog(errors, output, GetTestResourcePath());
	File(outputPath).WriteAllLines(output, false, BomEncoder::Utf8);

	List<WString> baseline;
	File(baselinePath).ReadAllLinesByBom(baseline);
	if (baseline.Count() > 0 && baseline[baseline.Count() - 1] == L"")
	{
		baseline.RemoveAt(baseline.Count() - 1);
	}

	vint count = output.Count();
	if (count < baseline.Count())
	{
		count = baseline.Count();
	}

	for (vint i = 0; i < count; i++)
	{
		TEST_ASSERT(output.Count() > i);
		TEST_ASSERT(baseline.Count() > i);
		TEST_ASSERT(output[i] == baseline[i]);
	}
}
开发者ID:vczh-libraries,项目名称:GacUI,代码行数:29,代码来源:TestResource.cpp

示例6: Insert

void SkylineBinPack::Insert(List<Size2U> &sizes, List<Rect2U> &outRects, LevelChoiceHeuristic method)
{
    while (sizes.Count() > 0)
    {
        Rect2U bestRect;
        Size2U bestSize(Math::IntMaxValue, Math::IntMaxValue);
        int bestSkylineIndex = -1;
        int bestRectIndex = -1;
        for (size_t i = 0; i < sizes.Count(); ++i)
        {
            Rect2U newRect;
            Size2U outBestSize;
            int outBestIndex = 0;
            switch (method)
            {
            case LevelChoiceHeuristic::LevelBottomLeft:
                newRect = FindPositionForNewNodeBottomLeft(sizes[i], outBestSize, outBestIndex);
                break;
            case LevelChoiceHeuristic::LevelMinWasteFit:
                newRect = FindPositionForNewNodeMinWaste(sizes[i], outBestSize.Height, outBestSize.Width, outBestIndex);
                break;
            default:
                assert(false);
                break;
            }

            if (newRect.Size.Height != 0)
            {
                if (outBestSize.Width < bestSize.Width || (outBestSize.Width == bestSize.Width && outBestSize.Height < bestSize.Height))
                {
                    bestRect = newRect;
                    bestSize = outBestSize;
                    bestSkylineIndex = outBestIndex;
                    bestRectIndex = (int)i;
                }
            }
        }

        if (bestRectIndex == -1)
            return;

        // Perform the actual packing.

        AddSkylineLevel(bestSkylineIndex, bestRect);
        mUsedSurfaceArea += (sizes[bestRectIndex]).Area();
        sizes.RemoveAt(bestRectIndex);
        outRects.Add(bestRect);
    }
}
开发者ID:fjz13,项目名称:Medusa,代码行数:49,代码来源:SkylineBinPack.cpp

示例7: ShowDialog

			bool GuiSaveFileDialog::ShowDialog()
			{
				List<WString> fileNames;
				auto service = GetCurrentController()->DialogService();
				if (!service->ShowFileDialog(
					GetHostWindow()->GetNativeWindow(),
					fileNames,
					filterIndex,
					(enabledPreview ? INativeDialogService::FileDialogSavePreview : INativeDialogService::FileDialogSave),
					title,
					fileName,
					directory,
					defaultExtension,
					filter,
					options))
				{
					return false;
				}

				if (fileNames.Count() > 0)
				{
					fileName = fileNames[0];
					FileNameChanged.Execute(GuiEventArgs());
					FilterIndexChanged.Execute(GuiEventArgs());
				}
				return true;
			}
开发者ID:vczh-libraries,项目名称:GacUI,代码行数:27,代码来源:GuiDialogs.cpp

示例8: Append

    // Override of the List interface
    List* Append( VALUE elem ) {
#ifdef USE_CONS_OPTIMIZATIONS
        List* tail = this;
        while (!tail->Rest().IsEmpty() ) {
            tail = tail->Rest().GetList();
        }
        if (tail->RefCount < 2 && tail->Rest().IsEmpty()) {
            // We can optimize things as we can reuse this materalization.
            // Nobody is referencing it.
            if (tail->AttemptDirtyAdd(elem)) {
                return this;
            };
        }
#endif
        int originalCount = Count();
        int last = Count()-1;
        List* c = VALUE(QParenthesis,elem).GetList();
        while (last >= 0) {
            c = c->Prepend( GetAt(last) );
            last--;
        }
        int newCount = c->Count();
        assert( newCount == originalCount + 1 );
//        std::cout << "\nBefore:" << LIST(this).Print();
//        std::cout << "\nAdded:" << elem.Print();
//        std::cout << "\nAfter:" << LIST(c).Print() << "\n";
        return c;
    }
开发者ID:Starcounter-Jack,项目名称:Addie,代码行数:29,代码来源:Cons.hpp

示例9: Dispose

		void Application::Dispose()
		{
			{
				List<BaseForm *> forms;
				for (auto & c : *components)
				{
					if (c.Value)
					{
						BaseForm * ctrl = dynamic_cast<BaseForm*>(c.Value);
						if (ctrl)
						{
							forms.Add(ctrl);		
						}
						c.Value = 0;
					}
				}
				for (int i=0; i<forms.Count(); i++)
					delete forms[i];
				delete components;
				delete cmdLine;
				delete objMap;
				delete onMainLoop;
			}
			GdiplusShutdown(gdiToken);

			_CrtDumpMemoryLeaks();
		}
开发者ID:lixf,项目名称:15869-p1,代码行数:27,代码来源:WinApp.cpp

示例10: FindFile

const FileEntry* FileStorage::FindFile(const StringRef& path, const DirectoryEntry* parent/* = nullptr*/) const
{
	if (parent == nullptr)
	{
		parent = &mRootDir;
	}

	if (Path::IsPath(path))
	{
		List<HeapString> paths;
		RETURN_NULL_IF_FALSE(Path::Split(path, paths));

		const DirectoryEntry* dir = parent;
		for (uint i = 0; i < paths.Count() - 1; ++i)
		{
			dir = dir->FindDirectory(paths[i]);
			RETURN_NULL_IF_NULL(dir);
		}

		return dir->FindFile(paths.Last());
	}
	else
	{
		return parent->FindFile(path);
	}
}
开发者ID:johndpope,项目名称:Medusa,代码行数:26,代码来源:FileStorage.cpp

示例11: EvalFunctionReferenceClosure

		void SymbolTable::EvalFunctionReferenceClosure()
		{
			for (auto & func : Functions)
			{
				List<String> funcList;
				EnumerableHashSet<String> funcSet;
				for (auto & ref : func.Value->ReferencedFunctions)
				{
					funcList.Add(ref);
					funcSet.Add(ref);
				}
				for (int i = 0; i < funcList.Count(); i++)
				{
					RefPtr<FunctionSymbol> funcSym;
					if (Functions.TryGetValue(funcList[i], funcSym))
					{
						for (auto rfunc : funcSym->ReferencedFunctions)
						{
							if (funcSet.Add(rfunc))
								funcList.Add(rfunc);
						}
					}
				}
				func.Value->ReferencedFunctions = _Move(funcSet);
			}
		}
开发者ID:daliniu,项目名称:Spire,代码行数:26,代码来源:SymbolTable.cpp

示例12: FindOrCreateFileEntry

FileEntry* FileStorage::FindOrCreateFileEntry(const StringRef& path, DirectoryEntry* parent /*= nullptr*/)
{
	if (parent == nullptr)
	{
		parent = &mRootDir;
	}

	FileEntry* fileEntry = nullptr;
	if (Path::IsPath(path))
	{
		List<HeapString> paths;
		RETURN_NULL_IF_FALSE(Path::Split(path, paths));

		DirectoryEntry* dir = parent;
		for (uint i = 0; i < paths.Count() - 1; ++i)
		{
			dir = dir->FindOrCreateDirectoryEntry(paths[i]);
			RETURN_NULL_IF_NULL(dir);
		}

		fileEntry = dir->FindOrCreateFileEntry(paths.Last());
	}
	else
	{
		fileEntry = parent->FindOrCreateFileEntry(path);
	}

	return fileEntry;
}
开发者ID:johndpope,项目名称:Medusa,代码行数:29,代码来源:FileStorage.cpp

示例13: ClearActions

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

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

示例14: TryParse

bool Version::TryParse(const StringRef& versionString, Version& outVersion)
{
	outVersion = Version::Zero;
	List<HeapString> parts;
	StringParser::Split(versionString, StringRef("."), parts);

	uint length = (uint)parts.Count();
	RETURN_FALSE_IF(length < 2 || length>4);

	long outMajor;
	if (parts[0].TryParseInt(outMajor))
	{
		outVersion.SetMajor((uint)outMajor);
	}
	else
	{
		return false;
	}

	long outMinor;
	if (parts[1].TryParseInt(outMinor))
	{
		outVersion.SetMinor((uint)outMinor);
	}
	else
	{
		return false;
	}

	length -= 2;
	if (length > 0)
	{
		long outBuild;
		if (parts[2].TryParseInt(outBuild))
		{
			outVersion.SetBuild((uint)outBuild);
		}
		else
		{
			return false;
		}

		--length;
		if (length > 0)
		{
			long outRevision;
			if (parts[3].TryParseInt(outRevision))
			{
				outVersion.SetRevision((uint)outRevision);
			}
			else
			{
				return false;
			}
		}
	}

	return true;
}
开发者ID:fjz13,项目名称:Medusa,代码行数:59,代码来源:Version.cpp

示例15:

	List<Vec4> ChoiceForm::ReadFrameData(GL::Texture2D tex)
	{
		List<Vec4> rs;
		int w, h;
		tex.GetSize(w, h);
		rs.SetSize(w*h);
		tex.GetData(0, DataType::Float4, rs.Buffer(), rs.Count()*sizeof(Vec4));
		return rs;
	}
开发者ID:zlzyf,项目名称:Spire,代码行数:9,代码来源:ChoiceControl.cpp


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