本文整理汇总了C++中nglPath::GetChars方法的典型用法代码示例。如果您正苦于以下问题:C++ nglPath::GetChars方法的具体用法?C++ nglPath::GetChars怎么用?C++ nglPath::GetChars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nglPath
的用法示例。
在下文中一共展示了nglPath::GetChars方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: InstallApplication
bool iOSDevice::InstallApplication(const nglPath& rPath)
{
AMDeviceConnect(mpDevice);
bool paired = AMDeviceIsPaired(mpDevice);
bool validated = AMDeviceValidatePairing(mpDevice) == 0;
bool sessionstarted = AMDeviceStartSession(mpDevice) == 0;
//if (paired && validated && sessionstarted)
{
CFStringRef path = CFStringCreateWithCString(NULL, rPath.GetChars(), kCFStringEncodingUTF8);
CFURLRef relative_url = CFURLCreateWithFileSystemPath(NULL, path, kCFURLPOSIXPathStyle, false);
CFURLRef url = CFURLCopyAbsoluteURL(relative_url);
CFRelease(relative_url);
service_conn_t afcFd;
bool servicestarted = (AMDeviceStartService(mpDevice, CFSTR("com.apple.afc"), &afcFd, NULL) == 0);
(AMDeviceStopSession(mpDevice) == 0);
(AMDeviceDisconnect(mpDevice) == 0);
(AMDeviceTransferApplication(afcFd, path, NULL, &iOSDevice::TransferCallback, (void*)this) == 0);
close(afcFd);
CFStringRef keys[] = { CFSTR("PackageType") };
CFStringRef values[] = { CFSTR("Developer") };
CFDictionaryRef options = CFDictionaryCreate(NULL, (const void **)&keys, (const void **)&values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
AMDeviceConnect(mpDevice);
(AMDeviceIsPaired(mpDevice));
(AMDeviceValidatePairing(mpDevice) == 0);
(AMDeviceStartSession(mpDevice) == 0);
service_conn_t installFd;
(AMDeviceStartService(mpDevice, CFSTR("com.apple.mobile.installation_proxy"), &installFd, NULL) == 0);
(AMDeviceStopSession(mpDevice) == 0);
(AMDeviceDisconnect(mpDevice) == 0);
mach_error_t result = AMDeviceInstallApplication(installFd, path, options, InstallCallback, (void*)this);
if (result != 0)
{
printf("AMDeviceInstallApplication failed: %d\n", result);
nglString str;
str.CFormat("AMDeviceInstallApplication failed: %d", result);
InstallationProgress(0, str);
return false;
}
close(installFd);
CFRelease(path);
CFRelease(options);
NGL_OUT("[100%%] Installed package %s\n", rPath.GetChars());
nglString str;
str.CFormat("Installed package %s", rPath.GetChars());
InstallationProgress(100, str);
return true;
}
return false;
}
示例5: 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();
}
示例6: SetTexturePath
void nuiFrame::SetTexturePath(const nglPath& rPath)
{
mTexturePath = rPath;
nuiTexture* pOld = mpTexture;
mpTexture = nuiTexture::GetTexture(rPath);
if (!mpTexture || !mpTexture->IsValid())
{
NGL_OUT(_T("nuiFrame::SetTexturePath warning : could not load graphic resource '%ls'\n"), rPath.GetChars());
return;
}
if (GetSourceClientRect() == nuiRect(0,0,0,0))
SetSourceClientRect(nuiRect(0, 0, mpTexture->GetWidth(), mpTexture->GetHeight()));
if (pOld)
pOld->Release();
if (mInterpolated)
{
mpTexture->SetMinFilter(GL_LINEAR);
mpTexture->SetMagFilter(GL_LINEAR);
}
else
{
mpTexture->SetMinFilter(GL_NEAREST);
mpTexture->SetMagFilter(GL_NEAREST);
}
Changed();
}