]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
pluginlib: Fix compilation on older compilers.
authorradekk <radekk@bacula-devel-centos7.vm.korzeniewski.net>
Fri, 29 Oct 2021 09:28:46 +0000 (05:28 -0400)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:56:56 +0000 (13:56 +0200)
bacula/src/plugins/fd/pluginlib/execprog.h
bacula/src/plugins/fd/pluginlib/pluginclass.h
bacula/src/plugins/fd/pluginlib/pluginctx.h
bacula/src/plugins/fd/pluginlib/smartalist.h

index 225efe8e3bc95ca336a9bae9e2113ef77a8aa35a..864e760d1bd659b6db18fd7a70168c51688833f8 100644 (file)
@@ -187,8 +187,8 @@ public:
    /* and finally terminate execution when finish */
    int terminate(bpContext *ctx, bool raise_error = true);
 
-   inline POOL_MEM &get_error() noexcept { return m_errmsg; }
-   inline char *get_error_str() noexcept { return m_errmsg.c_str(); }
+   inline POOL_MEM &get_error() { return m_errmsg; }
+   inline char *get_error_str() { return m_errmsg.c_str(); }
 
    /* direct pipe management */
    inline int close_wpipe() { return ::close_wpipe(bpipe); }
index 78447bcdcbed8c45e2e711a651cec43dd3a1e22b..30026a258542c922c6ec4ce47240d33b51c966e8 100644 (file)
@@ -143,10 +143,11 @@ namespace pluginlib
       int m_listing_top_nr;            ///
       int m_listing_func;              ///
 
-      virtual bRC parse_plugin_config(bpContext *ctx, restore_object_pkt *rop) { return bRC_OK; }
+      virtual bRC parse_plugin_config(bpContext *ctx, restore_object_pkt *rop);
       virtual bRC parse_plugin_command(bpContext *ctx, const char *command);
 
       virtual bRC parse_plugin_restore_object(bpContext *ctx, restore_object_pkt *rop);
+      virtual bRC handle_plugin_config(bpContext *ctx, restore_object_pkt *rop) { return bRC_OK; }
       virtual bRC handle_plugin_restore_object(bpContext *ctx, restore_object_pkt *rop) { return bRC_OK; }
 
       virtual bRC prepare_estimate(bpContext *ctx, char *command) { return bRC_OK; }
@@ -188,9 +189,12 @@ namespace pluginlib
       virtual bRC perform_end_restore_file(bpContext *ctx) { return bRC_OK; }
       virtual bRC perform_cancel_command(bpContext *ctx) { return bRC_OK; }
 
-      virtual const char **get_listing_top_struct() noexcept { return NULL; }
+      virtual const char **get_listing_top_struct() { return NULL; }
 
       virtual void pluginctx_switch_command(const char *command) {}
+      virtual bool pluginctx_check_command(const char *command) { return false; }
+      virtual bool pluginctx_are_parameters_parsed() const { return false; }
+      virtual void pluginctx_set_parameters_parsed() {}
       virtual void pluginctx_clear_abort_on_error() {}
       virtual void pluginctx_set_abort_on_error() {}
       virtual bRC pluginctx_parse_parameter(bpContext *ctx, const char *argk, const char *argv) { return bRC_Error; }
@@ -222,6 +226,9 @@ namespace pluginlib
       COMMCTX<CTX> pluginctx;          /// the current plugin execution context
 
       virtual void pluginctx_switch_command(const char *command) { pluginctx.switch_command(command); }
+      virtual bool pluginctx_check_command(const char *command) { return pluginctx.check_command(command); }
+      virtual bool pluginctx_are_parameters_parsed() { return pluginctx->are_parameters_parsed(); }
+      virtual void pluginctx_set_parameters_parsed() { pluginctx->set_parameters_parsed(); }
       virtual void pluginctx_clear_abort_on_error() { pluginctx->clear_abort_on_error(); }
       virtual void pluginctx_set_abort_on_error() { pluginctx->set_abort_on_error(); }
       virtual bRC pluginctx_parse_parameter(bpContext *ctx, const char *argk, const char *argv) { return pluginctx->parse_parameter(ctx, argk, argv); }
index f1c2dfce080bd66473ac1d889722747dc0e45982..91cad398c8162853d8e089496a32ab317d5022b8 100644 (file)
@@ -51,6 +51,7 @@ namespace pluginlib
          f_fatal(false),
          abort_on_error(false),
          f_debug(false),
+         m_parameters_parsed(false),
          ini(),
          preg()
       { pm_strcpy(cmd, command); }
@@ -72,7 +73,7 @@ namespace pluginlib
        * @return true when is error
        * @return false when no error
        */
-      inline bool is_error() { return f_error || f_fatal; }
+      inline bool is_error() const { return f_error || f_fatal; }
 
       /**
        * @brief Checks if plugin context operation is flagged on f_fatal.
@@ -80,14 +81,14 @@ namespace pluginlib
        * @return true when is fatal error
        * @return false when no fatal error
        */
-      inline bool is_fatal() { return f_fatal || (f_error && abort_on_error); }
+      inline bool is_fatal() const { return f_fatal || (f_error && abort_on_error); }
 
       /**
        * @brief Return a Job Message error level based on context
        *
        * @return int
        */
-      inline int jmsg_err_level() { return is_fatal() ? M_FATAL : M_ERROR; }
+      inline int jmsg_err_level() const { return is_fatal() ? M_FATAL : M_ERROR; }
 
       /**
        * @brief Set the abort on error flag
@@ -105,7 +106,10 @@ namespace pluginlib
        * @return true if flag is set
        * @return false  if flag is not set
        */
-      bool is_abort_on_error() { return abort_on_error; }
+      inline bool is_abort_on_error() const { return abort_on_error; }
+
+      inline bool are_parameters_parsed() const { return m_parameters_parsed; }
+      inline void set_parameters_parsed() { m_parameters_parsed = true; }
 
    protected:
       POOL_MEM cmd;                 /// plugin command for this context
@@ -113,6 +117,7 @@ namespace pluginlib
       bool f_fatal;                 /// the plugin signaled a fatal error
       bool abort_on_error;          /// abort on error flag
       bool f_debug;                 /// when additional debugging required
+      bool m_parameters_parsed;
       ConfigFile ini;               /// Restore ini file handler
       regex_t preg;                 /// this is a regex context for include/exclude
 
index d50528742d9a00c58ebc6ce88640cee5a17ed37b..62155958cda3854743a5ab4b0ccc9942a9108fb5 100644 (file)
@@ -129,6 +129,7 @@ public:
       }
       return *this;
    }
+#if __cplusplus >= 201104
    // This is a simple move operator
    inline smart_alist<T> &operator=(smart_alist<T> &&other)
    {
@@ -140,6 +141,7 @@ public:
       }
       return *this;
    }
+#endif
 };
 
 #endif   /* _SMARTALIST_H_ */