diff options
author | Murray Cumming <murrayc@murrayc.com> | 2008-07-29 10:56:31 +0000 |
---|---|---|
committer | Murray Cumming <murrayc@src.gnome.org> | 2008-07-29 10:56:31 +0000 |
commit | 6c9256a16561e6bbb87607af7351e79ab3860bda (patch) | |
tree | 1bd1c51741f86b98afc6274ca28c6dcbc8473e59 /tests | |
parent | 436daf15106fd3d47c4f36ad0611f656b2ac9982 (diff) | |
download | glibmm-6c9256a16561e6bbb87607af7351e79ab3860bda.tar.gz |
find(), find_child(), traverse(), foreach(): Rearrange the parameters so
2008-07-29 Murray Cumming <murrayc@murrayc.com>
* glib/src/nodetree.hg: find(), find_child(), traverse(), foreach():
Rearrange the parameters so we can have default values.
* tests/glibmm_nodetree/main.cc: Adapted.
svn path=/trunk/; revision=702
Diffstat (limited to 'tests')
-rw-r--r-- | tests/glibmm_nodetree/main.cc | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/tests/glibmm_nodetree/main.cc b/tests/glibmm_nodetree/main.cc index 2e68c276..28fabfbd 100644 --- a/tests/glibmm_nodetree/main.cc +++ b/tests/glibmm_nodetree/main.cc @@ -36,58 +36,56 @@ int main() tc.append(te); te.prepend_data(f); - const type_nodetree_string::TraverseFlags flags = - type_nodetree_string::TraverseFlags(type_nodetree_string::TRAVERSE_LEAVES | type_nodetree_string::TRAVERSE_NON_LEAVES); std::cout << "Breadth-first:" << std::endl; - ta.traverse(Glib::LEVEL_ORDER, flags, INT_MAX, echoslot); + ta.traverse(echoslot, Glib::LEVEL_ORDER); std::cout << std::endl; std::cout << "Depth-first (pre):" << std::endl; - ta.traverse(Glib::PRE_ORDER, flags, INT_MAX, echoslot); + ta.traverse(echoslot, Glib::PRE_ORDER); std::cout << std::endl; std::cout << "Depth-first (in):" << std::endl; - ta.traverse(Glib::IN_ORDER, flags, INT_MAX, echoslot); + ta.traverse(echoslot, Glib::IN_ORDER); std::cout << std::endl; std::cout << "Depth-first (post):" << std::endl; - ta.traverse(Glib::POST_ORDER, flags, INT_MAX, echoslot); + ta.traverse(echoslot, Glib::POST_ORDER); std::cout << std::endl; std::cout << "Leaf children of 'a':" << std::endl; - ta.foreach(type_nodetree_string::TRAVERSE_ALL, sigc::bind<bool>(sigc::ptr_fun(echol), true)); + ta.foreach(sigc::bind<bool>(sigc::ptr_fun(echol), true)); std::cout << std::endl; std::cout << "Non-leaf children of 'a':" << std::endl; - ta.foreach(type_nodetree_string::TRAVERSE_ALL, sigc::bind<bool>(sigc::ptr_fun(echol), false)); + ta.foreach(sigc::bind<bool>(sigc::ptr_fun(echol), false)); std::cout << std::endl; - type_nodetree_string* tmp = ta.find(Glib::IN_ORDER, flags, e); + type_nodetree_string* tmp = ta.find(e, Glib::IN_ORDER); if(!tmp) std::cout << e << " not found" << std::endl; else std::cout << "Found " << (tmp->data()) << std::endl; - tmp = ta.find(Glib::IN_ORDER, flags, a); + tmp = ta.find(a, Glib::IN_ORDER); if(!tmp) std::cout << a << " not found" << std::endl; else std::cout << "Found " << (tmp->data()) << std::endl; - tmp = ta.find(Glib::IN_ORDER, flags, "f"); + tmp = ta.find("f", Glib::IN_ORDER); if(!tmp) std::cout << a << " not found" << std::endl; else std::cout << "Found " << (tmp->data()) << std::endl; - tmp = ta.find_child(flags, e); + tmp = ta.find_child(e); if(!tmp) std::cout << e << " is not a child of " << (ta.data()) << std::endl; else std::cout << "Mistakenly found " << e << " in " << (ta.data()) << "'s children" << std::endl; - tmp = ta.find_child(flags, c); + tmp = ta.find_child(c); if(!tmp) std::cout << c << " is the number " << ta.child_index(c) << " child of " << (ta.data()) << std::endl; else |