?? treeop.h
字號(hào):
/********************************************************
文 件 名: tree.h
所屬項(xiàng)目:
編寫單位:
作 者: 易劍
編寫日期: 2003-02-10
版 本:
功能描述: 操作配置文件的樹結(jié)構(gòu)函數(shù)
修改日志:
修改時(shí)間:
修 改 者:
修改內(nèi)容:
*********************************************************/
#ifndef _TREE_OP_H
#define _TREE_OP_H
#include <stdio.h>
#include "tree_node.h"
#define NODE_IS_LEAF 0 /* 結(jié)點(diǎn)是樹葉 */
#define NODE_IS_BRANCH 1 /* 結(jié)點(diǎn)是樹枝結(jié)點(diǎn) */
#define NODE_IS_ROOT -1 /* 結(jié)點(diǎn)是樹根 */
#define NEXT_NODE_EXIST 8 /* 結(jié)點(diǎn)是的下一結(jié)點(diǎn)存在 */
/* 初始化配置文件 */
struct tree_node *init_cfg(char *cfg_filepath, char *task_filepath, char **argv, char *direct);
/* 反初始化 */
void uninit(struct tree_node *root);
/* 創(chuàng)建樹根 */
struct tree_node *create_treeroot(char *data);
/* 提取指定路徑的值 */
char *get_value(struct tree_node *root, const char *path, int *flag);
/* 判斷指定路么是否是合法路徑 */
int node_is_exist(struct tree_node *root, const char *path);
/* 獲得下一個(gè)并列路徑 */
char *get_next_path(struct tree_node *root, const char *path, int flag);
/* 得到下一個(gè)并列結(jié)點(diǎn)的路徑和結(jié)點(diǎn)類型 */
char *get_next_path2(struct tree_node *root, const char *path, int *flag);
/* 得到父結(jié)點(diǎn) */
int get_parentnode(struct tree_node *root, const char *path, struct tree_node **parent);
/* 得到父結(jié)點(diǎn)路徑 */
char *get_parentnodepath(struct tree_node *root, const char *path);
/* 修改結(jié)點(diǎn) */
int update_node(struct tree_node *root,
const char *path,
const char *newdata,
const char *newvalue);
/* 插入一個(gè)結(jié)點(diǎn) */
int insert_node(struct tree_node *root, const char *path, const char *data, const char *value);
/* 插入一棵子樹 */
int insert_subtree(struct tree_node *root, const char *path, struct tree_node *subtree);
/* 刪除一個(gè)結(jié)點(diǎn) */
int delete_node(struct tree_node *root, const char *path);
/* 將根結(jié)點(diǎn)為 root,路徑為 path 的樹結(jié)構(gòu)輸出到文件 result_filepah 中*/
/* 內(nèi)部調(diào)用 recursion_dump() 和 get_node() */
int dump_tree(struct tree_node *root, const char *result_filepath, const char *path);
/* 從文件 filename 中獲取數(shù)據(jù)創(chuàng)建以 root 為根的樹 */
void createtree_fromfile(char *filename, struct tree_node **root);
/* 從文件 fp 中獲取數(shù)據(jù)創(chuàng)建以 root 為根的樹 */
void createtree_fromfilefp(FILE *fp, struct tree_node **root);
/*
外部函數(shù) -- start
*/
/* 在屏幕上打印樹 */
void print_tree(struct tree_node *root,int spaceNum);
void print_tree(struct tree_node *root);
/*
外部函數(shù) -- end
*/
#endif /* _TREE_OP_H */
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -