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 2001/08/08 23:46:46 UTC
cvs commit: xml-xalan/c/src/ICUBridge ICUBridgeCollationCompareFunctor.cpp ICUBridgeCollationCompareFunctor.hpp
dbertoni 01/08/08 14:46:46
Modified: c/src/ICUBridge ICUBridgeCollationCompareFunctor.cpp
ICUBridgeCollationCompareFunctor.hpp
Log:
Updates for ICU changes.
Revision Changes Path
1.16 +34 -39 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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ICUBridgeCollationCompareFunctor.cpp 2001/07/18 04:38:25 1.15
+++ ICUBridgeCollationCompareFunctor.cpp 2001/08/08 21:46:46 1.16
@@ -82,7 +82,11 @@
{
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))
@@ -101,48 +105,51 @@
int
-ICUBridgeCollationCompareFunctor::operator()(
+ICUBridgeCollationCompareFunctor::doDefaultCompare(
const XalanDOMChar* theLHS,
const XalanDOMChar* theRHS) const
{
- UErrorCode theStatus = U_ZERO_ERROR;
-
- XalanAutoPtr<Collator> theCollator(Collator::createInstance(theStatus));
-
- if (theStatus == U_ZERO_ERROR ||
- (theStatus >= U_ERROR_INFO_START && theStatus < U_ERROR_INFO_LIMIT))
+ if (isValid() == false)
{
- assert(theCollator.get() != 0);
+ return s_defaultFunctor(theLHS, theRHS);
+ }
+ else
+ {
+ assert(m_defaultCollator != 0);
#if defined(XALAN_USE_WCHAR_CAST_HACK)
- return theCollator->compare(
+ return m_defaultCollator->compare(
(const wchar_t*)theLHS,
length(theLHS),
(const wchar_t*)theRHS,
length(theRHS));
#else
- return theCollator->compare(
+ return m_defaultCollator->compare(
theLHS,
length(theLHS),
theRHS,
length(theRHS));
#endif
}
- else
- {
- return s_defaultFunctor(theLHS, theRHS);
- }
}
+int
+ICUBridgeCollationCompareFunctor::operator()(
+ const XalanDOMChar* theLHS,
+ const XalanDOMChar* theRHS) const
+{
+ return doDefaultCompare(theLHS, theRHS);
+}
+
+
+
inline Collator*
getCollator(
const XalanDOMChar* theLocale,
UErrorCode& theStatus)
{
- char theBuffer[ULOC_FULLNAME_CAPACITY];
-
const unsigned int theLength = length(theLocale);
if (theLength >= ULOC_FULLNAME_CAPACITY)
@@ -153,13 +160,22 @@
}
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);
@@ -210,26 +226,5 @@
const XalanDOMChar* theLHS,
const XalanDOMChar* theRHS)
{
- 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
- }
+ return doDefaultCompare(theLHS, theRHS);
}
1.5 +5 -0 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ICUBridgeCollationCompareFunctor.hpp 2001/07/18 04:38:25 1.4
+++ ICUBridgeCollationCompareFunctor.hpp 2001/08/08 21:46:46 1.5
@@ -105,6 +105,11 @@
private:
+ int
+ doDefaultCompare(
+ const XalanDOMChar* theLHS,
+ const XalanDOMChar* theRHS) const;
+
bool m_isValid;
Collator* m_defaultCollator;
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org