📄 node.h
字号:
#ifndef NODE_H
#define NODE_H
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include "boost/functional/hash.hpp"
#include "boost/functional/hash/map.hpp"
#include "AppException.h"
#include "Item.h"
//#include "ItemHeaderTable.h"
using namespace std;
using namespace boost;
struct ltstr {
bool operator() (const size_t h1, const size_t h2) const {
return (h1 < h2);
}
};
class ItemHeaderTable;
class Node {
friend ostream& operator<<(ostream& os, const Node& node);
public:
Node(string name, Node* parent, int count);
virtual ~Node();
string getName() const;
int getCount() const;
Node* getParentNode();
Node* getLinkNode();
int getChildrenCount() const;
void incrementCount(int i);
void setLinkNode(Node* node);
void addChild(Node* child, ItemHeaderTable* iht);
void insertTree(vector<Item*>* itemColl, ItemHeaderTable* iht);
bool hasSingleBranchOnly();
Node* getLeafNode();
private:
string mName;
int mCount;
Node* parentNode;
Node* linkNode;
map<const size_t, Node* , ltstr> childrenMap;
hash<string> string_hash;
};
inline ostream& operator<<(ostream& os, const Node& node) {
os << "Name: " << node.getName();
os << " Count: " << node.getCount();
os << " Children: " << node.getChildrenCount();
return os;
};
#endif /* NODE_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -