当前位置: 首页>>代码示例>>C++>>正文


C++ nglPath::GetVolumeLessPath方法代码示例

本文整理汇总了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();
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:25,代码来源:nglZipFS.cpp

示例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;
}
开发者ID:YetToCome,项目名称:nui3,代码行数:60,代码来源:nuiNativeResourceVolume.cpp

示例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;
}
开发者ID:YetToCome,项目名称:nui3,代码行数:30,代码来源:nuiNativeResourceVolume.cpp

示例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;
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:18,代码来源:nglZipFS.cpp


注:本文中的nglPath::GetVolumeLessPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。