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


C++ Path::Capacity方法代码示例

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


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

示例1: 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;
		}
开发者ID:ArtVandelae,项目名称:nestopia,代码行数:29,代码来源:NstApplicationInstance.cpp

示例2: 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;
		}
开发者ID:ArtVandelae,项目名称:nestopia,代码行数:23,代码来源:NstApplicationInstance.cpp

示例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;
		}
开发者ID:ArtVandelae,项目名称:nestopia,代码行数:43,代码来源:NstDialogBrowse.cpp

示例4: 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;
		}
开发者ID:ArtVandelae,项目名称:nestopia,代码行数:36,代码来源:NstDialogBrowse.cpp


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