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

📄 warfilecallback.h

📁 ftpserver very good sample
💻 H
字号:
/** */#ifndef WAR_FILE_CALLBACK_H#define WAR_FILE_CALLBACK_H/* SYSTEM INCLUDES */#ifndef WAR_ASSERT_H_INCLUDED#   include "assert.h"#endif/* PROJECT INCLUDES */#ifndef WAR_TRANSFER_BUFFER_H#   include "WarTransferBuffer.h"#endif#ifndef WAR_PTR_WRAPPER_H#   include "WarPtrWrapper.h"#endif/* LOCAL INCLUDES *//* FORWARD REFERENCES */class WarFile;#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********//****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplus/** Base class for File IO callback operations.  The class contains a buffer, and a callback-routine  that is used to process the event that data is  written or read.*/class WarFileCallback : public WarSmartPointer{public:    // LIFECYCLE    enum CurrentOperationE    {        CB_NONE,        CB_READ,        CB_WRITE    };        /**    * Default constructor.    */    WarFileCallback(WarTransferBuffer *transferBuffer)        : mTransferBufferPtr(transferBuffer),        mpFile(NULL),        mCurrentOperation(CB_NONE)    {}        /**    * Destructor.    */    ~WarFileCallback(void);        // OPERATORS    WarFileCallback& operator = (WarTransferBuffer *transferBuffer)    {        mTransferBufferPtr = transferBuffer;        return *this;    }    WarFileCallback& operator = (const WarError& error)    {        mResult = error;        return *this;    }    /**    * Assignment operator.    *    * @param from THe value to assign to this object.    *    * @return A reference to this object.    */    WarFileCallback& operator=(WarFileCallback& from);        // OPERATIONS         void Prepare(war_uint32_t bytesToProcess,         WarFile *pfile)    {        assert(pfile != NULL);        assert(mTransferBufferPtr->GetLength() <= bytesToProcess);                mpFile = pfile;        mBytesToProcess = bytesToProcess;        mResult.Reset();    }    virtual void OnCallback() throw(WarException)    {        WarThrow(WarError(WAR_ERR_NOT_IMPLEMENTED), NULL);    }    // ACCESS    // INQUIRY        /// Buffer to read from or store the result in    WarPtrWrapper<WarTransferBuffer> mTransferBufferPtr;    /// The result from the async IO operation    WarError mResult;    /** Bytes to read or write. This must be equal to or      * less than the capacity of the buffer      */    war_uint32_t mBytesToProcess;        /** The file used for callback */    WarFile *mpFile;    /** The current/last operation */    CurrentOperationE mCurrentOperation;protected:private:};/* INLINE METHODS *//* EXTERNAL REFERENCES */#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif  /* WAR_FILE_CALLBACK_H_ */

⌨️ 快捷键说明

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