utilities/downloadmanager/inc/filestorage.h
changeset 16 3c88a81ff781
equal deleted inserted replaced
14:6aeb7a756187 16:3c88a81ff781
       
     1 /**
       
     2    This file is part of CWRT package **
       
     3 
       
     4    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
       
     5 
       
     6    This program is free software: you can redistribute it and/or modify
       
     7    it under the terms of the GNU (Lesser) General Public License as 
       
     8    published by the Free Software Foundation, version 2.1 of the License. 
       
     9    This program is distributed in the hope that it will be useful, but
       
    10    WITHOUT ANY WARRANTY; without even the implied warranty of 
       
    11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
       
    12    (Lesser) General Public License for more details. You should have 
       
    13    received a copy of the GNU (Lesser) General Public License along 
       
    14    with this program. If not, see <http://www.gnu.org/licenses/>.
       
    15 */
       
    16 
       
    17 #ifndef FILESTORAGE_H
       
    18 #define FILESTORAGE_H
       
    19 
       
    20 #include "dmcommon.h"
       
    21 #include "dmpimpl.h"
       
    22 #include "downloadstore.h"
       
    23 #include "clientdownload.h"
       
    24 #include <QObject>
       
    25 
       
    26 // forward declarations
       
    27 class FileStoragePrivate;
       
    28 
       
    29 // class declaration
       
    30 
       
    31 // concrete implementation class
       
    32 class FileStorage : public DownloadStore
       
    33 {
       
    34     DM_DECLARE_PRIVATE(FileStorage); // private implementation
       
    35 public:
       
    36     FileStorage(const QString& clientName, ClientDownload* download);
       
    37     virtual ~FileStorage();
       
    38 
       
    39     // writes to the file
       
    40     int write(const QByteArray& data, bool lastChunk=0);
       
    41     // closes the file
       
    42     int close();
       
    43     // opnes the file
       
    44     int open(QIODevice::OpenMode mode);
       
    45     // creates the storage
       
    46     int createStore();
       
    47     // deletes the file storage
       
    48     int deleteStore();
       
    49      //returns the size of loaded file
       
    50     int storedDataSize();
       
    51 
       
    52 private:
       
    53     // moves the file
       
    54     void moveDlFile();
       
    55 };    
       
    56 
       
    57 #endif