From 1e9b82839efb7eee4def01017811bedaba1ca555 Mon Sep 17 00:00:00 2001 From: karliss Date: Sun, 31 May 2020 09:20:54 +0300 Subject: [PATCH] Add documentation for TempConfig. (#2221) --- src/common/TempConfig.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/common/TempConfig.h b/src/common/TempConfig.h index 4f6b8fb8..7dbcb650 100644 --- a/src/common/TempConfig.h +++ b/src/common/TempConfig.h @@ -5,6 +5,23 @@ #include #include +/** + * @brief Class for temporary modifying r2 `e` configuration. + * + * Modified values will be restored at the end of scope. This is useful when using a r2 command that can only + * be configured using `e` configuration and doesn't accept arguments. TempConfig::set calls can be chained. + * If a command or r2 method accepts arguments directly it is preferred to use those instead of temporary modifying + * global configuration. + * + * \code + * { + * TempConfig tempConfig; + * tempConfig.set("asm.arch", "x86").set("asm.comments", false); + * return Core()->cmdRaw("pd"); + * // config automatically restored at the end of scope + * } + * \endcode + */ class TempConfig { public: @@ -16,6 +33,8 @@ public: TempConfig &set(const QString &key, bool value); private: + TempConfig(const TempConfig&) = delete; + TempConfig &operator=(const TempConfig&) = delete; QMap resetValues; };