You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2002/01/04 20:12:43 UTC
cvs commit: xml-xalan/c/src/ICUBridge ICUBridge.cpp ICUBridge.hpp ICUBridgeCollationCompareFunctor.cpp ICUBridgeCollationCompareFunctor.hpp ICUXalanNumberFormatFactory.cpp ICUXalanNumberFormatFactory.hpp ICUXalanNumberFormatProxy.cpp ICUXalanNumberFormatProxy.hpp
dbertoni 02/01/04 11:12:43
Modified: c/src/ICUBridge ICUBridge.cpp ICUBridge.hpp
ICUBridgeCollationCompareFunctor.cpp
ICUBridgeCollationCompareFunctor.hpp
ICUXalanNumberFormatFactory.cpp
ICUXalanNumberFormatFactory.hpp
ICUXalanNumberFormatProxy.cpp
ICUXalanNumberFormatProxy.hpp
Log:
Changes for ICU 2.0.
Revision Changes Path
1.14 +12 -12 xml-xalan/c/src/ICUBridge/ICUBridge.cpp
Index: ICUBridge.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/ICUBridge/ICUBridge.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ICUBridge.cpp 7 Dec 2001 18:58:25 -0000 1.13
+++ ICUBridge.cpp 4 Jan 2002 19:12:43 -0000 1.14
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -55,7 +55,7 @@
* <http://www.apache.org/>.
*/
-#include <ICUBridge/ICUBridge.hpp>
+#include "ICUBridge.hpp"
@@ -113,12 +113,12 @@
-const ICUBridge::ICUUnicodeString
+const UnicodeString
ICUBridge::XalanDOMCharStringToUnicodeString(const XalanDOMChar* theString)
{
if (theString == 0)
{
- return ICUUnicodeString();
+ return UnicodeString();
}
else
{
@@ -157,14 +157,14 @@
return ICUUnicodeString(&theBuffer[0], theLength);
}
#else
- return ICUUnicodeString(theString, length(theString));
+ return UnicodeString(theString, length(theString));
#endif
}
}
-const ICUBridge::ICUUnicodeString
+const UnicodeString
ICUBridge::XalanDOMStringToUnicodeString(const XalanDOMString& theString)
{
// Just call up to the XalanDOMChar* version...
@@ -174,7 +174,7 @@
const XalanDOMString
-ICUBridge::UnicodeStringToXalanDOMString(const ICUUnicodeString& theString)
+ICUBridge::UnicodeStringToXalanDOMString(const UnicodeString& theString)
{
const int32_t theLength = theString.length();
@@ -228,8 +228,8 @@
void
ICUBridge::UnicodeStringToXalanDOMString(
- const ICUUnicodeString& theString,
- XalanDOMString& theResult)
+ const UnicodeString& theString,
+ XalanDOMString& theResult)
{
#if defined(XALAN_XALANDOMCHAR_USHORT_MISMATCH)
@@ -307,7 +307,7 @@
theDFS->setSymbol(DecimalFormatSymbols::kIntlCurrencySymbol, ICUBridge::XalanDOMStringToUnicodeString(theXalanDFS.getInternationalCurrencySymbol()));
theDFS->setSymbol(DecimalFormatSymbols::kMonetarySeparatorSymbol, theXalanDFS.getMonetaryDecimalSeparator());
- ICUBridge::ICUUnicodeString theUnicodeResult;
+ UnicodeString theUnicodeResult;
// Construct a DecimalFormat. Note that we release the XalanAutoPtr, since the
// DecimalFormat will adopt the DecimalFormatSymbols instance.
@@ -389,8 +389,8 @@
// OK, do the compare...
return theCollator->compare(
#if defined(XALAN_XALANDOMCHAR_USHORT_MISMATCH)
- XalanDOMCharStringToUnicodeString(theLHS),
- XalanDOMCharStringToUnicodeString(theRHS));
+ ICUBridge::XalanDOMCharStringToUnicodeString(theLHS),
+ ICUBridge::XalanDOMCharStringToUnicodeString(theRHS));
#else
theLHS,
length(theLHS),
1.5 +8 -31 xml-xalan/c/src/ICUBridge/ICUBridge.hpp
Index: ICUBridge.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/ICUBridge/ICUBridge.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ICUBridge.hpp 7 Dec 2001 18:58:25 -0000 1.4
+++ ICUBridge.hpp 4 Jan 2002 19:12:43 -0000 1.5
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -64,32 +64,15 @@
-#include <vector>
-
-
-
#include <XalanDOM/XalanDOMString.hpp>
-// We're stuck here. We don't want to include the ICU header files, since we're trying
-// to keep them hidden, but we need their namespace. So we're just duplicating here. When
-// it changes, we'll have to track that change. This is more desirable than forcing users
-// to have the ICU sources.
-//
-// We could fix this by using factories, rather than allowing user access to these
-// implementation classes. It's certainly worth pursuing...
-#if defined(XALAN_NO_NAMESPACES)
-class UnicodeString;
-#else
-namespace icu_2_0
-{
- class UnicodeString;
-};
-#endif
+#include <unicode/unistr.h>
+class Function;
class XalanDecimalFormatSymbols;
@@ -98,25 +81,19 @@
{
public:
-#if defined(XALAN_NO_NAMESPACES)
- typedef UnicodeString ICUUnicodeString;
-#else
- typedef icu_2_0::UnicodeString ICUUnicodeString;
-#endif
-
- static const ICUUnicodeString
+ static const UnicodeString
XalanDOMCharStringToUnicodeString(const XalanDOMChar* theString);
- static const ICUUnicodeString
+ static const UnicodeString
XalanDOMStringToUnicodeString(const XalanDOMString& theString);
static const XalanDOMString
- UnicodeStringToXalanDOMString(const ICUUnicodeString& theString);
+ UnicodeStringToXalanDOMString(const UnicodeString& theString);
static void
UnicodeStringToXalanDOMString(
- const ICUUnicodeString& theString,
- XalanDOMString& theResult);
+ const UnicodeString& theString,
+ XalanDOMString& theResult);
static unsigned long
FormatNumber(
1.20 +7 -132 xml-xalan/c/src/ICUBridge/ICUBridgeCollationCompareFunctor.cpp
Index: ICUBridgeCollationCompareFunctor.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/ICUBridge/ICUBridgeCollationCompareFunctor.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- ICUBridgeCollationCompareFunctor.cpp 7 Dec 2001 18:58:25 -0000 1.19
+++ ICUBridgeCollationCompareFunctor.cpp 4 Jan 2002 19:12:43 -0000 1.20
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -56,84 +56,24 @@
*/
#include "ICUBridgeCollationCompareFunctor.hpp"
-#include "ICUBridge.hpp"
-
-
-
-#include <Include/XalanAutoPtr.hpp>
-
-
-
-#include <PlatformSupport/DOMStringHelper.hpp>
-
-#include <unicode/coll.h>
-// this is the ICU's macro for using namespace ...
-U_NAMESPACE_USE
-
-
-
-const StylesheetExecutionContextDefault::DefaultCollationCompareFunctor ICUBridgeCollationCompareFunctor::s_defaultFunctor;
+#include "ICUBridge.hpp"
+#include "ICUBridgeCollationCompareFunctorImpl.hpp"
ICUBridgeCollationCompareFunctor::ICUBridgeCollationCompareFunctor() :
- m_isValid(false),
- m_defaultCollator(0)
+ m_impl(new ICUBridgeCollationCompareFunctorImpl)
{
- UErrorCode theStatus = U_ZERO_ERROR;
-
-#if defined(XALAN_ICU_DEFAULT_LOCALE_PROBLEM)
- m_defaultCollator = Collator::createInstance(Locale::US, theStatus);
-#else
- m_defaultCollator = Collator::createInstance(theStatus);
-#endif
-
- if (theStatus == U_ZERO_ERROR ||
- (theStatus >= U_ERROR_INFO_START && theStatus < U_ERROR_INFO_LIMIT))
- {
- m_isValid = true;
- }
}
ICUBridgeCollationCompareFunctor::~ICUBridgeCollationCompareFunctor()
{
- delete m_defaultCollator;
-}
-
-
-
-int
-ICUBridgeCollationCompareFunctor::doDefaultCompare(
- const XalanDOMChar* theLHS,
- const XalanDOMChar* theRHS) const
-{
- if (isValid() == false)
- {
- return s_defaultFunctor(theLHS, theRHS);
- }
- else
- {
- assert(m_defaultCollator != 0);
-
-#if defined(XALAN_USE_WCHAR_CAST_HACK)
- return m_defaultCollator->compare(
- (const wchar_t*)theLHS,
- length(theLHS),
- (const wchar_t*)theRHS,
- length(theRHS));
-#else
- return m_defaultCollator->compare(
- theLHS,
- length(theLHS),
- theRHS,
- length(theRHS));
-#endif
- }
+ delete m_impl;
}
@@ -143,46 +83,7 @@
const XalanDOMChar* theLHS,
const XalanDOMChar* theRHS) const
{
- return doDefaultCompare(theLHS, theRHS);
-}
-
-
-
-inline Collator*
-getCollator(
- const XalanDOMChar* theLocale,
- UErrorCode& theStatus)
-{
- const XalanDOMString::size_type theLength = length(theLocale);
-
- if (theLength >= ULOC_FULLNAME_CAPACITY)
- {
- theStatus = U_ILLEGAL_ARGUMENT_ERROR;
-
- return 0;
- }
- else
- {
-#if defined(XALAN_NON_ASCII_PLATFORM)
- CharVectorType theVector;
-
- TranscodeToLocalCodePage(theLocale, theVector, true);
-
- const char* const theBuffer = c_str(theVector);
-#else
- char theBuffer[ULOC_FULLNAME_CAPACITY];
-
- // Since language names must be ASCII, this
- // is the cheapest way to "transcode"...
- for (unsigned int i = 0; i <= theLength; ++i)
- {
- theBuffer[i] = char(theLocale[i]);
- }
-#endif
- return Collator::createInstance(
- Locale::createFromName(theBuffer),
- theStatus);
- }
+ return (*m_impl)(theLHS, theRHS);
}
@@ -193,31 +94,5 @@
const XalanDOMChar* theRHS,
const XalanDOMChar* theLocale) const
{
- UErrorCode theStatus = U_ZERO_ERROR;
-
- XalanAutoPtr<Collator> theCollator(getCollator(theLocale, theStatus));
-
- if (theStatus == U_ZERO_ERROR ||
- (theStatus >= U_ERROR_INFO_START && theStatus < U_ERROR_INFO_LIMIT))
- {
- assert(theCollator.get() != 0);
-
-#if defined(XALAN_USE_WCHAR_CAST_HACK)
- return theCollator->compare(
- (const wchar_t*)theLHS,
- length(theLHS),
- (const wchar_t*)theRHS,
- length(theRHS));
-#else
- return theCollator->compare(
- theLHS,
- length(theLHS),
- theRHS,
- length(theRHS));
-#endif
- }
- else
- {
- return s_defaultFunctor(theLHS, theRHS);
- }
+ return (*m_impl)(theLHS, theRHS, theLocale);
}
1.8 +3 -37 xml-xalan/c/src/ICUBridge/ICUBridgeCollationCompareFunctor.hpp
Index: ICUBridgeCollationCompareFunctor.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/ICUBridge/ICUBridgeCollationCompareFunctor.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ICUBridgeCollationCompareFunctor.hpp 7 Dec 2001 18:58:25 -0000 1.7
+++ ICUBridgeCollationCompareFunctor.hpp 4 Jan 2002 19:12:43 -0000 1.8
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -68,21 +68,7 @@
-// We're stuck here. We don't want to include the ICU header files, since we're trying
-// to keep them hidden, but we need their namespace. So we're just duplicating here. When
-// it changes, we'll have to track that change. This is more desirable than forcing users
-// to have the ICU sources.
-//
-// We could fix this by using factories, rather than allowing user access to these
-// implementation classes. It's certainly worth pursuing...
-#if defined(XALAN_NO_NAMESPACES)
-class Collator;
-#else
-namespace icu_2_0
-{
- class Collator;
-};
-#endif
+class ICUBridgeCollationCompareFunctorImpl;
@@ -105,29 +91,9 @@
const XalanDOMChar* theLHS,
const XalanDOMChar* theRHS,
const XalanDOMChar* theLocale) const;
-
- bool
- isValid() const
- {
- return m_isValid;
- }
-
private:
- int
- doDefaultCompare(
- const XalanDOMChar* theLHS,
- const XalanDOMChar* theRHS) const;
-
- bool m_isValid;
-
-#if defined(XALAN_NO_NAMESPACES)
- Collator* m_defaultCollator;
-#else
- icu_2_0::Collator* m_defaultCollator;
-#endif
-
- const static StylesheetExecutionContextDefault::DefaultCollationCompareFunctor s_defaultFunctor;
+ ICUBridgeCollationCompareFunctorImpl* const m_impl;
};
1.3 +1 -1 xml-xalan/c/src/ICUBridge/ICUXalanNumberFormatFactory.cpp
Index: ICUXalanNumberFormatFactory.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/ICUBridge/ICUXalanNumberFormatFactory.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ICUXalanNumberFormatFactory.cpp 22 Aug 2000 20:17:54 -0000 1.2
+++ ICUXalanNumberFormatFactory.cpp 4 Jan 2002 19:12:43 -0000 1.3
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.2 +1 -1 xml-xalan/c/src/ICUBridge/ICUXalanNumberFormatFactory.hpp
Index: ICUXalanNumberFormatFactory.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/ICUBridge/ICUXalanNumberFormatFactory.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ICUXalanNumberFormatFactory.hpp 8 May 2000 17:13:13 -0000 1.1
+++ ICUXalanNumberFormatFactory.hpp 4 Jan 2002 19:12:43 -0000 1.2
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
1.9 +2 -5 xml-xalan/c/src/ICUBridge/ICUXalanNumberFormatProxy.cpp
Index: ICUXalanNumberFormatProxy.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/ICUBridge/ICUXalanNumberFormatProxy.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ICUXalanNumberFormatProxy.cpp 7 Dec 2001 18:58:25 -0000 1.8
+++ ICUXalanNumberFormatProxy.cpp 4 Jan 2002 19:12:43 -0000 1.9
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -59,12 +59,9 @@
-#include <vector>
-
+#include <unicode/dcfmtsym.h>
-#include <unicode/dcfmtsym.h>
-#include <unicode/decimfmt.h>
// this is the ICU's macro for using namespace ...
U_NAMESPACE_USE
1.4 +2 -16 xml-xalan/c/src/ICUBridge/ICUXalanNumberFormatProxy.hpp
Index: ICUXalanNumberFormatProxy.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/ICUBridge/ICUXalanNumberFormatProxy.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ICUXalanNumberFormatProxy.hpp 7 Dec 2001 18:58:25 -0000 1.3
+++ ICUXalanNumberFormatProxy.hpp 4 Jan 2002 19:12:43 -0000 1.4
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 2000 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -68,21 +68,7 @@
-// We're stuck here. We don't want to include the ICU header files, since we're trying
-// to keep them hidden, but we need their namespace. So we're just duplicating here. When
-// it changes, we'll have to track that change. This is more desirable than forcing users
-// to have the ICU sources.
-//
-// We could fix this by using factories, rather than allowing user access to these
-// implementation classes. It's certainly worth pursuing...
-#if defined(XALAN_NO_NAMESPACES)
-class DecimalFormat;
-#else
-namespace icu_2_0
-{
- class DecimalFormat;
-};
-#endif
+#include <unicode/decimfmt.h>
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org