ICU-5447 Allow the dependencies to be enumerated.

X-SVN-Rev: 21465
This commit is contained in:
George Rhoten 2007-04-27 19:12:15 +00:00
parent 18ee440bb2
commit 59f209cb05
3 changed files with 22 additions and 12 deletions

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 1999-2006, International Business Machines
* Copyright (C) 1999-2007, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -1164,13 +1164,18 @@ Package::checkDependency(void *context, const char *itemName, const char *target
UBool
Package::checkDependencies() {
isMissingItems=FALSE;
enumDependencies(this, checkDependency);
return (UBool)!isMissingItems;
}
void
Package::enumDependencies(void *context, CheckDependency check) {
int32_t i;
isMissingItems=FALSE;
for(i=0; i<itemCount; ++i) {
enumDependencies(items+i);
enumDependencies(items+i, context, check);
}
return (UBool)!isMissingItems;
}
char *

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2005-2006, International Business Machines
* Copyright (C) 2005-2007, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -29,6 +29,8 @@
#define MAX_FILE_COUNT 2000
#define MAX_PKG_NAME_LENGTH 32
typedef void CheckDependency(void *context, const char *itemName, const char *targetName);
U_NAMESPACE_BEGIN
struct Item {
@ -115,8 +117,13 @@ public:
*/
UBool checkDependencies();
/*
* Enumerate all the dependencies and give the results to context and check
*/
void enumDependencies(void *context, CheckDependency check);
private:
void enumDependencies(Item *pItem);
void enumDependencies(Item *pItem, void *context, CheckDependency check);
static void checkDependency(void *context, const char *itemName, const char *targetName);

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2003-2006, International Business Machines
* Copyright (C) 2003-2007, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -53,8 +53,6 @@ printError(void *context, const char *fmt, va_list args) {
U_CDECL_END
typedef void CheckDependency(void *context, const char *itemName, const char *targetName);
// check a dependency ------------------------------------------------------ ***
/*
@ -586,7 +584,7 @@ getDataFormat(const uint8_t dataFormat[4]) {
U_NAMESPACE_BEGIN
void
Package::enumDependencies(Item *pItem) {
Package::enumDependencies(Item *pItem, void *context, CheckDependency check) {
const UDataInfo *pInfo;
const uint8_t *inBytes;
int32_t format, length, infoLength, itemHeaderLength;
@ -619,10 +617,10 @@ Package::enumDependencies(Item *pItem) {
switch(format) {
case FMT_RES:
ures_enumDependencies(ds, pItem->name, pInfo, inBytes, length, checkDependency, this, &errorCode);
ures_enumDependencies(ds, pItem->name, pInfo, inBytes, length, check, context, &errorCode);
break;
case FMT_CNV:
ucnv_enumDependencies(ds, pItem->name, pInfo, inBytes, length, checkDependency, this, &errorCode);
ucnv_enumDependencies(ds, pItem->name, pInfo, inBytes, length, check, context, &errorCode);
break;
default:
break;