From 0f2d14ab3a610dce399eeb575f4305a53777ddd0 Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Tue, 15 Jun 2010 21:19:16 +0000 Subject: [PATCH] ICU-7586 fix namespace bugs X-SVN-Rev: 28202 --- icu4c/source/common/udata.cpp | 4 +- icu4c/source/i18n/ucol_tok.cpp | 2 + icu4c/source/test/intltest/fldset.h | 70 ++++++++++++++++++------- icu4c/source/tools/toolutil/dbgutil.cpp | 2 + icu4c/source/tools/toolutil/dbgutil.h | 15 +++--- 5 files changed, 65 insertions(+), 28 deletions(-) diff --git a/icu4c/source/common/udata.cpp b/icu4c/source/common/udata.cpp index 3a854448982..13dc8ab3d10 100644 --- a/icu4c/source/common/udata.cpp +++ b/icu4c/source/common/udata.cpp @@ -5,7 +5,7 @@ * Corporation and others. All Rights Reserved. * ****************************************************************************** -* file name: udata.c +* file name: udata.cpp * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 @@ -72,6 +72,8 @@ might have to #include some other header #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) +U_NAMESPACE_USE + /*********************************************************************** * * static (Global) data diff --git a/icu4c/source/i18n/ucol_tok.cpp b/icu4c/source/i18n/ucol_tok.cpp index 60c7f517acb..f6e9bf8b4b7 100644 --- a/icu4c/source/i18n/ucol_tok.cpp +++ b/icu4c/source/i18n/ucol_tok.cpp @@ -31,6 +31,8 @@ #include "cmemory.h" #include "util.h" +U_NAMESPACE_USE + U_CDECL_BEGIN static int32_t U_CALLCONV uhash_hashTokens(const UHashTok k) diff --git a/icu4c/source/test/intltest/fldset.h b/icu4c/source/test/intltest/fldset.h index 0aa010c281e..0c9747b44c6 100644 --- a/icu4c/source/test/intltest/fldset.h +++ b/icu4c/source/test/intltest/fldset.h @@ -54,8 +54,8 @@ class FieldsSet { * @return a formatted string listing which fields are set in * this, with the comparison made agaainst those fields in other. */ - UnicodeString diffFrom(const FieldsSet& other, UErrorCode &status) const; - + U_NAMESPACE_QUALIFIER UnicodeString diffFrom(const FieldsSet& other, UErrorCode &status) const; + public: /** * Fill-in fields from a specified string, such as "NAME1=VALUE1,NAME2=VALUE2", etc. @@ -63,8 +63,10 @@ class FieldsSet { * @param status status of parse * @return the number of valid parsed fields on success, or a negative number on failure. */ - int32_t parseFrom(const UnicodeString& str, UErrorCode& status) { return parseFrom(str,NULL,status); } - + int32_t parseFrom(const U_NAMESPACE_QUALIFIER UnicodeString& str, UErrorCode& status) { + return parseFrom(str,NULL,status); + } + /** * Fill-in fields from a specified string, such as "NAME1=VALUE1,NAME2=VALUE2", etc. * @param inheritFrom if a field's value is given as 0-length, such as NAME1 in "NAME1=,NAME2=VALUE2", @@ -73,8 +75,12 @@ class FieldsSet { * @param status status of parse * @return the number of valid parsed fields on success, or a negative number on failure. */ - int32_t parseFrom(const UnicodeString& str, const FieldsSet& inheritFrom, UErrorCode& status) { return parseFrom(str, &inheritFrom, status); } - + int32_t parseFrom(const U_NAMESPACE_QUALIFIER UnicodeString& str, + const FieldsSet& inheritFrom, + UErrorCode& status) { + return parseFrom(str, &inheritFrom, status); + } + /** * Fill-in fields from a specified string, such as "NAME1=VALUE1,NAME2=VALUE2", etc. * @param inheritFrom if a field's value is given as 0-length, such as NAME1 in "NAME1=,NAME2=VALUE2", @@ -83,9 +89,10 @@ class FieldsSet { * @param status status of parse * @return the number of valid parsed fields on success, or a negative number on failure. */ - int32_t parseFrom(const UnicodeString& str, const - FieldsSet* inheritFrom, UErrorCode& status); - + int32_t parseFrom(const U_NAMESPACE_QUALIFIER UnicodeString& str, + const FieldsSet* inheritFrom, + UErrorCode& status); + protected: /** * Callback interface for subclass. @@ -101,7 +108,10 @@ class FieldsSet { * @param status error status - set to error for failure. * @return field number, or negative if field should be skipped. */ - virtual int32_t handleParseName(const FieldsSet* inheritFrom, const UnicodeString& name, const UnicodeString& substr, UErrorCode& status); + virtual int32_t handleParseName(const FieldsSet* inheritFrom, + const U_NAMESPACE_QUALIFIER UnicodeString& name, + const U_NAMESPACE_QUALIFIER UnicodeString& substr, + UErrorCode& status); /** * Callback interface for subclass. @@ -112,15 +122,21 @@ class FieldsSet { * @param status error status - set to error for failure. * @see parseValueDefault */ - virtual void handleParseValue(const FieldsSet* inheritFrom, int32_t field, const UnicodeString& substr, UErrorCode& status); - + virtual void handleParseValue(const FieldsSet* inheritFrom, + int32_t field, + const U_NAMESPACE_QUALIFIER UnicodeString& substr, + UErrorCode& status); + /** * the default implementation for handleParseValue. * Base implementation is to parse a decimal integer value, or inherit from inheritFrom if the string is 0-length. * Implementations of this function should call set(field,...) on successful parse. * @see handleParseValue */ - void parseValueDefault(const FieldsSet* inheritFrom, int32_t field, const UnicodeString& substr, UErrorCode& status); + void parseValueDefault(const FieldsSet* inheritFrom, + int32_t field, + const U_NAMESPACE_QUALIFIER UnicodeString& substr, + UErrorCode& status); /** @@ -129,7 +145,11 @@ class FieldsSet { * if fails, will call parseValueDefault() * @see handleParseValue */ - void parseValueEnum(UDebugEnumType type, const FieldsSet* inheritFrom, int32_t field, const UnicodeString& substr, UErrorCode& status); + void parseValueEnum(UDebugEnumType type, + const FieldsSet* inheritFrom, + int32_t field, + const U_NAMESPACE_QUALIFIER UnicodeString& substr, + UErrorCode& status); private: /** @@ -214,8 +234,9 @@ public: * @param matches fillin to hold any fields different. Will have the calendar's value set on them. * @return true if the calendar matches in these fields. */ - UBool matches(Calendar *cal, CalendarFieldsSet &diffSet, - UErrorCode& status) const; + UBool matches(U_NAMESPACE_QUALIFIER Calendar *cal, + CalendarFieldsSet &diffSet, + UErrorCode& status) const; /** * For each set field, set the same field on this Calendar. @@ -223,13 +244,16 @@ public: * @param cal Calendar to modify * @param status Contains any errors propagated by the Calendar. */ - void setOnCalendar(Calendar *cal, UErrorCode& status) const; + void setOnCalendar(U_NAMESPACE_QUALIFIER Calendar *cal, UErrorCode& status) const; protected: /** * subclass override */ - void handleParseValue(const FieldsSet* inheritFrom, int32_t field, const UnicodeString& substr, UErrorCode& status); + void handleParseValue(const FieldsSet* inheritFrom, + int32_t field, + const U_NAMESPACE_QUALIFIER UnicodeString& substr, + UErrorCode& status); }; /** @@ -253,8 +277,14 @@ class DateTimeStyleSet : public FieldsSet { */ UDateFormatStyle getTimeStyle() const; protected: - void handleParseValue(const FieldsSet* inheritFrom, int32_t field, const UnicodeString& substr, UErrorCode& status); - int32_t handleParseName(const FieldsSet* inheritFrom, const UnicodeString& name, const UnicodeString& substr, UErrorCode& status); + void handleParseValue(const FieldsSet* inheritFrom, + int32_t field, + const U_NAMESPACE_QUALIFIER UnicodeString& substr, + UErrorCode& status); + int32_t handleParseName(const FieldsSet* inheritFrom, + const U_NAMESPACE_QUALIFIER UnicodeString& name, + const U_NAMESPACE_QUALIFIER UnicodeString& substr, + UErrorCode& status); }; diff --git a/icu4c/source/tools/toolutil/dbgutil.cpp b/icu4c/source/tools/toolutil/dbgutil.cpp index bd90f92adaf..c0254554ae1 100644 --- a/icu4c/source/tools/toolutil/dbgutil.cpp +++ b/icu4c/source/tools/toolutil/dbgutil.cpp @@ -18,6 +18,8 @@ #include #include +U_NAMESPACE_USE + static UnicodeString **strs = NULL; static const UnicodeString& _fieldString(UDebugEnumType type, int32_t field, UnicodeString& fillin) { diff --git a/icu4c/source/tools/toolutil/dbgutil.h b/icu4c/source/tools/toolutil/dbgutil.h index 63b28f6977a..be2ad992032 100644 --- a/icu4c/source/tools/toolutil/dbgutil.h +++ b/icu4c/source/tools/toolutil/dbgutil.h @@ -17,25 +17,26 @@ #if !UCONFIG_NO_FORMATTING -//class UnicodeString; - -U_CAPI const UnicodeString& U_EXPORT2 udbg_enumString(UDebugEnumType type, int32_t field); +U_CAPI const U_NAMESPACE_QUALIFIER UnicodeString& U_EXPORT2 +udbg_enumString(UDebugEnumType type, int32_t field); /** * @return enum offset, or UDBG_INVALID_ENUM on error */ -U_CAPI int32_t U_EXPORT2 udbg_enumByString(UDebugEnumType type, const UnicodeString& string); +U_CAPI int32_t U_EXPORT2 +udbg_enumByString(UDebugEnumType type, const U_NAMESPACE_QUALIFIER UnicodeString& string); /** * Convert a UnicodeString (with ascii digits) into a number. * @param s string * @return numerical value, or 0 on error */ -U_CAPI int32_t U_EXPORT2 udbg_stoi(const UnicodeString &s); +U_CAPI int32_t U_EXPORT2 udbg_stoi(const U_NAMESPACE_QUALIFIER UnicodeString &s); -U_CAPI double U_EXPORT2 udbg_stod(const UnicodeString &s); +U_CAPI double U_EXPORT2 udbg_stod(const U_NAMESPACE_QUALIFIER UnicodeString &s); -U_CAPI UnicodeString *udbg_escape(const UnicodeString &s, UnicodeString *dst); +U_CAPI U_NAMESPACE_QUALIFIER UnicodeString * U_EXPORT2 +udbg_escape(const U_NAMESPACE_QUALIFIER UnicodeString &s, U_NAMESPACE_QUALIFIER UnicodeString *dst); #endif