• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ nglPath类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中nglPath的典型用法代码示例。如果您正苦于以下问题:C++ nglPath类的具体用法?C++ nglPath怎么用?C++ nglPath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了nglPath类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: LoadCSS

bool MainWindow::LoadCSS(const nglPath& rPath)
{
  NGL_OUT("MainWindow::LoadCSS");
  nglIStream* pF = rPath.OpenRead();
  if (!pF)
  {
    NGL_OUT(_T("Unable to open CSS source file '%ls'\n"), rPath.GetChars());
    return false;
  }
  
  nuiCSS* pCSS = new nuiCSS();
  bool res = pCSS->Load(*pF, rPath);
  delete pF;
  
  if (res)
  {
    nuiMainWindow::SetCSS(pCSS);
    NGL_OUT("MainWindow::LoadCSS OK");
    return true;
  }
  
  NGL_OUT(_T("%ls\n"), pCSS->GetErrorString().GetChars());
  
  delete pCSS;
  NGL_OUT("MainWindow::LoadCSS ERROR");
  return false;
}
开发者ID:changbiao,项目名称:nui3,代码行数:27,代码来源:MainWindow.cpp


示例2: GetFileInfo

nglString nuiFileTree::GetFileInfo(const nglPath& rPath)
{
  nglString str;
  nglPathInfo info;
  rPath.GetInfo(info);


  // file modification date
  nglTimeInfo timeInfo;
  nglString timestr;
  nglTime lastMod = info.LastMod;
  lastMod.GetLocalTime(timeInfo);
  timestr.Format(_T("%d/%d/%d, %d:%d"), timeInfo.Year+1900, timeInfo.Month, timeInfo.Day, timeInfo.Hours, timeInfo.Minutes);

  str.Append(timestr);
  
  if (rPath.IsLeaf())
  {
    // file size
    str.Append(_T(" - "));
    FormatFileSize(info.Size, str);
  }

  return str;
}
开发者ID:,项目名称:,代码行数:25,代码来源:


示例3: nglInputDeviceInstance

nglInputDeviceLinux::nglInputDeviceLinux (const nglPath& rDevice) : nglInputDeviceInstance(), nglEvent()
{
  mFlags = Read|Error;
  mFD = open((char*)rDevice.GetPathName().GetChars(), O_RDONLY);
  if (mFD == -1)
    return;

  char byte;
  char name[128];

  // Get number of axes
  ioctl(mFD, JSIOCGAXES, &byte);
  mAxes.resize(byte);

  // Get number of buttons
  ioctl(mFD, JSIOCGBUTTONS, &byte);
  mButtons.resize(byte);

  // Fetch name
  if (ioctl(mFD, JSIOCGNAME(sizeof(name)), name) < 0)
    mName = "unkown";
  else
    mName = name;

  // Synthetize port name
  mPort.Format("%s", rDevice.GetPathName().GetChars());

  App->AddEvent(this);
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:29,代码来源:nglInputDevice_Linux.cpp


示例4: Init

nuiSpriteDef::nuiSpriteDef(const nglPath& rSpriteDefPath)
{
  Init();
  nglString name(rSpriteDefPath.GetNodeName());
  SetObjectName(name);
  std::map<nglString, nuiSpriteDef*>::const_iterator it = mSpriteMap.find(name);
  if (it != mSpriteMap.end())
    it->second->Release();

  mSpriteMap[name] = this;

  {
    std::list<nglPath> children;
    rSpriteDefPath.GetChildren(&children);
    std::list<nglPath>::const_iterator it = children.begin();
    std::list<nglPath>::const_iterator end = children.end();
    for (; it != end; it++)
    {
      nuiSpriteAnimation* pAnim = new nuiSpriteAnimation(*it);
      if (pAnim->GetFrameCount())
        AddAnimation(pAnim);
      else
        delete pAnim;
    }
  }
}
开发者ID:jbl2024,项目名称:nui3,代码行数:26,代码来源:nuiSpriteView.cpp


示例5: p

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


示例6: isRoot

bool nuiFileTree::isRoot(const nglPath& rPath)
{
  const nglString& pathName = rPath.GetPathName();
  
  return (
    rPath.GetParent().GetPathName().IsEmpty() || 
    !rPath.GetPathName().Compare(_T("/")) || 
    !rPath.GetParent().GetPathName().Compare(_T("/Volumes")) ||
    ((pathName.GetLength() == 3) && (pathName[1] == _T(':')) && (pathName[2] == _T('/')))
    );
}
开发者ID:,项目名称:,代码行数:11,代码来源:


示例7: AddFile

void nuiMimeMultiPart::AddFile(const nglPath& rPath, const nglString& rVarName, const nglString& rFileName, ContentTransfertEncoding encoding)
{
  nglString name(rFileName);
  if (name.IsNull())
    name = rPath.GetNodeName();
    
  nglIStream* pFile = rPath.OpenRead();
  if (!pFile)
    return;

  AddFile(pFile, rVarName, name, encoding);
}
开发者ID:,项目名称:,代码行数:12,代码来源:


示例8: nuiObject

nuiTexture::nuiTexture (const nglPath& rPath, nglImageCodec* pCodec)
: nuiObject(), mTextureID(0), mTarget(0), mRotated(false)
{
  if (SetObjectClass(_T("nuiTexture")))
    InitAttributes();

  mpImage = NULL;
  mpProxyTexture = NULL;
  
  float scale = 1.0f;
  nglPath p(rPath);
  nglString path(p.GetRemovedExtension());
  if (nuiGetScaleFactor() > 1)
  {
    nglString ext(p.GetExtension());
    nglString res(path);
    res.Add(_T("@2x.")).Add(ext);
    p = res;
    mpImage = new nglImage(p, pCodec);
    if (mpImage && mpImage->IsValid())
    {
      scale = 2.0f;
    }
    else
    {
      delete mpImage;
      mpImage = NULL;
    }
  }
  else if (path.GetRight(3) == _T("@2x"))
  {
    scale = 2.0;
  }

  
  if (!mpImage)
  {
    mpImage = new nglImage(rPath, pCodec);
  }

  mpSurface = NULL;
  mOwnImage = true;
  mForceReload = false;
  mRetainBuffer = mRetainBuffers;

  SetProperty(_T("Source"),rPath.GetPathName());
  mpTextures[rPath.GetPathName()] = this;

  Init();
  SetScale(scale);
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:51,代码来源:nuiTexture.cpp


示例9: parent

bool nglZipPath::Decompose(const nglPath& rPath, std::list<nglPath>& rList)
{
  nglPath parent(rPath.GetParent());
  nglString tmp = rPath.GetNodeName();
  nglPath node(tmp.IsNull()? nglString::Empty : tmp);

  if (parent == rPath)
    return true;

  rList.push_front(node);
  return Decompose(parent, rList);

  return true;
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:14,代码来源:nglZipFS.cpp


示例10: nglVolume

nglZipFS::nglZipFS(const nglPath& rPath)
: nglVolume(nglPath(rPath.GetNodeName()).GetRemovedExtension(), nglString::Empty, nglString::Empty, nglPathVolume::ReadOnly, nglPathVolume::eTypeZip),
  mRoot(_T(""), 0, 0, 0, false), mpFileFuncDef(NULL)
{
  mpStream = rPath.OpenRead();
  mOwnStream = true;
  SetValid(mpStream != NULL);

	if (mpStream)
		mpStream->SetEndian(eEndianIntel);
	
  mpPrivate = new nglZipPrivate();
  NGL_ASSERT(mpPrivate);
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:14,代码来源:nglZipFS.cpp


示例11: path

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


示例12: p

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


示例13: SaveLanguage

bool nuiTranslator::SaveLanguage(const nglPath& rOutputLanguageFile) const
{
  nglOStream* pStream = rOutputLanguageFile.OpenWrite(true);
  bool res = SaveLanguage(pStream);
  delete pStream;
  return res;
}
开发者ID:YetToCome,项目名称:nui3,代码行数:7,代码来源:nuiTranslator.cpp


示例14: while

bool nuiTranslator::LoadLanguages(const nglPath& rLanguageFilesFolder)
{
  mFiles.clear();
  
  std::list<nglPath> Children;
  rLanguageFilesFolder.GetChildren(&Children);
  
  std::list<nglPath>::iterator it = Children.begin();
  std::list<nglPath>::iterator end = Children.end();
  
  while (it != end)
  {
    const nglPath& rPath(*it);
    NGL_OUT(_T("Localization file: %ls\n"), rPath.GetChars());
    if (rPath.GetExtension() == _T("loc"))
    {
      nglPath p(rPath.GetNodeName());
      nglString n(p.GetRemovedExtension());
      mFiles[n] = rPath;
    }
    
    ++it;
  }
  
  return mFiles.empty();
}
开发者ID:YetToCome,项目名称:nui3,代码行数:26,代码来源:nuiTranslator.cpp


示例15: nuiList

nuiFileList::nuiFileList(const nglPath& rPath)
    : nuiList(nuiVertical),
      mFileListSink(this)
{
    SetObjectClass(_T("nuiFileList"));
    nuiLabel* pLabel = new nuiLabel(_T(".."));
    pLabel->SetProperty(_T("Path"), rPath.GetParent().GetAbsolutePath().GetPathName());

    Populate(rPath);
    mFileListSink.Connect(Activated, &nuiFileList::Selected, this);
}
开发者ID:,项目名称:,代码行数:11,代码来源:


示例16: DumpIncluder

void Generator::DumpIncluder(const nglPath& rootSource, const nglPath& pngSource,const nglPath& codeSource, const nglPath& HincluderPath, const nglPath& CPPincluderPath, nglString& HincluderStr, nglString& CPPincluderStr)
{
  std::list<nglPath> children;
  std::list<nglPath>::iterator it;
  
  pngSource.GetChildren(&children);
  
  for (it = children.begin(); it != children.end(); ++it)
  {
    nglPath child = *it;
    
    if (!child.IsLeaf())
    {
      // recurs.
      DumpIncluder(rootSource, child, codeSource, HincluderPath, CPPincluderPath, HincluderStr, CPPincluderStr);
      continue;
    }
    
    if (child.GetExtension().Compare(_T("png"), false))
      continue;
    
    nglString node = child.GetPathName();
    node.DeleteLeft(rootSource.GetPathName().GetLength()+1);
    node.DeleteRight(nglPath(node).GetExtension().GetLength() +1);
    
    nglPath HdestPath = codeSource + nglPath(node);
    nglPath CPPdestPath = codeSource + nglPath(node);
    HdestPath = nglPath(HdestPath.GetPathName() + _T(".h"));
    CPPdestPath = nglPath(CPPdestPath.GetPathName() + _T(".cpp"));
    
    HdestPath.MakeRelativeTo(HincluderPath.GetParent());
    CPPdestPath.MakeRelativeTo(CPPincluderPath.GetParent());
    
    nglString tmp;
    tmp.Format(_T("#include \"%ls\"\n"), HdestPath.GetChars());
    HincluderStr.Append(tmp);
    tmp.Format(_T("#include \"%ls\"\n"), CPPdestPath.GetChars());
    CPPincluderStr.Append(tmp);
  }
  
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:41,代码来源:Generator.cpp


示例17: ParsePngFiles

void Generator::ParsePngFiles(const nglPath& rootSource, const nglPath& pngSource, const nglPath& codeSource)
{
  std::list<nglPath> children;
  pngSource.GetChildren(&children);
  
  std::list<nglPath>::iterator it;
  for (it = children.begin(); it != children.end(); ++it)
  {
    const nglPath& child = *it;
    
    if (!child.IsLeaf())
    {
      // recurs.
      ParsePngFiles(rootSource, child, codeSource);
      continue;
    }
    
    if (child.GetExtension().Compare(_T("png"), false))
      continue;
    
    nglString node = child.GetPathName();
    node.DeleteLeft(rootSource.GetPathName().GetLength()+1);
    node.DeleteRight(nglPath(node).GetExtension().GetLength() +1);
    
    nglPath destPath = codeSource + nglPath(node);
    
    NGL_OUT(_T("path '%ls', node '%ls' => destPath '%ls'\n"), child.GetChars(), node.GetChars(), destPath.GetChars());
    
    nglPath destDir = destPath.GetParent();
    if (!destDir.Exists())
      destDir.Create(true);
    
    // and call the generator tool to create .cpp and .h files
    nglString cmd;
    nglString space(_T(" "));
    cmd.Append(mTool).Append(_T(" ")).Append(child.GetChars()).Append(_T(" ")).Append(destPath.GetChars());
    NGL_OUT(_T("command : %ls\n"), cmd.GetChars());
    system(cmd.GetStdString().c_str());
  }
  
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:41,代码来源:Generator.cpp


示例18: nuiWidget

nuiSVGView::nuiSVGView(const nglPath& rSource)
  : nuiWidget(),
    mCache(nuiRect())
{
  nuiSVGView::Init();
  nglIStream* pFile = rSource.OpenRead();
  if (pFile)
  {
    Load(*pFile);
    delete pFile;
  }
}
开发者ID:jbl2024,项目名称:nui3,代码行数:12,代码来源:nuiSVGView.cpp


示例19: LoadLanguage

bool nuiTranslator::LoadLanguage(const nglPath& rLanguageFile)
{
  nglIStream* pStream = rLanguageFile.OpenRead();
  if (!pStream)
    return false;
  
  bool res = LoadLanguage(pStream);
  
  delete pStream;
  
  return res;
}
开发者ID:YetToCome,项目名称:nui3,代码行数:12,代码来源:nuiTranslator.cpp


示例20: PopulateDirs

bool nuiList::PopulateDirs(const nglPath& rPath)
{
  list<nglPath> FileList;

  rPath.GetChildren(&FileList);

  list<nglPath>::iterator it;
  list<nglPath>::iterator end = FileList.end();

  for (it = FileList.begin(); it != end; ++it)
  {
    if (!(*it).IsLeaf())
    {
      nuiLabel* pLabel = new nuiLabel(_T("[ ")+(*it).GetNodeName()+_T(" ]"));
      pLabel->SetProperty(_T("Path"),(*it).GetAbsolutePath().GetPathName());
      AddChild(pLabel);
    }
  }

  SetProperty(_T("Path"),rPath.GetAbsolutePath().GetPathName());
  return true;
}
开发者ID:jpastuszek,项目名称:nui3,代码行数:22,代码来源:nuiList.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ nglString类代码示例发布时间:2022-05-31
下一篇:
C++ network类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap