ICU-1972 Convert the uenum API from C++ to C due to the C callbacks with the C/C++ compiler on z/OS

X-SVN-Rev: 9144
This commit is contained in:
George Rhoten 2002-07-13 16:31:03 +00:00
parent 923c56edd3
commit 02aa4c915f
3 changed files with 21 additions and 12 deletions

View file

@ -390,7 +390,7 @@ SOURCE=.\udatamem.c
# End Source File
# Begin Source File
SOURCE=.\uenum.cpp
SOURCE=.\uenum.c
# End Source File
# Begin Source File

View file

@ -5,7 +5,7 @@
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
* file name: uenum.cpp
* file name: uenum.c
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:2
@ -26,18 +26,20 @@ static const UEnumeration nullEnumeration = {
NULL /* reset */
};
void uenum_close(UEnumeration* en)
U_CAPI void U_EXPORT2
uenum_close(UEnumeration* en)
{
if (en) {
if (en->close != NULL) {
en->close(en);
} else { // this seems dangerous, but better kill the object
} else { /* this seems dangerous, but we better kill the object */
uprv_free(en);
}
}
}
int32_t uenum_count(UEnumeration* en, UErrorCode* status)
U_CAPI int32_t U_EXPORT2
uenum_count(UEnumeration* en, UErrorCode* status)
{
if (!en || U_FAILURE(*status)) {
return -1;
@ -50,9 +52,10 @@ int32_t uenum_count(UEnumeration* en, UErrorCode* status)
}
}
const UChar* uenum_unext(UEnumeration* en,
int32_t* resultLength,
UErrorCode* status)
U_CAPI const UChar* U_EXPORT2
uenum_unext(UEnumeration* en,
int32_t* resultLength,
UErrorCode* status)
{
if (!en || U_FAILURE(*status)) {
return NULL;
@ -65,9 +68,10 @@ const UChar* uenum_unext(UEnumeration* en,
}
}
const char* uenum_next(UEnumeration* en,
int32_t* resultLength,
UErrorCode* status)
U_CAPI const char* U_EXPORT2
uenum_next(UEnumeration* en,
int32_t* resultLength,
UErrorCode* status)
{
if (!en || U_FAILURE(*status)) {
return NULL;
@ -80,7 +84,8 @@ const char* uenum_next(UEnumeration* en,
}
}
void uenum_reset(UEnumeration* en, UErrorCode* status)
U_CAPI void U_EXPORT2
uenum_reset(UEnumeration* en, UErrorCode* status)
{
if (!en || U_FAILURE(*status)) {
return;

View file

@ -19,6 +19,8 @@
#include "unicode/uenum.h"
U_CDECL_BEGIN
/**
* following are the type declarations for
* implementations of APIs. If any of these
@ -119,5 +121,7 @@ struct UEnumeration {
UEnumReset *reset;
};
U_CDECL_END
#endif