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


C++ wxString::SetChar方法代码示例

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


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

示例1: MakeLowerAscii

void MakeLowerAscii(wxString& str)
{
	for (size_t i = 0; i < str.Len(); i++) {
		wxChar c = str.GetChar(i);
		if (c >= 'A' && c <= 'Z') {
			c += 32;
			str.SetChar(i, wxUniChar(c));
		}
		else if (c == 0x130 || c == 0x131) {
			c = 'i';
			str.SetChar(i, wxUniChar(c));
		}
	}
}
开发者ID:Typz,项目名称:FileZilla,代码行数:14,代码来源:misc.cpp

示例2: RenameFile

bool RenameFile(wxWindow* parent, wxString dir, wxString from, wxString to)
{
	if (dir.Right(1) != _T("\\") && dir.Right(1) != _T("/"))
		dir += wxFileName::GetPathSeparator();

#ifdef __WXMSW__
	to = to.Left(255);

	if ((to.Find('/') != -1) ||
		(to.Find('\\') != -1) ||
		(to.Find(':') != -1) ||
		(to.Find('*') != -1) ||
		(to.Find('?') != -1) ||
		(to.Find('"') != -1) ||
		(to.Find('<') != -1) ||
		(to.Find('>') != -1) ||
		(to.Find('|') != -1))
	{
		wxMessageBox(_("Filenames may not contain any of the following characters: / \\ : * ? \" < > |"), _("Invalid filename"), wxICON_EXCLAMATION);
		return false;
	}

	SHFILEOPSTRUCT op;
	memset(&op, 0, sizeof(op));

	from = dir + from + _T(" ");
	from.SetChar(from.Length() - 1, '\0');
	op.pFrom = from;
	to = dir + to + _T(" ");
	to.SetChar(to.Length()-1, '\0');
	op.pTo = to;
	op.hwnd = (HWND)parent->GetHandle();
	op.wFunc = FO_RENAME;
	op.fFlags = FOF_ALLOWUNDO;
	return SHFileOperation(&op) == 0;
#else
	if ((to.Find('/') != -1) ||
		(to.Find('*') != -1) ||
		(to.Find('?') != -1) ||
		(to.Find('<') != -1) ||
		(to.Find('>') != -1) ||
		(to.Find('|') != -1))
	{
		wxMessageBox(_("Filenames may not contain any of the following characters: / * ? < > |"), _("Invalid filename"), wxICON_EXCLAMATION);
		return false;
	}

	return wxRename(dir + from, dir + to) == 0;
#endif
}
开发者ID:pappacurds,项目名称:filezilla,代码行数:50,代码来源:file_utils.cpp


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