本文整理汇总了C++中qvector类的典型用法代码示例。如果您正苦于以下问题:C++ qvector类的具体用法?C++ qvector怎么用?C++ qvector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了qvector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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 ...");
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例11: 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);
}
}
示例12: 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);
}
示例13: 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);
}
}
示例14: 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);
}
}
示例15: 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;
}