Hey Methodhai,
Here is a good snippit of example code to help you out:
We'll assume you're using the QbJob object. I'll use a pointer instance, since I know you're probably using a query.
// Note: the job object pointer normally comes from iterating through
// a standard job query. Please refer to previous forum posts for information
QbJob *job = new QbJob();
// We'll use the following string objects to catch the results we want.
QbString cmdline;
QbString padding;
QbString shell;
// Note: the package libraries are pure "ANSI C" libs, there are C++ objects
// which do package decoding as well, however I'll use the C libs
// for this example
// Expand the package encoded in the job's data method
qb_package *pck = qb_package_expand((QB_CHAR*) job->data().value());
// since we know it's a hash of data, we'll just iterate through each
// hash element (hash, dictionary... same thing)
for (QB_INT i = 0; i < qb_package_list_len(pck); i++) {
qb_package *item = qb_package_list_get(pck, i);
QbString name(qb_package_get_name(item));
if (name == "cmdline") {
cmdline = qb_package_get_value(item);
} else if (name == "padding") {
padding = qb_package_get_value(item);
} else if (name == "shell") {
shell = qb_package_get_value(item);
}
}
// ANSI C doesn't give you destructors... so we need to do it ourselves.
qb_package_destroy(pck);
// Here we'll show you how to take the job's agenda, and use the Qube!
// range analysis object to get the compressed form of the range
// (ex. 1-100x10)
QbRange collection;
for (QB_INT i = 0; i < job->agenda().length(); i++) {
QbWork* work = job->agenda().get(i);
if (work == NULL)
continue;
collection.add(work->name());
}
QbString range = collection.value();
I hope this is everything you need. Let us know if you have anything else.
A.