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


C++ VectorMap::GetKeys方法代码示例

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


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

示例1: BenchNTL2

void BenchNTL2(const char *file, Stream& out) {
	FileIn in(file);
	if (!in) {
		out << "Cannot open input file.\n";
		return;
	}

	VectorMap<String, int> map;
	
	for(;;) {
		int c = in.Get();
		if(c < 0) break;
		if(IsAlpha(c) || c == '_') {
			String id;
			id.Cat(c);
			c = in.Get();
			while(c >= 0 && (IsAlNum(c) || c == '_')) {
				id.Cat(c);
				c = in.Get();
			}
			map.GetAdd(id, 0)++;
		}
		else
		if(IsDigit(c))
			do c = in.Get();
			while(c >= 0 && (IsAlNum(c) || c == '.'));
	}

	Vector<int> order = GetSortOrder(map.GetKeys());
	for(int i = 0; i < order.GetCount(); i++)
		out << ~map.GetKey(order[i]) << ": " << map[order[i]] << '\n';
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:32,代码来源:AllMaps.cpp

示例2: Scores

void Puzzle::Scores()
{
    WithScoreLayout<TopWindow> d;
    CtrlLayoutOK(d, t_("Best scores"));
    d.score.AddColumn(t_("Dimension"));
    d.score.AddColumn(t_("Moves"));
    d.score.ColumnWidths("71 48");
    d.score.NoCursor().NoGrid();
    Vector<int> o = GetSortOrder(score.GetKeys());
    for(int i = 0; i < o.GetCount(); i++)
        d.score.Add(score.GetKey(o[i]), score[o[i]]);
    d.Run();
}
开发者ID:kolyden,项目名称:mirror,代码行数:13,代码来源:Puzzle.cpp

示例3: BenchNTL

void BenchNTL(const char *file) {
	FileIn in(file);
	if (!in) {
		std::cout << "Cannot open input file.\n";
		return;
	}

	VectorMap<String, Vector<int> > map;
	int line = 1;

	for(;;) {
		int c = in.Get();
		if(c < 0) break;
		if(IsAlpha(c) || c == '_') {
			String id;
			id.Cat(c);
			c = in.Get();
			while(c >= 0 && (IsAlNum(c) || c == '_')) {
				id.Cat(c);
				c = in.Get();
			}
			map.GetAdd(id).Add(line);
		}
		else
		if(IsDigit(c))
			do c = in.Get();
			while(c >= 0 && (IsAlNum(c) || c == '.'));
		if(c == '\n')
			++line;
	}

	Vector<int> order = GetSortOrder(map.GetKeys());
#ifndef NO_OUTPUT
	for(int i = 0; i < order.GetCount(); i++) {
		std::cout << ~map.GetKey(order[i]) << ": ";
		const Vector<int>& l = map[order[i]];
		for(int i = 0; i < l.GetCount(); i++) {
			if(i) std::cout << ", ";
			std::cout << l[i];
		}
		std::cout << '\n';
	}
#endif
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:44,代码来源:idmap.cpp

示例4: main

int main(int argc, const char *argv[])
{
	int n;
	VectorMap<String, int> map;
	Cout() << "   lines   words   bytes file\n";
	int total_lines = 0;
	int total_words = 0;
	int total_bytes = 0;
	for(int i = 1; i < argc; i++) {
		String f = LoadFile(argv[i]);
		int lines = 0;
		int words = 0;
		const char *q = f;
		for(;;) {
			int c = *q;
			if(IsAlpha(c)) {
				const char *b = q++;
				while(IsAlNum(*q)) q++;
				map.GetAdd(String(b, q), 0)++;
				words++;
			}
			else {
				if(!c) break;
				if(c == '\n')
					++lines;
				q++;
			}
		}
		Cout() << Format("%8d%8d%8d %s\n", lines, words, f.GetCount(), argv[i]);
		total_lines += lines;
		total_words += words;
		total_bytes += f.GetCount();
	}
	Vector<int> order = GetSortOrder(map.GetKeys());
#ifndef NOOUTPUT
	Cout() << Format("--------------------------------------%8d%8d%8d total\n", total_lines, total_words, total_bytes);

	for(int i = 0; i < order.GetCount(); i++)
		Cout() << map.GetKey(order[i]) << ": " << map[order[i]] << '\n';
#endif
	return 0;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:42,代码来源:wc.cpp

示例5: Create

ValueMap::ValueMap(const VectorMap<Value, Value>& m, int deep)
{
	Data& d = Create();
	d.key = clone(m.GetKeys());
	d.value = ValueArray(m.GetValues(), 0);
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:6,代码来源:ValueUtil.cpp


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