• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ qvector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: show_vtbl_xrefs_window_cb

static bool idaapi show_vtbl_xrefs_window_cb(void *ud)
{
	get_xrefs_to_vtbl();
	if (!xref_list.empty())
	{
		HWND hwnd = NULL;
		TForm *form = create_tform(vtbl_t_list[current_line_pos].vtbl_name.c_str(), &hwnd);

		object_explorer_info_t *si = new object_explorer_info_t(form);

		qvector <qstring>::iterator xref_iter;
		for (xref_iter = xref_list.begin(); xref_iter != xref_list.end(); xref_iter++)
			si->sv.push_back(simpleline_t(*xref_iter));

		simpleline_place_t s1;
		simpleline_place_t s2(si->sv.size() - 1);
		si->cv = create_custom_viewer("", NULL, &s1, &s2, &s1, 0, &si->sv);
		si->codeview = create_code_viewer(form, si->cv, CDVF_STATUSBAR);
		set_custom_viewer_handlers(si->cv, NULL, NULL, ct_vtbl_xrefs_window_click, NULL, NULL, si);
		open_tform(form, FORM_ONTOP | FORM_RESTORE);

		return true;
	}

	warning("ObjectExplorer not found any xrefs here ...");

	return false;
}
开发者ID:andrivet,项目名称:HexRaysCodeXplorer,代码行数:28,代码来源:ObjectExplorer.cpp


示例2: object_explorer_form_init

void object_explorer_form_init()
{
	if (!vtbl_list.empty() && !vtbl_t_list.empty())
	{
		HWND hwnd = NULL;
		TForm *form = create_tform("Object Explorer", &hwnd);
		if (hwnd == NULL)
		{
			warning("Object Explorer window already open. Switching to it.");
			form = find_tform("Object Explorer");
			if (form != NULL)
				switchto_tform(form, true);
			return;
		}

		object_explorer_info_t *si = new object_explorer_info_t(form);

		qvector <qstring>::iterator vtbl_iter;
		for (vtbl_iter = vtbl_list.begin(); vtbl_iter != vtbl_list.end(); vtbl_iter++)
			si->sv.push_back(simpleline_t(*vtbl_iter));

		simpleline_place_t s1;
		simpleline_place_t s2(si->sv.size() - 1);
		si->cv = create_custom_viewer("", NULL, &s1, &s2, &s1, 0, &si->sv);
		si->codeview = create_code_viewer(form, si->cv, CDVF_STATUSBAR);
		set_custom_viewer_handlers(si->cv, ct_object_explorer_keyboard, ct_object_explorer_popup, ct_object_explorer_click, NULL, NULL, si);
		hook_to_notification_point(HT_UI, ui_object_explorer_callback, si);
		open_tform(form, FORM_TAB | FORM_MENU | FORM_RESTORE);
	}
	else
		warning("ObjectExplorer not found any virtual tables here ...");
}
开发者ID:andrivet,项目名称:HexRaysCodeXplorer,代码行数:32,代码来源:ObjectExplorer.cpp


示例3: show_rtti_window_cb

static bool idaapi show_rtti_window_cb(void *ud)
{
	if (!rtti_list.empty() && !rtti_addr.empty())
	{
		HWND hwnd = NULL;
		TForm *form = create_tform("RTTI Objects List", &hwnd);

		object_explorer_info_t *si = new object_explorer_info_t(form);

		qvector <qstring>::iterator rtti_iter;
		for (rtti_iter = rtti_list.begin(); rtti_iter != rtti_list.end(); rtti_iter++)
			si->sv.push_back(simpleline_t(*rtti_iter));

		simpleline_place_t s1;
		simpleline_place_t s2(si->sv.size() - 1);
		si->cv = create_custom_viewer("", NULL, &s1, &s2, &s1, 0, &si->sv);
		si->codeview = create_code_viewer(form, si->cv, CDVF_STATUSBAR);
		set_custom_viewer_handlers(si->cv, NULL, NULL, ct_rtti_window_click, NULL, NULL, si);
		open_tform(form, FORM_ONTOP | FORM_RESTORE);

		return true;
	}

	warning("ObjectExplorer not found any RTTI objects ...");

	return false;
}
开发者ID:andrivet,项目名称:HexRaysCodeXplorer,代码行数:27,代码来源:ObjectExplorer.cpp


示例4: qmutex_lock

void disp_request_t::flush() {
   qmutex_lock(mtx);
   for (qvector<json_object*>::iterator i = objects.begin(); i != objects.end(); i++) {
      json_object_put(*i);
   }
   objects.clear();
   qmutex_unlock(mtx);
}
开发者ID:cseagle,项目名称:collabREate,代码行数:8,代码来源:idanet.cpp


示例5: merge_types

tid_t idaapi merge_types(qvector<qstring> types_to_merge, qstring type_name) {
	tid_t struct_type_id = BADADDR;

	std::set<ea_t> offsets;

	if (types_to_merge.size() != 0) {
		struct_type_id = add_struc(BADADDR, type_name.c_str());
		if (struct_type_id != 0 || struct_type_id != BADADDR)
		{
			struc_t * struc = get_struc(struct_type_id);
			if (struc != NULL) {
				qvector<qstring>::iterator types_iter;
				for (types_iter = types_to_merge.begin(); types_iter != types_to_merge.end(); types_iter++) {

					tid_t type_id = get_struc_id((*types_iter).c_str());
					if (type_id != BADADDR) {
						struc_t * struc_type = get_struc(type_id);
						if (struc_type != NULL) {
							// enumerate members
							for (ea_t offset = get_struc_first_offset(struc_type); offset != BADADDR; offset = get_struc_next_offset(struc_type, offset)) {
								member_t * member_info = get_member(struc_type, offset);
								if (member_info != NULL) {
									if (offsets.count(member_info->soff) == 0) {
										qstring member_name = get_member_name2(member_info->id);
										asize_t member_size = get_member_size(member_info);

										if (member_name.find("vftbl_", 0) != -1) {
											tinfo_t tif;
											if (get_member_tinfo2(member_info, &tif)) {
												add_struc_member(struc, member_name.c_str(), member_info->soff, dwrdflag(), NULL, member_size);
												member_t * membr = get_member(struc, member_info->soff);
												if (membr != NULL) {
													set_member_tinfo2(struc, membr, 0, tif, SET_MEMTI_COMPATIBLE);
												}
											}
										}
										else {
											add_struc_member(struc, member_name.c_str(), member_info->soff, member_info->flag, NULL, member_size);
										}

										offsets.insert(member_info->soff);
									}
								}
							}
						}
					}
				}
			}
		}
	}

	return struct_type_id;
}
开发者ID:computerline1z,项目名称:HexRaysCodeXplorer,代码行数:53,代码来源:TypeExtractor.cpp


示例6: merge_types

tid_t idaapi merge_types(const qvector<qstring>& types_to_merge, const qstring& type_name) {
	tid_t struct_type_id = BADADDR;

	if (types_to_merge.empty())
		return struct_type_id;

	std::set<ea_t> offsets;

	struct_type_id = add_struc(BADADDR, type_name.c_str());
	if (struct_type_id == BADADDR)
		return struct_type_id;

	struc_t * struc = get_struc(struct_type_id);
	if (!struc)
		return struct_type_id;

	for (auto types_iter = types_to_merge.begin(), end = types_to_merge.end(); types_iter != end; ++types_iter) {
		struc_t * struc_type = get_struc(get_struc_id(types_iter->c_str()));
		if (!struc_type)
			continue;

		// enumerate members
		for ( ea_t offset = get_struc_first_offset(struc_type) ; offset != BADADDR ; offset = get_struc_next_offset(struc_type, offset)) {
			member_t * member_info = get_member(struc_type, offset);
			if (!member_info)
				continue;

			if (offsets.count(member_info->soff) == 0) {
				qstring member_name = get_member_name(member_info->id);
				asize_t member_size = get_member_size(member_info);

				if (member_name.find("vftbl_", 0) != -1) {
					tinfo_t tif;
					if (get_member_tinfo(&tif, member_info)) {
						add_struc_member(struc, member_name.c_str(), member_info->soff, dword_flag(), NULL, member_size);
						if (member_t * membr = get_member(struc, member_info->soff)) {
							set_member_tinfo(struc, membr, 0, tif, SET_MEMTI_COMPATIBLE);
						}
					}
				}
				else {
					add_struc_member(struc, member_name.c_str(), member_info->soff, member_info->flag, NULL, member_size);
				}

				offsets.insert(member_info->soff);
			}
		}
	}

	return struct_type_id;
}
开发者ID:REhints,项目名称:HexRaysCodeXplorer,代码行数:51,代码来源:TypeExtractor.cpp


示例7: get_vbtbl_by_ea

bool get_vbtbl_by_ea(ea_t vtbl_addr, VTBL_info_t &vtbl) {
	bool result = false;

	search_objects(false);

	qvector <VTBL_info_t>::iterator vtbl_iter;

	for (vtbl_iter = vtbl_t_list.begin(); vtbl_iter != vtbl_t_list.end(); vtbl_iter++) {
		if ((*vtbl_iter).ea_begin == vtbl_addr) {
			vtbl =  *vtbl_iter;
			result = true;
			break;
		}
	}

	return result;
}
开发者ID:BigwillJ,项目名称:HexRaysCodeXplorer,代码行数:17,代码来源:ObjectExplorer.cpp


示例8: while

//this is the callback that gets called by execute_sync, in theory new datagrams
//can arrive and be processed during the loop since queue synchronization takes
//place within the StringList
int idaapi disp_request_t::execute(void) {
   while (objects.size() > 0) {
      qmutex_lock(mtx);
      qvector<json_object*>::iterator i = objects.begin();
      json_object *obj = *i;
      objects.erase(i);
      qmutex_unlock(mtx);
      bool res = (*_disp)(obj);
      if (!res) {  //not sure we really care what is returned here
//         msg(PLUGIN_NAME": connection to server severed at dispatch.\n");
//         comm->cleanup(true);     //probably not the right thing to do??
//         break;
      }
      else {
         //msg(PLUGIN_NAME": dispatch routine called successfully.\n");
      }
   }
   return 0;
}
开发者ID:cseagle,项目名称:collabREate,代码行数:22,代码来源:idanet.cpp


示例9: writeQIntVec

int writeQIntVec(qvector & qv, string fname, int buffsize) {
  int j, nrows, fmt, ncols, nnz;
  uint64 v;
  ostream *ofstr = open_out_buf(fname, buffsize);
  ncols = qv.size();
  nrows = 4;
  nnz = nrows * ncols;
  fmt = 110;
  ofstr->write((const char *)&fmt, 4);
  ofstr->write((const char *)&nrows, 4);
  ofstr->write((const char *)&ncols, 4);
  ofstr->write((const char *)&nnz, 4);
  for (j = 0; j < qv.size(); j++) {
    v = qv[j].bottom;
    ofstr->write((const char *)&v, 8);
    v = qv[j].top;
    ofstr->write((const char *)&v, 8);
  }
  closeos(ofstr);
  return 0;
}
开发者ID:BIDData,项目名称:BIDMach,代码行数:21,代码来源:utils.cpp


示例10: writeQIntVecx

int writeQIntVecx(qvector & im, string fname, int buffsize) {
  int fmt, nrows, ncols, nnz;
  ostream *ofstr = open_out_buf(fname.c_str(), buffsize);
  fmt = 170;
  nrows = im.size();
  ncols = 1;
  nnz = nrows;
  ofstr->write((const char *)&fmt, 4);
  ofstr->write((const char *)&nrows, 4);
  ofstr->write((const char *)&ncols, 4);
  ofstr->write((const char *)&nnz, 4);
  ofstr->write((const char *)&im[0], 16 * nrows);
  closeos(ofstr);
  return 0;
}
开发者ID:BIDData,项目名称:BIDMach,代码行数:15,代码来源:utils.cpp


示例11: extract_all_types

bool idaapi extract_all_types(void *ud)
{
	logmsg(DEBUG, "extract_types()\n");

	// find vtables in the binary
	search_objects(false);

	qvector <VTBL_info_t>::iterator vtbl_iter;

	std::map<ea_t, VTBL_info_t> vtbl_map;
	for (vtbl_iter = vtbl_t_list.begin(); vtbl_iter != vtbl_t_list.end(); vtbl_iter++)
		vtbl_map[(*vtbl_iter).ea_begin] = (*vtbl_iter);

	int file_id = create_open_file("types.txt");
	if (file_id == -1)
	{
		logmsg(ERROR, "Failed to open file for dumping types.txt\r\n");
		return false;
	}

	int struct_no = 0;

	for (vtbl_iter = vtbl_t_list.begin(); vtbl_iter != vtbl_t_list.end(); vtbl_iter++) {
		qstring info_msg;
		info_msg.cat_sprnt("Processing vtable %s\n", (*vtbl_iter).vtbl_name.c_str());
		logmsg(DEBUG, info_msg.c_str());

		qstring type_name;
		type_name.sprnt("struc_2_%d", struct_no);

		ea_t cur_vt_ea = (*vtbl_iter).ea_begin;
		int struct_subno = 0;

		qvector <qstring> types_to_merge;
		for (ea_t addr = get_first_dref_to(cur_vt_ea); addr != BADADDR; addr = get_next_dref_to(cur_vt_ea, addr)) {
			qstring name;
			if (get_func_name(&name, addr) <= 0)
				continue;

			qstring info_msg1;
			info_msg1.cat_sprnt("\t%s\n", name.c_str());
			logmsg(DEBUG, info_msg1.c_str());

			func_t *pfn = get_func(addr);
			if (!pfn)
				continue;

			hexrays_failure_t hf;
			cfuncptr_t cfunc = decompile(pfn, &hf);
			if (cfunc != NULL) {
				qstring var_name;
				info_msg.clear();

				if (find_var(cfunc, (*vtbl_iter).vtbl_name, var_name)) {
					info_msg.cat_sprnt(" : %s\n", var_name.c_str());
					logmsg(DEBUG, info_msg.c_str());

					qstring sub_type_name = type_name;
					sub_type_name.cat_sprnt("_%d", struct_subno);
					struct_subno++;

					if (reconstruct_type(cfunc, var_name, sub_type_name)) {
						if (check_subtype((*vtbl_iter), sub_type_name)) {
							types_to_merge.push_back(sub_type_name);
						}
					}
				}
				else {
					info_msg.cat_sprnt(" : none\n");
					logmsg(DEBUG, info_msg.c_str());
				}
			}
		}

		struct_no++;

		merge_types(types_to_merge, type_name);
		dump_type_info(file_id, (*vtbl_iter), type_name, vtbl_map);
	}

	qclose(file_id);
	return true;
}
开发者ID:REhints,项目名称:HexRaysCodeXplorer,代码行数:83,代码来源:TypeExtractor.cpp


示例12: process_rtti

void process_rtti()
{
	ea_t start = getnseg(0)->startEA;

	while (TRUE)
	{
		ea_t rt = find_RTTI(start, inf.maxEA);
		start = rt + 4;

		if (rt == BADADDR)
			break;

		char* name = get_demangle_name(rt);

		ea_t rtd = rt - 8;

		rtti_addr.push_back(rtd);

		qstring tmp;
#ifndef __EA64__
		tmp.cat_sprnt(" 0x%x:  %s", rtd, name);
#else
		tmp.cat_sprnt(_T(" 0x%I64X:  %s"), rtd, name);
#endif

		rtti_list.push_back(tmp);
	}
}
开发者ID:andrivet,项目名称:HexRaysCodeXplorer,代码行数:28,代码来源:ObjectExplorer.cpp


示例13: process_vtbl

static BOOL process_vtbl(ea_t &ea_sect)
{
	VTBL_info_t vftable_info_t;
	if(get_vtbl_info(ea_sect, vftable_info_t))
	{
		ea_sect = vftable_info_t.ea_end;
		ea_t ea_assumed;
		verify_32_t((vftable_info_t.ea_begin - 4), ea_assumed);

		if(vftable_info_t.methods > 1)
		{
			if(has_user_name(getFlags(vftable_info_t.ea_begin)))
			{							
				vftable_info_t.vtbl_name = get_short_name(vftable_info_t.ea_begin);

				qstring vtbl_info_str;
				vtbl_info_str.cat_sprnt(" 0x%x - 0x%x:  %s  methods count: %d", vftable_info_t.ea_begin, vftable_info_t.ea_end, vftable_info_t.vtbl_name.c_str(), vftable_info_t.methods);
				vtbl_list.push_back(vtbl_info_str);

				vtbl_t_list.push_back(vftable_info_t);

				return(TRUE);
			}
		}

		return(FALSE);
	}

	ea_sect += sizeof(UINT);	
	return(FALSE);
}
开发者ID:BigwillJ,项目名称:HexRaysCodeXplorer,代码行数:31,代码来源:ObjectExplorer.cpp


示例14: queueObject

//queue up a received datagram for eventual handlng via IDA's execute_sync mechanism
//call no sdk functions other than execute_sync
void disp_request_t::queueObject(json_object *obj) {
   bool call_exec = false;
   qmutex_lock(mtx);
   objects.push_back(obj);
   call_exec = objects.size() == 1;
   qmutex_unlock(mtx);

   if (call_exec) {
      //only invoke execute_sync if the buffer just added was at the head of the queue
      //in theory this allows multiple datagrams to get queued for handling
      //in a single execute_sync callback
      execute_sync(*this, MFF_WRITE);
   }
}
开发者ID:cseagle,项目名称:collabREate,代码行数:16,代码来源:idanet.cpp


示例15: get_xrefs_to_vtbl

static void get_xrefs_to_vtbl()
{
	ea_t cur_vt_ea = vtbl_t_list[current_line_pos].ea_begin;
	for (ea_t addr = get_first_dref_to(cur_vt_ea); addr != BADADDR; addr = get_next_dref_to(cur_vt_ea, addr))
	{
		qstring name;
		get_func_name2(&name, addr);

		xref_addr.push_back(addr);

		qstring tmp;
		tmp.cat_sprnt(" 0x%x:  %s", addr, name);
		xref_list.push_back(tmp);
	}
}
开发者ID:BigwillJ,项目名称:HexRaysCodeXplorer,代码行数:15,代码来源:ObjectExplorer.cpp


示例16: map_port

ea_t map_port(ea_t from)
{
  for ( int i=0; i < map.size(); i++ )
    if ( map[i].from == from )
      return map[i].to;
  return from;
}
开发者ID:nealey,项目名称:vera,代码行数:7,代码来源:reg.cpp


示例17: does_exist

int does_exist(TFuncMallocWrapper new_func_malloc)
{
	for(int i = 0; i< funcMalloc_wrappers.size(); i++){
		if(funcMalloc_wrappers[i].address == new_func_malloc.address)return 1;
	}
	return 0;
}
开发者ID:melbcat,项目名称:findMalloc,代码行数:7,代码来源:findMalloc.cpp


示例18: process_vtbl

static BOOL process_vtbl(ea_t &ea_sect)
{
	VTBL_info_t vftable_info_t;
	if (get_vtbl_info(ea_sect, vftable_info_t))
	{
		ea_sect = vftable_info_t.ea_end;
		ea_t ea_assumed;
#ifndef __EA64__
		verify_32_t((vftable_info_t.ea_begin - 4), ea_assumed);
#else
		verify_64_t((vftable_info_t.ea_begin - sizeof(UINT64)), ea_assumed);
#endif


		if (vftable_info_t.methods > 0)
		{
			/*if(has_user_name(getFlags(vftable_info_t.ea_begin)))
			{	*/
			vftable_info_t.vtbl_name = f_get_short_name(vftable_info_t.ea_begin);
			qstring vtbl_info_str;
#ifndef __EA64__
			vtbl_info_str.cat_sprnt(" 0x%x - 0x%x:  %s  methods count: ", vftable_info_t.ea_begin, vftable_info_t.ea_end, vftable_info_t.vtbl_name);
			vtbl_info_str.cat_sprnt(" %u", vftable_info_t.methods);
#else
			
			vtbl_info_str.cat_sprnt(_T("  0x%I64X -  0x%I64X:  %s  methods count: "), vftable_info_t.ea_begin, vftable_info_t.ea_end, vftable_info_t.vtbl_name);
			vtbl_info_str.cat_sprnt(_T(" %d"), (vftable_info_t.methods));
#endif
			vtbl_list.push_back(vtbl_info_str);
			vtbl_t_list.push_back(vftable_info_t);
			return(TRUE);
			//}
		}
		return(FALSE);
	}
#ifndef __EA64__
	ea_sect += sizeof(UINT);
#else
	ea_sect += sizeof(UINT64);	
#endif

	return(FALSE);
}
开发者ID:andrivet,项目名称:HexRaysCodeXplorer,代码行数:43,代码来源:ObjectExplorer.cpp


示例19: add_mapping

static void add_mapping(ea_t from, ea_t to)
{
  if ( from != to )
  {
    deb(IDA_DEBUG_IDP, "add_mapping %a -> %a\n", from, to);
    portmap_t &p = map.push_back();
    p.from = from;
    p.to = to;
  }
}
开发者ID:nealey,项目名称:vera,代码行数:10,代码来源:reg.cpp


示例20: get_xrefs_to_vtbl

static void get_xrefs_to_vtbl()
{
	// the list is repeat while select another vtable
	xref_list.clear();
	xref_addr.clear();

	ea_t cur_vt_ea = vtbl_t_list[current_line_pos].ea_begin;
	for (ea_t addr = get_first_dref_to(cur_vt_ea); addr != BADADDR; addr = get_next_dref_to(cur_vt_ea, addr))
	{
		qstring name;
		f_get_func_name2(&name, addr);

		xref_addr.push_back(addr);

		qstring tmp;
#ifndef __EA64__
		tmp.cat_sprnt(" 0x%x:  %s", addr, name);
#else
		tmp.cat_sprnt(_T(" 0x%I64X:  %s"), addr, name);
#endif
		xref_list.push_back(tmp);
	}
}
开发者ID:andrivet,项目名称:HexRaysCodeXplorer,代码行数:23,代码来源:ObjectExplorer.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rString类代码示例发布时间:2022-05-31
下一篇:
C++ queue_type类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap