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


C++ VString::WriteToStream方法代码示例

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


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

示例1: _PutString

void VJSStream::_PutString(VJSParms_callStaticFunction& ioParms, VStream* inStream)
{
	VString s;
	if (ioParms.IsStringParam(1))
	{
		ioParms.GetStringParam(1, s);
		VError err = s.WriteToStream(inStream);
	}
	else
		vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_STRING, "1");
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:11,代码来源:VJSRuntime_stream.cpp

示例2: _WriteCatalog

//ACI0078887 23rd Nov 2012, O.R., always specify folder used for computing relative path of entry in TOC
VError VArchiveStream::_WriteCatalog( const VFile* inFile, const XBOX::VFilePath& inSourceFolder,const VString &inExtraInfo, uLONG8 &ioTotalByteCount )
{
	VString fileInfo;
	VStr8 slash("/");
	VStr8 extra("::");
	VStr8 folderSep(XBOX::FOLDER_SEPARATOR);
	VError result = VE_INVALID_PARAMETER;
	XBOX::VString savedExtraInfo = inExtraInfo;

	//ACI0078887 23rd Nov 2012, O.R., compute relative path using the specified source folder
	//don't assume that extra info carries relative folder info
		//ACI0078887 23rd Nov 2012, O.R., compute relative path using the specified source folder
	//don't assume that extra info carries relative folder info
	if (savedExtraInfo == PRESERVE_PARENT_OPTION)
	{
		//this is a bogus extra info that we use internally so we need to clear it so that it is not saved into
		//the archive.
		//This options means that the file will have to be restored in with its parent directory preserved.
		savedExtraInfo.Clear();

		VFolder *folder = inFile->RetainParentFolder();
		VString fileName;
		folder->GetName(fileInfo);
		// folder name can be a drive letter like Z:
		fileInfo.Exchange( (UniChar) ':', (UniChar) '_');
		inFile->GetName(fileName);
		fileInfo += slash;
		fileInfo += fileName;
		fileInfo.Insert( slash, 1 );
		folder->Release();
		result  = VE_OK;
	}
	else
	{
		if(testAssert(inFile->GetPath().GetRelativePath(inSourceFolder,fileInfo)))
		{
			result  = VE_OK;
			fileInfo.Insert( FOLDER_SEPARATOR, 1);
		}
	}

	if(result == VE_OK)
	{
		fileInfo.Exchange(folderSep ,slash, 1, 255);
		if ( fileInfo.GetUniChar(1) == '/' )
			fileInfo.Insert( '.', 1 );

		fileInfo += extra;
		fileInfo += savedExtraInfo;
		result = fStream->PutLong('file');
		if ( result == VE_OK )
		{
			result = fileInfo.WriteToStream(fStream);
		}
		if ( result == VE_OK )
		{
			sLONG8 fileSize = 0;
			inFile->GetSize(&fileSize);
			fStream->PutLong8(fileSize);
			ioTotalByteCount += fileSize;
	#if VERSIONWIN || VERSION_LINUX
			/* rez file size */
			fStream->PutLong8(0);
			/* no file kind or creator under Windows */
			fStream->PutLong(0); /* kind */
			fStream->PutLong(0); /* creator */
	#elif VERSIONMAC
			inFile->GetResourceForkSize(&fileSize);
			fStream->PutLong8(fileSize);
			ioTotalByteCount += fileSize;

			OsType osType;
			inFile->MAC_GetKind( &osType );
			result = fStream->PutLong( osType );
			inFile->MAC_GetCreator( &osType );
			result = fStream->PutLong( osType );
	#endif
		}
	}
	return result;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:82,代码来源:VArchiveStream.cpp


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