• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ show_tree函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中show_tree函数的典型用法代码示例。如果您正苦于以下问题:C++ show_tree函数的具体用法?C++ show_tree怎么用?C++ show_tree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了show_tree函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: event_callback

/* Mouse callback */
static int
event_callback (Gpm_Event *event, void *data)
{
    WTree *tree = data;

    if (!(event->type & GPM_UP))
	return MOU_NORMAL;

    if (tree->is_panel)
	event->y--;

    event->y--;

    if (!tree->active)
	change_panel ();

    if (event->y < 0){
	tree_move_backward (tree, tlines (tree) - 1);
	show_tree (tree);
    }
    else if (event->y >= tlines (tree)){
	tree_move_forward (tree, tlines (tree) - 1);
	show_tree (tree);
    } else {
	tree_event (tree, event->y);
	if ((event->type & (GPM_UP|GPM_DOUBLE)) == (GPM_UP|GPM_DOUBLE)){
	    chdir_sel (tree);
	}
    }
    return MOU_NORMAL;
}
开发者ID:ebichu,项目名称:dd-wrt,代码行数:32,代码来源:tree.c


示例2: show_tree

/* this is very haphazzard */
void show_tree(rtn_t * root, struct trunk *prev, int is_left)
{
	char *prev_str = NULL;
	
	struct trunk this_disp;
	
	if (root == NULL) return;
	
	this_disp.prev = prev;
	this_disp.str = "    ";
	
	prev_str = this_disp.str;

/*	*/
	show_tree(root->next[0], &this_disp, 1);

	if (!prev)
		this_disp.str = "---";
	else if (is_left) {
		this_disp.str = ".--";
		prev_str = "   |";
	} else {
		this_disp.str = "`--";
		prev->str = prev_str;
	}
/* */
	show_trunks(&this_disp);
	printf("%d\n", *(int *)root->data);
 
	if (prev) prev->str = prev_str;
	this_disp.str = "   |";
 
	show_tree(root->next[1], &this_disp, 0);
	if (!prev) puts("");
}
开发者ID:edomerz,项目名称:rtree,代码行数:36,代码来源:rtree.c


示例3: show_tree

void show_tree(node *start)
{
    if(start->lptr != NULL)
        show_tree(start->lptr);

    if(start->rptr != NULL)
        show_tree(start->rptr);

    printf("%c \n",start->data);
}
开发者ID:harshikatiyar,项目名称:Competitive_Programming,代码行数:10,代码来源:operator-precedence.c


示例4: tree_callback

static cb_ret_t
tree_callback (Widget *w, widget_msg_t msg, int parm)
{
    WTree *tree = (WTree *) w;
    Dlg_head *h = tree->widget.parent;

    switch (msg) {
    case WIDGET_DRAW:
	tree_frame (h, tree);
	show_tree (tree);
	return MSG_HANDLED;

    case WIDGET_KEY:
	return tree_key (tree, parm);

    case WIDGET_FOCUS:
	tree->active = 1;
	buttonbar_set_label (h, 1, _("Help"), tree_help_cmd);
	buttonbar_set_label_data (h, 2, _("Rescan"),
	    tree_rescan_command, tree);
	buttonbar_set_label_data (h, 3, _("Forget"), tree_forget_cmd, tree);
	buttonbar_set_label_data (h, 5, _("Copy"), tree_copy_cmd, tree);
	buttonbar_set_label_data (h, 6, _("RenMov"), tree_move_cmd, tree);
#if 0
	/* FIXME: mkdir is currently defunct */
	buttonbar_set_label_data (h, 7, _("Mkdir"), tree_mkdir_cmd, tree);
#else
	buttonbar_clear_label (h, 7);
#endif
	buttonbar_set_label_data (h, 8, _("Rmdir"), tree_rmdir_command, tree);
	set_navig_label (tree);
	buttonbar_redraw (h);


	/* FIXME: Should find a better way of only displaying the
	   currently selected item */
	show_tree (tree);
	return MSG_HANDLED;

	/* FIXME: Should find a better way of changing the color of the
	   selected item */

    case WIDGET_UNFOCUS:
	tree->active = 0;
	show_tree (tree);
	return MSG_HANDLED;

    case WIDGET_DESTROY:
	tree_destroy (tree);
	return MSG_HANDLED;

    default:
	return default_proc (msg, parm);
    }
}
开发者ID:ebichu,项目名称:dd-wrt,代码行数:55,代码来源:tree.c


示例5: tree_key

static inline cb_ret_t
tree_key (WTree *tree, int key)
{
    int i;

    for (i = 0; tree_keymap [i].key_code; i++){
	if (key == tree_keymap [i].key_code){
	    if (tree_keymap [i].fn != tree_start_search)
	        tree->searching = 0;
	    (*tree_keymap [i].fn)(tree);
	    show_tree (tree);
	    return MSG_HANDLED;
	}
    }

    /* We do not want to use them if we do not need to */
    /* Input line may want to take the motion key event */
    if (key == KEY_LEFT)
	return move_left (tree) ? MSG_HANDLED : MSG_NOT_HANDLED;

    if (key == KEY_RIGHT)
	return move_right (tree) ? MSG_HANDLED : MSG_NOT_HANDLED;

    if (is_abort_char (key)) {
	if (tree->is_panel) {
	    tree->searching = 0;
	    show_tree (tree);
	    return MSG_HANDLED;  /* eat abort char */
	}
	/* modal tree dialog: let upper layer see the
	   abort character and close the dialog */
	return MSG_NOT_HANDLED;
    }

    /* Do not eat characters not meant for the tree below ' ' (e.g. C-l). */
    if ((key >= ' ' && key <= 255) || key == KEY_BACKSPACE) {
	if (tree->searching){
	    tree_do_search (tree, key);
	    show_tree (tree);
	    return MSG_HANDLED;
	}

	if (!command_prompt) {
	    tree_start_search (tree);
	    tree_do_search (tree, key);
	    return MSG_HANDLED;
	}
	return tree->is_panel ? MSG_HANDLED : MSG_NOT_HANDLED;
    }

    return MSG_NOT_HANDLED;
}
开发者ID:ebichu,项目名称:dd-wrt,代码行数:52,代码来源:tree.c


示例6: tree_event

static int
tree_event (Gpm_Event * event, void *data)
{
    WTree *tree = (WTree *) data;
    Widget *w = WIDGET (data);
    Gpm_Event local;

    if (!mouse_global_in_widget (event, w))
        return MOU_UNHANDLED;

    /* rest of the upper frame - call menu */
    if (tree->is_panel && (event->type & GPM_DOWN) != 0 && event->y == WIDGET (w->owner)->y + 1)
        return MOU_UNHANDLED;

    local = mouse_get_local (event, w);

    if ((local.type & GPM_UP) == 0)
        return MOU_NORMAL;

    if (tree->is_panel)
        local.y--;

    local.y--;

    if (!tree->active)
        change_panel ();

    if (local.y < 0)
    {
        tree_move_backward (tree, tlines (tree) - 1);
        show_tree (tree);
    }
    else if (local.y >= tlines (tree))
    {
        tree_move_forward (tree, tlines (tree) - 1);
        show_tree (tree);
    }
    else if ((local.type & (GPM_UP | GPM_DOUBLE)) == (GPM_UP | GPM_DOUBLE))
    {
        if (tree->tree_shown[local.y] != NULL)
        {
            tree->selected_ptr = tree->tree_shown[local.y];
            tree->topdiff = local.y;
        }
        tree_chdir_sel (tree);
    }

    return MOU_NORMAL;
}
开发者ID:GalaxyTab4,项目名称:workbench,代码行数:49,代码来源:tree.c


示例7: show_tree

/**
 *  木の内容を表示する関数(帰りがけ順)
 *  @param TREE *p 表示したい部分木
 *      for Debug
 */
void show_tree(TREE *p)
{
    // 要素が登録されていない
    if (p->left == p || p->right == p)
        return ;
    
    // 左へ
    if(p->left != NULL)
        show_tree(p->left);
    
    printf("id: %d\n", p->id);
    
    // 右へ
    if(p->right != NULL)
        show_tree(p->right);
}
开发者ID:tiwanari,项目名称:pro_exce,代码行数:21,代码来源:03-123006.c


示例8: show_entry

/* A file entry went away or appeared */
static void show_entry(struct diff_options *opt, const char *prefix,
		       struct tree_desc *desc, struct strbuf *base)
{
	unsigned mode;
	const char *path;
	const unsigned char *sha1 = tree_entry_extract(desc, &path, &mode);
	int pathlen = tree_entry_len(path, sha1);
	int old_baselen = base->len;

	strbuf_add(base, path, pathlen);
	if (DIFF_OPT_TST(opt, RECURSIVE) && S_ISDIR(mode)) {
		enum object_type type;
		struct tree_desc inner;
		void *tree;
		unsigned long size;

		tree = read_sha1_file(sha1, &type, &size);
		if (!tree || type != OBJ_TREE)
			die("corrupt tree sha %s", sha1_to_hex(sha1));

		if (DIFF_OPT_TST(opt, TREE_IN_RECURSIVE))
			opt->add_remove(opt, *prefix, mode, sha1, base->buf, 0);

		strbuf_addch(base, '/');

		init_tree_desc(&inner, tree, size);
		show_tree(opt, prefix, &inner, base);
		free(tree);
	} else
		opt->add_remove(opt, prefix[0], mode, sha1, base->buf, 0);

	strbuf_setlen(base, old_baselen);
}
开发者ID:julesbowden,项目名称:git,代码行数:34,代码来源:tree-diff.c


示例9: main

int main()
{
    ptree root = NULL;
    create_tree(&root);
    show_tree(root);
    return 0;
}
开发者ID:zhipc,项目名称:codeStorage,代码行数:7,代码来源:create_tree.c


示例10: show_entry

/* A file entry went away or appeared */
static int show_entry(struct diff_options *opt, const char *prefix, struct tree_desc *desc, const char *base)
{
	unsigned mode;
	const char *path;
	const unsigned char *sha1 = extract(desc, &path, &mode);

	if (opt->recursive && S_ISDIR(mode)) {
		char type[20];
		char *newbase = malloc_base(base, path, strlen(path));
		struct tree_desc inner;
		void *tree;

		tree = read_sha1_file(sha1, type, &inner.size);
		if (!tree || strcmp(type, "tree"))
			die("corrupt tree sha %s", sha1_to_hex(sha1));

		inner.buf = tree;
		show_tree(opt, prefix, &inner, newbase);

		free(tree);
		free(newbase);
		return 0;
	}

	opt->add_remove(opt, prefix[0], mode, sha1, base, path);
	return 0;
}
开发者ID:4ker,项目名称:annotated-git-1.0,代码行数:28,代码来源:tree-diff.c


示例11: selected_lvl

void MainWindow::on_actionRemove_triggered()
{
    if(ui->treeWidget->selectedItems().count() == 0)
    {
        QErrorMessage error_mes;
        error_mes.showMessage("Node was not selected");
        error_mes.exec();
        return;
    }
    int lvl = selected_lvl();
    space * wp = (space*)getRoot();
    if(lvl == 0){
        remove_space();

    }else if(lvl == 1){
        int index_star = selected_index(0);
        remove_star(index_star);

    }else if(lvl == 2){
        int index_star = selected_index(1);
        star * p_star = (star*)wp->sublvl[index_star];
        int index_planet = selected_index(0);
        remove_planet(p_star,index_planet);

    }else if(lvl == 3){
        int index_star = selected_index(2);
        star * p_star = (star*)wp->sublvl[index_star];
        int index_planet = selected_index(1);
        planet * p_planet = (planet*)p_star->sublvl[index_planet];
        int index_sat = selected_index(0);
        remove_satellite(p_planet,index_sat);
    }
    show_tree();
}
开发者ID:kreatimont,项目名称:CourseWork_upd,代码行数:34,代码来源:mainwindow.cpp


示例12: show_entry

/* A file entry went away or appeared */
static void show_entry(struct diff_options *opt, const char *prefix, struct tree_desc *desc,
		       const char *base, int baselen)
{
	unsigned mode;
	const char *path;
	const unsigned char *sha1 = tree_entry_extract(desc, &path, &mode);
	int pathlen = tree_entry_len(path, sha1);

	if (DIFF_OPT_TST(opt, RECURSIVE) && S_ISDIR(mode)) {
		enum object_type type;
		char *newbase = malloc_base(base, baselen, path, pathlen);
		struct tree_desc inner;
		void *tree;
		unsigned long size;

		tree = read_sha1_file(sha1, &type, &size);
		if (!tree || type != OBJ_TREE)
			die("corrupt tree sha %s", sha1_to_hex(sha1));

		init_tree_desc(&inner, tree, size);
		show_tree(opt, prefix, &inner, newbase, baselen + 1 + pathlen);

		free(tree);
		free(newbase);
	} else {
		char *fullname = malloc_fullname(base, baselen, path, pathlen);
		opt->add_remove(opt, prefix[0], mode, sha1, fullname);
		free(fullname);
	}
}
开发者ID:Inkdit,项目名称:git,代码行数:31,代码来源:tree-diff.c


示例13: cmd_ilist

int cmd_ilist(string str) {
    object ob;
    string file, *files;
    int deep_list, i, s;

    notify_fail(SYNTAX);
    if(!str)
        return 0;
    
    seteuid(geteuid(previous_object()));

    if(sscanf(str, "-R %s", file))
        deep_list = 1;
    else if(sscanf(str, "-T %s", file))
        deep_list = 2;
    else 
        file = str;

    ob = ref_ob(file);

    if(!ob || !objectp(ob)) {
        notify_fail("Couldn't find object.\n");
        return 0;
        }

    write(wrap("Files inherited by " + dump_variable(ob)));
    if(!deep_list) files = inherit_list(ob);
    else if(deep_list == 1) files = deep_inherit_list(ob);
    else if(deep_list == 2) return show_tree(ob, 1);
    
    for(i = 0, s = sizeof(files); i < s; i ++)
        printf("     %d: %s\n", i + 1, files[i]);
    return 1;
    } // do_cmd
开发者ID:ClockworkSoul,项目名称:MortalRemains,代码行数:34,代码来源:_ilist.c


示例14: main

int main()
{
    struct tree *phead = NULL;
    init_node_head(&phead, sizeof(struct tree));
    create_tree(phead);
    show_tree(phead);
    return 0;
}
开发者ID:zhipc,项目名称:codeStorage,代码行数:8,代码来源:tree_chain.c


示例15: tree_event

static int
tree_event (Gpm_Event * event, void *data)
{
    WTree *tree = (WTree *) data;
    Widget *w = (Widget *) data;
    Gpm_Event local;

    if (!mouse_global_in_widget (event, w))
        return MOU_UNHANDLED;

    local = mouse_get_local (event, w);

    /* rest of the upper frame, the menu is invisible - call menu */
    if (tree->is_panel && (local.type & GPM_DOWN) != 0 && local.y == 1 && !menubar_visible)
        return the_menubar->widget.mouse (event, the_menubar);

    if ((local.type & GPM_UP) == 0)
        return MOU_NORMAL;

    if (tree->is_panel)
        local.y--;

    local.y--;

    if (!tree->active)
        change_panel ();

    if (local.y < 0)
    {
        tree_move_backward (tree, tlines (tree) - 1);
        show_tree (tree);
    }
    else if (local.y >= tlines (tree))
    {
        tree_move_forward (tree, tlines (tree) - 1);
        show_tree (tree);
    }
    else
    {
        tree_mouse_click (tree, local.y);
        if ((local.type & (GPM_UP | GPM_DOUBLE)) == (GPM_UP | GPM_DOUBLE))
            tree_chdir_sel (tree);
    }

    return MOU_NORMAL;
}
开发者ID:ryanlee,项目名称:mc,代码行数:46,代码来源:tree.c


示例16: tree_event

/* Handle mouse click */
static void
tree_event (WTree *tree, int y)
{
    if (tree->tree_shown [y]){
	tree->selected_ptr = tree->tree_shown [y];
	tree->topdiff = y;
    }
    show_tree (tree);
}
开发者ID:ebichu,项目名称:dd-wrt,代码行数:10,代码来源:tree.c


示例17: show_array

/**
 *  配列の中身を表示する関数
 *      for Debug
 */
void show_array()
{
    int i;
    
    for (i = 0; i < n_words; i++)
    {
        printf("%s ->", words[i]->word);
        show_tree(&(words[i]->second_words));
        putchar('\n');
    }
}
开发者ID:tiwanari,项目名称:pro_exce,代码行数:15,代码来源:03-123006.c


示例18: move_right

static int
move_right (WTree *tree)
{
    if (tree_navigation_flag){
	tree_move_to_child (tree);
	show_tree (tree);
	maybe_chdir (tree);
	return 1;
    }
    return 0;
}
开发者ID:ebichu,项目名称:dd-wrt,代码行数:11,代码来源:tree.c


示例19: remove_space

void MainWindow::on_actionClear_tree_triggered()
{
    if(ui->treeWidget->selectedItems().count() == 0)
    {
        QErrorMessage error_mes;
        error_mes.showMessage("Tree doesn`t exist");
        error_mes.exec();
        return;
    }
    remove_space();
    show_tree();
}
开发者ID:kreatimont,项目名称:CourseWork_upd,代码行数:12,代码来源:mainwindow.cpp


示例20: move_left

static int
move_left (WTree *tree)
{
    int v;

    if (tree_navigation_flag){
	v = tree_move_to_parent (tree);
	show_tree (tree);
	maybe_chdir (tree);
	return v;
    }
    return 0;
}
开发者ID:ebichu,项目名称:dd-wrt,代码行数:13,代码来源:tree.c



注:本文中的show_tree函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ show_usage函数代码示例发布时间:2022-05-30
下一篇:
C++ show_trace函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap