⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gnhdrec.h

📁 SYMIBNA 支持大型文件断点续传的引擎源代码
💻 H
字号:
/*
 ============================================================================
 Name        : GnHDRec.h
 Author      : cheney.kan
 Version     : 0.9
 Copyright   : Your copyright notice
 Description : CGnHDRec declaration
 ============================================================================
 */

#ifndef GNHDREC_H
#define GNHDREC_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include <f32file.h>


// CLASS DECLARATION


class RWriteStream;
class RReadStream;
class CDesC8Array;


class CGnHDRecFmt : public CBase
{
public:
    TBuf8<255>  iUri;
    TInt32     iPoint;

public:
    void ExternalizeL(RWriteStream& aStream)const;
    void InternalizeL(RReadStream& aStream);

//private:
            
};

/**
 *  CGnHDRec
 * 
 */
class CGnHDRec : public CBase
    {
public:
    // Constructors and destructor

    /**
     * Two-phased constructor.
     */
    static CGnHDRec* NewLC();

    /**
     * Two-phased constructor.
     */
    static CGnHDRec* NewL();

    void OpenRecFileL(const TDesC & aRecFileName);
    // if open error, create the rec file.
    void OpenOrCreateRecFileL(const TDesC & aRecFileName);
    const TDesC & GetRecFileName() const;

    // return the position(in Bytes) at previous time downloading.
    // if not found the aUri in rec file, return -1.
    TInt32 GetPositionPreTimeL(const TDesC8 & aUri);

    // update the aGnHDRecFmt info to rec file.
    void UpdateRecPosL(CGnHDRecFmt & aGnHDRecFmt);

    //void DeleteRecL(const TDesC8 & aUri);

    // remove current uri resume point info from rec file.
    // you should call GetPositionPreTimeL() before this function, 
    // or this function does nothing.
    void DeleteRecAndCloseL();

    void RemoveUriInfoFromRecL(const TDesC8 & aUri);
    
    /**
     * Destructor.
     */
    virtual ~CGnHDRec();

private:

     void ResetL();

     void ReplaceAllRecFilesL();

     TInt FindIndexL(RReadStream & aStream, const TDesC8 & aUri);

     TInt32 InternalizeNextTInt32L(RReadStream & aStream, TInt aIndex);
     RArray<TInt32> InternalizeAllTInt32L(RReadStream & aStream);

     CDesC8Array * InternalizeAllDesL(RReadStream & aStream);

     void ExternalizeAllTInt32L(RWriteStream & aStream, RArray<TInt32> & aList);

     void ExternalizeAllDesL(RWriteStream & aStream, CDesC8Array & aList);
     
    /**
     * Constructor for performing 1st stage construction
     */
    CGnHDRec();

    /**
     * EPOC default constructor for performing 2nd stage construction
     */
    void ConstructL();

private:
    RFs         iRFs;
    RFile       iRecFile;

    TBuf<255>   iRecFileName;
    TBuf<255>   iRecFileName2;

    TInt        iIndex;

    };

#endif // GNHDREC_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -