mCRL2
Loading...
Searching...
No Matches
input_input_output_tool.h
Go to the documentation of this file.
1// Author(s): Wieger Wesselink
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_INPUT_INPUT_OUTPUT_TOOL_H
13#define MCRL2_UTILITIES_INPUT_INPUT_OUTPUT_TOOL_H
14
16
17namespace mcrl2
18{
19
20namespace utilities
21{
22
23namespace tools
24{
25
29{
30 protected:
32 std::string m_output_filename;
33
36 void check_positional_options(const command_line_parser& parser)
37 {
38 if (3 < parser.arguments.size())
39 {
40 parser.error("too many file arguments");
41 }
42 }
43
45 std::string synopsis() const
46 {
47 return "[OPTION]... INFILE1 [INFILE2 [OUTFILE]]\n";
48 }
49
52 void parse_options(const command_line_parser& parser)
53 {
55 if (2 < parser.arguments.size())
56 {
57 m_output_filename = parser.arguments[2];
58 }
59 }
60
62 std::string output_file_message() const
63 {
64 std::ostringstream out;
65 out << "Output written to " << ((m_output_filename.empty())? "standard output" : ("'" + m_output_filename + "'"));
66 return out.str();
67 }
68
70 std::string make_tool_description(const std::string& description) const
71 {
72 return description + " If INFILE2 is not present, standard input is used. If OUTFILE is not present, standard output is used.";
73 }
74
75 public:
77 input_input_output_tool(const std::string& name,
78 const std::string& author,
79 const std::string& what_is,
80 const std::string& tool_description,
81 std::string known_issues = ""
82 )
83 : input_input_tool(name, author, what_is, tool_description, known_issues)
84 {
85 }
86
88 const std::string& output_filename() const
89 {
90 return m_output_filename;
91 }
92
94 std::string& output_filename()
95 {
96 return m_output_filename;
97 }
98};
99
100} // namespace tools
101
102} // namespace utilities
103
104} // namespace mcrl2
105
106#endif // MCRL2_UTILITIES_INPUT_INPUT_OUTPUT_TOOL_H
Base class for tools that take two files as input, and write the results to a file.
const std::string & output_filename() const
Returns a const reference to the output filename.
std::string make_tool_description(const std::string &description) const
Adds a message about input and output files to the given description.
std::string synopsis() const
Returns the synopsis of the tool.
std::string output_file_message() const
Returns a message about the output filename.
std::string & output_filename()
Returns a reference to the output filename.
void parse_options(const command_line_parser &parser)
Parse non-standard options.
input_input_output_tool(const std::string &name, const std::string &author, const std::string &what_is, const std::string &tool_description, std::string known_issues="")
Constructor.
void check_positional_options(const command_line_parser &parser)
Checks if the number of positional options is OK.
Base class for tools that take two files as input.
void parse_options(const command_line_parser &parser)
Parse non-standard options.
add your file description here.
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72