Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
command-setup.hpp
Go to the documentation of this file.
1/*
2 COMMAND-INSTANCE-SETUP.hpp - Key abstraction for steam/edit operations and UNDO management
3
4 Copyright (C)
5 2017, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
14
43#ifndef CONTROL_COMMAND_SETUP_H
44#define CONTROL_COMMAND_SETUP_H
45
46#include "lib/error.hpp"
47#include "lib/nocopy.hpp"
49#include "lib/symbol.hpp"
50
51#include <functional>
52#include <string>
53
54
55
56
57namespace steam {
58namespace control {
59
60 using std::string;
61 using lib::Symbol;
62
63 class CommandDef;
64
65 using DefinitionClosure = std::function<void(CommandDef&)>;
66
67
68
89 : util::Cloneable // copy-construction allowed, but no assignment
90 {
92
93 public:
95 CommandSetup (Symbol cmdID);
96
97 operator Symbol const&() const
98 {
99 return cmdID_;
100 }
101 operator string() const
102 {
103 return string{cmdID_};
104 }
105
108
110 static void invokeDefinitionClosures();
111
113 static size_t pendingCnt();
114
115 friend bool
116 operator== (CommandSetup const& left, CommandSetup const& right)
117 {
118 return left.cmdID_ == right.cmdID_;
119 }
120 friend bool
121 operator!= (CommandSetup const& left, CommandSetup const& right)
122 {
123 return left.cmdID_ != right.cmdID_;
124 }
125 };
126
127
128
129
135 #define COMMAND_DEFINITION(_NAME_) \
136 CommandSetup _NAME_ = CommandSetup{STRINGIFY(_NAME_)} = [](CommandDef& def)
137
138
139
140}} // namespace steam::control
141#endif /*CONTROL_COMMAND_SETUP_H*/
Token or Atom with distinct identity.
Definition symbol.hpp:120
Helper class used solely for defining a Command-Object.
Marker and Helper for writing Steam-Layer Command definitions.
friend bool operator==(CommandSetup const &left, CommandSetup const &right)
CommandSetup & operator=(DefinitionClosure)
core functionality: provide a command definition block.
static size_t pendingCnt()
diagnostics / test
friend bool operator!=(CommandSetup const &left, CommandSetup const &right)
Types marked with this mix-in may be duplicated by copy-construction, yet may not be moved or transfe...
Definition nocopy.hpp:96
Steam-Layer command frontend.
Lumiera error handling (C++ interface).
enable_if_c< Cond::value, T >::type enable_if
SFINAE helper to control the visibility of specialisations and overloads.
Definition meta/util.hpp:87
std::function< void(CommandDef &)> DefinitionClosure
Steam-Layer implementation namespace root.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Marker types to indicate a literal string and a Symbol.