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


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

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


在下文中一共展示了nglPath::GetPathName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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,代码来源:

示例4: p

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

示例5: Load

bool nuiSWF::Load(const nglPath& rPath)
{
  std::string str(rPath.GetPathName().GetStdString());
  const char* pFlashMovieName = str.c_str();
  int  movie_version = 0;

  StopAutoDraw();

//  gameswf::get_movie_info(pFlashMovieName, &movie_version, &mWidth, &mHeight, &mFPS, &mFrames, &mTags);
//  if (movie_version == 0)
//  {
//    NGL_OUT(_T("error: can't get info about %s\n"), pFlashMovieName);
//    return false;
//  }
//  
//  if (mFPS <= 0.5f)
//  {
//    NGL_OUT(_T("Forcing %f FPS instead of 0\n"), mFPS);
//    mFPS = 12.0f;
//  }
//
//  NGL_OUT(_T("Flash file loaded successfully\nName %s\nVersion %i\nWidth %i\nHeight %i\nFPS %f\n"), pFlashMovieName, movie_version, mWidth, mHeight, mFPS);

  //computeMouseScale(mBounds.extent);

  // Load the actual movie.
  mpMovie = mpPlayer->create_movie(pFlashMovieName);
  if (mpMovie == NULL)
  {
    NGL_OUT(_T("error: can't create a movie from '%s'\n"), pFlashMovieName);
    return false;
  }

  movie_version = mpMovie->get_version();
  mWidth = mpMovie->get_width_pixels();
  mHeight = mpMovie->get_height_pixels();
  mFPS = mpMovie->get_frame_rate();
  mFrames = mpMovie->get_frame_count();
  NGL_OUT(_T("Flash file loaded successfully\nName %s\nVersion %i\nWidth %i\nHeight %i\nFPS %f\n"), pFlashMovieName, movie_version, mWidth, mHeight, mFPS);
  
  mpMovieInterface = mpMovie->create_instance();
  if (mpMovieInterface == NULL)
  {
    NGL_OUT(_T("error: can't create movie instance\n"));
    return false;
  }
  mpMovieInterface->add_ref();
    
  InvalidateLayout();
  return true;
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:51,代码来源:nuiSWF.cpp

示例6: nuiDecoration

nuiFrame::nuiFrame(const nglString& rName, const nglPath& rTexturePath, const nuiRect& rClientRect, const nuiColor& rColor)
: nuiDecoration(rName),
  mpTexture(NULL),
  mColor(rColor),
  mUseWidgetFrameColor(false),
  mClientRect(rClientRect)
{
  if (SetObjectClass(_T("nuiFrame")))
    InitAttributes();
	
  SetTexturePath(rTexturePath.GetPathName());
  mDebug = false;
  mInterpolated = true;
}
开发者ID:jpastuszek,项目名称:nui3,代码行数:14,代码来源:nuiFrame.cpp

示例7: nuiDecoration

nuiImageDecoration::nuiImageDecoration(const nglString& rName, const nglPath& rTexturePath, const nuiRect& rClientRect, nuiPosition position, const nuiColor& rColor)
: nuiDecoration(rName),
  mpTexture(NULL),
  mPosition(position),
  mClientRect(rClientRect),
  mColor(rColor),
  mRepeatX(false),
  mRepeatY(false)
{
  if (SetObjectClass(_T("nuiImageDecoration")))
    InitAttributes();
	
  mpTexture = nuiTexture::GetTexture(rTexturePath);
  if (mpTexture)
    SetProperty(_T("Texture"), rTexturePath.GetPathName());
}
开发者ID:jpastuszek,项目名称:nui3,代码行数:16,代码来源:nuiImageDecoration.cpp

示例8: GetStringID

nglString nuiSound::GetStringID(const nglPath& rPath, nuiSound::Type type)
{
  nglString str = rPath.GetPathName();
  switch (type) 
  {
    case nuiSound::eStream:
      str += STREAM_SUFFIX;
      break;
      
    case nuiSound::eMemory:
      str += MEMORY_SUFFIX;
      break;
      
    default:
      NGL_ASSERT(0);
      break;
  }
  return str;
}
开发者ID:YetToCome,项目名称:nui3,代码行数:19,代码来源:nuiSound.cpp

示例9: 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

示例10: 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

示例11: SetTexturePath

void nuiImageDecoration::SetTexturePath(nglPath path)
{
  SetProperty(_T("Texture"), path.GetPathName());
  nuiTexture* pOld = mpTexture;
  mpTexture = nuiTexture::GetTexture(path);
  if (!mpTexture || !mpTexture->IsValid())
  {
    NGL_OUT(_T("nuiImageDecoration::SetTexturePath warning : could not load graphic resource '%ls'\n"), path.GetChars());
    return;
  }
  
  if (GetSourceClientRect() == nuiRect(0,0,0,0))
    SetSourceClientRect(nuiRect(0, 0, mpTexture->GetWidth(), mpTexture->GetHeight()));
  if (pOld)
    pOld->Release();
  
  SetRepeatX(mRepeatX);
  SetRepeatY(mRepeatY);
  
  Changed();
}
开发者ID:jpastuszek,项目名称:nui3,代码行数:21,代码来源:nuiImageDecoration.cpp

示例12: SetPath

void PreferencesBase::SetPath(const nglString& rKey, const nglString& rName, const nglPath& value, PreferencesTarget target)
{
  nuiXMLNode* pNode = OpenKey(rKey, target);
  pNode->SetAttribute(rName, value.GetPathName());
}
开发者ID:YetToCome,项目名称:nui3,代码行数:5,代码来源:PreferencesBase.cpp

示例13: StaticInit

nglImage::nglImage (const nglPath& rPath, nglImageCodec* pCodec )
{
  StaticInit();
  mpCodec = pCodec;
  mOwnCodec = (pCodec == NULL);

  nglIStream* pIFile = rPath.OpenRead();
  if (!pIFile)
  {
    return;
  }
  
  if (pIFile->GetState() != eStreamReady)
  {
    delete pIFile;
    return;
  }

  if (!mpCodec)
  {
    uint32 count;
    count = mpCodecInfos->size();
    for (uint32 i=0; i<count && !mpCodec; i++)
    {
      if ((*mpCodecInfos)[i])
      {
        mpCodec = (*mpCodecInfos)[i]->CreateInstance(); // try to create a codec
        if (mpCodec) // success?
        {
          if (!mpCodec->Probe(pIFile)) // try to make the codec recognize the data.
          { // :-(
            delete mpCodec;
            mpCodec = NULL;
          }
        }
      }
    }
  }

  if (!mpCodec) // If not codec was able to detect the image format we try to match the file with its extension.
  {
    uint32 count = mpCodecInfos->size();
    nglString filename = rPath.GetPathName();
    for (uint32 i=0; i<count && !mpCodec; i++)
    {
      if ((*mpCodecInfos)[i])
      {
        if (!((*mpCodecInfos)[i]->ExtensionMatch (filename))) // success?
        {
          // :-(
          delete mpCodec;
          mpCodec = NULL;
        }
      }
    }
  }

  if (mpCodec)
  {
    mpCodec->Init(this);
    mpCodec->Feed(pIFile);
    if (mOwnCodec)
    {
      delete mpCodec;
      mpCodec = NULL;
      mOwnCodec = false;
    }
  }
  
  delete pIFile;

  if (IsValid() && !mInfo.mPreMultAlpha)
    PreMultiply();
}
开发者ID:hamedmohammadi,项目名称:nui3,代码行数:74,代码来源:nglImage.cpp

示例14: AddFile

bool nuiZipWriter::AddFile(const nglPath& rPath, const nglString& rPathInZip, const nglString& rComment)
{
  return AddFile(rPath.OpenRead(), rPathInZip.IsEmpty() ? rPath.GetPathName() : rPathInZip, rComment, true);
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:4,代码来源:nglZipFS.cpp

示例15: CreateAtlasFromPath

bool nuiTexture::CreateAtlasFromPath(const nglPath& rPath, int32 MaxTextureSize, int32 ForceAtlasSize, bool AutoTrim)
{
  //NGL_OUT(_T("nuiTexture::CreateAtlasFromPath(rPath = '%s', MaxTextureSize = %d, ForceAtlasSize = %d, AutoTrim = '%s')\n"), rPath.GetChars(), MaxTextureSize, ForceAtlasSize, YESNO(AutoTrim));
  MaxTextureSize *= nuiGetScaleFactor();
  ForceAtlasSize *= nuiGetScaleFactor();
  int32 offset = 0;
  if (ForceAtlasSize)
    offset = 1;

  //App->GetLog().SetLevel(_T("StopWatch"), 100);
  nuiStopWatch watch(_T("Create atlas"));
  std::vector<AtlasElem> images;
  
  GetAllImages(images, rPath, MaxTextureSize, ForceAtlasSize, AutoTrim);
  watch.AddIntermediate(_T("Got all images"));
  
  TEXTURE_PACKER::TexturePacker* packer = TEXTURE_PACKER::createTexturePacker();
  packer->setTextureCount(images.size() + offset);

  if (ForceAtlasSize)
    packer->addTexture(ForceAtlasSize - 2, 0); // -2 to account for the border padding
  
  for (uint32 i = 0; i < images.size(); i++)
  {
    const AtlasElem& rElem(images[i]);
    packer->addTexture(rElem.mpImage->GetWidth(), rElem.mpImage->GetHeight());
  }
  
  int32 width = 0, height = 0;
  int unused_area = packer->packTextures(width, height, true, true);
  watch.AddIntermediate(_T("Packed textures"));

  // Create image buffer:
  nglImageInfo info(width, height, 32);
  info.AllocateBuffer();
  // Clear buffer:
  memset(info.mpBuffer, 0, 4 * width * height);
  nuiTexture* pAtlas = nuiTexture::GetTexture(info);
  pAtlas->SetSource(rPath.GetPathName());
  
  // Finally, to retrieve the results, for each texture 0-(n-1) call 'getTextureLocation'.
  for (uint32 i = 0; i < images.size(); i++)
  {
    AtlasElem& rElem(images[i]);
    int x, y, w, h;
    bool rotated = packer->getTextureLocation(i + offset, x, y, w, h);
    if (rotated)
    {
      nglImage* pImg = rElem.mpImage->RotateRight();
      delete rElem.mpImage;
      rElem.mpImage = pImg;
    }

    NGL_OUT(_T("{%d, %d, %d, %d} %s %s\n"), x, y, w, h, TRUEFALSE(rotated), rElem.mPath.GetChars());
    
    nglCopyImage(pAtlas->GetImage()->GetBuffer(), x, y, width, height, info.mBitDepth, rElem.mpImage->GetBuffer(), rElem.mpImage->GetWidth(), rElem.mpImage->GetHeight(), rElem.mpImage->GetBitDepth(), false, false);
    nuiTexture* pTex = nuiTexture::CreateTextureProxy(rElem.mPath.GetPathName(), rPath.GetPathName(), nuiRect(x, y, w, h), rotated);
    delete rElem.mpImage;
  }

  TEXTURE_PACKER::releaseTexturePacker(packer);

  watch.AddIntermediate(_T("Done"));
  return true;
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:65,代码来源:nuiTexture.cpp


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