mCRL2
Loading...
Searching...
No Matches
xinput_output_tool.h
Go to the documentation of this file.
1// Author(s): Willem Rietdijk
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
11
12#ifndef MCRL2_UTILITIES_XINPUT_OUTPUT_TOOL_H
13#define MCRL2_UTILITIES_XINPUT_OUTPUT_TOOL_H
14
16
17namespace mcrl2
18{
19
20namespace utilities
21{
22
23namespace tools
24{
25
28{
29 protected:
31 std::string m_output_filename;
32
35 void check_positional_options(const command_line_parser& parser) override
36 {
37 if (max_input_files > 0 && max_input_files + 1 < parser.arguments.size())
38 {
39 parser.error("too many file arguments");
40 }
41 else if (min_input_files + 1 > parser.arguments.size())
42 {
43 parser.error("too few file arguments");
44 }
45 }
46
49 std::string synopsis() const override
50 {
51 return "[OPTION]... [INFILES [OUTFILE]]\n";
52 }
53
56 void parse_options(const command_line_parser& parser) override
57 {
58 // Read input filenames from arguments list
60
61 // Remove last input filename and set as output filename
64 }
65
67 std::string output_file_message() const
68 {
69 std::ostringstream out;
70 out << "Output written to "
71 << ((m_output_filename.empty()) ? "standard output" : ("'" + m_output_filename + "'"));
72 return out.str();
73 }
74
76 std::string make_tool_description(const std::string& description) const
77 {
78 // return utilities::word_wrap_text(description + " If INFILE is not present, standard input is used.");
79 return description;
80 }
81
82 public:
84 xinput_output_tool(const std::string& name,
85 const std::string& author,
86 const std::string& what_is,
87 const std::string& tool_description,
88 std::string known_issues = "",
89 uint16_t min = 0,
90 uint16_t max = 0
91 )
92 : xinput_tool(name, author, what_is, tool_description, known_issues, min, max)
93 {
94 }
95
97 const std::string& output_filename() const { return m_output_filename; }
98
100 std::string& output_filename() { return m_output_filename; }
101};
102
103} // namespace tools
104
105} // namespace utilities
106
107} // namespace mcrl2
108
109#endif // MCRL2_UTILITIES_XINPUT_OUTPUT_TOOL_H
Base class for tools that take an x number of files as input and one output file.
void parse_options(const command_line_parser &parser) override
Parse non-standard options.
xinput_output_tool(const std::string &name, const std::string &author, const std::string &what_is, const std::string &tool_description, std::string known_issues="", uint16_t min=0, uint16_t max=0)
Constructor.
std::string synopsis() const override
Returns the synopsis of the tool.
std::string output_file_message() const
Returns a message about the input filename.
std::string m_output_filename
The output file name.
std::string & output_filename()
Returns a reference to the output filename.
void check_positional_options(const command_line_parser &parser) override
Checks if the number of positional options is OK.
std::string make_tool_description(const std::string &description) const
Adds a message about input files to the given description.
const std::string & output_filename() const
Returns a const reference to the output filename.
Base class for tools that take an x number of files as input.
Definition xinput_tool.h:28
const std::vector< std::string > & input_filenames() const
Returns a const reference to the input filenames.
void parse_options(const command_line_parser &parser) override
Parse non-standard options.
Definition xinput_tool.h:60
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
Base class for tools that take an x number of files as input and one output file.