void FileIODevice::_open_file(bool for_write) { QFile::OpenMode flags; if(for_write) { flags = QFile::WriteOnly; if(GetWriteMode() == WriteAppend) flags |= QFile::Append; else if(GetWriteMode() == WriteOver) flags |= QFile::Truncate; else throw NotImplementedException<>(); } else { flags = QFile::ReadOnly; } File().open(flags); if(!File().isOpen()) { DataTransportException<true> ex( QString("Could not open file: %1").arg(FileName()).toUtf8().constData()); ex.Data["err"] = File().errorString().toUtf8().constData(); throw ex; } }
int OGRTigerDataSource::TestCapability( const char *pszCap ) { if( EQUAL(pszCap,ODsCCreateLayer) ) return GetWriteMode(); else return FALSE; }
void FileIODevice::TruncateFile() { FailIfReadOnly(); WriteModeEnum _md = GetWriteMode(); SetWriteMode(WriteOver); Write(""); SetWriteMode(_md); }