retdec-cpp
decompilation.h
Go to the documentation of this file.
1 
8 #ifndef RETDEC_DECOMPILATION_H
9 #define RETDEC_DECOMPILATION_H
10 
11 #include <functional>
12 #include <memory>
13 #include <string>
14 
15 #include "retdec/resource.h"
16 
17 namespace retdec {
18 
19 class File;
20 
21 namespace internal {
22 
23 class Connection;
24 class DecompilationImpl;
25 
26 } // namespace internal
27 
31 class Decompilation: public Resource {
32 public:
34  using Callback = std::function<void (const Decompilation &decompilation)>;
35 
40  enum class OnError {
41  Throw,
42  NoThrow
43  };
44 
45 public:
47  Decompilation(const std::string &id,
48  const std::shared_ptr<::retdec::internal::Connection> &conn);
50  virtual ~Decompilation() override;
51 
54  int getCompletion();
55  int getCompletion() const noexcept;
57 
60  void waitUntilFinished(OnError onError = OnError::Throw);
61  void waitUntilFinished(const Callback &callback,
62  OnError onError = OnError::Throw);
64 
67  std::shared_ptr<File> getOutputHllFile();
68  std::string getOutputHll();
70 
71 private:
72  internal::DecompilationImpl *impl() noexcept;
73  const internal::DecompilationImpl *impl() const noexcept;
74 };
75 
76 } // namespace retdec
77 
78 #endif
Representation of a decompilation.
Definition: decompilation.h:31
The namespace of the library.
Definition: doxygen.h:8
std::function< void(const Decompilation &decompilation)> Callback
Type of a callback for waitUntilFinished().
Definition: decompilation.h:34
OnError
What should the waiting member functions do when a decompilation fails?
Definition: decompilation.h:40
Base class of all resources.
Base class of all resources.
Definition: resource.h:24