]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Add set_limit_offset() to OutputWriter groups
authorEric Bollengier <eric@baculasystems.com>
Mon, 31 Oct 2022 14:52:13 +0000 (15:52 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:00 +0000 (13:57 +0200)
bacula/src/lib/output.c
bacula/src/lib/output.h

index 2f119bf08f6bcca4baa6fa112b56ce061e866f03..35bfc66cc24f0d8071cbbbd1c175deb49fda4aec 100644 (file)
@@ -198,6 +198,12 @@ char *OutputWriter::start_group(const char *name, bool append)
 char *OutputWriter::end_group(bool append)
 {
    get_buf(append);
+   if (limit >= 0) {
+      get_output(OT_SEP, OT_INT, "limit", limit, OT_END);
+   }
+   if (offset >= 0) {
+      get_output(OT_SEP, OT_INT, "offset", offset, OT_END);
+   }
    return get_output(OT_SEP,
                      OT_INT32, "error", error,
                      OT_STRING, "errmsg", NPRTB(errmsg),
index 47de2faed9e9601a0f5485add24281580f6aaf36..289d8e659a753273a10be41e052f90daf53066d8 100644 (file)
@@ -116,6 +116,8 @@ private:
       need_separator=false;
       will_need_separator=true;
 
+      limit = -1;               // not set
+      offset = -1;              // not set
       error = 0;
       errmsg = NULL; 
    };
@@ -141,6 +143,8 @@ protected:
    const char     *close_hash;
    const char     *label;
 
+   int             limit;
+   int             offset;
    int             error;
    char           *errmsg;
 
@@ -181,6 +185,10 @@ public:
    virtual char *start_list(const char *name, bool append=true);
    virtual char *end_list(bool append=true);
 
+   void set_limit_offset(int l, int o) {
+      limit = l;
+      offset = o;
+   };
    void set_label(const char *l) {
       label = l;
    };