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

📄 stringinttree.h

📁 这是一个有关哈夫曼编/译码器的课程设计
💻 H
字号:
#ifndef _STRINGTREE_H_
#define _STRINGTREE_H_

#include "BinTree.h"


// CStringIntTreeNode. A node that holds a string and an int
// Since it inherits CBinTreeNode, can it be managed
// by the CBinTree class.
class CStringIntTreeNode : public CBinTreeNode
{
	LPTSTR mString;
	int mInt;
public:
	CStringIntTreeNode(LPCTSTR str,int i);
	~CStringIntTreeNode();

	LPCTSTR GetString() const { return mString; }
	int GetInt() const { return mInt; }
};

// CStringIntTree. A binary tree of CStringIntTreeNode nodes.
class CStringIntTree : public CBinTree
{
protected:
  // Overrides the pure virtual compare function.
  // and compares the strings of the nodes.
  int Compare(CBinTreeNode* p1,CBinTreeNode* p2) const;

  virtual void OnRemoveNode(CBinTreeNode* pNode) { delete (CStringIntTreeNode*)pNode; };
public:
  // Destructor
	~CStringIntTree() { Clear(); };
  
  // Function to directly add CStringIntTreeNode:s to the tree.
  void Add(LPCTSTR str,int i);

  BOOL DeleteByString(LPCTSTR str);
  // Save the contents to a file.
  void Save(LPCTSTR fileName);

  // Load the contents from a file.
  void Load(LPCTSTR fileName);

  // Delete all nodes (not only remove them from the tree)
  void Clear();

  // FindByString. Returns the CStringIntTreeNode matching the
  // given string str or NULL if couldn't be found.
  CStringIntTreeNode* FindByString(LPCTSTR str);
};

#endif // _STRINGTREE_H_

⌨️ 快捷键说明

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