本文整理汇总了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);
}
示例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);
}
示例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();
}
示例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");
}
}
示例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");
}
示例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();
}