mCRL2
Loading...
Searching...
No Matches
input_input_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_TOOL_H
13#define MCRL2_UTILITIES_INPUT_INPUT_TOOL_H
14
16
17namespace mcrl2
18{
19
20namespace utilities
21{
22
23namespace tools
24{
25
28{
29 protected:
31 std::string m_input_filename1;
32
34 std::string m_input_filename2;
35
38 void check_positional_options(const command_line_parser& parser)
39 {
40 if (2 < parser.arguments.size())
41 {
42 parser.error("too many file arguments");
43 }
44 }
45
47 std::string synopsis() const
48 {
49 return "[OPTION]... INFILE1 [INFILE2]\n";
50 }
51
54 void parse_options(const command_line_parser& parser)
55 {
56 tool::parse_options(parser);
57 if (0 < parser.arguments.size())
58 {
59 m_input_filename1 = parser.arguments[0];
60 }
61 if (1 < parser.arguments.size())
62 {
63 m_input_filename2 = parser.arguments[1];
64 }
65 }
66
68 std::string input_file_message() const
69 {
70 std::ostringstream out;
71 out << "Input read from " << m_input_filename1 << " and " << ((m_input_filename2.empty())? "standard input" : ("'" + m_input_filename2 + "'"));
72 return out.str();
73 }
74
76 std::string make_tool_description(const std::string& description) const
77 {
78 return description + " If INFILE2 is not present, standard input is used.";
79 }
80
81 public:
83 input_input_tool(const std::string& name,
84 const std::string& author,
85 const std::string& what_is,
86 const std::string& tool_description,
87 std::string known_issues = ""
88 )
89 : tool(name, author, what_is, tool_description, known_issues)
90 {
91 }
92
94 const std::string& input_filename1() const
95 {
96 return m_input_filename1;
97 }
98
100 std::string& input_filename1()
101 {
102 return m_input_filename1;
103 }
104
106 const std::string& input_filename2() const
107 {
108 return m_input_filename2;
109 }
110
112 std::string& input_filename2()
113 {
114 return m_input_filename2;
115 }
116};
117
118} // namespace tools
119
120} // namespace utilities
121
122} // namespace mcrl2
123
124#endif // MCRL2_UTILITIES_INPUT_INPUT_TOOL_H
Base class for tools that take two files as input.
input_input_tool(const std::string &name, const std::string &author, const std::string &what_is, const std::string &tool_description, std::string known_issues="")
Constructor.
std::string & input_filename1()
Returns a reference to the first input filename.
const std::string & input_filename2() const
Returns a const reference to the second input filename.
const std::string & input_filename1() const
Returns a const reference to the first input 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 m_input_filename1
The first input file name.
std::string input_file_message() const
Returns a message about the input filename.
void check_positional_options(const command_line_parser &parser)
Checks if the number of positional options is OK.
std::string synopsis() const
Returns the synopsis of the tool.
std::string m_input_filename2
The second input file name.
std::string & input_filename2()
Returns a reference to the first second filename.
void parse_options(const command_line_parser &parser)
Parse non-standard options.
Base class for command line tools. as result.
Definition tool.h:39
virtual void parse_options(const command_line_parser &parser)
Parse non-standard options.
Definition tool.h:76
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
add your file description here.