icedynablock.h

来自「使用stl技术,(还没看,是听说的)」· C头文件 代码 · 共 48 行

H
48
字号
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Include Guard
#ifndef __ICEDYNABLOCK_H__
#define __ICEDYNABLOCK_H__

	struct ICECORE_API DynamicBlock
	{
						DynamicBlock()	{ Length = 0; Data = null;			}
						~DynamicBlock()	{ Release();						}

				bool	Release()		{ DELETEARRAY(Data); return true;	}

				bool	Init(udword length)
						{
								Release();
								Data = new ubyte[length];
								CHECKALLOC(Data);
								Length = length;
								return true;
						}

				bool	Compare(DynamicBlock* blc)
						{
							if(!blc)				return false;
							if(blc->Length!=Length)	return false;
							ubyte* Data2 = blc->Data;
							for(udword i=0;i<Length;i++)
								if(Data[i]!=Data2[i])	return false;
							return true;
						}

		udword			Length;
		ubyte*			Data;
	};

	class ICECORE_API DataBlock : public Cell
	{
						DECLARE_ICE_CLASS(DataBlock, Cell);
						DECLARE_FIELDS;

			// Initialize
						bool			Init(udword length)										{ return mBlock.Init(length);			}

						DynamicBlock	mBlock;
	};

#endif // __ICEDYNABLOCK_H__

⌨️ 快捷键说明

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