//********************************************************************************
// C++ Certificate Program Intermediate Spring 1999 : Stephen Philips
//
// Final Project
// File       : \\Venus\katy\C++ Certificate\intermediate\Final Project
//				\WordCountBTree.h
//
// Purpose    : Declaration for class WordCountBTree to be used for counting words
//				in Lecture 6
//
// Author     : Hsin-yi F. Berg
// Date		  : 6/2/99
// Update	  : 6/8/99
//********************************************************************************
#ifndef	WORDCOUNTBTREE_H
#define WORDCOUNTBTREE_H
#include "BinaryTree.h"
const int max_char = 128;
class Token
{
public:
	/*
		Token::Token()
		Constructor for a Token.
	*/
	Token();
	/*
		Token::~Token()
		Restructor for the Token.
	*/
	~Token();
	/*
		char *Token::GetNextToken(istream & in)
		Takes an istream and breaks it up into "tokens".
		Returns a string.
		If an empty string is returned, it's EOF
	*/
	char *GetNextToken(istream & in);
//	/*
//		int Token::GetType(void) const
//		Returns the type of the token.
//	*/
//	TokenType getType(void) const;
	/*
		char *Token::GetValue()
		Converts Token to a char *.
	*/
	char *GetValue();
private:
	char *token;
	// TokenType type;
};
class WordCountBTree : public BinaryTree
{
public:
	/*
		WordCountBTree::WordCountBTree()
		Constructor of a WordCountBTree.
	*/
	WordCountBTree();
	/*
		WordCountBTree::~WordCountBTree()
		Destructor of a WordCountBTree.
	*/
	~WordCountBTree();
	/*
		void WordCountBTree::CountWordFreq(istream &in)
		Put all the words in the Btree and count the frequencies.
	*/
	void CountWordFreq(istream &in);
	/*
		void WordCountBTree::PrintWordFreq()
		Print out all the words that are in the tree, and their frequencies.
	*/
	void PrintWordFreq();
private:
	Token curToken;
	/*
		void WordCountBTree::PrintWordFreqHelp(LeafNode* pLeafNode)
		Helper function for the PrintWordFreq function.
	*/
	void PrintWordFreqHelp(LeafNode* pLeafNode);
};
#endif

 

Back	Top