本文整理汇总了C++中std_string::size方法的典型用法代码示例。如果您正苦于以下问题:C++ std_string::size方法的具体用法?C++ std_string::size怎么用?C++ std_string::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std_string
的用法示例。
在下文中一共展示了std_string::size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EnsureTerminatingSeparator
void EnsureTerminatingSeparator(std_string& strPath)
{
if(strPath.size() == 0) return;
if(strPath.c_str()[strPath.size() - 1] == _T('\\')) return;
strPath += _T("\\");
}
示例2: UpdateNativeImage
void UpdateNativeImage(bool bInstall)
{
const std_string strNGen = FindNGen();
if(strNGen.size() == 0) return;
const std_string strKeePassExe = GetKeePassExePath();
if(strKeePassExe.size() == 0) return;
std_string strParam = (bInstall ? _T("") : _T("un"));
strParam += _T("install \"");
strParam += strKeePassExe + _T("\"");
SHELLEXECUTEINFO sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO));
sei.cbSize = sizeof(SHELLEXECUTEINFO);
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
sei.lpVerb = _T("open");
sei.lpFile = strNGen.c_str();
sei.lpParameters = strParam.c_str();
sei.nShow = SW_HIDE;
ShellExecuteEx(&sei);
if(sei.hProcess != NULL)
{
WaitForSingleObject(sei.hProcess, 16000);
CloseHandle(sei.hProcess);
}
}
示例3: _tWinMain
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow)
{
UNREFERENCED_PARAMETER(hInstance);
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
UNREFERENCED_PARAMETER(nCmdShow);
INITCOMMONCONTROLSEX icc;
ZeroMemory(&icc, sizeof(INITCOMMONCONTROLSEX));
icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
icc.dwICC = ICC_STANDARD_CLASSES;
InitCommonControlsEx(&icc);
std_string strCmdLine = GetCommandLine();
boost::trim_if(strCmdLine, boost::is_any_of(g_lpPathTrimChars));
std::transform(strCmdLine.begin(), strCmdLine.end(), strCmdLine.begin(), tolower);
if((strCmdLine.size() >= g_strNGenInstall.size()) && (strCmdLine.substr(
strCmdLine.size() - g_strNGenInstall.size()) == g_strNGenInstall))
{
UpdateNativeImage(false);
Sleep(200);
UpdateNativeImage(true);
}
if((strCmdLine.size() >= g_strNGenUninstall.size()) && (strCmdLine.substr(
strCmdLine.size() - g_strNGenUninstall.size()) == g_strNGenUninstall))
{
UpdateNativeImage(false);
}
if((strCmdLine.size() >= g_strPreLoadRegister.size()) && (strCmdLine.substr(
strCmdLine.size() - g_strPreLoadRegister.size()) == g_strPreLoadRegister))
{
RegisterPreLoad(true);
}
if((strCmdLine.size() >= g_strPreLoadUnregister.size()) && (strCmdLine.substr(
strCmdLine.size() - g_strPreLoadUnregister.size()) == g_strPreLoadUnregister))
{
RegisterPreLoad(false);
}
if((strCmdLine.size() >= g_strNetCheck.size()) && (strCmdLine.substr(
strCmdLine.size() - g_strNetCheck.size()) == g_strNetCheck))
{
CheckDotNetInstalled();
}
return 0;
}
示例4: CheckDotNetInstalled
void CheckDotNetInstalled()
{
OSVERSIONINFO osv;
ZeroMemory(&osv, sizeof(OSVERSIONINFO));
osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osv);
if(osv.dwMajorVersion >= 6) return; // .NET ships with Vista and higher
const std_string strNGen = FindNGen();
if(strNGen.size() == 0)
{
std_string strMsg = _T("KeePass 2.x requires the Microsoft .NET Framework >= 2.0, ");
strMsg += _T("however this framework currently doesn't seem to be installed ");
strMsg += _T("on your computer. Without this framework, KeePass will not run.\r\n\r\n");
strMsg += _T("The Microsoft .NET Framework is available as free download from the ");
strMsg += _T("Microsoft website.\r\n\r\n");
strMsg += _T("Do you want to visit the Microsoft website now?");
const int nRes = MessageBox(NULL, strMsg.c_str(), _T("KeePass Setup"),
MB_ICONQUESTION | MB_YESNO);
if(nRes == IDYES)
{
SHELLEXECUTEINFO sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFO));
sei.cbSize = sizeof(SHELLEXECUTEINFO);
sei.lpVerb = _T("open");
sei.lpFile = _T("http://msdn.microsoft.com/en-us/netframework/aa569263.aspx");
sei.nShow = SW_SHOW;
ShellExecuteEx(&sei);
}
}
}
示例5: AddComponent
void CUpdateCheckEx::AddComponent(const std_string& strLine, UC_COMPONENTS_LIST& vList)
{
if(strLine.size() == 0) return;
if(strLine[0] == _T('#')) { ASSERT(FALSE); return; } // Reserved for future use
std::vector<std_string> vInfo;
SU_Split(vInfo, strLine, _T("#"));
if(vInfo.size() < 2) { ASSERT(FALSE); return; }
std::vector<std_string> vVersion;
SU_Split(vVersion, vInfo[1], _T("."));
if(vVersion.size() < 4) { ASSERT(FALSE); return; }
UC_COMPONENT_INFO c;
c.strName = vInfo[0];
c.qwVerAvailable = ((static_cast<UINT64>(_ttol(vVersion[0].c_str())) << 48) |
(static_cast<UINT64>(_ttol(vVersion[1].c_str())) << 32) |
(static_cast<UINT64>(_ttol(vVersion[2].c_str())) << 16) |
static_cast<UINT64>(_ttol(vVersion[3].c_str())));
vList.push_back(c);
}
示例6: RegisterPreLoad
void RegisterPreLoad(bool bRegister)
{
const std_string strPath = GetKeePassExePath();
if(strPath.size() == 0) return;
HKEY hKey = NULL;
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
0, KEY_WRITE, &hKey) != ERROR_SUCCESS) return;
if(hKey == NULL) return;
const std_string strItemName = _T("KeePass 2 PreLoad");
std_string strItemValue = _T("\"");
strItemValue += strPath;
strItemValue += _T("\" --preload");
if(bRegister)
RegSetValueEx(hKey, strItemName.c_str(), 0, REG_SZ,
(const BYTE*)strItemValue.c_str(), static_cast<DWORD>((strItemValue.size() +
1) * sizeof(TCHAR)));
else
RegDeleteValue(hKey, strItemName.c_str());
RegCloseKey(hKey);
}
示例7:
inline
basic_cstring<CharT>::basic_cstring( std_string const& s )
: m_begin( s.c_str() )
, m_end( m_begin + s.size() )
{
}