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/02/07 02:39:58 UTC
cvs commit: xml-xalan/c/src/PlatformSupport XalanOutputStream.cpp XalanOutputStream.hpp XalanToXercesTranscoderWrapper.cpp XalanToXercesTranscoderWrapper.hpp XalanTranscodingServices.cpp XalanTranscodingServices.hpp XalanUTF16Transcoder.cpp XalanUTF16Transcoder.hpp
dbertoni 02/02/06 17:39:58
Modified: c/src/PlatformSupport XalanOutputStream.cpp
XalanOutputStream.hpp
XalanToXercesTranscoderWrapper.cpp
XalanToXercesTranscoderWrapper.hpp
XalanTranscodingServices.cpp
XalanTranscodingServices.hpp
XalanUTF16Transcoder.cpp XalanUTF16Transcoder.hpp
Log:
Added basic support for determining if a Unicode character can be represented in the output encoding.
Revision Changes Path
1.15 +20 -0 xml-xalan/c/src/PlatformSupport/XalanOutputStream.cpp
Index: XalanOutputStream.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanOutputStream.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- XalanOutputStream.cpp 26 Sep 2001 21:52:46 -0000 1.14
+++ XalanOutputStream.cpp 7 Feb 2002 01:39:58 -0000 1.15
@@ -299,6 +299,26 @@
+bool
+XalanOutputStream::canTranscodeTo(unsigned int theChar) const
+{
+ if (m_transcoder != 0)
+ {
+ return m_transcoder->canTranscodeTo(theChar);
+ }
+ else
+ {
+ // We'll always return true here, since an exception will be
+ // thrown when we try to transcode. We'ed like to enable the
+ // commented out line, if we can ever figure out how to see
+ // if a character can be encoded.
+ return true;
+// return XalanTranscodingServices::canTranscodeToLocalCodePage(theChar);
+ }
+}
+
+
+
void
XalanOutputStream::flushBuffer()
{
1.9 +9 -0 xml-xalan/c/src/PlatformSupport/XalanOutputStream.hpp
Index: XalanOutputStream.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanOutputStream.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XalanOutputStream.hpp 26 Sep 2001 14:10:31 -0000 1.8
+++ XalanOutputStream.hpp 7 Feb 2002 01:39:58 -0000 1.9
@@ -235,6 +235,15 @@
setOutputEncoding(const XalanDOMString& theEncoding);
/**
+ * Determine if a given value can be represented in
+ * the output encoding.
+ *
+ * @return true if the value can be represented, and false if not.
+ */
+ bool
+ canTranscodeTo(unsigned int theChar) const;
+
+ /**
* Set the flag that indicates whether a transcoding
* error should throw an exception. The default is
* to throw an exception. If this flag is false, and
1.6 +10 -2 xml-xalan/c/src/PlatformSupport/XalanToXercesTranscoderWrapper.cpp
Index: XalanToXercesTranscoderWrapper.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanToXercesTranscoderWrapper.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XalanToXercesTranscoderWrapper.cpp 26 Sep 2001 21:55:34 -0000 1.5
+++ XalanToXercesTranscoderWrapper.cpp 7 Feb 2002 01:39:58 -0000 1.6
@@ -67,9 +67,9 @@
-XalanToXercesTranscoderWrapper::XalanToXercesTranscoderWrapper(XMLTranscoder* theTranscoder) :
+XalanToXercesTranscoderWrapper::XalanToXercesTranscoderWrapper(XMLTranscoder& theTranscoder) :
XalanOutputTranscoder(),
- m_transcoder(theTranscoder)
+ m_transcoder(&theTranscoder)
{
}
@@ -165,4 +165,12 @@
}
return theCode;
+}
+
+
+
+bool
+XalanToXercesTranscoderWrapper::canTranscodeTo(unsigned int theChar) const
+{
+ return m_transcoder->canTranscodeTo(theChar);
}
1.4 +4 -1 xml-xalan/c/src/PlatformSupport/XalanToXercesTranscoderWrapper.hpp
Index: XalanToXercesTranscoderWrapper.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanToXercesTranscoderWrapper.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanToXercesTranscoderWrapper.hpp 25 Sep 2001 21:12:51 -0000 1.3
+++ XalanToXercesTranscoderWrapper.hpp 7 Feb 2002 01:39:58 -0000 1.4
@@ -78,7 +78,7 @@
public:
explicit
- XalanToXercesTranscoderWrapper(XMLTranscoder* theTranscoder);
+ XalanToXercesTranscoderWrapper(XMLTranscoder& theTranscoder);
virtual
~XalanToXercesTranscoderWrapper();
@@ -101,6 +101,9 @@
size_t& theSourceCharsTranscoded,
size_t& theTargetBytesUsed,
unsigned char* theCharSizes);
+
+ virtual bool
+ canTranscodeTo(unsigned int theChar) const;
private:
1.12 +1 -1 xml-xalan/c/src/PlatformSupport/XalanTranscodingServices.cpp
Index: XalanTranscodingServices.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanTranscodingServices.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- XalanTranscodingServices.cpp 26 Sep 2001 21:57:07 -0000 1.11
+++ XalanTranscodingServices.cpp 7 Feb 2002 01:39:58 -0000 1.12
@@ -234,7 +234,7 @@
if (theResult == XalanTranscodingServices::OK)
{
- theTranscoder = new XalanToXercesTranscoderWrapper(theXercesTranscoder);
+ theTranscoder = new XalanToXercesTranscoderWrapper(*theXercesTranscoder);
}
}
1.7 +13 -0 xml-xalan/c/src/PlatformSupport/XalanTranscodingServices.hpp
Index: XalanTranscodingServices.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanTranscodingServices.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XalanTranscodingServices.hpp 25 Sep 2001 21:12:51 -0000 1.6
+++ XalanTranscodingServices.hpp 7 Feb 2002 01:39:58 -0000 1.7
@@ -217,6 +217,9 @@
/**
* Get the maximum character value for the local code page.
+ * This is now deprecated, since it's impossibly broken.
+ *
+ * @deprecated
*
* @return The maximum character value the local code page supports.
*/
@@ -233,6 +236,13 @@
static bool
getBytesEqualChars(const XalanDOMString& theEncoding);
+ static bool
+ canTranscodeToLocalCodePage(unsigned int theChar)
+ {
+ // Yuck!! See getMaximumCharacterValue() for more details.
+ return theChar <= 0x7fu ? true : false;
+ }
+
static const XalanDOMChar s_utf8String[];
static const XalanDOMChar s_utf16String[];
@@ -342,6 +352,9 @@
size_t& theSourceCharsTranscoded,
size_t& theTargetBytesUsed,
unsigned char* theCharSizes) = 0;
+
+ virtual bool
+ canTranscodeTo(unsigned int theChar) const = 0;
private:
1.6 +8 -0 xml-xalan/c/src/PlatformSupport/XalanUTF16Transcoder.cpp
Index: XalanUTF16Transcoder.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanUTF16Transcoder.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XalanUTF16Transcoder.cpp 25 Sep 2001 21:12:51 -0000 1.5
+++ XalanUTF16Transcoder.cpp 7 Feb 2002 01:39:58 -0000 1.6
@@ -166,3 +166,11 @@
return XalanTranscodingServices::OK;
}
+
+
+
+bool
+XalanUTF16Transcoder::canTranscodeTo(unsigned int /* theChar */) const
+{
+ return true;
+}
1.4 +3 -0 xml-xalan/c/src/PlatformSupport/XalanUTF16Transcoder.hpp
Index: XalanUTF16Transcoder.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanUTF16Transcoder.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanUTF16Transcoder.hpp 25 Sep 2001 21:12:51 -0000 1.3
+++ XalanUTF16Transcoder.hpp 7 Feb 2002 01:39:58 -0000 1.4
@@ -122,6 +122,9 @@
size_t& theTargetBytesUsed,
unsigned char* theCharSizes);
+ virtual bool
+ canTranscodeTo(unsigned int theChar) const;
+
private:
// Not implemented...
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org