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


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

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


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

示例1: Flush

YGG_API void FrameStreamWriter::Flush(Path path)
{
	if (!path)
		throw Exception("FrameStreamWriter: path was empty");

	if (!path.IsFile())
		throw Exception(Concatenate("FrameStreamWriter: \"", path.Absolute(), "\" is not a valid file path"));

	std::ofstream outStream((ystr)path, std::ios::out | std::ios::binary);
	if (!outStream)
		throw Exception(Concatenate("FrameStreamWriter: \"", path.Absolute(), "\" could not be opened for writing."));

	//metadata
	if (metadata)
	{
		Write(outStream, (uint64_t)metadata.Size());
		outStream.write((const char*)metadata.Data(), metadata.Size());
	}
	else
		Write(outStream, 0ull);

	//total frame count
	Write(outStream, currentFrame);

	//duration
	Write(outStream, duration);

	//key frames
	Write(outStream, (uint64_t)keyFrames.size()); //key frame count
	(outStream).write((const char*)keyFrames.data(), keyFrames.size() * sizeof(uint64_t));

	//frame datasets
	Write(outStream, (uint64_t)frameData.size()); //frame data stream count
	for (auto& fd : frameData)
	{
		//key hash
		Write(outStream, fd.first);

		//element size
		Write(outStream, fd.second->ElementSize);

		//frames
		Write(outStream, (uint64_t)fd.second->Frames.size());
		for (size_t i = 0u; i < fd.second->Frames.size(); ++i)
		{
			//frame number
			Write(outStream, fd.second->Frames[i]);

			//data
			(outStream).write((const char*)fd.second->Data[i], fd.second->ElementSize);
		}
	}

	outStream.close();
}
开发者ID:marzer,项目名称:Yggdrasil,代码行数:55,代码来源:FrameStreams.cpp

示例2: FrameStreamReader

YGG_API FrameStreamReader::FrameStreamReader(Path path)
{
	if (!path)
		throw Exception("FrameStreamReader: path was empty");

	if (!path.IsExtantFile())
		throw Exception(Concatenate(YL("The path \""), path.Absolute(), "\" did not exist."));

	file.reset(new MappedFile(path));
	data = (uint8_t*)file->Data();
	Initialize();	
}
开发者ID:marzer,项目名称:Yggdrasil,代码行数:12,代码来源:FrameStreams.cpp


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