summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/task/argument-task.hh
diff options
context:
space:
mode:
authorMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
committerMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
commit967be9e750221ab2ab783f95df79bb26d290a45e (patch)
tree6802900a5e975f9f68b169f0f503f040056d6952 /tiger-compiler/src/task/argument-task.hh
add: added projectsHEADmain
Diffstat (limited to 'tiger-compiler/src/task/argument-task.hh')
-rw-r--r--tiger-compiler/src/task/argument-task.hh58
1 files changed, 58 insertions, 0 deletions
diff --git a/tiger-compiler/src/task/argument-task.hh b/tiger-compiler/src/task/argument-task.hh
new file mode 100644
index 0000000..775b084
--- /dev/null
+++ b/tiger-compiler/src/task/argument-task.hh
@@ -0,0 +1,58 @@
+/**
+ ** \file task/argument-task.hh
+ ** \brief Declare the task::ArgumentTask class.
+ */
+
+#pragma once
+
+#include <string>
+
+#include <task/task.hh>
+
+namespace task
+{
+ /** \brief A `Task' expecting arguments prior to be executed.
+
+ This class embodies tasks which need an additional parameter for their
+ `execute()' method. Therefore a call to `arg_set()' must be made prior to
+ the `execute()' method, to set the value of this expected argument.
+ This class also automates the registering of its derived classes, as does its
+ sibling class `SimpleTask' for tasks without additional argument.
+ */
+ class ArgumentTask : public Task
+ {
+ /** \name Ctor & dtor.
+ ** \{ */
+ public:
+ /// Construct and register an ArgumentTask.
+ ArgumentTask(const char* name,
+ const char* module_name,
+ const char* desc,
+ const char* argname,
+ std::string deps = "");
+
+ /** \} */
+
+ /** \name Accessors.
+ ** \{ */
+ public:
+ /// Access to 'arg'.
+ const std::string& arg_get() const;
+
+ /// Access to `arg'.
+ virtual void arg_set(const std::string& arg) const;
+
+ /// Access to `argname'.
+ const char* argname_get() const;
+
+ /** \} */
+
+ protected:
+ /// ArgumentTask argument value.
+ mutable std::string arg_;
+
+ /// Argument name to be displayed when printing.
+ const char* argname_;
+ };
+
+} // namespace task