/******************************************************************************
 GNBBaseNode.h

	Interface for GNBBaseNode class.

	Copyright © 1999 by Glenn W. Bach. All rights reserved.

 ******************************************************************************/

#ifndef _H_GNBBaseNode
#define _H_GNBBaseNode

#include "JNamedTreeNode.h"

#include <JFileArray.h>

class JString;
class ostream;

class GNBBaseNode : public JNamedTreeNode
{
public:

	enum Type
	{
		kBaseNode = 1,
		kRootNode,
		kCategoryNode,
		kNoteNode,
		kToDoNode
	};

public:

	GNBBaseNode(JNamedTreeNode* parent,
						const char* name,
						const JBoolean isBranch,
						Type type);

	GNBBaseNode(Type type, JTree* tree, 
						const JCharacter* name,
				   		const JBoolean isBranch = kTrue);

	virtual ~GNBBaseNode();

	virtual void	SaveNode(ostream& os);
	void			SaveBranch(ostream& os);
	void			ReadBranchSetup(istream& is, const JFileVersion version);
	virtual void	ReadNodeSetup(istream& is, const JFileVersion version);
	virtual void	DiscardNode();
	void			DiscardBranch();

	JBoolean		FindChildNode(const JFAID_t id, JTreeNode** node);
	Type			GetType() const;

private:

	Type			itsType;

private:

	// not allowed

	GNBBaseNode(const GNBBaseNode& source);
	const GNBBaseNode& operator=(const GNBBaseNode& source);

};

/******************************************************************************
 GetType (public)

 ******************************************************************************/

inline GNBBaseNode::Type
GNBBaseNode::GetType()
	const
{
	return itsType;
}

#endif
