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

C++ qstring类代码示例

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

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



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

示例1: reconstruct_type

bool idaapi reconstruct_type(cfuncptr_t cfunc, qstring var_name, qstring type_name)
{
	bool bResult = false;
	// initialize type rebuilder
	type_builder_t type_bldr;
	type_bldr.expression_to_match.push_back(var_name.c_str());
	
	// traverse the ctree structure
	type_bldr.apply_to(&cfunc->body, NULL);
	
	if (type_bldr.structure.size() != 0) {
		tid_t struct_type_id = type_bldr.get_structure(type_name.c_str());
		
		if(struct_type_id != 0 || struct_type_id != -1) {
			tinfo_t new_type = create_typedef(type_name.c_str());
			if(new_type.is_correct()) {
				qstring type_str = type_name.c_str();
				//if (new_type.print(&type_str, NULL, PRTYPE_DEF | PRTYPE_MULTI))
					logmsg(DEBUG, ("New type created: %s\n", type_str.c_str()));

				bResult = true;
			}
		}
	} else {
		warning("Failed to reconstruct type, no field references have been found...");
		logmsg(DEBUG, "Failed to reconstruct type, no field references have been found...");
	}

	return bResult;
}
开发者ID:GuardAngelY,项目名称:HexRaysCodeXplorer,代码行数:30,代码来源:TypeReconstructor.cpp


示例2: send_request

//--------------------------------------------------------------------------
// returns error code
int rpc_engine_t::send_request(qstring &s)
{
  // if nothing is initialized yet or error occurred, silently fail
  if ( irs == NULL || network_error_code != 0 )
    return -1;

  finalize_packet(s);
  const char *ptr = s.c_str();
  ssize_t left = s.length();
#ifdef DEBUG_NETWORK
  rpc_packet_t *rp = (rpc_packet_t *)ptr;
  int len = qntohl(rp->length);
  show_hex(rp+1, len, "SEND %s %d bytes:\n", get_rpc_name(rp->code), len);
  //  msg("SEND %s\n", get_rpc_name(rp->code));
#endif
  while ( left > 0 )
  {
    ssize_t code = irs_send(irs, ptr, left);
    if ( code == -1 )
    {
      code = irs_error(irs);
      network_error_code = code;
      warning("irs_send: %s", winerr((int)code));
      return (int)code;
    }
    left -= code;
    ptr += code;
  }
  return 0;
}
开发者ID:nealey,项目名称:vera,代码行数:32,代码来源:rpc_engine.cpp


示例3: dump_type_info

void idaapi dump_type_info(int file_id, const VTBL_info_t& vtbl_info, const qstring& type_name, const std::map<ea_t, VTBL_info_t>& vtbl_map) {
	struc_t * struc_type = get_struc(get_struc_id(type_name.c_str()));
	if (!struc_type)
		return;

	qstring file_entry_key;
	qstring key_hash;
	bool filtered = false;

	get_struct_key(struc_type, vtbl_info, file_entry_key, filtered, vtbl_map);
	get_hash_of_string(file_entry_key, key_hash);

	if (filtered)
		return;

	qstring file_entry_val;
	tinfo_t new_type = create_typedef(type_name.c_str());

	if (new_type.is_correct() && new_type.print(&file_entry_val, NULL, PRTYPE_DEF | PRTYPE_1LINE)) {
		qstring line;

		line = key_hash + ";" + file_entry_key + ";";
		line.cat_sprnt("%a;", vtbl_info.ea_begin);
		line += file_entry_val + ";";

		if (rtti_vftables.count(vtbl_info.ea_begin) != 0) {
			VTBL_info_t vi = rtti_vftables[vtbl_info.ea_begin];
			line += vi.vtbl_name;
		}
		line.rtrim();
		line += "\r\n";
		qwrite(file_id, line.c_str(), line.length());
	}
}
开发者ID:REhints,项目名称:HexRaysCodeXplorer,代码行数:34,代码来源:TypeExtractor.cpp


示例4: HU_CenterMessage

//
// HU_CenterMessage
//
// haleyjd 04/27/04: rewritten to use qstring
//
void HU_CenterMessage(const char *s)
{
   static qstring qstr(128);
   int st_height = GameModeInfo->StatusBar->height;

   qstr.clear();

   // haleyjd 02/28/06: colored center message
   if(centermsg_color)
   {
      qstr += centermsg_color;
      centermsg_color = NULL;
   }
   
   qstr += s;
  
   centermessage_widget.setMessage(qstr.constPtr(),
      (SCREENWIDTH - V_FontStringWidth(hud_font, s)) / 2,
      (SCREENHEIGHT - V_FontStringHeight(hud_font, s) -
       ((scaledwindow.height == SCREENHEIGHT) ? 0 : st_height - 8)) / 2,
       leveltime + (message_timer * 35) / 1000);
   
   // print message to console also
   C_Printf("%s\n", s);
}
开发者ID:Altazimuth,项目名称:eternity,代码行数:30,代码来源:hu_stuff.cpp


示例5: getZoneSize

//
// MetaObject::toString
//
// Virtual method for conversion of metaobjects into strings. As with the prior
// C implementation, the returned string pointer is a static buffer and should
// not be cached. The default toString method creates a hex dump representation
// of the object. This should be pretty interesting in C++...
// 04/03/11: Altered to use new ZoneObject functionality so that the entire
// object, including all subclasses, are dumped properly. Really cool ;)
//
const char *MetaObject::toString() const
{
   static qstring qstr;
   size_t bytestoprint = getZoneSize();
   const byte *data    = reinterpret_cast<const byte *>(getBlockPtr());
   
   qstr.clearOrCreate(128);

   if(!bytestoprint) // Not a zone object? Can only dump the base class.
   {
      bytestoprint = sizeof(*this);
      data = reinterpret_cast<const byte *>(this); // Not evil, I swear :P
   }

   while(bytestoprint)
   {
      int i;

      // print up to 12 bytes on each line
      for(i = 0; i < 12 && bytestoprint; ++i, --bytestoprint)
      {
         byte val = *data++;
         char bytes[4] = { 0 };

         sprintf(bytes, "%02x ", val);

         qstr += bytes;
      }
      qstr += '\n';
   }

   return qstr.constPtr();
}
开发者ID:camgunz,项目名称:eternity,代码行数:43,代码来源:metaapi.cpp


示例6: show_citem_custom_view

bool idaapi show_citem_custom_view(void *ud, qstring ctree_item, qstring item_name)
{
	HWND hwnd = NULL;
	qstring form_name = "Ctree Item View: ";
	form_name.append(item_name);
	TForm *form = create_tform(form_name.c_str(), &hwnd);
	func_ctree_info_t *si = new func_ctree_info_t(form);

	istringstream s_citem_str(ctree_item.c_str());
	string tmp_str;
	while (getline(s_citem_str, tmp_str, ';'))
	{
		qstring tmp_qstr = tmp_str.c_str();
		si->sv.push_back(simpleline_t(tmp_qstr));
	}

	simpleline_place_t s1;
	simpleline_place_t s2(ctree_item.size());
	si->cv = create_custom_viewer("Ctree Item View: ", NULL, &s1, &s2, &s1, 0, &si->sv);
	si->codeview = create_code_viewer(form, si->cv, CDVF_NOLINES);
	set_custom_viewer_handlers(si->cv, NULL, NULL, NULL, NULL, NULL, NULL, si);
	open_tform(form, FORM_ONTOP | FORM_RESTORE);

	return false;
}
开发者ID:rock44422,项目名称:HexRaysCodeXplorer,代码行数:25,代码来源:CtreeExtractor.cpp


示例7: toString

result_t XmlComment::toString(qstring &retVal)
{
    retVal = "<!--";
    retVal.append(m_data.data());
    retVal.append("-->");

    return 0;
}
开发者ID:zhangyinglong,项目名称:fibjs,代码行数:8,代码来源:XmlComment.cpp


示例8: MakeMAPxy

//
// MakeMAPxy
//
// Utility to convert Hexen's map numbers into MAPxy map name strings.
//
static void MakeMAPxy(qstring &mapName)
{
   char *endptr = NULL;
   auto  num    = mapName.toLong(&endptr, 10);

   if(*endptr == '\0' && num >= 1 && num <= 99)
      mapName.Printf(9, "MAP%02d", num);
}
开发者ID:Altazimuth,项目名称:eternity,代码行数:13,代码来源:xl_mapinfo.cpp


示例9: check_subtype

bool idaapi check_subtype(const VTBL_info_t &vtbl_info, const qstring &subtype_name) {
	bool bResult = false;
	qstring search_str;
	search_str.sprnt("_%p", vtbl_info.ea_begin);

	tid_t type_id = get_struc_id(subtype_name.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) {
					qstring member_name = get_member_name2(member_info->id);
					if (member_name.find(search_str, 0) != -1) {
						bResult = true;
						break;
					}
				}
			}
		}
	}

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


示例10: qstring

//
// INStatsManager::makeKey
//
// Make a key from a path and a lump name, even if the wad's not loaded.
//
void INStatsManager::getLevelKey(qstring &outstr, 
                                 const char *path, const char *mapName)
{
   outstr = path;
   outstr.normalizeSlashes();
   outstr << "::" << qstring(mapName).toUpper();
}
开发者ID:doomtech,项目名称:eternity,代码行数:12,代码来源:in_stats.cpp


示例11: add_struc

tid_t type_builder_t::get_structure(const qstring name)
{
	tid_t struct_type_id = add_struc(BADADDR, name.c_str());
	if (struct_type_id != 0 || struct_type_id != -1)
	{
		struc_t * struc = get_struc(struct_type_id);
		if(struc != NULL)
		{
			opinfo_t opinfo;
			opinfo.tid = struct_type_id;

			int j = 0;
			
			for(std::map<int, struct_filed>::iterator i = structure.begin(); i != structure.end() ; i ++)
			{
				VTBL_info_t vtbl;

				flags_t member_flgs = 0;
				if(i->second.size == 1)
					member_flgs = byteflag();
				else if (i->second.size == 2)
					member_flgs = wordflag();
				else if (i->second.size == 4)
					member_flgs = dwrdflag();
				else if (i->second.size == 8)
					member_flgs = qwrdflag();

				char field_name[258];
				memset(field_name, 0x00, sizeof(field_name));

				if((i->second.vftbl != BADADDR) && get_vbtbl_by_ea(i->second.vftbl, vtbl)) 
				{
					qstring vftbl_name = name;
					vftbl_name.cat_sprnt("_VTABLE_%X_%p", i->second.offset, i->second.vftbl);

					tid_t vtbl_str_id = create_vtbl_struct(vtbl.ea_begin, vtbl.ea_end, (char *)vftbl_name.c_str(), 0);
					if (vtbl_str_id != BADADDR) {
						sprintf_s(field_name, sizeof(field_name), "vftbl_%d_%p", j, i->second.vftbl);
						int iRet = add_struc_member(struc, field_name, i->second.offset, member_flgs, NULL, i->second.size);

						member_t * membr = get_member_by_name(struc, field_name);
						if (membr != NULL) {
							tinfo_t new_type = create_typedef((char *)vftbl_name.c_str());
							if(new_type.is_correct()) {
								smt_code_t dd = set_member_tinfo2(struc, membr, 0, make_pointer(new_type), SET_MEMTI_COMPATIBLE);
							}
						}
					}	
				} 
				else 
				{
					sprintf_s(field_name, sizeof(field_name), "field_%X", i->second.offset);
					int iRet = add_struc_member(struc, field_name, i->second.offset, member_flgs, NULL, i->second.size);
				}
				j ++;
			}
		}
	}
	return struct_type_id;
}
开发者ID:GuardAngelY,项目名称:HexRaysCodeXplorer,代码行数:60,代码来源:TypeReconstructor.cpp


示例12: ToTGA

bool ToTGA(quint8* data, int width, int height, int bytes, const qstring& file)
{
	FILE* outfile = fopen(file.c_str(), "wb");
	
	if (!outfile)
		return false;

	quint8 header[18];
	memset(header, 0, 18);

	header[2] = 2; // type

	*((quint16*)(&header[12])) = (quint16)width;
	*((quint16*)(&header[14])) = (quint16)height;

	header[16] = bytes * 8;
	fwrite(header, 1, 18, outfile);

	if( bytes == 3 )
		fwrite(data, 1, width * height * 3, outfile);
	else
		fwrite(data, 1, width * height * 4, outfile);

	fclose(outfile);
	return true;
}
开发者ID:IwishIcanFLighT,项目名称:Asylum_Tutorials,代码行数:26,代码来源:main.cpp


示例13: FromBMP

bool FromBMP(quint8** out, int& outwidth, int& outheight, int& outbytes, const qstring& file)
{
	FILE* infile = fopen(file.c_str(), "rb");;

	if( !infile )
		return false;

	fseek(infile, 0, SEEK_END);
	long length = ftell(infile);
	fseek(infile, 0, SEEK_SET);

	char* data = (char*)malloc(length);

	if( !data )
	{
		fclose(infile);
		return false;
	}

	fread(data, 1, length, infile);
	fclose(infile);

	size_t size = FromBMP(out, outwidth, outheight, outbytes, (size_t)length, data);
	free(data);

	return (0 != size);
}
开发者ID:IwishIcanFLighT,项目名称:Asylum_Tutorials,代码行数:27,代码来源:main.cpp


示例14: openthirdpartytxurl

void transactionview::openthirdpartytxurl(qstring url)
{
    if(!transactionview || !transactionview->selectionmodel())
        return;
    qmodelindexlist selection = transactionview->selectionmodel()->selectedrows(0);
    if(!selection.isempty())
        qdesktopservices::openurl(qurl::fromuserinput(url.replace("%s", selection.at(0).data(transactiontablemodel::txhashrole).tostring())));
}
开发者ID:moorecoin,项目名称:MooreCoinMiningAlgorithm,代码行数:8,代码来源:transactionview.cpp


示例15: func_name_has_prefix

inline bool func_name_has_prefix(qstring &prefix, ea_t startEA) {
	qstring func_name;
	
	if (prefix.length() <= 0)
		return false;
	
	if (get_func_name2(&func_name, startEA) == 0)
		return false;
	
	if (func_name.length() <= 0)
		return false;
	
	if (func_name.find(prefix.c_str(), 0) != 0)
		return false;
	
	return true;
}
开发者ID:rock44422,项目名称:HexRaysCodeXplorer,代码行数:17,代码来源:CtreeExtractor.cpp


示例16: E_CfgListToCommaString

//
// E_CfgListToCommaString
//
// Concatenates all values in a CFGF_LIST CFG_STR option into a single
// string of comma-delimited values.
//
void E_CfgListToCommaString(cfg_t *sec, const char *optname, qstring &output)
{
   unsigned int numopts = cfg_size(sec, optname);
   
   output.clear();

   for(unsigned int i = 0; i < numopts; i++)
   {
      const char *str = cfg_getnstr(sec, optname, i);

      if(str)
         output += str;

      size_t len = output.length();
      if(i != numopts - 1 && len && output[len - 1] != ',')
         output += ',';
   }
}
开发者ID:Blastfrog,项目名称:eternity,代码行数:24,代码来源:e_lib.cpp


示例17: cnodestination

// coin control: custom change address changed
void sendcoinsdialog::coincontrolchangeedited(const qstring& text)
{
    if (model && model->getaddresstablemodel())
    {
        // default to no change address until verified
        coincontroldialog::coincontrol->destchange = cnodestination();
        ui->labelcoincontrolchangelabel->setstylesheet("qlabel{color:red;}");

        cmoorecoinaddress addr = cmoorecoinaddress(text.tostdstring());

        if (text.isempty()) // nothing entered
        {
            ui->labelcoincontrolchangelabel->settext("");
        }
        else if (!addr.isvalid()) // invalid address
        {
            ui->labelcoincontrolchangelabel->settext(tr("warning: invalid moorecoin address"));
        }
        else // valid address
        {
            cpubkey pubkey;
            ckeyid keyid;
            addr.getkeyid(keyid);
            if (!model->getpubkey(keyid, pubkey)) // unknown change address
            {
                ui->labelcoincontrolchangelabel->settext(tr("warning: unknown change address"));
            }
            else // known change address
            {
                ui->labelcoincontrolchangelabel->setstylesheet("qlabel{color:black;}");

                // query label
                qstring associatedlabel = model->getaddresstablemodel()->labelforaddress(text);
                if (!associatedlabel.isempty())
                    ui->labelcoincontrolchangelabel->settext(associatedlabel);
                else
                    ui->labelcoincontrolchangelabel->settext(tr("(no label)"));

                coincontroldialog::coincontrol->destchange = addr.get();
            }
        }
    }
}
开发者ID:moorecoin,项目名称:MooreCoinMiningAlgorithm,代码行数:44,代码来源:sendcoinsdialog.cpp


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


示例19: toString

result_t XmlDocumentType::toString(qstring &retVal)
{
    retVal = "<!DOCTYPE ";
    retVal.append(m_name);

    if (!m_publicId.empty())
    {
        retVal.append(" PUBLIC \"");
        retVal.append(m_publicId);
        retVal += '\"';
    }

    if (!m_systemId.empty())
    {
        if (m_publicId.empty())
            retVal.append(" SYSTEM \"");
        else
            retVal.append(" \"");

        retVal.append(m_systemId);
        retVal += '\"';
    }

    retVal += '>';

    return 0;
}
开发者ID:zhangyinglong,项目名称:fibjs,代码行数:27,代码来源:XmlDocumentType.cpp


示例20: get_hash_of_string

int get_hash_of_string(qstring &string_to_hash, qstring &hash) {
	SHA1Context sha;
	uint8_t Message_Digest[SHA1HashSize];
	int err;

	err = SHA1Reset(&sha);
	if (err == shaSuccess) {
		err = SHA1Input(&sha, (uint8_t *)string_to_hash.c_str(), string_to_hash.length());
		if (err == shaSuccess) {
			err = err = SHA1Result(&sha, Message_Digest);
			if (err == shaSuccess) {
				char digest_hex[SHA1HashSize * 2 + 1];
				memset(digest_hex, 0x00, sizeof(digest_hex));
				SHA1MessageDigestToString(Message_Digest, digest_hex);

				hash = digest_hex;
			}
		}
	}

	return err;
}
开发者ID:rock44422,项目名称:HexRaysCodeXplorer,代码行数:22,代码来源:CtreeExtractor.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ quantity类代码示例发布时间:2022-05-31
下一篇:
C++ qi类代码示例发布时间: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