本文整理汇总了C++中nsAString::Insert方法的典型用法代码示例。如果您正苦于以下问题:C++ nsAString::Insert方法的具体用法?C++ nsAString::Insert怎么用?C++ nsAString::Insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsAString
的用法示例。
在下文中一共展示了nsAString::Insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
static nsresult
GetShellFolderPath(int folder, nsAString& _retval)
{
PRUnichar* buf;
PRUint32 bufLength = _retval.GetMutableData(&buf, MAXPATHLEN + 3);
NS_ENSURE_TRUE(bufLength >= (MAXPATHLEN + 3), NS_ERROR_OUT_OF_MEMORY);
nsresult rv = NS_OK;
#if defined(WINCE) && !defined(WINCE_WINDOWS_MOBILE)
if (folder == CSIDL_APPDATA || folder == CSIDL_LOCAL_APPDATA)
folder = CSIDL_PROFILE;
BOOL ok = SHGetSpecialFolderPath(NULL, buf, folder, true);
if (!ok) {
_retval.SetLength(0);
return NS_ERROR_FAILURE;
}
buf[bufLength - 1] = L'\0';
_retval.SetLength(wcslen(buf));
// sometimes CSIDL_PROFILE shows up without a root slash
if (folder == CSIDL_PROFILE && buf[0] != '\\') {
_retval.Insert('\\', 0);
}
#else
LPITEMIDLIST pItemIDList = NULL;
if (SUCCEEDED(SHGetSpecialFolderLocation(NULL, folder, &pItemIDList)) &&
SHGetPathFromIDListW(pItemIDList, buf)) {
// We're going to use wcslen (wcsnlen not available in msvc7.1) so make
// sure to null terminate.
buf[bufLength - 1] = L'\0';
_retval.SetLength(wcslen(buf));
} else {
_retval.SetLength(0);
rv = NS_ERROR_NOT_AVAILABLE;
}
CoTaskMemFree(pItemIDList);
#endif
return rv;
}