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


C++ VJSParms_callStaticFunction::RetainFileParam方法代码示例

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


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

示例1: do_BinaryStream

void VJSStream::do_BinaryStream(VJSParms_callStaticFunction& ioParms)
{
	VFile* file = ioParms.RetainFileParam( 1);
	bool forwrite = ioParms.GetBoolParam( 2, L"Write", L"Read");
	if (file != NULL)
	{
		VError err = VE_OK;
		if (forwrite)
		{
			if (!file->Exists())
				err = file->Create();
		}
		VFileStream* stream = new VFileStream(file);
		if (err == VE_OK)
		{
			if (forwrite)
				err = stream->OpenWriting();
			else
				err = stream->OpenReading();
		}
		
		if (err == VE_OK)
		{
			ioParms.ReturnValue(VJSStream::CreateInstance(ioParms.GetContextRef(), stream));
		}
		else
		{
			delete stream;
		}
	}
	else
		vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_FILE, "1");
	ReleaseRefCountable( &file);
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:34,代码来源:VJSRuntime_stream.cpp

示例2: _save

void VJSDirectory::_save(VJSParms_callStaticFunction& ioParms, CUAGDirectory* inDirectory)
{
	VFile* dest = ioParms.RetainFileParam(1);

	if (dest != nil || ioParms.CountParams() == 0)

		ioParms.ReturnBool(inDirectory->Save(dest) == VE_OK);

	else {
		
		XBOX::vThrowError(XBOX::VE_JVSC_WRONG_PARAMETER_TYPE_FILE, "1");
		ioParms.ReturnBool(false);

	}

	QuickReleaseRefCountable(dest);
}
开发者ID:StephaneH,项目名称:core-Components,代码行数:17,代码来源:JsUAG.cpp

示例3: do_LoadText

void VJSGlobalClass::do_LoadText(VJSParms_callStaticFunction& ioParms, VJSGlobalObject*)
{
	bool okloaded = false;

	VFile* file = ioParms.RetainFileParam(1);

	if (file != nil)
	{
		if (file->Exists())
		{
			VFileStream inp(file);
			VError err = inp.OpenReading();
			if (err == VE_OK)
			{
				CharSet defaultCharSet = VTC_UTF_8;
				sLONG xcharset = 0;
				if (ioParms.GetLongParam(2, &xcharset) && xcharset != 0)
					defaultCharSet = (CharSet)xcharset;
				inp.GuessCharSetFromLeadingBytes(defaultCharSet );
				inp.SetCarriageReturnMode( eCRM_NATIVE );
				VString s;
				err = inp.GetText(s);
				if (err == VE_OK)
				{
					ioParms.ReturnString(s);
					okloaded = true;
				}
				inp.CloseReading();
			}
			
			
		}
		file->Release();
	}
	else
		vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_FILE, "1");

	if (!okloaded)
		ioParms.ReturnNullValue();

}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:41,代码来源:VJSGlobalClass.cpp

示例4: do_include

void VJSGlobalClass::do_include( VJSParms_callStaticFunction& inParms, VJSGlobalObject *inGlobalObject)
{
	// EvaluateScript() uses NULL (this is default) as inThisObject argument. 
	// This works fine currently, but would it be better (if any problem) to pass global (application) object instead? 
	// See WAK0074064.

	VFile* file = inParms.RetainFileParam(1, false);
	if (file != NULL)
	{
		bool newlyRegistered = inGlobalObject->RegisterIncludedFile( file);		// sc 15/06/2010 the file must be registered
		if (inParms.GetBoolParam(2,"refresh","auto") || newlyRegistered)
		{
			inParms.GetContext().EvaluateScript( file, NULL, inParms.GetExceptionRefPointer());
		}
		file->Release();
	}
	else
	{
		VString pathname;
		if (inParms.IsStringParam(1) && inParms.GetStringParam( 1, pathname))
		{
			VFolder* folder = inGlobalObject->GetRuntimeDelegate()->RetainScriptsFolder();
			if (folder != NULL)
			{
				file = new VFile( *folder, pathname, FPS_POSIX);
				
				bool newlyRegistered = inGlobalObject->RegisterIncludedFile( file);		// sc 15/06/2010 the file must be registered
				if (inParms.GetBoolParam(2,"refresh","auto") || newlyRegistered)
				{
					inParms.GetContext().EvaluateScript( file, NULL, inParms.GetExceptionRefPointer());
				}
				ReleaseRefCountable( &file);
			}
			ReleaseRefCountable( &folder);
		}
		else
			vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_FILE, "1");
	}
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:39,代码来源:VJSGlobalClass.cpp

示例5: do_SaveText

void VJSGlobalClass::do_SaveText(VJSParms_callStaticFunction& ioParms, VJSGlobalObject*)
{
	VString s;
	if (ioParms.IsStringParam(1))
	{
		if (ioParms.GetStringParam(1, s))
		{
			VFile* file = ioParms.RetainFileParam(2);
			if (file != nil)
			{
				VError err = VE_OK;
				if (file->Exists())
					err = file->Delete();
				if (err == VE_OK)
					err = file->Create();
				if (err == VE_OK)
				{
					CharSet defaultCharSet = VTC_UTF_8;
					sLONG xcharset = 0;
					if (ioParms.GetLongParam(3, &xcharset) && xcharset != 0)
						defaultCharSet = (CharSet)xcharset;
					VFileStream inp(file);
					err = inp.OpenWriting();
					if (err == VE_OK)
					{
						inp.SetCharSet(defaultCharSet);
						inp.PutText(s);
						inp.CloseWriting();
					}
				}
			}
			else
				vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_FILE, "2");
		}
	}
	else
		vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_STRING, "1");
}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:38,代码来源:VJSGlobalClass.cpp

示例6: do_loadImage

void VJSGlobalClass::do_loadImage(VJSParms_callStaticFunction& ioParms, VJSGlobalObject*)
{
	bool okloaded = false;

#if !VERSION_LINUX   // Postponed Linux Implementation !

	VFile* file = ioParms.RetainFileParam(1);

	if (file != nil)
	{
		if (file->Exists())
		{
			XBOX::VPicture* pict = new XBOX::VPicture(*file, false);
			/*
			VJSPictureContainer* pictContains = new VJSPictureContainer(pict, true, ioParms.GetContextRef());
			ioParms.ReturnValue(VJSImage::CreateInstance(ioParms.GetContextRef(), pictContains));
			pictContains->Release();
			*/
			if (pict != NULL)
			{
				okloaded = true;
				ioParms.ReturnVValue(*pict);
				delete pict;
			}
		}
		file->Release();
	}
	else
		vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_FILE, "1");

#endif

	if (!okloaded)
		ioParms.ReturnNullValue();

}
开发者ID:sanyaade-webdev,项目名称:core-XToolbox,代码行数:36,代码来源:VJSGlobalClass.cpp


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