Esempio n. 1
0
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;
    }
}
Esempio n. 2
0
int OGRTigerDataSource::TestCapability( const char *pszCap )

{
    if( EQUAL(pszCap,ODsCCreateLayer) )
        return GetWriteMode();
    else
        return FALSE;
}
Esempio n. 3
0
void FileIODevice::TruncateFile()
{
    FailIfReadOnly();

    WriteModeEnum _md = GetWriteMode();
    SetWriteMode(WriteOver);
    Write("");
    SetWriteMode(_md);
}