X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FConsole%2FtestServer.cc;h=9db2b09e27b42c36e964898e5c153ff5eab82c83;hb=6aae6e526573187ece558842e928578e5aa4cc4c;hp=5d1a323c626ad6388c3e413df6953354b5e60019;hpb=601d1f509f5bb24df167a4dd5a20da67a0af9af8;p=senf.git diff --git a/senf/Utils/Console/testServer.cc b/senf/Utils/Console/testServer.cc index 5d1a323..9db2b09 100644 --- a/senf/Utils/Console/testServer.cc +++ b/senf/Utils/Console/testServer.cc @@ -1,6 +1,6 @@ // $Id$ // -// Copyright (C) 2008 +// Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund @@ -25,10 +25,11 @@ // Custom includes #include -#include +#include #include namespace kw = senf::console::kw; +namespace fty = senf::console::factory; void echo(std::ostream & output, senf::console::ParseCommandInfo const & command) { @@ -45,16 +46,16 @@ struct TestObject { senf::console::ScopedDirectory dir; - TestObject() - : dir(this) + TestObject() + : dir(this) { - dir.add("vat", &TestObject::vat) - .arg("vat", "VAT in %", kw::default_value = 19) - .arg("amount", "Amount including VAT") - .doc("Returns the amount of {vat}-% VAT included in {amount}"); + dir.add("vat", fty::Command(&TestObject::vat, this) + .arg("vat", "VAT in %", kw::default_value = 19) + .arg("amount", "Amount including VAT") + .doc("Returns the amount of {vat}-% VAT included in {amount}") ); } - double vat (int vat, double amount) + double vat (int vat, double amount) { return amount * vat/(100.0+vat); } @@ -80,13 +81,13 @@ int main(int, char **) .doc("This is the console test application"); senf::console::root() - .mkdir("console") - .doc("Console settings"); + .add("console",fty::Directory() + .doc("Console settings")); senf::console::DirectoryNode & serverDir ( senf::console::root() - .mkdir("server") - .doc("server commands") ); + .add("server",fty::Directory() + .doc("server commands"))); senf::console::ScopedDirectory<> testDir; senf::console::root() @@ -94,25 +95,25 @@ int main(int, char **) .doc("Test functions"); senf::console::root()["console"] - .add("showlog", &enableLogging) - .doc("Enable display of log messages on the current console"); + .add("showlog", fty::Command(&enableLogging) + .doc("Enable display of log messages on the current console")); - senf::console::root().link("sl", senf::console::root()["console"]("showlog")); + senf::console::root().add("sl", fty::Link(senf::console::root()["console"]("showlog"))); serverDir - .add("shutdown", &shutdownServer) - .doc("Terminate server application"); + .add("shutdown", fty::Command(&shutdownServer) + .doc("Terminate server application")); testDir - .add("echo", &echo) - .doc("Example of a function utilizing manual argument parsing"); + .add("echo", fty::Command(&echo) + .doc("Example of a function utilizing manual argument parsing")); TestObject test; testDir .add("extra", test.dir) .doc("Example of an instance directory"); - senf::console::root().link("ex", test.dir); + senf::console::root().add("ex", fty::Link(test.dir)); senf::console::Server::start( senf::INet4SocketAddress(23232u) ) .name("testServer");