ICU-5447 Make it easier to enumerate items.

X-SVN-Rev: 20614
This commit is contained in:
George Rhoten 2006-10-30 05:08:36 +00:00
parent afd294656e
commit 0b66ebe18c
3 changed files with 16 additions and 7 deletions

View file

@ -528,7 +528,11 @@ main(int argc, char *argv[]) {
/* list items */
if(options[OPT_LIST_ITEMS].doesOccur) {
pkg->listItems(stdout);
int32_t i;
for(i=0; i<pkg->getItemCount(); ++i) {
fprintf(stdout, "%s\n", pkg->getItem(i)->name);
}
}
/* check dependencies between items */

View file

@ -1139,13 +1139,17 @@ Package::extractItems(const char *filesPath, const Package &listPkg, char outTyp
}
}
void
Package::listItems(FILE *file) {
int32_t i;
int32_t
Package::getItemCount() {
return itemCount;
}
for(i=0; i<itemCount; ++i) {
fprintf(file, "%s\n", items[i].name);
const Item *
Package::getItem(int32_t idx) {
if (0 <= idx && idx < itemCount) {
return &items[idx];
}
return NULL;
}
void

View file

@ -107,7 +107,8 @@ public:
/* This variant extracts an item to a specific filename. */
void extractItem(const char *filesPath, const char *outName, int32_t index, char outType);
void listItems(FILE *file);
int32_t getItemCount();
const Item *getItem(int32_t idx);
/*
* Check dependencies and return TRUE if all dependencies are fulfilled.