senf::console::factory Namespace Reference

Console node factories. More...

Classes

class  Command
 OverloadedCommandNode factory. More...
 
class  Directory
 DirectoryNode factory. More...
 
class  Link
 LinkNode factory. More...
 
class  SimpleCommand
 SimpleCommandNode factory. More...
 
class  Variable
 Variable node factory. More...
 

Detailed Description

Console node factories.

The senf::console::factory namespace (customarily aliased to fty in user code) contains factories used to create new node types:

namespace fty = senf::console::factory;
senf::console::DirectoryNode & dir (node.add("dirname", fty::Directory()));
dir.add("name", fty::Command<void(bool)>(&fn)
.arg("flag")
.doc("documentation"));
The node is added by passing the factory instance to senf::console::DirectoryNode::add().

To further customize the node, you may call attributor members on the temporary factory class
instance. Since the attributor members always return a self-reference to the factory class
instance, attributor calls may be chained arbitrarily.

\see
    \ref console_commands for details on the command nodes \n
    \ref node_tree for details on the structural nodes (directory, link)

\note All factories are documented here as classes when in fact some are functions returning
    internal classes.

\par "Implementation note:" It is not true, that all attributor members return a self reference. Some
    attributor members will return a new object of slightly different type. However, the
    behavior is as documented above.