retdec-cpp
decompilation_arguments.h
Go to the documentation of this file.
1 
8 #ifndef RETDEC_DECOMPILATION_ARGUMENTS_H
9 #define RETDEC_DECOMPILATION_ARGUMENTS_H
10 
11 #include <map>
12 #include <memory>
13 #include <string>
14 
15 namespace retdec {
16 
17 class File;
18 
23 private:
25  using Arguments = std::map<std::string, std::string>;
26 
28  using Files = std::map<std::string, std::shared_ptr<File>>;
29 
30 public:
32  using ArgumentIterator = Arguments::const_iterator;
33 
35  using FileIterator = Files::const_iterator;
36 
37 public:
47 
50  DecompilationArguments &mode(const std::string &mode);
51  DecompilationArguments withMode(const std::string &mode) const;
52  bool hasMode() const;
53  std::string mode() const;
55 
58  DecompilationArguments &selDecompRanges(const std::string &ranges);
59  DecompilationArguments withSelDecompRanges(const std::string &ranges);
60  bool hasSelDecompRanges() const;
61  std::string selDecompRanges() const;
63 
66  DecompilationArguments &selDecompDecoding(const std::string &decoding);
67  DecompilationArguments withSelDecompDecoding(const std::string &decoding);
68  bool hasSelDecompDecoding() const;
69  std::string selDecompDecoding() const;
71 
74  DecompilationArguments &inputFile(const std::shared_ptr<File> &file);
75  DecompilationArguments withInputFile(const std::shared_ptr<File> &file) const;
76  bool hasInputFile() const;
77  std::shared_ptr<File> inputFile() const;
79 
82  DecompilationArguments &argument(const std::string &id,
83  const std::string &value);
84  DecompilationArguments withArgument(const std::string &id,
85  const std::string &value) const;
86  bool hasArgument(const std::string &id) const;
87  std::string argument(const std::string &id) const;
91 
94  DecompilationArguments &file(const std::string &id,
95  const std::shared_ptr<File> &file);
96  DecompilationArguments withFile(const std::string &id,
97  const std::shared_ptr<File> &file) const;
98  bool hasFile(const std::string &id) const;
99  std::shared_ptr<File> file(const std::string &id) const;
100  FileIterator filesBegin() const;
101  FileIterator filesEnd() const;
103 
104 private:
106  Arguments arguments;
107 
109  Files files;
110 };
111 
112 } // namespace retdec
113 
114 #endif
bool hasInputFile() const
Is the input file set?
Definition: decompilation_arguments.cpp:212
FileIterator filesBegin() const
Returns an iterator to the beginning of arguments.
Definition: decompilation_arguments.cpp:310
DecompilationArguments & argument(const std::string &id, const std::string &value)
Sets the argument of the given ID to the given value.
Definition: decompilation_arguments.cpp:226
The namespace of the library.
Definition: doxygen.h:8
Arguments for decompilations.
Definition: decompilation_arguments.h:22
DecompilationArguments withSelDecompRanges(const std::string &ranges)
Returns a copy of the arguments with a different ranges for selective decompilation.
Definition: decompilation_arguments.cpp:143
bool hasSelDecompRanges() const
Are the ranges for selective decompilation set?
Definition: decompilation_arguments.cpp:151
DecompilationArguments withMode(const std::string &mode) const
Returns a copy of the arguments with a different mode.
Definition: decompilation_arguments.cpp:97
std::string selDecompDecoding() const
Returns the type of decoding for selective decompilation.
Definition: decompilation_arguments.cpp:189
DecompilationArguments & operator=(const DecompilationArguments &other)
Copy-assigns the given arguments.
bool hasFile(const std::string &id) const
Is a file of the given ID present?
Definition: decompilation_arguments.cpp:294
FileIterator filesEnd() const
Returns an iterator past the last argument.
Definition: decompilation_arguments.cpp:317
Files::const_iterator FileIterator
Iterator for files.
Definition: decompilation_arguments.h:35
bool hasArgument(const std::string &id) const
Is an argument of the given ID present?
Definition: decompilation_arguments.cpp:245
ArgumentIterator argumentsBegin() const
Returns an iterator to the beginning of arguments.
Definition: decompilation_arguments.cpp:261
DecompilationArguments()
Constructs default arguments.
ArgumentIterator argumentsEnd() const
Returns an iterator past the last argument.
Definition: decompilation_arguments.cpp:268
DecompilationArguments & file(const std::string &id, const std::shared_ptr< File > &file)
Sets the file of the given ID to the given value.
Definition: decompilation_arguments.cpp:275
std::shared_ptr< File > inputFile() const
Returns the input file.
Definition: decompilation_arguments.cpp:219
bool hasMode() const
Is the mode set?
Definition: decompilation_arguments.cpp:105
DecompilationArguments withSelDecompDecoding(const std::string &decoding)
Returns a copy of the arguments with a different type of decoding for selective decompilation.
Definition: decompilation_arguments.cpp:174
DecompilationArguments withFile(const std::string &id, const std::shared_ptr< File > &file) const
Returns a copy of the files with a differing file of the given ID.
Definition: decompilation_arguments.cpp:284
std::string selDecompRanges() const
Returns the ranges for selective decompilation.
Definition: decompilation_arguments.cpp:158
bool hasSelDecompDecoding() const
Is the type of decoding for selective decompilation set?
Definition: decompilation_arguments.cpp:182
DecompilationArguments withInputFile(const std::shared_ptr< File > &file) const
Returns a copy of the arguments with a different input file.
Definition: decompilation_arguments.cpp:204
~DecompilationArguments()
Destructs the arguments.
DecompilationArguments withArgument(const std::string &id, const std::string &value) const
Returns a copy of the arguments with a differing argument of the given ID.
Definition: decompilation_arguments.cpp:235
Arguments::const_iterator ArgumentIterator
Iterator for arguments.
Definition: decompilation_arguments.h:32
std::string mode() const
Returns the mode.
Definition: decompilation_arguments.cpp:112