本文整理汇总了C++中CServerPath::IsSubdirOf方法的典型用法代码示例。如果您正苦于以下问题:C++ CServerPath::IsSubdirOf方法的具体用法?C++ CServerPath::IsSubdirOf怎么用?C++ CServerPath::IsSubdirOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CServerPath
的用法示例。
在下文中一共展示了CServerPath::IsSubdirOf方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BelowRecursionRoot
bool CRemoteRecursiveOperation::BelowRecursionRoot(const CServerPath& path, recursion_root::new_dir &dir)
{
if (!dir.start_dir.empty()) {
if (path.IsSubdirOf(dir.start_dir, false))
return true;
else
return false;
}
auto & root = recursion_roots_.front();
if (path.IsSubdirOf(root.m_remoteStartDir, false))
return true;
// In some cases (chmod from tree for example) it is neccessary to list the
// parent first
if (path == root.m_remoteStartDir && root.m_allowParent)
return true;
if (dir.link == 2) {
dir.start_dir = path;
return true;
}
return false;
}
示例2: BelowRecursionRoot
bool CRecursiveOperation::BelowRecursionRoot(const CServerPath& path, CNewDir &dir)
{
if (!dir.start_dir.empty())
{
if (path.IsSubdirOf(dir.start_dir, false))
return true;
else
return false;
}
if (path.IsSubdirOf(m_startDir, false))
return true;
// In some cases (chmod from tree for example) it is neccessary to list the
// parent first
if (path == m_startDir && m_allowParent)
return true;
if (dir.link == 2)
{
dir.start_dir = path;
return true;
}
return false;
}
示例3: IsParentOf
bool CServerPath::IsParentOf(const CServerPath &path, bool cmpNoCase) const
{
if (!this)
return false;
return path.IsSubdirOf(*this, cmpNoCase);
}
示例4: IsParentOf
BOOL CServerPath::IsParentOf(const CServerPath &path, BOOL bCompareNoCase /*=FALSE*/) const
{
if (!this)
return FALSE;
return path.IsSubdirOf(*this, bCompareNoCase);
}
示例5: GetCommonParent
CServerPath CServerPath::GetCommonParent(const CServerPath& path) const
{
if (*this == path) {
return *this;
}
if (empty() || path.empty()) {
return CServerPath();
}
if (m_type != path.m_type ||
(!traits[m_type].prefixmode && m_data->m_prefix != path.m_data->m_prefix))
{
return CServerPath();
}
if (!HasParent()) {
if (path.IsSubdirOf(*this, false)) {
return *this;
}
else {
return CServerPath();
}
}
else if (!path.HasParent()) {
if (IsSubdirOf(path, false)) {
return path;
}
else {
return CServerPath();
}
}
CServerPath parent;
parent.m_type = m_type;
CServerPathData& parentData = parent.m_data.get();
tConstSegmentIter last = m_data->m_segments.end();
tConstSegmentIter last2 = path.m_data->m_segments.end();
if (traits[m_type].prefixmode == 1) {
if (!m_data->m_prefix) {
--last;
}
if (!path.m_data->m_prefix) {
--last2;
}
parentData.m_prefix = GetParent().m_data->m_prefix;
}
else
parentData.m_prefix = m_data->m_prefix;
tConstSegmentIter iter = m_data->m_segments.begin();
tConstSegmentIter iter2 = path.m_data->m_segments.begin();
while (iter != last && iter2 != last2) {
if (*iter != *iter2) {
if (!traits[m_type].has_root && parentData.m_segments.empty()) {
return CServerPath();
}
else {
return parent;
}
}
parentData.m_segments.push_back(*iter);
++iter;
++iter2;
}
return parent;
}
示例6: OnEndLabelEdit
void CRemoteTreeView::OnEndLabelEdit(wxTreeEvent& event)
{
if (event.IsEditCancelled())
{
event.Veto();
return;
}
if (!m_pState->IsRemoteIdle())
{
event.Veto();
return;
}
CItemData* const pData = (CItemData*)GetItemData(event.GetItem());
if (pData)
{
event.Veto();
return;
}
CServerPath old_path = GetPathFromItem(event.GetItem());
CServerPath parent = old_path.GetParent();
const wxString& oldName = GetItemText(event.GetItem());
const wxString& newName = event.GetLabel();
if (oldName == newName)
{
event.Veto();
return;
}
m_pState->m_pCommandQueue->ProcessCommand(new CRenameCommand(parent, oldName, parent, newName));
m_pState->ChangeRemoteDir(parent);
CServerPath currentPath;
const wxTreeItemId selected = GetSelection();
if (selected)
currentPath = GetPathFromItem(selected);
if (currentPath.empty())
return;
if (currentPath == old_path || currentPath.IsSubdirOf(old_path, false))
{
// Previously selected path was below renamed one, list the new one
std::list<wxString> subdirs;
while (currentPath != old_path)
{
if (!currentPath.HasParent())
{
// Abort just in case
return;
}
subdirs.push_front(currentPath.GetLastSegment());
currentPath = currentPath.GetParent();
}
currentPath = parent;
currentPath.AddSegment(newName);
for (std::list<wxString>::const_iterator iter = subdirs.begin(); iter != subdirs.end(); ++iter)
currentPath.AddSegment(*iter);
m_pState->ChangeRemoteDir(currentPath);
}
else if (currentPath != parent)
m_pState->ChangeRemoteDir(currentPath);
}
示例7: GetCommonParent
CServerPath CServerPath::GetCommonParent(const CServerPath& path) const
{
if (*this == path)
return *this;
if (m_bEmpty || path.m_bEmpty)
return CServerPath();
if (m_type != path.m_type ||
(!traits[m_type].prefixmode && m_data->m_prefix != path.m_data->m_prefix))
{
return CServerPath();
}
if (!HasParent())
{
if (path.IsSubdirOf(*this, false))
return *this;
else
return CServerPath();
}
else if (!path.HasParent())
{
if (IsSubdirOf(path, false))
return path;
else
return CServerPath();
}
CServerPath parent;
parent.m_bEmpty = false;
parent.m_type = m_type;
CServerPathData& parentData = parent.m_data.Get();
std::list<wxString>::const_iterator last = m_data->m_segments.end();
std::list<wxString>::const_iterator last2 = path.m_data->m_segments.end();
if (traits[m_type].prefixmode == 1)
{
if (m_data->m_prefix.empty())
last--;
if (path.m_data->m_prefix.empty())
last2--;
parentData.m_prefix = GetParent().m_data->m_prefix;
}
else
parentData.m_prefix = m_data->m_prefix;
std::list<wxString>::const_iterator iter = m_data->m_segments.begin();
std::list<wxString>::const_iterator iter2 = path.m_data->m_segments.begin();
while (iter != last && iter2 != last2)
{
if (*iter != *iter2)
{
if (!traits[m_type].has_root && parentData.m_segments.empty())
return CServerPath();
else
return parent;
}
parentData.m_segments.push_back(*iter);
iter++;
iter2++;
}
return parent;
}