eis/inc/base/TestNode.h

84 lines
2.3 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*********************************************************************
*
* 文 件: TestNode.h //TODO请概述文件功能
*
* 版权所有: Shanghai Baosight Software Co., Ltd.
*
* 概述://TODO请添加本文件包含功能详细描述
* //TODO
* //TODO
*
* 版本历史
* 0.5 2010-06-15 邹福洲 参照CppTest增加宏的功能
* 0.2 2010-03-31 徐长盛 框架确立,功能可以正常演示
* 0.1 2010-03-26 徐长盛 初次编写框架
* %USER%
*********************************************************************/
#ifndef _TestNode_H
#define _TestNode_H
#include <iostream>
#include <string.h>
#include <string>
#include <list>
using namespace std;
namespace baosight
{
class TestNode;
typedef list<TestNode*> TestNodeList;
/*********************************************************************
* 类 名: TestNode
* 版权所有: Shanghai Baosight Software Co., Ltd.
* 类 职 责: 测试节点,一个测试用例是一个节点,如果该节点下还有子节点,则当前节点的测试用例被屏蔽,只是当做菜单显示
* 版本历史
* 1.0 2010-07-25 tonny //TODO请添加本次主要修改内容
*
*********************************************************************/
class TestNode
{
public:
TestNode(){}
TestNode(string name,TestNode* father = NULL,char m_keyName = '0'):m_str(name),m_key(m_keyName),p_father(father){}
string getName(){ return m_str ;}
TestNode* getFather(){ return p_father ;}
void setFather(TestNode* father){ p_father = father;}
TestNode* getChild(string name);
TestNode* getChild(char key);
list<TestNode*>& getAllChild(){return m_childNodes;}
virtual int getChildNum() { return m_childNodes.size(); }
virtual char getKey() { return m_key;}
virtual string getMenu();
void setKey(char c ) { m_key = c;}
virtual int addChild(TestNode* pnode);
virtual int test(void* data = 0) { cout<<"hi,I am "<<m_str<<endl;return 0;}
virtual int clearChild(TestNode* child){ return 0;}
virtual int clearAllChild();
virtual ~TestNode() ;
TestNode* existNode(TestNode* existnode, TestNode* father = NULL);
TestNode* existNodeInTree(TestNode* node);
private:
char genKey(int num);
protected:
TestNodeList m_childNodes;
TestNode* p_father;
string m_str;
char m_key;
};
typedef TestNode FirstLevelNode;
typedef TestNode SecondLevelNode;
typedef TestNode ThirdLevelNode;
};
#endif