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

📄 linklist.h

📁 用C++完成的双链表源代码
💻 H
字号:
// LinkList.h// author: Ke Song based C source from pp Sister XiuJie Chen ;)// http://kesongemini.diy.163.com#ifndef KS_LINKLIST_H#define KS_LINKLIST_Htypedef char *	CONTENTS;class LinkList_T;class LinkListNode_T{public:	friend class LinkList_T;private:	LinkListNode_T  *prev;	LinkListNode_T  *next;	CONTENTS				contents;};class LinkList_T{// DISALLOW TO USEprivate:	LinkList_T( const LinkList_T& rhs );						// DISALLOW TO USE	LinkList_T& operator=( const LinkList_T& rhs);	// DISALLOW TO USEpublic:	LinkList_T( void );												// CONSTRUCTOR	~LinkList_T( void );											// DESTRUCTORpublic:	void init( void );												// initialize members	void prepend( CONTENTS contents );				// insert into as _top item	void append( CONTENTS contents );					// insert into as _bottom item	void append2current ( CONTENTS contents );// insert into as _current->next	void prepend2current( CONTENTS contents ); // insert into as _current->prev	CONTENTS deleteFirst ( void );						// delete 1st			item	CONTENTS deleteLast ( void );							// delete last		item	CONTENTS deleteCurrent ( void );					// delete _current item	void deleteAll( void );										// delete all of the items	void freeAll ( void );										// free all of the memory used	void freeCurrent ( void );								// free the _current item	void freeNode ( LinkListNode_T *pNode );					// free		a node	CONTENTS deleteNode ( LinkListNode_T *pNode );		// delete a node		bool freeMatch ( CONTENTS contents );							// free the matchinger	LinkListNode_T *findMatch ( CONTENTS contents );	// find the matchinger	int index ( CONTENTS contents );					// get index		from contents	CONTENTS contents ( int index );					// get contents	from index// INLINE	bool isEmpty( void );											// is the list empty	CONTENTS Top( void );											// get _top			item	CONTENTS Bottom( void );									// get _bottom		item	CONTENTS Current( void );									// get _current	itemprivate:	LinkListNode_T  *_top;	LinkListNode_T  *_bottom;	LinkListNode_T  *_current;private:	static void panic ( char *s );						// STATIC FUNCTION};#include "LinkList_I.h"											// INLINE FUNCTION#endif // KS_LINKLIST_H

⌨️ 快捷键说明

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