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


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

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


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

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

示例2: CopyDirectory

bool ProjectGenerator::CopyDirectory(const nglPath& targetPath, const nglPath& srcpath)
{
  // create folder
  if (!targetPath.Create())
  {
    nglString msg;
    msg.Format(_T("creating target folder '%ls'"), targetPath.GetChars());
    return MsgError(msg);
  }
  
  
  std::list<nglPath> children;
  srcpath.GetChildren(&children);
  std::list<nglPath>::iterator it;
  for (it = children.begin(); it != children.end(); ++it)
  {
    const nglPath& srcpath = *it;
    
    if (!srcpath.IsLeaf())
      continue;
    
    nglPath dstpath = targetPath;
    dstpath += srcpath.GetNodeName();
    
    nglString contents;
    
    nglIStream* piFile = srcpath.OpenRead();
    if (!piFile)
    {
      nglString msg;
      msg.Format(_T("opening for reading input file '%ls'"), srcpath.GetChars());
      return MsgError(msg);
    }
    
    nglOStream* poFile = dstpath.OpenWrite(false);
    if (!poFile)
    {
      nglString msg;
      msg.Format(_T("opening for writing output file '%ls'"), dstpath.GetChars());
      return MsgError(msg);
    }
    
    piFile->PipeTo(*poFile);
    delete poFile;
    delete piFile;
    
    NGL_OUT(_T("nui project generator : created file '%ls'\n"), dstpath.GetChars());
  }
  
  return true;
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:51,代码来源:ProjectGenerator.cpp

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

示例4: Load

bool nuiHugeImage::Load(const nglPath& rImagePath)
{
  ClearImage();
  
  // Load the big image:
  nglIStream* pStream = rImagePath.OpenRead();
  nglImage* pImage = new nglImage(pStream);
  delete pStream;
  if (!pImage)
    return false;
  
  int32 w = pImage->GetWidth();
  int32 h = pImage->GetHeight();

  mTextures.resize((w / TEXTURE_SIZE) + 1);

  mImageSize.Set(w, h);
  
  int32 i = 0;
  for (int32 x = 0; x < w; x += TEXTURE_SIZE, i++)
  {
    int32 j = 0;
    mTextures[i].resize((h / TEXTURE_SIZE) + 1);
    for (int32 y = 0; y < h; y += TEXTURE_SIZE, j++)
    {
      int32 sx = MIN(TEXTURE_SIZE, w - x);
      int32 sy = MIN(TEXTURE_SIZE, h - y);
      nglImage* pCrop = pImage->Crop(x, y, sx, sy);
      //NGL_OUT(_T("Crop[%d][%d] 0x%x\n"), i, j, pCrop);
      mTextures[i][j] = nuiTexture::GetTexture(pCrop, true);
//       mTextures[i][j]->EnableAutoMipMap(true);
//       mTextures[i][j]->SetMagFilter(GL_LINEAR);
//       mTextures[i][j]->SetMinFilter(GL_LINEAR_MIPMAP_LINEAR);
    }
  }
  
  delete pImage;
  
  mZoom = 1.0f;
  mX = w / 2;
  mY = h / 2;
  
  InvalidateLayout();
  return true;
}
开发者ID:hamedmohammadi,项目名称:nui3,代码行数:45,代码来源:nuiHugeImage.cpp

示例5: GenerateFile

bool ProjectGenerator::GenerateFile(const nglPath& src, const nglPath& dst)
{
  uint32 srcsize = (uint32)src.GetSize();
  
  nglIStream* pFile = src.OpenRead();
  if (!pFile)
  {
    nglString msg;
    msg.Format(_T("reading input file '%ls'"), src.GetChars());
    return MsgError(msg);
  }

  char* str = new char[srcsize + 1];
  pFile->Read(str, srcsize, 1);
  str[srcsize] = 0;
  delete pFile;
  
  nglString contents(str);
  contents.Replace(_T("TemplateApp"), mProjectName);
  contents.Replace(_T("../../../nui3"), mNuiRelativeSource.GetPathName());

  
  nglOStream* poFile = dst.OpenWrite(false);
  if (!poFile)
  {
    nglString msg;
    msg.Format(_T("writing output file '%ls'"), dst.GetChars());
    return MsgError(msg);
  }

  char* ptr = contents.Export();
  
  poFile->Write(ptr, contents.GetLength(), 1);
  delete poFile;
  if (ptr)
    free(ptr);

  NGL_OUT(_T("nui project generator : generated '%ls'\n"), dst.GetChars());
  return true;
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:40,代码来源:ProjectGenerator.cpp

示例6: LoadCSS

bool MainWindow::LoadCSS(const nglPath& rPath)
{
  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);
  
  if (res)
  {
    SetCSS(pCSS);
    return true;
  }
  
  NGL_OUT(_T("%ls\n"), pCSS->GetErrorString().GetChars());
  
  delete pCSS;
  return false;
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:23,代码来源:MainWindow.cpp

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

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


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