/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2011-2011 Free Software Foundation Europe e.V.
+ Copyright (C) 2011-2012 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
class sellist : public SMARTALLOC {
- char *errmsg;
+ const char *errmsg;
char *p, *e, *h;
char esave, hsave;
int64_t beg, end;
bool set_string(char *string, bool scan);
int64_t first();
int64_t next();
- int size() const;
- char *get_errmsg();
+ void begin();
+ /* size() valid only if scan enabled on string */
+ int size() const { return num_items; };
+ char *get_list() { return str; };
+ /* if errmsg == NULL, no error */
+ const char *get_errmsg() { return errmsg; };
};
/*
num_items = 0;
max = 99999;
str = NULL;
- e = errmsg = NULL;
+ e = NULL;
+ errmsg = NULL;
}
/*
}
/*
- * Return list size, but only if scan enabled on string
- */
-inline int sellist::size() const
-{
- return num_items;
-}
-
-/*
- * Return error message or NULL if none
+ * Returns first item
+ * error if returns -1 and errmsg set
+ * end of items if returns -1 and errmsg NULL
*/
-inline char *sellist::get_errmsg()
+inline int64_t sellist::first()
{
- return errmsg;
+ begin();
+ return next();
}
/*
- * Returns first item
- * error if returns -1 and errmsg set
- * end of items if returns -1 and errmsg NULL
+ * Reset to walk list from beginning
*/
-inline int64_t sellist::first()
+inline void sellist::begin()
{
e = str;
end = 0;
beg = 1;
errmsg = NULL;
- return next();
}