// CCharArray.h: interface for the CCharArray class. // ////////////////////////////////////////////////////////////////////// #ifndef _CCharArray_H_ #define _CCharArray_H_ #ifdef _WINDOWS64 #ifdef PUB_TOOLS_EXPORTS #define PUB_TOOLS_API __declspec(dllexport) #else #define PUB_TOOLS_API __declspec(dllimport) #endif #else #define PUB_TOOLS_API #endif class PUB_TOOLS_API CCharArray { public: // CCharArray(); CCharArray(char *pChar, int nLen, bool bAutoDel = false); ~CCharArray(); private: char *m_pChar; // 数据缓冲区 int m_nCharLen; // m_pChar数组的长度 int m_nCharIndex; // m_pChar数组中当前有效位置 bool m_bAutoDelete; // 是否删除缓冲区的数据 private: void SetLen(int nIndex) { m_nCharLen = nIndex; } void SetIndex(int nIndex) { m_nCharIndex = nIndex; } int GetIndex() { return m_nCharIndex; } int CheckLen(int nLen); bool GetIsAutoDelete() { return m_bAutoDelete; } public: int GetLen() { return m_nCharLen; } char *GetChar() { return m_pChar; } void IsAutoDelete(bool bAutoDelete = true) { m_bAutoDelete = bAutoDelete; } /* bool PutChar(char *pChar,int nLen); bool GetChar(char *pChar,int nLen); bool Skip(int nLen); */ }; #endif // _CCharArray_H_