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

C++ xr_string类代码示例

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

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



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

示例1: strstr

void strreplaceall						(xr_string &str, LPCSTR S, LPCSTR N)
{
	LPCSTR	A;
	int		S_len = xr_strlen(S);
	while ((A = strstr(str.c_str(),S)) != 0)
		str.replace(A - str.c_str(),S_len,N);
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:7,代码来源:script_engine_help.cpp


示例2: _load_

void TDB_packer::_load_(const xr_string& fname)
{
    	lbIncludeFolders->Items->Clear		();
    	lbIncludeFiles->Items->Clear		();

     	CInifile ini						(fname.c_str());

        if(ini.section_exist("include_folders"))
        {
           CInifile::Sect S 		= ini.r_section("include_folders");
           CInifile::SectCIt it 		= S.Data.begin();
           CInifile::SectCIt it_e 	= S.Data.end();
           for( ;it!=it_e; ++it)
           {
           		WideString 					ws;
                ws 							= (*it).first.c_str();
               lbIncludeFolders->Items->Add	(ws);
           }
        }
        if(ini.section_exist("include_files"))
        {
           CInifile::Sect S 		= ini.r_section("include_files");
           CInifile::SectCIt it 	= S.Data.begin();
           CInifile::SectCIt it_e 	= S.Data.end();
           for( ;it!=it_e; ++it)
           {
           		WideString 					ws;
                ws 							= (*it).first.c_str();
               lbIncludeFiles->Items->Add	(ws);
           }
        }
        Caption	=	fname.c_str();
}
开发者ID:NeoAnomaly,项目名称:xray,代码行数:33,代码来源:FrmDBXpacker.cpp


示例3: _CopyVal

LPCSTR _CopyVal(LPCSTR src, xr_string& dst, char separator)
{
    LPCSTR p;
    ptrdiff_t n;
    p = strchr(src, separator);
    n = (p > 0) ? (p - src) : xr_strlen(src);
    dst = src;
    dst = dst.erase(n, dst.length());
    return dst.c_str();
}
开发者ID:BubbaXXX,项目名称:xray-16,代码行数:10,代码来源:xr_trims.cpp


示例4: LoadMapInfo

void CMapListHelper::LoadMapInfo(LPCSTR map_cfg_fn, const xr_string& map_name, LPCSTR map_ver)
{
	CInifile	ini				(map_cfg_fn);

	shared_str _map_name		= map_name.substr(0,map_name.find('\\')).c_str();
	shared_str _map_ver			= map_ver;

	if(ini.section_exist("map_usage"))
	{
		if(ini.line_exist("map_usage","ver") && !map_ver)
			_map_ver				= ini.r_string("map_usage", "ver");

		CInifile::Sect S			= ini.r_section("map_usage");
		CInifile::SectCIt si		= S.Data.begin();
		CInifile::SectCIt si_e		= S.Data.end();
		for( ;si!=si_e; ++si)
		{
			const shared_str& game_type = (*si).first;
			
			if(game_type=="ver")		continue;

			SGameTypeMaps* M			= GetMapListInt(game_type);
			if(!M)
			{
				Msg						("--unknown game type-%s",game_type.c_str());
				m_storage.resize		(m_storage.size()+1);
				SGameTypeMaps&	Itm		= m_storage.back();
				Itm.m_game_type_name	= game_type;
				Itm.m_game_type_id		= ParseStringToGameType(game_type.c_str());
				M						= &m_storage.back();
			}
			
			SGameTypeMaps::SMapItm	Itm;
			Itm.map_name				= _map_name;
			Itm.map_ver					= _map_ver;
			
			if(M->m_map_names.end()!=std::find(M->m_map_names.begin(),M->m_map_names.end(),Itm))
			{
				Msg("! duplicate map found [%s] [%s]", _map_name.c_str(), _map_ver.c_str());
			}else
			{
#ifndef MASTER_GOLD
				Msg("added map [%s] [%s]", _map_name.c_str(), _map_ver.c_str());
#endif // #ifndef MASTER_GOLD
				M->m_map_names.push_back	(Itm);
			}
		}			
	}

}
开发者ID:BeaconDev,项目名称:xray-16,代码行数:50,代码来源:UIGameCustom.cpp


示例5: R_ASSERT2

// %c[255,255,255,255]
u32 CUILines::GetColorFromText(const xr_string& str)const {
//	typedef xr_string::size_type size;

    StrSize begin, end, comma1_pos, comma2_pos, comma3_pos;

    begin = str.find(BEGIN);
    end = str.find(END, begin);
    R_ASSERT2(npos != begin, "CUISubLine::GetColorFromText -- can't find beginning tag %c[");
    R_ASSERT2(npos != end, "CUISubLine::GetColorFromText -- can't find ending tag ]");

    // try default color
    if (npos != str.find("%c[default]", begin, end - begin))
        return m_dwTextColor;

    // Try predefined in XML colors
//	CUIXmlInit xml;
    for (CUIXmlInit::ColorDefs::const_iterator it = CUIXmlInit::GetColorDefs()->begin(); it != CUIXmlInit::GetColorDefs()->end(); ++it)
    {
        int cmp = str.compare(begin+3, end-begin-3, *it->first);
        if (cmp == 0)
            return it->second;
    }

    // try parse values separated by commas
    comma1_pos = str.find(",", begin);
    comma2_pos = str.find(",", comma1_pos + 1);
    comma3_pos = str.find(",", comma2_pos + 1);

    R_ASSERT2(npos != comma1_pos, "CUISubLine::GetColorFromText -- can't find first comma");
    R_ASSERT2(npos != comma2_pos, "CUISubLine::GetColorFromText -- can't find second comma");
    R_ASSERT2(npos != comma3_pos, "CUISubLine::GetColorFromText -- can't find third comma");


    u32 a, r, g, b;
    xr_string single_color;

    begin+=3;

    single_color = str.substr(begin, comma1_pos - 1);
    a = atoi(single_color.c_str());
    single_color = str.substr(comma1_pos + 1, comma2_pos - 1);
    r = atoi(single_color.c_str());
    single_color = str.substr(comma2_pos + 1, comma3_pos - 1);
    g = atoi(single_color.c_str());
    single_color = str.substr(comma3_pos + 1, end - 1);
    b = atoi(single_color.c_str());

    return color_argb(a,r,g,b);
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:50,代码来源:UILines.cpp


示例6: AppendFolderToName

xr_string	EFS_Utils::AppendFolderToName(xr_string& tex_name, int depth, BOOL full_name)
{
	string1024 nm;
	xr_strcpy(nm,tex_name.c_str());
	tex_name = AppendFolderToName(nm,sizeof(nm),depth,full_name);
	return tex_name;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:7,代码来源:FileSystem_borland.cpp


示例7: GetOpenName

bool EFS_Utils::GetOpenName(LPCSTR initial, xr_string& buffer, bool bMulti, LPCSTR offset, int start_flt_ext )
{
	char			buf	[255*255]; //max files to select
	xr_strcpy			(buf, buffer.c_str());

/*
char* g_SHBF_Folder =("C:\\Program Files");
TCHAR path[_MAX_PATH];
BROWSEINFO info={NULL,NULL,path,"title",BIF_USENEWUI,BrowseCallbackProc, (LPARAM)g_SHBF_Folder };
SHBrowseForFolder       (&info);
*/
/*
	{
		HANDLE hDialog = OSDInit(true, "SDITEST", 0, 0, 0, 0, 0, 0);
		if(hDialog)
		{
			OSDRET osResult=OSDDoModal(hDialog, 0);
			OSDRelease(hDialog);
		}

	}
*/
//	bool bRes = false;
	bool bRes		= GetOpenNameInternal(initial, buf, sizeof(buf), bMulti, offset, start_flt_ext);

	if (bRes)
		buffer=(char*)buf;

	return bRes;
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:30,代码来源:FileSystem_borland.cpp


示例8: GetBriefInfo

void CWeaponMagazined::GetBriefInfo(xr_string& str_name, xr_string& icon_sect_name, xr_string& str_count)
{
	int	AE = GetAmmoElapsed();
	int	AC = GetAmmoCurrent();

	if (AE == 0 || 0 == m_magazine.size())
		icon_sect_name = *m_ammoTypes[m_ammoType];
	else
		icon_sect_name = *m_ammoTypes[m_magazine.back().m_LocalAmmoType];

	string256		sItemName;
	strcpy_s(sItemName, *CStringTable().translate(pSettings->r_string(icon_sect_name.c_str(), "inv_name_short")));

	if (HasFireModes())
		strcat_s(sItemName, GetCurrentFireModeStr());

	str_name = sItemName;

	{
		if (!unlimited_ammo())
			sprintf_s(sItemName, "%d/%d", AE, AC - AE);
		else
			sprintf_s(sItemName, "%d/--", AE);

		str_count = sItemName;
	}
}
开发者ID:Karlan88,项目名称:xray,代码行数:27,代码来源:WeaponMagazined.cpp


示例9: GetSaveName

bool EFS_Utils::GetSaveName( LPCSTR initial, xr_string& buffer, LPCSTR offset, int start_flt_ext )
{
	string4096 buf;
	strcpy(buf,buffer.c_str());
	bool bRes = GetSaveName(initial,buf,sizeof(buf),offset,start_flt_ext);
	if (bRes) buffer=buf;
	return bRes;
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:8,代码来源:FileSystem_borland.cpp


示例10: CNameAfterEdit

bool CPropHelper::CNameAfterEdit(PropValue* sender, xr_string& edit_val)
{
	CTextValue* V	= dynamic_cast<CTextValue*>(sender); VERIFY(V);
    ListItem* L		= (ListItem*)sender->tag;
    shared_str tmp	= edit_val.c_str();
	bool accepted	= LHelper().NameAfterEdit(L,V->GetValue(),tmp);
    edit_val		= tmp.c_str();
    return 			accepted;
}
开发者ID:2asoft,项目名称:xray,代码行数:9,代码来源:PropertiesListHelper.cpp


示例11: _GetItem

LPCSTR _GetItem(LPCSTR src, int index, xr_string& dst, char separator, LPCSTR def, bool trim)
{
    LPCSTR ptr;
    ptr = _SetPos(src, index, separator);
    if (ptr) _CopyVal(ptr, dst, separator);
    else dst = def;
    if (trim) _Trim(dst);
    return dst.c_str();
}
开发者ID:BubbaXXX,项目名称:xray-16,代码行数:9,代码来源:xr_trims.cpp


示例12: GetOpenName

bool EFS_Utils::GetOpenName(LPCSTR initial, xr_string& buffer, bool bMulti, LPCSTR offset, int start_flt_ext )
{
	string_path		buf;
	strcpy			(buf,buffer.c_str());
	bool bRes		= GetOpenName(initial,buf,sizeof(buf),bMulti,offset,start_flt_ext);

	if (bRes) 
		buffer=(char*)buf;

	return bRes;
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:11,代码来源:FileSystem_borland.cpp


示例13: add_debug_info_restrictions

void   add_debug_info_restrictions (debug::text_tree& root_s, const xr_string& restr)
{
	size_t cur_i = 0;

	do 
	{
		size_t pos = restr.find(',', cur_i);
		if ( pos == xr_string::npos )
		{
			pos = restr.size()-1;
		}

		if ( cur_i > pos )
		{
			

			root_s.add_line(restr.substr(cur_i, pos-cur_i));
		}
		cur_i = pos + 1;

	} while ( cur_i < restr.size() );
}
开发者ID:2asoft,项目名称:xray,代码行数:22,代码来源:base_monster_debug.cpp


示例14: ChangeFileExt

xr_string EFS_Utils::ChangeFileExt(const xr_string& src, LPCSTR ext)
{
    return ChangeFileExt(src.c_str(), ext);
}
开发者ID:Frankie-666,项目名称:xray-16,代码行数:4,代码来源:FileSystem.cpp


示例15: if

void CUILines::CutFirstColoredTextEntry(xr_string& entry, u32& color, xr_string& text) const {
    entry.clear();

    StrSize begin	= text.find(BEGIN);
    StrSize end	= text.find(END, begin);
    if (xr_string::npos == end)
        begin = end;
    StrSize begin2	= text.find(BEGIN, end);
    StrSize end2	= text.find(END,begin2);
    if (xr_string::npos == end2)
        begin2 = end2;

    // if we do not have any color entry or it is single with 0 position
    if (xr_string::npos == begin)
    {
        entry = text;
        color = m_dwTextColor;
        text.clear();
    }
    else if (0 == begin && xr_string::npos == begin2)
    {
        entry = text;
        color = GetColorFromText(entry);
        entry.replace(begin, end - begin + 1, "");
        text.clear();
    }
    // if we have color entry not at begin
    else if (0 != begin)
    {
        entry = text.substr(0, begin );
        color = m_dwTextColor;
        text.replace(0, begin, "");
    }
    // if we have two color entries. and first has 0 position
    else if (0 == begin && xr_string::npos != begin2)
    {
        entry = text.substr(0, begin2);
        color = GetColorFromText(entry);
        entry.replace(begin, end - begin + 1, "");
        text.replace(0, begin2, "");
    }
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:42,代码来源:UILines.cpp


示例16: GetWord

bool CUILine::GetWord(Word& w, const xr_string& text, int begin) const{

	if (text.empty())
		return false;

	StrSize first, last, lastsp/*last space*/;
	first  = text.find_first_not_of(' ', begin);
	last   = text.find_first_of(' ', first);
	
	if( npos==last && npos==first )
		return false;

	if( npos==last && npos!=first )
	{
		w.pos		= (int)first;
		w.len		= (int)(text.length()-first);
		w.len_full	= w.len;
		return		true;
	}

	lastsp			= text.find_first_not_of(' ', last);

	if (npos == lastsp && npos == first) // maybe we have string only with spaces
	{
		first		= text.find_first_of(' ',begin);
		last		= text.find_last_of(' ',begin);
		
		if (npos == first) //suxxx it is empty string
			return	false;

		w.pos		= (int)first;
		w.len		= (int)(last - first + 1);
		w.len_full	= w.len;
		return		true;
	}
	

	if (npos == lastsp)
		lastsp = last;
	else
		--lastsp;

	if (npos == last && npos != first)
		last = text.size() - 1;
	else
		--last;

	if (npos == lastsp)
		lastsp = last;

	first = begin;

	w.pos		= (int) first;
	w.len		= (int)(last - first + 1);
	w.len_full	= (int)(lastsp - first + 1);

#ifdef DEBUG
	if (npos != first && (npos == last || npos == lastsp ))
		R_ASSERT2(false,"CUILine::InitPos -- impossible match");
#endif

	return true;        
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:63,代码来源:UILine.cpp


示例17: r_stringZ

void IReader::r_stringZ(xr_string& dest)
{
    dest = (char*)(data + Pos);
    Pos += int(dest.size() + 1);
};
开发者ID:BubbaXXX,项目名称:xray-16,代码行数:5,代码来源:FS.cpp


示例18: r_string

void IReader::r_string(xr_string& dest)
{
    char* src = (char*)data + Pos;
    u32 sz = advance_term_string();
    dest.assign(src, sz);
}
开发者ID:BubbaXXX,项目名称:xray-16,代码行数:6,代码来源:FS.cpp


示例19: CNameBeforeEdit

void CPropHelper::CNameBeforeEdit(PropValue* sender, xr_string& edit_val)
{
	int cnt			=_GetItemCount(edit_val.c_str(),'\\');
	edit_val		= _SetPos(edit_val.c_str(),cnt-1,'\\');
}
开发者ID:2asoft,项目名称:xray,代码行数:5,代码来源:PropertiesListHelper.cpp


示例20: FastMsg

void print_free_functions				(lua_State *L, const luabind::object &object, LPCSTR header, const xr_string &indent)
{
	u32							count = 0;
	luabind::object::iterator	I = object.begin();
	luabind::object::iterator	E = object.end();
	for ( ; I != E; ++I) {
		if ((*I).type() != LUA_TFUNCTION)
			continue;
		(*I).pushvalue();
		luabind::detail::free_functions::function_rep* rep = 0;
		if (lua_iscfunction(L, -1))
		{
			if (lua_getupvalue(L, -1, 2) != 0)
			{
				// check the magic number that identifies luabind's functions
				if (lua_touserdata(L, -1) == (void*)0x1337)
				{
					if (lua_getupvalue(L, -2, 1) != 0)
					{
						if (!count)
							FastMsg("\n%snamespace %s {",indent.c_str(),header);
						++count;
						rep = static_cast<luabind::detail::free_functions::function_rep*>(lua_touserdata(L, -1));
						std::vector<luabind::detail::free_functions::overload_rep>::const_iterator	i = rep->overloads().begin();
						std::vector<luabind::detail::free_functions::overload_rep>::const_iterator	e = rep->overloads().end();
						for ( ; i != e; ++i) {
							xr_string	S;
							(*i).get_signature(L,S);
							FastMsg("    %sfunction %s%s;",indent.c_str(),rep->name(), process_signature(S).c_str());
						}
						lua_pop(L, 1);
					}
				}
				lua_pop(L, 1);
			}
		}
		lua_pop(L, 1);
	}
	{
		static xr_vector<xr_string> nesting_path;

		xr_string				_indent = indent;
		xr_string				last_key = "?";
		_indent.append			("    ");
		
		object.pushvalue();
		int n_table = lua_gettop(L);
		// Msg("# n_table = %d ", n_table);
		lua_pushnil		(L);		
		int save_top = lua_gettop(L);

// #pragma todo("alpet : при загруженной сохраненке здесь иногда происходит сбой invalid key to 'next', а потом креш в недрах Direct3D ")
		while (lua_next(L, n_table) != 0) {  
			last_key = "~"; 
			int key_type = lua_type(L, -2);			
			if (lua_type(L, -1) == LUA_TTABLE && key_type == LUA_TSTRING && lua_objlen(L, -2) > 0) {				
				last_key = lua_tostring(L, -2);
				LPCSTR	S = last_key.c_str();
				MsgCB("~#CONTEXT: last_key = %s", S);
				string_path script_name;
				sprintf_s(script_name, sizeof(script_name) - 1, "%s.script", S);
				if (nesting_path.size() == 0 && // скан глобального пространства имен
					(last_key == "" || last_key == "config" || last_key == "package" || last_key == "jit" || last_key == "loaded" || last_key == "md_list" ||
   					 FS.exist("$game_scripts$", script_name) )) // с дампом экспортируемых luabind вещей, возникают сбои!
				{
					Msg("! skipping namespace %s ", last_key.c_str());
					lua_pop(L, 1);
					continue;
				}
				
				if (xr_strcmp("_G", S)) {					
					luabind::object		object(L);
					object.set();
					// if (!xr_strcmp("security", S)) { S = S; } /// wtf?
					xr_string path_dump = "";
					for (u32 ns = 0; ns < nesting_path.size(); ns++)
						path_dump = path_dump + nesting_path.at(ns) + ".";

					path_dump = path_dump + S;
					Msg("#dumping namespace %s ", path_dump.c_str());
					nesting_path.push_back(S);

					u32 nest_level = nesting_path.size();
					// если слишком много вложений или начали повторяться строки
					if (nest_level < 2 &&
						!(nest_level > 1 && nesting_path.at(0) == S)
						)
					{
						print_free_functions(L, object, S, _indent);
					}
					else
					{
						// problem detected
						Msg("! WARN: to many nested levels for export = %d, or self-reference detected ", nest_level);
						FlushLog();
						dumper->flush();
					}
					nesting_path.pop_back();

				}
//.........这里部分代码省略.........
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:101,代码来源:script_engine_help.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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