本文整理汇总了C++中nglPath::GetVolumeLessPath方法的典型用法代码示例。如果您正苦于以下问题:C++ nglPath::GetVolumeLessPath方法的具体用法?C++ nglPath::GetVolumeLessPath怎么用?C++ nglPath::GetVolumeLessPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nglPath
的用法示例。
在下文中一共展示了nglPath::GetVolumeLessPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetChildren
bool nglZipFS::GetChildren(const nglPath& rPath, std::list<nglPath>& rChildren)
{
nglString p(rPath.GetVolumeLessPath());
p.TrimLeft(_T('/'));
//wprintf(_T("trimed path '%s'\n"), p.GetChars());
nglPath path(p);
Node* pNode = mRoot.Find(path);
if (!pNode)
return 0;
std::list<nglZipFS::Node*>::iterator it;
std::list<nglZipFS::Node*>::iterator end = pNode->mpChildren.end();
for (it = pNode->mpChildren.begin(); it != end; ++it)
{
if (*it)
{
nglZipPath path(this, rPath.GetPathName().IsEmpty()? (*it)->mName : rPath.GetPathName() );
if (!rPath.GetPathName().IsEmpty())
path += nglPath((*it)->mName);
rChildren.push_back(path);
}
}
return rChildren.size();
}
示例2: GetPathInfo
bool nuiNativeResourceVolume::GetPathInfo(const nglPath& rPath, nglPathInfo& rInfo)
{
nglString tmp = rPath.GetVolumeLessPath();
nglPath path(tmp);
tmp.TrimLeft(L'/');
nglPath trimmed(tmp);
if (!path.GetPathName().Compare(_T("/")))
{
// we act like this is a folder
rInfo.Exists = true; ///< Node existence. All other fields are invalid if set to false.
rInfo.IsLeaf = false; ///< Leaf (file or assimilable) or non-leaf (folder)
rInfo.CanRead = true; ///< True if the file (leaf) can be read or the folder (non-leaf) can be traversed and its content listed
rInfo.CanWrite = false; ///< True if the file (leaf) can be written to or a new node can be created in this folder (non-leaf)
rInfo.LastAccess = 0; ///< nglTime stamp of last access (read or exec)
rInfo.LastMod = 0; ///< nglTime stamp of last modification (write)
rInfo.Size = 0; ///< If the node is a leaf, size in bytes. If non-leaf, always zero.
rInfo.Visible = true; ///< Always visible...
return true;
}
std::map<nglPath, std::set<nglString> >::const_iterator it = mItems.find(trimmed);
if (it != mItems.end())
{
// This is a folder
rInfo.Exists = true; ///< Node existence. All other fields are invalid if set to false.
rInfo.IsLeaf = false; ///< Leaf (file or assimilable) or non-leaf (folder)
rInfo.CanRead = true; ///< True if the file (leaf) can be read or the folder (non-leaf) can be traversed and its content listed
rInfo.CanWrite = false; ///< True if the file (leaf) can be written to or a new node can be created in this folder (non-leaf)
rInfo.LastAccess = 0; ///< nglTime stamp of last access (read or exec)
rInfo.LastMod = 0; ///< nglTime stamp of last modification (write)
rInfo.Size = 0; ///< If the node is a leaf, size in bytes. If non-leaf, always zero.
rInfo.Visible = true; ///< Always visible...
return true;
}
nuiNativeResource* pRes = new nuiNativeResource(path);
if (pRes && pRes->IsValid())
{
// This is a file
rInfo.Exists = true; ///< Node existence. All other fields are invalid if set to false.
rInfo.IsLeaf = true; ///< Leaf (file or assimilable) or non-leaf (folder)
rInfo.CanRead = true; ///< True if the file (leaf) can be read or the folder (non-leaf) can be traversed and its content listed
rInfo.CanWrite = false; ///< True if the file (leaf) can be written to or a new node can be created in this folder (non-leaf)
rInfo.LastAccess = 0; ///< nglTime stamp of last access (read or exec)
rInfo.LastMod = 0; ///< nglTime stamp of last modification (write)
rInfo.Size = pRes->Available(); ///< If the node is a leaf, size in bytes. If non-leaf, always zero.
rInfo.Visible = true; ///< Always visible...
delete pRes;
return true;
}
delete pRes;
return false;
}
示例3: GetChildren
bool nuiNativeResourceVolume::GetChildren(const nglPath& rPath, std::list<nglPath>& rChildren)
{
nglString p(rPath.GetVolumeLessPath());
p.TrimLeft(_T('/'));
//wprintf(_T("trimed path '%ls'\n"), p.GetChars());
nglPath path(p);
//wprintf(_T("GetChildren(\"%ls\") [%ls] [%ls]\n"), rPath.GetChars(), path.GetChars(), p.GetChars());
std::map<nglPath, std::set<nglString> >::const_iterator fit = mItems.find(path);
if (fit == mItems.end())
{
// The path has to point to a folder, not a file
return false;
}
const std::set<nglString>& rChildrenSet(fit->second);
std::set<nglString>::const_iterator it = rChildrenSet.begin();
std::set<nglString>::const_iterator end = rChildrenSet.end();
while (it != end)
{
nglPath p(rPath);
p += *it;
rChildren.push_back(p);
++it;
}
return true;
}
示例4: GetPathInfo
bool nglZipFS::GetPathInfo(const nglPath& rPath, nglPathInfo& rInfo)
{
nglString p(rPath.GetVolumeLessPath());
p.TrimLeft(_T('/'));
//wprintf(_T("trimed path '%s'\n"), p.GetChars());
nglPath path(p);
Node* pChild = mRoot.Find(path);
rInfo.Exists = pChild != NULL;
rInfo.CanRead = rInfo.Exists;
rInfo.CanWrite = false;
rInfo.IsLeaf = (pChild != NULL) ? (pChild->mIsLeaf) : false;
rInfo.Size = (pChild != NULL) ? (pChild->mSize) : 0;
rInfo.Visible = true; ///< Always visible...
return pChild != NULL;
}