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


C++ Index::Find方法代码示例

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


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

示例1: DndTargets

void Ctrl::DndTargets(GdkDragContext *context)
{
    static Index<String> text_targets;
    static Index<String> image_targets;
    ONCELOCK {
        GtkTargetList *target_list = gtk_target_list_new (NULL, 0);
        gtk_target_list_add_text_targets (target_list, 0);
        ToIndex(target_list, text_targets);
        GtkTargetList *target_list2 = gtk_target_list_new (NULL, 0);
        gtk_target_list_add_image_targets (target_list2, 0, TRUE);
        ToIndex(target_list2, image_targets);
    }
    dnd_targets.Clear();
    dnd_text_target.Clear();
    for(GList *list = gdk_drag_context_list_targets(context); list; list = g_list_next (list)) {
        String g = gdk_atom_name((GdkAtom)list->data);
        if(text_targets.Find(g) >= 0) {
            dnd_targets.Add("text");
            if(dnd_text_target.IsEmpty())
                dnd_text_target = g;
        }
        else if(image_targets.Find(g) >= 0) {
            dnd_targets.Add("image");
            if(dnd_image_target.IsEmpty())
                dnd_image_target = g;
        }
        else
            dnd_targets.Add(g);
    }
}
开发者ID:kolyden,项目名称:mirror,代码行数:30,代码来源:GtkDnD.cpp

示例2: OutDir

String MakeBuild::OutDir(const Index<String>& cfg, const String& package, const VectorMap<String, String>& bm,
                   bool use_target)
{
	Index<String> excl;
	excl.Add(bm.Get("BUILDER", "GCC"));
	excl.Add("MSC");
	LocalHost().AddFlags(excl);
	Vector<String> x;
	bool dbg = cfg.Find("DEBUG_FULL") >= 0 || cfg.Find("DEBUG_MINIMAL") >= 0;
	if(cfg.Find("DEBUG") >= 0) {
		excl.Add("BLITZ");
		if(cfg.Find("BLITZ") < 0)
			x.Add("NOBLITZ");
	}
	else
		if(dbg)
			x.Add("RELEASE");
	if(use_target)
		excl.Add("MAIN");
	for(int i = 0; i < cfg.GetCount(); i++)
		if(excl.Find(cfg[i]) < 0)
			x.Add(cfg[i]);
	Sort(x);
	for(int i = 0; i < x.GetCount(); i++)
		x[i] = InitCaps(x[i]);
	String outdir = GetVar("OUTPUT");
	if(output_per_assembly)
		outdir = AppendFileName(outdir, GetVarsName());
	if(!use_target)
		outdir = AppendFileName(outdir, package);
	outdir = AppendFileName(outdir, GetFileTitle(method) + "." + Join(x, "."));
	outdir = Filter(outdir, CharFilterSlash);
	return outdir;
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:34,代码来源:Build.cpp

示例3: Load

void CodeBrowser::Load()
{
	String find = ToUpper((String)~search);
	String match = ToUpper((String)~search_scope);
	String pm = GetPm();
	Vector<String> txt;
	Vector<Value>  ndx;
	Index<int>     fi;
	Index<String>  fs;
	for(int i = 0; i < CodeBase().GetCount(); i++) {
		String s = CodeBase().GetKey(i);
		const Array<CppItem>& n = CodeBase()[i];
		if(s.GetCount())
			if(MatchCib(s, match) && (MatchCib(s, find) || HasItem(n, find)) && MatchPm(n, pm)) {
				txt.Add(s);
				ndx.Add(s);
			}
		for(int i = 0; i < n.GetCount(); i++) {
			int f = n[i].file;
			if(fi.Find(f) < 0) {
				String s = GetFileText(GetSourceFilePath(f));
				if(s.StartsWith(pm) && MatchCib(s, match) &&
				   (IsNull(find) || MatchCib(s, find) || n[i].uname.StartsWith(find))) {
					txt.Add(s);
					ndx.Add(f);
					fs.Add(s);
					fi.Add(f);
				}
			}
		}
	}
	const Workspace& wspc = GetIdeWorkspace();
	for(int i = 0; i < wspc.GetCount(); i++) {
		String pn = wspc[i];
		const Package& p = wspc.GetPackage(i);
		String pp = PackageDirectory(pn);
		for(int j = 0; j < p.GetCount(); j++)
			if(!p[j].separator) {
				String fn = AppendFileName(pp, p[j]);
				String s = GetFileText(AppendFileName(pn, p[j]));
				if(fs.Find(s) < 0 && (IsNull(find) || MatchCib(s, find)) && MatchCib(s, match) && MatchPm(fn, pm)) {
					int f = GetSourceFileIndex(SourcePath(pn, p[j]));
					txt.Add(s);
					ndx.Add(f);
					fs.Add(s);
				}
			}
	}
	IndexSort(txt, ndx, ScopeLess());
	Value key = scope.GetKey();
	int sc = scope.GetCursorSc();
	scope.Clear();
	for(int i = 0; i < txt.GetCount(); i++)
		scope.Add(IsString(ndx[i]) ? ndx[i] : Null, txt[i], ndx[i]);
	if(scope.FindSetCursor(key))
		scope.ScCursor(sc);
//	clear.Enable(IsSearch());
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:58,代码来源:CodeBrowser.cpp

示例4: Run

bool Thread::Run(Callback _cb)
{
	LLOG("Thread::Run");
	AtomicInc(sThreadCount);
	if(!threadr)
#ifndef CPU_BLACKFIN
		threadr = sMain = true;
#else
	{
		threadr = true;
		//the sMain replacement
#ifdef PLATFORM_POSIX
		pthread_t thid = pthread_self();
		vm.Enter();
		if(threadsv.Find(thid) < 0){
			//thread not yet present, mark present
			threadsv.Add(thid);
		}
		else
			RLOG("BUG: Multiple Add in Mt.cpp");
		vm.Leave();
#endif
	}
#endif
	Detach();
	Callback *cb = new Callback(_cb);
#ifdef PLATFORM_WIN32
	handle = (HANDLE)_beginthreadex(0, 0, sThreadRoutine, cb, 0, ((unsigned int *)(&thread_id)));
#endif
#ifdef PLATFORM_POSIX
	if(pthread_create(&handle, 0, sThreadRoutine, cb))
		handle = 0;
#endif
	return handle;
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:35,代码来源:Mt.cpp

示例5: IncludesFile

bool   IncludesFile(const String& parent_path, const String& header_path)
{
	LTIMING("IncludesFile");
	int pi = sSrcFile.Find(parent_path);
	int i = sSrcFile.Find(header_path);
	return pi >= 0 && i >= 0 && sIncludes.Find(MAKEQWORD(pi, i)) >= 0;
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:7,代码来源:srcfiles.cpp

示例6:

PPMacro *FindPPMacro(const String& id, Index<int>& segment_id, int& segmenti)
{
	Index<int> undef;
	PPMacro *r;
	int best;
	for(int pass = 0; pass < 2; pass++) {
		r = NULL;
		best = segmenti;
		int line = -1;
		int q = sAllMacros.Find(id);
		while(q >= 0) {
			PPMacro& m = sAllMacros[q];
			if(m.macro.IsUndef()) {
				if(pass == 0 && segment_id.Find(m.segment_id) >= 0)
					undef.FindAdd(m.segment_id); // cancel out undefined macro...
			}
			else
			if(pass == 0 || m.segment_id == 0 || undef.Find(m.undef_segment_id) < 0) {
				int si = m.segment_id == 0 ? INT_MAX : segment_id.Find(m.segment_id); // defs macros always override
				if(si > best || si >= 0 && si == best && m.line > line) {
					best = si;
					line = m.line;
					r = &m;
				}
			}
			q = sAllMacros.FindNext(q);
		}
		if(undef.GetCount() == 0)
			break;
	}
	segmenti = best;
	return r;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:33,代码来源:ppfile.cpp

示例7: ExportProject

void Ide::ExportProject(const String& ep, bool all, bool gui, bool deletedir)
{
	SaveFile(false);
	::Workspace wspc;
	wspc.Scan(main);
	Index<String> used;
	HdependClearDependencies();
	for(int i = 0; i < wspc.GetCount(); i++) {
		const Package& p = wspc.GetPackage(i);
		String pn = wspc[i];
		for(int j = 0; j < p.GetCount(); j++) {
			const Package::File& f = p[j];
			if(!f.separator) {
				String p = SourcePath(pn, f);
				used.FindAdd(p);
				Vector<String> d = HdependGetDependencies(p);
				for(int q = 0; q < d.GetCount(); q++)
					used.FindAdd(d[q]);
				for(int q = 0; q < f.depends.GetCount(); q++)
					used.FindAdd(SourcePath(pn, f.depends[q].text));
			}
		}
	}
	if(FileExists(ep)) {
		if(gui && !PromptYesNo(DeQtf(ep) + " is existing file.&"
		                "Do you want to delete it?")) return;
		FileDelete(ep);
	}
	if(deletedir && DirectoryExists(ep)) {
		if(gui && !PromptYesNo(DeQtf(ep) + " is existing directory.&"
		                "Do you want to replace it?")) return;
		DeleteFolderDeep(ep);
	}

	Progress pi("Exporting project");
	pi.SetTotal(wspc.GetCount());
	for(int i = 0; i < wspc.GetCount(); i++) {
		if(gui && pi.StepCanceled())
			return;
		CopyFolder(AppendFileName(ep, wspc[i]), PackageDirectory(wspc[i]), used, all, true);
	}
	Vector<String> upp = GetUppDirs();
	for(int i = 0; i < upp.GetCount(); i++) {
		if(gui && pi.StepCanceled())
			return;
		String d = upp[i];
		FindFile ff(AppendFileName(d, "*"));
		while(ff) {
			if(ff.IsFile()) {
				String fn = ff.GetName();
				String path = AppendFileName(d, fn);
				if(all || used.Find(path) >= 0)
					CopyFile(AppendFileName(ep, fn), path, true);
			}
			ff.Next();
		}
		CopyFolder(AppendFileName(ep, wspc[i]), PackageDirectory(wspc[i]), used, all, true);
	}
	ExportMakefile(ep);
}
开发者ID:ultimatepp,项目名称:mirror,代码行数:60,代码来源:Export.cpp

示例8: IndexClient

void IndexClient()
{
	/// .Index and client types

	/// In order to store elements to `Index`, they type must be `Moveable`, have deep copy and
	/// defined the `operator==` and a `GetHashValue` function or method to compute the hash
	/// code. It is recommended to use `CombineHash` to combine hash values of types that
	/// already provide `GetHashValue`:

	struct Person : Moveable<Person> {
		String name;
		String surname;
	
		unsigned GetHashValue() const          { return CombineHash(name, surname); }
		bool operator==(const Person& b) const { return name == b.name && surname == b.surname; }
	
		Person(String name, String surname) : name(name), surname(surname) {}
		Person() {}
	};

	Index<Person> p;
	p.Add(Person("John", "Smith"));
	p.Add(Person("Paul", "Carpenter"));
	p.Add(Person("Carl", "Engles"));

	DUMP(p.Find(Person("Paul", "Carpenter")));
	
	///
}
开发者ID:ultimatepp,项目名称:mirror,代码行数:29,代码来源:IndexClient.cpp

示例9: DndTargets

void Ctrl::DndTargets(GdkDragContext *context)
{
	static Index<String> text_targets;
	static Index<String> image_targets;
	static Index<String> files_targets;
	ONCELOCK {
		GtkTargetList *target_list = gtk_target_list_new (NULL, 0);
		gtk_target_list_add_text_targets(target_list, 0);
		ToIndex(target_list, text_targets);
		GtkTargetList *target_list2 = gtk_target_list_new (NULL, 0);
		gtk_target_list_add_image_targets(target_list2, 0, TRUE);
		ToIndex(target_list2, image_targets);
		GtkTargetList *target_list3 = gtk_target_list_new (NULL, 0);
		gtk_target_list_add_uri_targets(target_list3, 0);
		ToIndex(target_list3, files_targets);
	}
	dnd_targets.Clear();
	dnd_text_target.Clear();
#if GTK_CHECK_VERSION(2,22,0) // No drag&drop support before 2.22, sorry...
	for(GList *list = gdk_drag_context_list_targets(context); list; list = g_list_next (list)) {
		String g = gdk_atom_name((GdkAtom)list->data);
		if(text_targets.Find(g) >= 0) {
			dnd_targets.Add("text");
			if(dnd_text_target.IsEmpty())
				dnd_text_target = g;
		}
		else
		if(image_targets.Find(g) >= 0) {
			dnd_targets.Add("image");
			if(dnd_image_target.IsEmpty())
				dnd_image_target = g;
		}
		else
		if(files_targets.Find(g) >= 0) {
			dnd_targets.Add("files");
			if(dnd_files_target.IsEmpty())
				dnd_files_target = g;
		}
		else
			dnd_targets.Add(g);
	}
#endif
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:43,代码来源:GtkDnD.cpp

示例10: Highlight

void LogSyntax::Highlight(const wchar *s, const wchar *end, HighlightOutput& hls, CodeEditor *editor, int line, int pos)
{
	const HlStyle& ink = hl_style[INK_NORMAL];
	HlStyle err = hl_style[INK_ERROR];
	err.bold = true;
	bool hl_line = false;
	bool sep_line = false;
	while(s < end) {
		int c = *s;
		const wchar *s0 = s;
		if(s + 3 <= end && (Is3(s, '-') || Is3(s, '*') || Is3(s, '=') || Is3(s, '+') ||
		                    Is3(s, '#') || Is3(s, ':') || Is3(s, '%') || Is3(s, '$')))
			sep_line = true;
		if(IsDigit(c))
			s = HighlightNumber(hls, s, thousands_separator, false, false);
		else
		if(c == '\'' || c == '\"') {
			s++;
			for(;;) {
				if(s >= end) {
					hls.Put(1, ink);
					s = s0 + 1;
					break;
				}
				if(*s == c) {
					s++;
					hls.Put((int)(s - s0), hl_style[INK_CONST_STRING]);
					break;
				}
				s += 1 + (s[0] == '\\' && s[1] == c);
			}
		}
		else
		if(IsAlpha(c) || c == '_') {
			static Index<String> rws;
			ONCELOCK {
				rws << "error" << "errors" << "warning" << "warnings" << "failed" << "exit" << "fatal"
				    << "failure" << "rejected";
			}
			String w;
			while(s < end && IsAlNum(*s) || *s == '_')
				w.Cat(ToLower(*s++));
			bool hl = rws.Find(w) >= 0;
			hls.Put(w.GetCount(), hl ? err : ink);
			hl_line = hl_line || hl;
		}
		else {
			bool hl = findarg(c, '[', ']', '(', ')', ':', '-', '=', '{', '}', '/', '<', '>', '*',
			                     '#', '@', '\\', '.') >= 0;
			hls.Put(1, hl ? hl_style[INK_OPERATOR] : ink);
			s++;
		}
		
	}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:54,代码来源:LogSyntax.cpp

示例11: RemoveWithParent

	void RemoveWithParent(const String& id, Vector<int>& remove) {
		for(;;) {
			int q = parent_ids.Find(id);
			if(q < 0)
				break;
			RemoveWithParent(ids[q]);
		}
		ids.Unlink(q);
		remove.Add(q);
		parent_ids.Unlinke(q);
	}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:11,代码来源:main.cpp

示例12: LoadFonts

void LoadFonts(DropList *face, Index<String>& fni, bool fixed)
{
	for(int i = 0; i < Font::GetFaceCount(); i++)
		if(!!(Font::GetFaceInfo(i) & Font::FIXEDPITCH) == fixed) {
			String n = Font::GetFaceName(i);
			if(fni.Find(n) < 0) {
				fni.Add(n);
				face->Add(i, n);
			}
		}
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:11,代码来源:Setup.cpp

示例13: FinishOldTable

void RichQtfParser::FinishOldTable()
{
	FinishCell();
	Index<int>  pos;
	Vector<int> srow;
	RichTable& t = Table();
	Tab& b = table.Top();
	for(int i = 0; i < t.GetRows(); i++) {
		int& s = srow.Add();
		s = 0;
		int nx = b.rown[i];
		for(int j = 0; j < nx; j++)
			s += t.GetSpan(i, j).cx;
		int xn = 0;
		for(int j = 0; j < nx; j++) {
			pos.FindAdd(xn * 10000 / s);
			xn += t.GetSpan(i, j).cx;
		}
	}
	Vector<int> h = pos.PickKeys();
	if(h.GetCount() == 0)
		Error("table");
	Sort(h);
	pos = pick(h);
	pos.Add(10000);
	RichTable tab;
	tab.SetFormat(t.GetFormat());
	for(int i = 0; i < pos.GetCount() - 1; i++) {
		tab.AddColumn(pos[i + 1] - pos[i]);
	}
	for(int i = 0; i < t.GetRows(); i++) {
		int s = srow[i];
		int nx = b.rown[i];
		int xn = 0;
		int xi = 0;
		for(int j = 0; j < nx; j++) {
			Size span = t.GetSpan(i, j);
			xn += span.cx;
			int nxi = pos.Find(xn * 10000 / s);
			tab.SetPick(i, xi, t.GetPick(i, j));
			tab.SetFormat(i, xi, t.GetFormat(i, j));
			tab.SetSpan(i, xi, max(span.cy - 1, 0), nxi - xi - 1);
			xi = nxi;
		}
	}
	table.Drop();
	if(table.GetCount())
		table.Top().text.CatPick(pick(tab));
	else
		target.CatPick(pick(tab));
	oldtab = false;
}
开发者ID:koz4k,项目名称:soccer,代码行数:52,代码来源:ParseQtf.cpp

示例14:

Thread::~Thread()
{
	Detach();
#ifdef CPU_BLACKFIN
#ifdef PLATFORM_POSIX
	//the static destruction replacement
	pthread_t thid = pthread_self();
	vm.Enter();
	int id = threadsv.Find(thid);
	if(id >= 0)
		threadsv.Remove(id);
	vm.Leave();
#endif
#endif
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:15,代码来源:Mt.cpp

示例15: GatherMethods

void GatherMethods(const String& type, VectorMap<String, bool>& inherited, bool g, Index<String>& done)
{
	if(done.Find(type) >= 0) return;
	done.Add(type);
	int q = CodeBase().Find(type);
	if(q < 0) return;
	const Array<CppItem>& n = CodeBase()[q];
	Index<String> set;
	for(int i = 0; i < n.GetCount(); i++) {
		const CppItem& m = n[i];
		if(set.Find(m.qitem) < 0) {
			set.Add(m.qitem);
			if(m.IsType()) {
				Vector<String> base = Split(m.qptype, ';');
				for(int i = 0; i < base.GetCount(); i++)
					GatherMethods(base[i], inherited, true, done);
			}
			if(m.IsCode() && g) {
				bool& virt = inherited.GetAdd(m.qitem);
				virt = virt || m.virt;
			}
		}
	}
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:24,代码来源:CodeBrowser.cpp


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