本文整理汇总了C++中STRING_VECTOR::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ STRING_VECTOR::empty方法的具体用法?C++ STRING_VECTOR::empty怎么用?C++ STRING_VECTOR::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类STRING_VECTOR
的用法示例。
在下文中一共展示了STRING_VECTOR::empty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnInitDialog
BOOL CSettingGitRemote::OnInitDialog()
{
ISettingsPropPage::OnInitDialog();
//CString str=((CSettings*)GetParent())->m_CmdPath.GetWinPath();
CString proj;
if( g_GitAdminDir.HasAdminDir(m_cmdPath,&proj) )
{
CString title;
this->GetWindowText(title);
this->SetWindowText(title + _T(" - ") + proj);
}
STRING_VECTOR remotes;
g_Git.GetRemoteList(remotes);
m_ctrlRemoteList.ResetContent();
for (size_t i = 0; i < remotes.size(); i++)
m_ctrlRemoteList.AddString(remotes[i]);
m_ctrlTagOpt.AddString(CString(MAKEINTRESOURCE(IDS_FETCH_REACHABLE)));
m_ctrlTagOpt.AddString(CString(MAKEINTRESOURCE(IDS_NONE)));
m_ctrlTagOpt.AddString(CString(MAKEINTRESOURCE(IDS_FETCH_TAGS_ONLY)));
m_ctrlTagOpt.SetCurSel(0);
//this->GetDlgItem(IDC_EDIT_REMOTE)->EnableWindow(FALSE);
this->UpdateData(FALSE);
if (remotes.empty())
{
GetDlgItem(IDC_EDIT_REMOTE)->SetWindowText(_T("origin"));
OnEnChangeEditRemote();
}
return TRUE;
}
示例2: SubmoduleCallback
static int SubmoduleCallback(git_submodule *sm, const char * /*name*/, void *payload)
{
STRING_VECTOR *list = *(STRING_VECTOR **)payload;
STRING_VECTOR *prefixList = *((STRING_VECTOR **)payload + 1);
CString path = CUnicodeUtils::GetUnicode(git_submodule_path(sm));
if (prefixList->empty())
list->push_back(path);
else
{
for (size_t i = 0; i < prefixList->size(); ++i)
{
CString prefix = prefixList->at(i) + L'/';
if (CStringUtils::StartsWith(path, prefix))
list->push_back(path);
}
}
return 0;
}
示例3: SubmoduleCallback
static int SubmoduleCallback(git_submodule *sm, const char * /*name*/, void *payload)
{
STRING_VECTOR *list = *(STRING_VECTOR **)payload;
STRING_VECTOR *prefixList = *((STRING_VECTOR **)payload + 1);
CString path = CUnicodeUtils::GetUnicode(git_submodule_path(sm));
if (prefixList->empty())
{
list->push_back(path);
}
else
{
for (size_t i = 0; i < prefixList->size(); ++i)
{
CString prefix = prefixList->at(i) + _T("/");
if (path.Left(prefix.GetLength()) == prefix)
list->push_back(path);
}
}
return 0;
}
示例4: RunCmdList
//static function, Share with SyncDialog
UINT CProgressDlg::RunCmdList(CWnd* pWnd, STRING_VECTOR& cmdlist, STRING_VECTOR& dirlist, bool bShowCommand, CString* pfilename, volatile bool* bAbort, CGitGuardedByteArray* pdata, CGit* git)
{
UINT ret=0;
std::vector<std::unique_ptr<CBlockCacheForPath>> cacheBlockList;
std::vector<std::unique_ptr<CGit>> gitList;
if (dirlist.empty())
cacheBlockList.push_back(std::make_unique<CBlockCacheForPath>(git->m_CurrentDir));
else
{
for (const auto& dir : dirlist)
{
auto pGit = std::make_unique<CGit>();
pGit->m_CurrentDir = dir;
gitList.push_back(std::move(pGit));
cacheBlockList.push_back(std::make_unique<CBlockCacheForPath>(dir));
}
}
EnsurePostMessage(pWnd, MSG_PROGRESSDLG_UPDATE_UI, MSG_PROGRESSDLG_START, 0);
if(pdata)
pdata->clear();
for (size_t i = 0; i < cmdlist.size(); ++i)
{
if(cmdlist[i].IsEmpty())
continue;
if (bShowCommand)
{
CStringA str;
if (gitList.empty() || gitList.size() == 1 && gitList[0]->m_CurrentDir == git->m_CurrentDir)
str = CUnicodeUtils::GetMulti(cmdlist[i].Trim() + _T("\r\n\r\n"), CP_UTF8);
else
str = CUnicodeUtils::GetMulti((i > 0 ? _T("\r\n") : _T("")) + gitList[i]->m_CurrentDir + _T("\r\n") + cmdlist[i].Trim() + _T("\r\n\r\n"), CP_UTF8);
for (int j = 0; j < str.GetLength(); ++j)
{
if(pdata)
{
pdata->m_critSec.Lock();
pdata->push_back(str[j]);
pdata->m_critSec.Unlock();
}
else
pWnd->PostMessage(MSG_PROGRESSDLG_UPDATE_UI,MSG_PROGRESSDLG_RUN,str[j]);
}
if(pdata)
pWnd->PostMessage(MSG_PROGRESSDLG_UPDATE_UI,MSG_PROGRESSDLG_RUN,0);
}
PROCESS_INFORMATION pi;
CAutoGeneralHandle hRead;
int runAsyncRet = -1;
if (gitList.empty())
runAsyncRet = git->RunAsync(cmdlist[i].Trim(), &pi, hRead.GetPointer(), nullptr, pfilename);
else
runAsyncRet = gitList[i]->RunAsync(cmdlist[i].Trim(), &pi, hRead.GetPointer(), nullptr, pfilename);
if (runAsyncRet)
{
EnsurePostMessage(pWnd, MSG_PROGRESSDLG_UPDATE_UI, MSG_PROGRESSDLG_FAILED, -1 * runAsyncRet);
return runAsyncRet;
}
CAutoGeneralHandle piProcess(pi.hProcess);
CAutoGeneralHandle piThread(pi.hThread);
DWORD readnumber;
char lastByte = '\0';
char byte;
CString output;
while (ReadFile(hRead, &byte, 1, &readnumber, nullptr))
{
if(pdata)
{
if(byte == 0)
byte = '\n';
pdata->m_critSec.Lock();
if (byte == '\n' && lastByte != '\r')
pdata->push_back('\r');
pdata->push_back( byte);
lastByte = byte;
pdata->m_critSec.Unlock();
if(byte == '\r' || byte == '\n')
pWnd->PostMessage(MSG_PROGRESSDLG_UPDATE_UI,MSG_PROGRESSDLG_RUN,0);
}
else
pWnd->PostMessage(MSG_PROGRESSDLG_UPDATE_UI,MSG_PROGRESSDLG_RUN,byte);
}
if (pdata)
{
pdata->m_critSec.Lock();
bool post = !pdata->empty();
pdata->m_critSec.Unlock();
if (post)
EnsurePostMessage(pWnd, MSG_PROGRESSDLG_UPDATE_UI, MSG_PROGRESSDLG_RUN, 0);
}
//.........这里部分代码省略.........
示例5: LoadList
void CSettingGitCredential::LoadList()
{
git_config * config;
git_config_new(&config);
CStringA projectConfigA = CUnicodeUtils::GetUTF8(g_Git.GetGitLocalConfig());
git_config_add_file_ondisk(config, projectConfigA.GetBuffer(), GIT_CONFIG_LEVEL_LOCAL, FALSE);
projectConfigA.ReleaseBuffer();
CStringA globalConfigA = CUnicodeUtils::GetUTF8(g_Git.GetGitGlobalConfig());
git_config_add_file_ondisk(config, globalConfigA.GetBuffer(), GIT_CONFIG_LEVEL_GLOBAL, FALSE);
globalConfigA.ReleaseBuffer();
CStringA globalXDGConfigA = CUnicodeUtils::GetUTF8(g_Git.GetGitGlobalXDGConfig());
git_config_add_file_ondisk(config, globalXDGConfigA.GetBuffer(), GIT_CONFIG_LEVEL_XDG, FALSE);
globalXDGConfigA.ReleaseBuffer();
CStringA systemConfigA = CUnicodeUtils::GetUTF8(g_Git.GetGitSystemConfig());
git_config_add_file_ondisk(config, systemConfigA.GetBuffer(), GIT_CONFIG_LEVEL_SYSTEM, FALSE);
systemConfigA.ReleaseBuffer();
STRING_VECTOR defaultList, urlList;
git_config_foreach_match(config, "credential\\.helper", GetCredentialDefaultUrlCallback, &defaultList);
git_config_foreach_match(config, "credential\\..*\\.helper", GetCredentialUrlCallback, &urlList);
STRING_VECTOR anyList;
git_config_foreach_match(config, "credential\\..*", GetCredentialAnyEntryCallback, &anyList);
git_config_free(config);
for (int i = 0; i < defaultList.size(); ++i)
m_ctrlUrlList.AddString(defaultList[i]);
for (int i = 0; i < urlList.size(); ++i)
m_ctrlUrlList.AddString(urlList[i]);
if (anyList.empty())
{
m_ctrlSimpleCredential.SetCurSel(SimpleCredentialType::None);
return;
}
if (anyList.size() > 1)
{
m_ctrlSimpleCredential.SetCurSel(SimpleCredentialType::Advanced);
return;
}
int pos = 0;
CString prefix = anyList[0].Tokenize(_T("\n"), pos);
CString key = anyList[0].Tokenize(_T("\n"), pos);
CString value = anyList[0].Tokenize(_T("\n"), pos);
if (key != _T("credential.helper"))
{
m_ctrlSimpleCredential.SetCurSel(SimpleCredentialType::Advanced);
return;
}
CString winstore = GetWinstorePath();
if (prefix == _T("L"))
{
if (value == _T("wincred"))
{
m_ctrlSimpleCredential.SetCurSel(SimpleCredentialType::LocalWincred);
return;
}
else if (value == winstore)
{
m_ctrlSimpleCredential.SetCurSel(SimpleCredentialType::LocalWinstore);
return;
}
}
if (prefix == _T("G") || prefix == _T("X"))
{
if (value == _T("wincred"))
{
m_ctrlSimpleCredential.SetCurSel(SimpleCredentialType::GlobalWincred);
return;
}
else if (value == winstore)
{
m_ctrlSimpleCredential.SetCurSel(SimpleCredentialType::GlobalWinstore);
return;
}
}
if (prefix == _T("S"))
{
if (value == _T("wincred"))
{
m_ctrlSimpleCredential.SetCurSel(SimpleCredentialType::SystemWincred);
return;
}
}
m_ctrlSimpleCredential.SetCurSel(SimpleCredentialType::Advanced);
}
示例6: OnInitDialog
BOOL CFirstStartWizardAuthentication::OnInitDialog()
{
CFirstStartWizardBasePage::OnInitDialog();
CString tmp;
tmp.LoadString(IDS_FIRSTSTART_SSHHINT);
GetDlgItem(IDC_FIRSTSTART_SSHHINT)->SetWindowText(tmp);
CAutoConfig config(true);
if (git_config_add_file_ondisk(config, CGit::GetGitPathStringA(g_Git.GetGitGlobalConfig()), GIT_CONFIG_LEVEL_GLOBAL, nullptr, FALSE))
MessageBox(g_Git.GetLibGit2LastErr(), L"TortoiseGit", MB_ICONEXCLAMATION);
else
{
if (git_config_add_file_ondisk(config, CGit::GetGitPathStringA(g_Git.GetGitGlobalXDGConfig()), GIT_CONFIG_LEVEL_XDG, nullptr, FALSE))
MessageBox(g_Git.GetLibGit2LastErr(), L"TortoiseGit", MB_ICONEXCLAMATION);
}
if (!g_Git.ms_bCygwinGit && !g_Git.ms_bMsys2Git)
{
if (git_config_add_file_ondisk(config, CGit::GetGitPathStringA(g_Git.GetGitProgramDataConfig()), GIT_CONFIG_LEVEL_PROGRAMDATA, nullptr, FALSE))
MessageBox(g_Git.GetLibGit2LastErr(), L"TortoiseGit", MB_ICONEXCLAMATION);
}
if (git_config_add_file_ondisk(config, CGit::GetGitPathStringA(g_Git.GetGitSystemConfig()), GIT_CONFIG_LEVEL_SYSTEM, nullptr, FALSE))
MessageBox(g_Git.GetLibGit2LastErr(), L"TortoiseGit", MB_ICONEXCLAMATION);
STRING_VECTOR defaultList;
git_config_foreach_match(config, "credential\\.helper", CSettingGitCredential::GetCredentialDefaultUrlCallback, &defaultList);
if (defaultList.size() <= 1 && (defaultList.empty() || defaultList.at(0)[0] == 'X' || defaultList.at(0)[0] == 'G'))
AddHelper(m_ctrlSimpleCredential, m_availableHelpers, MAKEINTRESOURCE(IDS_NONE));
CString selectedHelper;
if (config.GetString(L"credential.helper", selectedHelper) == GIT_ENOTFOUND)
m_ctrlSimpleCredential.SetCurSel(0);
if (CSettingGitCredential::GCMExists())
AddHelper(m_ctrlSimpleCredential, m_availableHelpers, L"manager", selectedHelper);
if (CSettingGitCredential::WincredExists())
AddHelper(m_ctrlSimpleCredential, m_availableHelpers, L"wincred", selectedHelper);
if (CSettingGitCredential::WinstoreExists())
AddHelper(m_ctrlSimpleCredential, m_availableHelpers, CSettingGitCredential::GetWinstorePath(), selectedHelper);
STRING_VECTOR urlList;
git_config_foreach_match(config, "credential\\..*\\.helper", CSettingGitCredential::GetCredentialUrlCallback, &urlList);
if (!urlList.empty() || m_ctrlSimpleCredential.GetCurSel() == -1)
{
m_ctrlSimpleCredential.EnableWindow(FALSE);
m_availableHelpers.clear();
m_ctrlSimpleCredential.Clear();
AddHelper(m_ctrlSimpleCredential, m_availableHelpers, MAKEINTRESOURCE(IDS_ADVANCED));
m_ctrlSimpleCredential.SetCurSel(0);
}
AdjustControlSize(IDC_DONTSAVE);
CString sshclient = CRegString(L"Software\\TortoiseGit\\SSH");
if (sshclient.IsEmpty())
sshclient = CRegString(L"Software\\TortoiseGit\\SSH", L"", FALSE, HKEY_LOCAL_MACHINE);
int idx = m_ctrlSSHClient.AddString(L"TortoiseGitPlink");
if (sshclient.IsEmpty() || IsTool(L"tortoisegitplink", sshclient) || IsTool(L"tortoiseplink", sshclient))
m_ctrlSSHClient.SetCurSel(idx);
idx = m_ctrlSSHClient.AddString(L"OpenSSH");
if (IsTool(L"ssh", sshclient))
m_ctrlSSHClient.SetCurSel(idx);
if (m_ctrlSSHClient.GetCurSel() == -1)
{
idx = m_ctrlSSHClient.AddString(sshclient);
m_ctrlSSHClient.SetCurSel(idx);
}
// TODO: Hide the button if PuTTY is not used?
//GetDlgItem(IDC_GENERATEPUTTYKEY)->ShowWindow(CAppUtils::IsSSHPutty() ? SW_SHOW : SW_HIDE);
UpdateData(FALSE);
return TRUE;
}