本文整理汇总了C++中Path::Ptr方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::Ptr方法的具体用法?C++ Path::Ptr怎么用?C++ Path::Ptr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path::Ptr方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SelectDirectory
const Path Browser::SelectDirectory()
{
Path path;
path.Reserve( MAX_PATH*2 );
Object::Pod<BROWSEINFO> bi;
bi.hwndOwner = Application::Instance::GetActiveWindow();
bi.pszDisplayName = path.Ptr();
bi.ulFlags = BIF_RETURNONLYFSDIRS;
if (LPITEMIDLIST const idl = ::SHBrowseForFolder( &bi ))
{
if (::SHGetPathFromIDList( idl, path.Ptr() ) && path.Validate())
path.MakePretty( true );
else
path.Clear();
IMalloc* pMalloc;
if (SUCCEEDED(::SHGetMalloc( &pMalloc )))
{
pMalloc->Free( idl );
pMalloc->Release();
}
}
else
{
path.Clear();
}
return path;
}
示例2: GetTmpPath
const Path Instance::GetTmpPath(GenericString file)
{
Path path;
path.Reserve( 255 );
if (uint length = ::GetTempPath( path.Capacity() + 1, path.Ptr() ))
{
if (length > path.Capacity() + 1)
{
path.Reserve( length - 1 );
length = ::GetTempPath( path.Capacity() + 1, path.Ptr() );
}
if (length)
path = GetLongPath( path.Ptr() );
}
if (path.Length())
path.MakePretty( true );
else
path << ".\\";
if (file.Empty())
file = L"nestopia.tmp";
path << file;
return path;
}
示例3: SaveFile
const Path Browser::SaveFile(wchar_t* const filter,Path initial)
{
Path path;
path.Reserve( MAX_PATH*2 );
const Path extension( initial.Extension() );
if (initial.File().Length() && initial.File()[0] != '.')
path = initial.File();
initial.File().Clear();
Object::Pod<OPENFILENAME> ofn;
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = Application::Instance::GetActiveWindow();
ofn.lpstrFile = path.Ptr();
ofn.nMaxFile = path.Capacity();
ofn.lpstrInitialDir = initial.Length() ? initial.Ptr() : L".";
ofn.Flags = OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY;
if (filter)
{
for (uint i=0; filter[i]; ++i)
{
if (filter[i] == '\t')
filter[i] = '\0';
}
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 1;
}
if (extension.Length())
ofn.lpstrDefExt = extension.Ptr();
if (::GetSaveFileName( &ofn ))
path.Validate();
else
path.Clear();
return path;
}
示例4: GetLongPath
const Path Instance::GetLongPath(wcstring const shortPath)
{
Path longPath;
longPath.Reserve( 255 );
uint length = ::GetLongPathName( shortPath, longPath.Ptr(), longPath.Capacity() + 1 );
if (length > longPath.Capacity() + 1)
{
longPath.Reserve( length - 1 );
length = ::GetLongPathName( shortPath, longPath.Ptr(), longPath.Capacity() + 1 );
}
if (!length)
return shortPath;
const wchar_t slashed = GenericString(shortPath).Back();
longPath.ShrinkTo( length );
longPath.MakePretty( slashed == '\\' || slashed == '/' );
return longPath;
}
示例5: OpenFile
const Path Browser::OpenFile(wchar_t* const filter,const Path dir,const Path ext)
{
for (uint i=0; filter[i]; ++i)
{
if (filter[i] == '\t')
filter[i] = '\0';
}
Path path;
path.Reserve( MAX_PATH*2 );
Object::Pod<OPENFILENAME> ofn;
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = Application::Instance::GetActiveWindow();
ofn.lpstrFile = path.Ptr();
ofn.nMaxFile = path.Capacity();
ofn.lpstrInitialDir = dir.Length() ? dir.Ptr() : L".";
ofn.Flags = OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY;
if (filter)
{
ofn.lpstrFilter = filter;
ofn.nFilterIndex = 1;
}
if (ext.Length())
ofn.lpstrDefExt = ext.Ptr();
if (::GetOpenFileName( &ofn ))
path.Validate();
else
path.Clear();
return path;
}
示例6: DrawPath
//=============================================================================
void CAppPathing::DrawPath (const Path & path, const Color & color)
{
Graphics::IRenderTarget * backbuffer = Graphics::GetContext()->Backbuffer();
const Point2 * prev = path.Ptr();
const Point2 * curr = prev + 1;
const Point2 * term = path.Term();
for ( ; curr < term; prev = curr, ++curr)
{
backbuffer->Arrow(
*prev,
*curr,
color,
2.0f
);
}
}
示例7: SaveFile
void Netplay::SaveFile() const
{
if (games.state == Games::DIRTY)
{
//const Path path( Application::Instance::GetExePath(L"netplaylist.xml") );
const Path path( Application::Instance::GetConfigPath(L"netplaylist.xml") );//bg
if (!games.paths.empty())
{
try
{
typedef Nes::Core::Xml Xml;
Xml xml;
Xml::Node root( xml.Create( L"netplaylist" ) );
root.AddAttribute( L"version", L"1.0" );
for (Games::Paths::const_iterator it(games.paths.begin()), end(games.paths.end()); it != end; ++it)
root.AddChild( L"file", it->Ptr() );
Io::Stream::Out stream( path );
xml.Write( root, stream );
Io::Log() << "Netplay: saved game list to \"netplaylist.xml\"\r\n";
}
catch (...)
{
Io::Log() << "Netplay: warning, couldn't save game list to \"netplaylist.xml\"!\r\n";
}
}
else if (path.FileExists())
{
if (Io::File::Delete( path.Ptr() ))
Io::Log() << "Netplay: game list empty, deleted \"netplaylist.xml\"\r\n";
else
Io::Log() << "Netplay: warning, couldn't delete \"netplaylist.xml\"!\r\n";
}
}
}