// // TransferBase.h // cocos2d_libs // // Created by 徐俊杰 on 2020/6/11. // #ifndef TransferBase_h #define TransferBase_h //#include "cocos2d.h" #include "rparticle/Macros/RParticleMacros.h" NS_RRP_BEGIN class TransferBase { public: // TransferBase(); // ~TransferBase(); /// If true, the transfer is reading data from a source. (Could be fread from a file or reading from a block of memory) /// @note There are transfers for which neither IsReading() nor IsWriting() is true (for example when generating a typetree). /// IsReading is NOT the inverse of IsWriting. bool IsReading () { return false; } /// Are we transferring data with endianess swapping. (We might neither endianess swap on write or read based on IsReading / IsWriting) /// The endianess conversion is done by the TransferBackend, but there are some special cases where you might want to handle it yourself. /// (For example a texture data is transferred a single UInt8* array, so all endianess swapping is the responsibiltiy of the texture transfer function.) bool ConvertEndianess () { return false; } /// @name Versioning /// @{ /// Sets the "version of the class currently transferred" void SetVersion (int) {} /// Returns if the transferred data's version is the version used by the source code bool IsVersionSmallerOrEqual (int /*version*/) { return false; } /// Deprecated: use IsVersionSmallerOrEqual instead. bool IsOldVersion (int /*version*/) { return false; } bool IsCurrentVersion () { return true; } /// @} /// @name Transfers /// @{ /// Alignment in the serialization system is done manually. /// The serialization system only ever cares about 4 byte alignment. /// When writing data that has an alignment of less than 4 bytes, followed by data that has 4 byte alignment, /// then Align must be called before the 4 byte aligned data. /// TRANSFER (1byte); /// TRANSFER (1byte); /// transfer.Align (); /// TRANSFER (4byte); void Align () {} /// @} private: }; NS_RRP_END #endif /* TransferBase_h */