本文整理汇总了C++中VFile类的典型用法代码示例。如果您正苦于以下问题:C++ VFile类的具体用法?C++ VFile怎么用?C++ VFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: RetainFolder
VFile *VProcess::RetainFile( EFolderKind inPrimarySelector, const VString& inFileName, EFolderKind inSecondarySelector) const
{
VFile *file = NULL;
VFolder *parent = RetainFolder( inPrimarySelector);
if (testAssert( parent != NULL))
{
file = new VFile( *parent, inFileName);
if ( (file != NULL) && !file->Exists())
ReleaseRefCountable( &file);
}
ReleaseRefCountable( &parent);
if ( (file == NULL) && (inSecondarySelector != 0) )
{
parent = RetainFolder( inSecondarySelector);
if ( (parent != NULL) && parent->Exists())
{
file = new VFile( *parent, inFileName);
if ( (file != NULL) && !file->Exists())
ReleaseRefCountable( &file);
}
ReleaseRefCountable( &parent);
}
return file;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:27,代码来源:VProcess.cpp
示例2: _AddFile
VError VArchiveStream::_AddFile(VFile& inFile,const VFilePath& inSourceFolder,const VString& inExtraInfo)
{
XBOX::VError result = VE_FILE_NOT_FOUND;
if ( inFile.Exists() )
{
///ACI0078887, O.R. Nov 29th 2012: mask error if file is already known, does no harm
result = VE_OK;
if (!ContainsFile( &inFile))
{
VString relativePath;
if(testAssert(!inSourceFolder.IsEmpty() && inFile.GetPath().GetRelativePath(inSourceFolder,relativePath)))
{
fUniqueFilesCollection->insert(inFile.GetPath());
fFileExtra.push_back( inExtraInfo );
fFileList.push_back( &inFile );
fSourceFolderForFiles.push_back(inSourceFolder);
}
else
{
///ACI0078887, O.R. Nov 29th 2012: explicitely fail if item is not relative to source folder, this should never happen
result = VE_INVALID_PARAMETER;
}
}
}
return result;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:26,代码来源:VArchiveStream.cpp
示例3: _save
void VJSImage::_save(XBOX::VJSParms_callStaticFunction& ioParms, VJSPictureContainer* inPict)
{
VPictureCodecFactoryRef fact;
const VPictureCodec* encoder = nil;
bool ok = false;
VPicture* pic = inPict->GetPict();
if (pic != nil)
{
VFile* file = ioParms.RetainFileParam(1);
if (file != nil)
{
VString mimetype;
ioParms.GetStringParam(2, mimetype);
if (mimetype.IsEmpty())
{
VString extension;
file->GetExtension(extension);
if (extension.IsEmpty())
extension = L"pic";
encoder = fact->RetainEncoderForExtension(extension);
}
else
encoder = fact->RetainEncoderByIdentifier(mimetype);
if (encoder != nil)
{
VError err = VE_OK;
if (file->Exists())
err = file->Delete();
if (err == VE_OK)
{
VValueBag *pictureSettings = nil;
VValueBag *bagMetas = (VValueBag*)inPict->RetainMetaBag();
if (bagMetas != nil)
{
pictureSettings = new VValueBag();
ImageEncoding::stWriter settingsWriter(pictureSettings);
VValueBag *bagRetained = settingsWriter.CreateOrRetainMetadatas( bagMetas);
if (bagRetained)
bagRetained->Release();
}
err=encoder->Encode(*pic, pictureSettings, *file);
QuickReleaseRefCountable(bagMetas);
QuickReleaseRefCountable(pictureSettings);
if (err == VE_OK)
ok = true;
}
encoder->Release();
}
file->Release();
}
else
vThrowError(VE_JVSC_WRONG_PARAMETER_TYPE_FILE, "1");
}
ioParms.ReturnBool(ok);
}
开发者ID:sanyaade-mobiledev,项目名称:core-XToolbox,代码行数:60,代码来源:VJSRuntime_Image.cpp
示例4: xbox_assert
VError VLexerFileInput::Init( const VFilePath &inPath )
{
fCurrentChar = 0;
fCurrentPageChar = 0;
fCommandStart = 0;
fCurrentLine = 0;
xbox_assert ( fFileStream == NULL );
VFile *vFile = new VFile( inPath );
fFileStream = new VFileStream( vFile ); // VFileStream retains the input VFile
vFile->Release();
VError vError = fFileStream->OpenReading();
if (vError != VE_OK) {
delete fFileStream;
fFileStream = NULL;
return vError;
}
vError = fFileStream->GuessCharSetFromLeadingBytes( XBOX::VTC_UTF_8 );
fFileStream->SetCarriageReturnMode( XBOX::eCRM_NATIVE );
if (vError == VE_OK)
vError = FillBuffer();
return vError;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:29,代码来源:ILexerInput.cpp
示例5: tr
void PaletteView::exportPalette(int start, int length) {
if (start >= 512) {
return;
}
if (start + length > 512) {
length = 512 - start;
}
m_controller->threadInterrupt();
QFileDialog* dialog = GBAApp::app()->getSaveFileDialog(this, tr("Export palette"), tr("Windows PAL (*.pal);;Adobe Color Table (*.act)"));
if (!dialog->exec()) {
m_controller->threadContinue();
return;
}
QString filename = dialog->selectedFiles()[0];
VFile* vf = VFileDevice::open(filename, O_WRONLY | O_CREAT | O_TRUNC);
if (!vf) {
m_controller->threadContinue();
return;
}
QString filter = dialog->selectedNameFilter();
if (filter.contains("*.pal")) {
GBAExportPaletteRIFF(vf, length, &m_controller->thread()->gba->video.palette[start]);
} else if (filter.contains("*.act")) {
GBAExportPaletteACT(vf, length, &m_controller->thread()->gba->video.palette[start]);
}
vf->close(vf);
m_controller->threadContinue();
}
开发者ID:ikeboy,项目名称:mgba,代码行数:28,代码来源:PaletteView.cpp
示例6: VFileStream
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
示例7: memset
VError VPictureData_MacPicture::SaveToFile(VFile& inFile)const
{
VError result = VE_OK;
if (fDataProvider && fDataProvider->GetDataSize())
{
VPtr p = fDataProvider->BeginDirectAccess();
if (p)
{
result = inFile.Create();
if (result == VE_OK)
{
VFileDesc* inFileDesc;
result = inFile.Open(FA_READ_WRITE, &inFileDesc);
if (result == VE_OK)
{
char buff[0x200];
memset(buff, 0, 0x200);
result = inFileDesc->PutData(buff, 0x200, 0);
if (result == VE_OK)
{
result = inFileDesc->PutData(p, fDataProvider->GetDataSize(), 0x200);
}
delete inFileDesc;
}
}
fDataProvider->EndDirectAccess();
}
else
fDataProvider->ThrowLastError();
}
else
{
VBlobWithPtr blob;
VSize outsize;
result = Save(&blob, 0, outsize);
if (result == VE_OK)
{
result = inFile.Create();
if (result == VE_OK)
{
VFileDesc* inFileDesc;
result = inFile.Open(FA_READ_WRITE, &inFileDesc);
if (result == VE_OK)
{
char buff[0x200];
memset(buff, 0, 0x200);
result = inFileDesc->PutData(buff, 0x200, 0);
if (result == VE_OK)
{
result = inFileDesc->PutData(blob.GetDataPtr(), blob.GetSize(), 0x200);
}
delete inFileDesc;
}
}
}
}
return result;
}
开发者ID:StephaneH,项目名称:core-XToolbox,代码行数:59,代码来源:V4DPictureData_QDPicture.cpp
示例8: saveFile
void CheatsModel::saveFile(const QString& path) {
VFile* vf = VFileDevice::open(path, O_TRUNC | O_CREAT | O_WRONLY);
if (!vf) {
return;
}
GBACheatSaveFile(m_device, vf);
vf->close(vf);
}
开发者ID:ST3ALth,项目名称:mGBA-Core,代码行数:8,代码来源:CheatsModel.cpp
示例9: VFileOpen
void CheatsModel::saveFile(const QString& path) {
VFile* vf = VFileOpen(path.toLocal8Bit().constData(), O_TRUNC | O_CREAT | O_WRONLY);
if (!vf) {
return;
}
GBACheatSaveFile(m_device, vf);
vf->close(vf);
}
开发者ID:MoochMcGee,项目名称:mgba,代码行数:8,代码来源:CheatsModel.cpp
示例10: VFile
VError VArchiveStream::AddFile( VFilePath &inFilePath )
{
VError result = VE_STREAM_CANNOT_FIND_SOURCE ;
VString empty;
VFile *file = new VFile( inFilePath );
result = _AddFile(*file,fRelativeFolder,empty);
file->Release();
return result;
}
开发者ID:sanyaade-iot,项目名称:core-XToolbox,代码行数:9,代码来源:VArchiveStream.cpp
示例11: loadFile
void CheatsModel::loadFile(const QString& path) {
VFile* vf = VFileDevice::open(path, O_RDONLY);
if (!vf) {
LOG(WARN) << tr("Failed to open cheats file: %1").arg(path);
return;
}
beginResetModel();
GBACheatParseFile(m_device, vf);
endResetModel();
vf->close(vf);
}
开发者ID:ST3ALth,项目名称:mGBA-Core,代码行数:11,代码来源:CheatsModel.cpp
示例12: mCoreGetState
void LoadSaveState::loadState(int slot) {
mCoreThread* thread = m_controller->thread();
VFile* vf = mCoreGetState(thread->core, slot, 0);
if (!vf) {
m_slots[slot - 1]->setText(tr("Empty"));
return;
}
mStateExtdata extdata;
mStateExtdataInit(&extdata);
void* state = mCoreExtractState(thread->core, vf, &extdata);
vf->seek(vf, 0, SEEK_SET);
if (!state) {
m_slots[slot - 1]->setText(tr("Corrupted"));
mStateExtdataDeinit(&extdata);
return;
}
QDateTime creation;
QImage stateImage;
unsigned width, height;
thread->core->desiredVideoDimensions(thread->core, &width, &height);
mStateExtdataItem item;
if (mStateExtdataGet(&extdata, EXTDATA_SCREENSHOT, &item) && item.size >= width * height * 4) {
stateImage = QImage((uchar*) item.data, width, height, QImage::Format_ARGB32).rgbSwapped();
}
if (mStateExtdataGet(&extdata, EXTDATA_META_TIME, &item) && item.size == sizeof(uint64_t)) {
uint64_t creationUsec;
LOAD_64LE(creationUsec, 0, item.data);
creation = QDateTime::fromMSecsSinceEpoch(creationUsec / 1000LL);
}
if (!stateImage.isNull()) {
QPixmap statePixmap;
statePixmap.convertFromImage(stateImage);
m_slots[slot - 1]->setIcon(statePixmap);
}
if (creation.toMSecsSinceEpoch()) {
m_slots[slot - 1]->setText(creation.toString(Qt::DefaultLocaleShortDate));
} else if (stateImage.isNull()) {
m_slots[slot - 1]->setText(tr("Slot %1").arg(slot));
} else {
m_slots[slot - 1]->setText(QString());
}
vf->close(vf);
mappedMemoryFree(state, thread->core->stateSize(thread->core));
}
开发者ID:leiradel,项目名称:mgba,代码行数:49,代码来源:LoadSaveState.cpp
示例13: sscanf
ComplexTexture::ComplexTexture( const char *texPath, const char *offPath )
{
_texture = VImage::create(texPath);
VFile file;
file.open(offPath, "r");
char tmp[VFILE_LINE_MAX];
int n1, n2;
file.readLine(tmp);
sscanf(tmp, "%d\n", &n1);
file.readLine(tmp);
sscanf(tmp, "%d\n", &n2);
file.close();
_offset = QPoint(n1, n2);
}
开发者ID:vitoz,项目名称:VLegend,代码行数:15,代码来源:ComplexTexture.cpp
示例14: RetainFile
VError VProjectItemFile::GetModificationTime( VTime& outModificationTime) const
{
VError err = VE_OK;
VFile *file = RetainFile();
if (file != NULL)
{
err = file->GetTimeAttributes( &outModificationTime, NULL, NULL);
ReleaseRefCountable( &file);
}
else
{
err = VE_FILE_NOT_FOUND;
}
return err;
}
开发者ID:sanyaade-mobiledev,项目名称:core-Wakanda,代码行数:17,代码来源:VProjectItemBehaviour.cpp
示例15: loadPal
void loadPal(char *palname)
{
VFile *mixfile;
SDL_Color palette[256];
int i;
mixfile = VFS_Open(palname);
/* Load the palette */
for (i = 0; i < 256; i++) {
mixfile->readByte(&palette[i].r, 1);
mixfile->readByte(&palette[i].g, 1);
mixfile->readByte(&palette[i].b, 1);
palette[i].r <<= 2;
palette[i].g <<= 2;
palette[i].b <<= 2;
}
SHPBase::setPalette(palette);
}
开发者ID:jjermann,项目名称:freecnc_redalert,代码行数:20,代码来源:shpview.cpp
示例16: inp
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
示例17: file
XBOX::VError VProjectItemFile::Rename( const XBOX::VString& inNewName)
{
if (fOwner == NULL)
return VE_FILE_CANNOT_RENAME;
VFilePath path;
if (!fOwner->GetFilePath( path))
return VE_FILE_CANNOT_RENAME;
VFile *newFile = NULL;
VFile file( path);
VError err = file.Rename( inNewName, &newFile);
if (err == VE_OK && newFile != NULL)
{
VString fileName;
newFile->GetName( fileName);
fOwner->SetName( fileName);
fOwner->SetDisplayName( fileName);
if (fOwner->HasRelativePath())
{
fOwner->SetRelativePath( fileName);
}
else
{
VFilePath path;
newFile->GetPath( path);
fOwner->SetURL( VURL( path));
}
}
ReleaseRefCountable( &newFile);
if (err != VE_OK)
err = VE_FILE_CANNOT_RENAME;
return err;
}
开发者ID:sanyaade-mobiledev,项目名称:core-Wakanda,代码行数:39,代码来源:VProjectItemBehaviour.cpp
示例18: VFile
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
示例19: SHPBase
/**
* Constructor loads a dune2 shpfile.
*
* @param fname the name of the dune2 shpfile.
* @param scaleq do scalling or not
*/
Dune2Image::Dune2Image(const char *fname, Sint8 scaleq) : SHPBase(fname, scaleq)
{
VFile* imgfile = 0;
// Open the file in .mix archivefile
imgfile = VFSUtils::VFS_Open(fname);
if (imgfile == 0)
{
logger->error(" File \"%s\" not found.\n", fname);
shpdata = 0;
throw ImageNotFound("File \"" + string(fname) + "\" not found.");
}
// Create the buffer with correct size
shpdata = new Uint8[imgfile->fileSize()];
// Fill the buffer
imgfile->readByte(shpdata, imgfile->fileSize());
// Close the archive
VFSUtils::VFS_Close(imgfile);
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:28,代码来源:Dune2Image.cpp
示例20: f_read
static int f_read(const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi)
{
Node *node;
VFile *file;
int n;
node = vfs.GetNode(path);
if (!node)
return 0;
try
{
file = node->open();
file->seek(offset);
n = file->read(buf, size);
file->close();
}
catch (vfsError e)
{
return 0;
}
return n;
}
开发者ID:udgover,项目名称:modules,代码行数:22,代码来源:fuse.cpp
注:本文中的VFile类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论