本文整理汇总了C++中CServerPath::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ CServerPath::empty方法的具体用法?C++ CServerPath::empty怎么用?C++ CServerPath::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CServerPath
的用法示例。
在下文中一共展示了CServerPath::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InvalidatePath
void CPathCache::InvalidatePath(tServerCache & serverCache, CServerPath const& path, wxString const& subdir)
{
CSourcePath sourcePath;
sourcePath.source = path;
sourcePath.subdir = subdir;
CServerPath target;
tServerCacheIterator serverIter = serverCache.find(sourcePath);
if (serverIter != serverCache.end()) {
target = serverIter->second;
serverCache.erase(serverIter);
}
if (target.empty() && !subdir.empty()) {
target = path;
if (!target.AddSegment(subdir))
return;
}
if (!target.empty()) {
// Unfortunately O(n), don't know of a faster way.
for (auto serverIter = serverCache.begin(); serverIter != serverCache.end(); ) {
if (serverIter->second == target || target.IsParentOf(serverIter->second, false))
serverCache.erase(serverIter++);
else if (serverIter->first.source == target || target.IsParentOf(serverIter->first.source, false))
serverCache.erase(serverIter++);
else
++serverIter;
}
}
}
示例2: StartRecursiveOperation
void CRecursiveOperation::StartRecursiveOperation(enum OperationMode mode, const CServerPath& startDir, const std::list<CFilter>& filters, bool allowParent /*=false*/, const CServerPath& finalDir /*=CServerPath()*/)
{
wxCHECK_RET(m_operationMode == recursive_none, _T("StartRecursiveOperation called with m_operationMode != recursive_none"));
wxCHECK_RET(m_pState->IsRemoteConnected(), _T("StartRecursiveOperation while disconnected"));
wxCHECK_RET(!startDir.empty(), _T("Empty startDir in StartRecursiveOperation"));
if (mode == recursive_chmod && !m_pChmodDlg)
return;
if ((mode == recursive_download || mode == recursive_addtoqueue || mode == recursive_download_flatten || mode == recursive_addtoqueue_flatten) && !m_pQueue)
return;
if (m_dirsToVisit.empty())
{
// Nothing to do in this case
return;
}
m_operationMode = mode;
m_pState->NotifyHandlers(STATECHANGE_REMOTE_IDLE);
m_startDir = startDir;
if (finalDir.empty())
m_finalDir = startDir;
else
m_finalDir = finalDir;
m_allowParent = allowParent;
m_filters = filters;
NextOperation();
}
示例3: AddBookmark
bool CBookmarksDialog::AddBookmark(const wxString &name, const wxString &local_dir, const CServerPath &remote_dir, bool sync)
{
if (local_dir.empty() && remote_dir.empty())
return false;
if ((local_dir.empty() || remote_dir.empty()) && sync)
return false;
CInterProcessMutex mutex(MUTEX_GLOBALBOOKMARKS);
CXmlFile file(wxGetApp().GetSettingsFile(_T("bookmarks")));
TiXmlElement* pDocument = file.Load();
if (!pDocument) {
wxString msg = file.GetError() + _T("\n\n") + _("The bookmark could not be added.");
wxMessageBoxEx(msg, _("Error loading xml file"), wxICON_ERROR);
return false;
}
TiXmlElement *pInsertBefore = 0;
TiXmlElement *pBookmark;
for (pBookmark = pDocument->FirstChildElement("Bookmark"); pBookmark; pBookmark = pBookmark->NextSiblingElement("Bookmark")) {
wxString remote_dir_raw;
wxString old_name = GetTextElement(pBookmark, "Name");
if (!name.CmpNoCase(old_name)) {
wxMessageBoxEx(_("Name of bookmark already exists."), _("New bookmark"), wxICON_EXCLAMATION);
return false;
}
if (name < old_name && !pInsertBefore)
pInsertBefore = pBookmark;
}
if (pInsertBefore)
pBookmark = pDocument->InsertBeforeChild(pInsertBefore, TiXmlElement("Bookmark"))->ToElement();
else
pBookmark = pDocument->LinkEndChild(new TiXmlElement("Bookmark"))->ToElement();
AddTextElement(pBookmark, "Name", name);
if (!local_dir.empty())
AddTextElement(pBookmark, "LocalDir", local_dir);
if (!remote_dir.empty())
AddTextElement(pBookmark, "RemoteDir", remote_dir.GetSafePath());
if (sync)
AddTextElementRaw(pBookmark, "SyncBrowsing", "1");
if (!file.Save(false)) {
wxString msg = wxString::Format(_("Could not write \"%s\", the bookmark could not be added: %s"), file.GetFileName(), file.GetError());
wxMessageBoxEx(msg, _("Error writing xml file"), wxICON_ERROR);
return false;
}
return true;
}
示例4: OnMenuMkdirChgDir
// Create a new Directory and enter the new Directory
void CRemoteTreeView::OnMenuMkdirChgDir(wxCommandEvent&)
{
CServerPath newpath = MenuMkdir();
if (!newpath.empty()) {
m_pState->ChangeRemoteDir(newpath);
}
}
示例5: StartRecursiveOperation
void CRemoteRecursiveOperation::StartRecursiveOperation(OperationMode mode, std::vector<CFilter> const& filters, CServerPath const& finalDir)
{
wxCHECK_RET(m_operationMode == recursive_none, _T("StartRecursiveOperation called with m_operationMode != recursive_none"));
wxCHECK_RET(m_state.IsRemoteConnected(), _T("StartRecursiveOperation while disconnected"));
wxCHECK_RET(!finalDir.empty(), _T("Empty final dir in recursive operation"));
if (mode == recursive_chmod && !m_pChmodDlg)
return;
if ((mode == recursive_transfer || mode == recursive_addtoqueue || mode == recursive_transfer_flatten || mode == recursive_addtoqueue_flatten) && !m_pQueue)
return;
if (recursion_roots_.empty()) {
// Nothing to do in this case
return;
}
m_processedFiles = 0;
m_processedDirectories = 0;
m_operationMode = mode;
m_state.NotifyHandlers(STATECHANGE_REMOTE_IDLE);
m_state.NotifyHandlers(STATECHANGE_REMOTE_RECURSION_STATUS);
m_filters = filters;
NextOperation();
}
示例6: CmpNoCase
int CServerPath::CmpNoCase(const CServerPath &op) const
{
if (empty() != op.empty())
return 1;
else if (m_data->m_prefix != op.m_data->m_prefix)
return 1;
else if (m_type != op.m_type)
return 1;
if (m_data->m_segments.size() > op.m_data->m_segments.size())
return 1;
else if (m_data->m_segments.size() < op.m_data->m_segments.size())
return -1;
tConstSegmentIter iter = m_data->m_segments.begin();
tConstSegmentIter iter2 = op.m_data->m_segments.begin();
while (iter != m_data->m_segments.end()) {
int res = fz::stricmp(*(iter++), *(iter2++));
if (res) {
return res;
}
}
return 0;
}
示例7: SetSyncBrowse
bool CState::SetSyncBrowse(bool enable, const CServerPath& assumed_remote_root /*=CServerPath()*/)
{
if (enable != m_sync_browse.local_root.empty())
return enable;
if (!enable)
{
wxASSERT(assumed_remote_root.empty());
m_sync_browse.local_root.clear();
m_sync_browse.remote_root.clear();
m_sync_browse.is_changing = false;
NotifyHandlers(STATECHANGE_SYNC_BROWSE);
return false;
}
if (!m_pDirectoryListing && assumed_remote_root.empty())
{
NotifyHandlers(STATECHANGE_SYNC_BROWSE);
return false;
}
m_sync_browse.is_changing = false;
m_sync_browse.local_root = m_localDir;
if (assumed_remote_root.empty())
m_sync_browse.remote_root = m_pDirectoryListing->path;
else
{
m_sync_browse.remote_root = assumed_remote_root;
m_sync_browse.is_changing = true;
m_sync_browse.compare = false;
}
while (m_sync_browse.local_root.HasParent() && m_sync_browse.remote_root.HasParent() &&
m_sync_browse.local_root.GetLastSegment() == m_sync_browse.remote_root.GetLastSegment())
{
m_sync_browse.local_root.MakeParent();
m_sync_browse.remote_root = m_sync_browse.remote_root.GetParent();
}
NotifyHandlers(STATECHANGE_SYNC_BROWSE);
return true;
}
示例8: if
bool CServerPath::operator<(const CServerPath &op) const
{
if (empty()) {
if (!op.empty()) {
return false;
}
}
else if (op.empty()) {
return true;
}
if (m_data->m_prefix || op.m_data->m_prefix) {
if (m_data->m_prefix < op.m_data->m_prefix) {
return true;
}
else if (op.m_data->m_prefix < m_data->m_prefix) {
return false;
}
}
if (m_type > op.m_type) {
return false;
}
else if (m_type < op.m_type) {
return true;
}
tConstSegmentIter iter1, iter2;
for (iter1 = m_data->m_segments.begin(), iter2 = op.m_data->m_segments.begin(); iter1 != m_data->m_segments.end(); ++iter1, ++iter2) {
if (iter2 == op.m_data->m_segments.end()) {
return false;
}
const int cmp = std::wcscmp(iter1->c_str(), iter2->c_str());
if (cmp < 0) {
return true;
}
if (cmp > 0) {
return false;
}
}
return iter2 != op.m_data->m_segments.end();
}
示例9: IsSubdirOf
bool CServerPath::IsSubdirOf(const CServerPath &path, bool cmpNoCase) const
{
if (empty() || path.empty()) {
return false;
}
if (m_type != path.m_type) {
return false;
}
if (!HasParent()) {
return false;
}
if (traits[m_type].prefixmode != 1) {
if (cmpNoCase ) {
if( m_data->m_prefix && !path.m_data->m_prefix ) {
return false;
}
else if( !m_data->m_prefix && path.m_data->m_prefix ) {
return false;
}
else if( m_data->m_prefix && path.m_data->m_prefix && fz::stricmp(*m_data->m_prefix, *path.m_data->m_prefix) ) {
return false;
}
}
if (!cmpNoCase && m_data->m_prefix != path.m_data->m_prefix)
return false;
}
// On MVS, dirs like 'FOO.BAR' without trailing dot cannot have
// subdirectories
if (traits[m_type].prefixmode == 1 && !path.m_data->m_prefix)
return false;
tConstSegmentIter iter1 = m_data->m_segments.begin();
tConstSegmentIter iter2 = path.m_data->m_segments.begin();
while (iter1 != m_data->m_segments.end()) {
if (iter2 == path.m_data->m_segments.end()) {
return true;
}
if (cmpNoCase) {
if (fz::stricmp(*iter1, *iter2)) {
return false;
}
}
else if (*iter1 != *iter2) {
return false;
}
++iter1;
++iter2;
}
return false;
}
示例10: if
bool CServerPath::operator==(const CServerPath &op) const
{
if (empty() != op.empty())
return false;
else if (m_type != op.m_type)
return false;
else if (m_data != op.m_data)
return false;
return true;
}
示例11: ListExpand
bool CRemoteTreeView::ListExpand(wxTreeItemId item)
{
const CServerPath path = GetPathFromItem(item);
wxASSERT(!path.empty());
if (path.empty())
return false;
CDirectoryListing listing;
if (m_pState->m_pEngine->CacheLookup(path, listing) == FZ_REPLY_OK)
RefreshItem(item, listing, false);
else
{
SetItemImages(item, true);
wxTreeItemId child = GetLastChild(item);
if (!child || GetItemText(child).empty())
return false;
}
return true;
}
示例12: Store
void CPathCache::Store(CServer const& server, CServerPath const& target, CServerPath const& source, wxString const& subdir)
{
scoped_lock lock(mutex_);
wxASSERT(!target.empty() && !source.empty());
tCacheIterator iter = m_cache.find(server);
if (iter == m_cache.cend())
#if HAVE_MAP_EMPLACE
iter = m_cache.emplace(std::make_pair(server, tServerCache())).first;
#else
iter = m_cache.insert(std::make_pair(server, tServerCache())).first;
#endif
tServerCache &serverCache = iter->second;
CSourcePath sourcePath;
sourcePath.source = source;
sourcePath.subdir = subdir;
serverCache[sourcePath] = target;
}
示例13: Run
int CNewBookmarkDialog::Run(const wxString &local_path, const CServerPath &remote_path)
{
if (!Load(m_parent, _T("ID_NEWBOOKMARK")))
return wxID_CANCEL;
XRCCTRL(*this, "ID_LOCALPATH", wxTextCtrl)->ChangeValue(local_path);
if (!remote_path.empty())
XRCCTRL(*this, "ID_REMOTEPATH", wxTextCtrl)->ChangeValue(remote_path.GetPath());
if (!m_server)
XRCCTRL(*this, "ID_TYPE_SITE", wxRadioButton)->Enable(false);
return ShowModal();
}
示例14: InvalidateCurrentWorkingDir
void CControlSocket::InvalidateCurrentWorkingDir(const CServerPath& path)
{
wxASSERT(!path.empty());
if (m_CurrentPath.empty())
return;
if (m_CurrentPath == path || path.IsParentOf(m_CurrentPath, false))
{
if (m_pCurOpData)
m_invalidateCurrentPath = true;
else
m_CurrentPath.clear();
}
}
示例15: OnSelectionChanged
void CRemoteTreeView::OnSelectionChanged(wxTreeEvent& event)
{
if (event.GetItem() != m_ExpandAfterList)
m_ExpandAfterList = wxTreeItemId();
if (m_busy)
return;
if (!m_pState->IsRemoteIdle())
{
wxBell();
return;
}
wxTreeItemId item = event.GetItem();
if (!item)
return;
const CServerPath path = GetPathFromItem(item);
wxASSERT(!path.empty());
if (path.empty())
return;
m_pState->ChangeRemoteDir(path);
}