From 659b8edaea2125af2c368d8264ffd9ea21cad044 Mon Sep 17 00:00:00 2001 From: "Unknown (roddey)" <dev-null@apache.org> Date: Tue, 25 Jan 2000 22:49:58 +0000 Subject: [PATCH] Moved the supportsSrcOfs() method from the individual transcoder to the transcoding service, where it should have been to begin with. git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@171658 13f79535-47bb-0310-9956-ffa450edef68 --- src/internal/XMLReader.cpp | 19 +++++++++-------- src/util/TransService.hpp | 8 +++++-- src/util/Transcoders/ICU/ICUTransService.cpp | 18 +++++++++------- src/util/Transcoders/ICU/ICUTransService.hpp | 8 +++++-- .../Transcoders/Iconv/IconvTransService.cpp | 21 +++++++++++++++---- .../Transcoders/Iconv/IconvTransService.hpp | 6 ++++++ .../Transcoders/Win32/Win32TransService.cpp | 17 ++++++++------- .../Transcoders/Win32/Win32TransService.hpp | 8 +++++-- 8 files changed, 72 insertions(+), 33 deletions(-) diff --git a/src/internal/XMLReader.cpp b/src/internal/XMLReader.cpp index 68ed505df..5da66bee9 100644 --- a/src/internal/XMLReader.cpp +++ b/src/internal/XMLReader.cpp @@ -56,6 +56,10 @@ /** * $Log$ + * Revision 1.7 2000/01/25 22:49:54 roddey + * Moved the supportsSrcOfs() method from the individual transcoder to the + * transcoding service, where it should have been to begin with. + * * Revision 1.6 2000/01/25 01:04:21 roddey * Fixes a bogus error about ]]> in char data. * @@ -194,6 +198,9 @@ XMLReader::XMLReader(const XMLCh* const pubId // Do an initial load of raw bytes refreshRawBuffer(); + // Ask the transcoding service if it supports src offset info + fSrcOfsSupported = XMLPlatformUtils::fgTransService->supportsSrcOfs(); + // // Use the recognizer class to get a basic sense of what family of // encodings this file is in. We'll start off with a reader of that @@ -269,6 +276,9 @@ XMLReader::XMLReader(const XMLCh* const pubId // Copy the encoding string to our member fEncodingStr = XMLString::replicate(encodingStr); + // Ask the transcoding service if it supports src offset info + fSrcOfsSupported = XMLPlatformUtils::fgTransService->supportsSrcOfs(); + // // Map the passed encoding name to one of our enums. If it does not // match one of the intrinsic encodings, it will come back 'other', @@ -301,9 +311,6 @@ XMLReader::XMLReader(const XMLCh* const pubId ); } - // Ask the transcoder if it supports src offset info - fSrcOfsSupported = fTranscoder->supportsSrcOfs(); - // // Note that, unlike above, we do not do an initial decode of the // first line. We take the caller's word that the encoding is correct @@ -391,9 +398,6 @@ bool XMLReader::refreshCharBuffer() , fEncodingStr ); } - - // Ask the transcoder if it supports src offset info - fSrcOfsSupported = fTranscoder->supportsSrcOfs(); } // @@ -1297,9 +1301,6 @@ bool XMLReader::setEncoding(const XMLCh* const newEncoding) // Update the base encoding member with the new base encoding found fEncoding = newBaseEncoding; - // Ask our new transcoder if it supports src offsets - fSrcOfsSupported = fTranscoder->supportsSrcOfs(); - // Looks ok to us return true; } diff --git a/src/util/TransService.hpp b/src/util/TransService.hpp index 0b775da83..6be26d23e 100644 --- a/src/util/TransService.hpp +++ b/src/util/TransService.hpp @@ -56,6 +56,10 @@ /** * $Log$ + * Revision 1.5 2000/01/25 22:49:55 roddey + * Moved the supportsSrcOfs() method from the individual transcoder to the + * transcoding service, where it should have been to begin with. + * * Revision 1.4 2000/01/25 19:19:07 roddey * Simple addition of a getId() method to the xcode and netacess abstractions to * allow each impl to give back an id string. @@ -153,6 +157,8 @@ public : virtual XMLLCPTranscoder* makeNewLCPTranscoder() = 0; + virtual bool supportsSrcOfs() const = 0; + virtual void upperCase(XMLCh* const toUpperCase) const = 0; @@ -221,8 +227,6 @@ public : // ----------------------------------------------------------------------- // The virtual transcoding interface // ----------------------------------------------------------------------- - virtual bool supportsSrcOfs() const = 0; - virtual XMLCh transcodeOne ( const XMLByte* const srcData diff --git a/src/util/Transcoders/ICU/ICUTransService.cpp b/src/util/Transcoders/ICU/ICUTransService.cpp index 5e22d7591..c4da4b6a4 100644 --- a/src/util/Transcoders/ICU/ICUTransService.cpp +++ b/src/util/Transcoders/ICU/ICUTransService.cpp @@ -56,6 +56,10 @@ /** * $Log$ + * Revision 1.12 2000/01/25 22:49:56 roddey + * Moved the supportsSrcOfs() method from the individual transcoder to the + * transcoding service, where it should have been to begin with. + * * Revision 1.11 2000/01/25 19:19:07 roddey * Simple addition of a getId() method to the xcode and netacess abstractions to * allow each impl to give back an id string. @@ -289,6 +293,13 @@ XMLLCPTranscoder* ICUTransService::makeNewLCPTranscoder() } +bool ICUTransService::supportsSrcOfs() const +{ + // This implementation supports source offset information + return true; +} + + void ICUTransService::upperCase(XMLCh* const toUpperCase) const { XMLCh* outPtr = toUpperCase; @@ -378,13 +389,6 @@ ICUTranscoder::~ICUTranscoder() // --------------------------------------------------------------------------- // ICUTranscoder: The virtual transcoder API // --------------------------------------------------------------------------- -bool ICUTranscoder::supportsSrcOfs() const -{ - // This implementation supports source offset information - return true; -} - - XMLCh ICUTranscoder::transcodeOne( const XMLByte* const srcData , const unsigned int srcBytes , unsigned int& bytesEaten) diff --git a/src/util/Transcoders/ICU/ICUTransService.hpp b/src/util/Transcoders/ICU/ICUTransService.hpp index 8e06e5458..522c87e32 100644 --- a/src/util/Transcoders/ICU/ICUTransService.hpp +++ b/src/util/Transcoders/ICU/ICUTransService.hpp @@ -56,6 +56,10 @@ /** * $Log$ + * Revision 1.7 2000/01/25 22:49:56 roddey + * Moved the supportsSrcOfs() method from the individual transcoder to the + * transcoding service, where it should have been to begin with. + * * Revision 1.6 2000/01/25 19:19:08 roddey * Simple addition of a getId() method to the xcode and netacess abstractions to * allow each impl to give back an id string. @@ -121,6 +125,8 @@ public : virtual XMLLCPTranscoder* makeNewLCPTranscoder(); + virtual bool supportsSrcOfs() const; + virtual void upperCase(XMLCh* const toUpperCase) const; @@ -164,8 +170,6 @@ public : // ----------------------------------------------------------------------- // Implementation of the virtual transcoder interface // ----------------------------------------------------------------------- - virtual bool supportsSrcOfs() const; - virtual XMLCh transcodeOne ( const XMLByte* const srcData diff --git a/src/util/Transcoders/Iconv/IconvTransService.cpp b/src/util/Transcoders/Iconv/IconvTransService.cpp index c2c6ea8e8..9a85f0f25 100644 --- a/src/util/Transcoders/Iconv/IconvTransService.cpp +++ b/src/util/Transcoders/Iconv/IconvTransService.cpp @@ -56,6 +56,10 @@ /** * $Log$ + * Revision 1.11 2000/01/25 22:49:57 roddey + * Moved the supportsSrcOfs() method from the individual transcoder to the + * transcoding service, where it should have been to begin with. + * * Revision 1.10 2000/01/25 20:56:51 abagchi * Now at least compiles * @@ -226,6 +230,11 @@ XMLLCPTranscoder* IconvTransService::makeNewLCPTranscoder() return new IconvLCPTranscoder; } +bool IconvTransService::supportsSrcOfs() const +{ + return true; +} + // --------------------------------------------------------------------------- // IconvTransService: The protected virtual transcoding service API @@ -252,6 +261,8 @@ void IconvTransService::upperCase(XMLCh* const toUpperCase) const towupper(*toUpperCase); } + + // --------------------------------------------------------------------------- // IconvLCPTranscoder: The virtual transcoder API // --------------------------------------------------------------------------- @@ -485,8 +496,10 @@ IconvLCPTranscoder::~IconvLCPTranscoder() // --------------------------------------------------------------------------- // IconvTranscoder: Constructors and Destructor // --------------------------------------------------------------------------- -IconvTranscoder::IconvTranscoder(const XMLCh* const encodingName, const unsigned int blockSize) -: XMLTranscoder(encodingName, blockSize) +IconvTranscoder::IconvTranscoder(const XMLCh* const encodingName + , const unsigned int blockSize) : + + XMLTranscoder(encodingName, blockSize) { } @@ -498,7 +511,7 @@ IconvTranscoder::~IconvTranscoder() // --------------------------------------------------------------------------- // IconvTranscoder: Implementation of the virtual transcoder API // --------------------------------------------------------------------------- -XMLCh IconvTranscoder::transcodeOne(const XMLByte* const srcData +XMLCh IconvTranscoder::transcodeOne(const XMLByte* const srcData , const unsigned int srcBytes , unsigned int& bytesEaten) { @@ -517,7 +530,7 @@ XMLCh IconvTranscoder::transcodeOne(const XMLByte* const srcData unsigned int -IconvTranscoder::transcodeXML( const XMLByte* const srcData +IconvTranscoder::transcodeXML( const XMLByte* const srcData , const unsigned int srcCount , XMLCh* const toFill , const unsigned int maxChars diff --git a/src/util/Transcoders/Iconv/IconvTransService.hpp b/src/util/Transcoders/Iconv/IconvTransService.hpp index 9ee1aa951..f514c0872 100644 --- a/src/util/Transcoders/Iconv/IconvTransService.hpp +++ b/src/util/Transcoders/Iconv/IconvTransService.hpp @@ -56,6 +56,10 @@ /** * $Log$ + * Revision 1.6 2000/01/25 22:49:57 roddey + * Moved the supportsSrcOfs() method from the individual transcoder to the + * transcoding service, where it should have been to begin with. + * * Revision 1.5 2000/01/25 19:19:08 roddey * Simple addition of a getId() method to the xcode and netacess abstractions to * allow each impl to give back an id string. @@ -114,6 +118,8 @@ public : virtual XMLLCPTranscoder* makeNewLCPTranscoder(); + virtual bool supportsSrcOfs() const; + virtual void upperCase(XMLCh* const toUpperCase) const; protected : diff --git a/src/util/Transcoders/Win32/Win32TransService.cpp b/src/util/Transcoders/Win32/Win32TransService.cpp index 89333ebc3..4f4faab45 100644 --- a/src/util/Transcoders/Win32/Win32TransService.cpp +++ b/src/util/Transcoders/Win32/Win32TransService.cpp @@ -56,6 +56,10 @@ /** * $Log$ + * Revision 1.6 2000/01/25 22:49:58 roddey + * Moved the supportsSrcOfs() method from the individual transcoder to the + * transcoding service, where it should have been to begin with. + * * Revision 1.5 2000/01/25 19:19:09 roddey * Simple addition of a getId() method to the xcode and netacess abstractions to * allow each impl to give back an id string. @@ -149,6 +153,12 @@ XMLLCPTranscoder* Win32TransService::makeNewLCPTranscoder() } +bool Win32TransService::supportsSrcOfs() const +{ + return false; +} + + void Win32TransService::upperCase(XMLCh* const toUpperCase) const { wcsupr(toUpperCase); @@ -195,13 +205,6 @@ Win32Transcoder::~Win32Transcoder() // Win32Transcoder: The virtual transcoder API // --------------------------------------------------------------------------- -// This will never get called because objects of this type are never created -bool Win32Transcoder::supportsSrcOfs() const -{ - return false; -} - - // This will never get called because objects of this type are never created XMLCh Win32Transcoder::transcodeOne(const XMLByte* const , const unsigned int diff --git a/src/util/Transcoders/Win32/Win32TransService.hpp b/src/util/Transcoders/Win32/Win32TransService.hpp index 56498b9c6..d2161a81d 100644 --- a/src/util/Transcoders/Win32/Win32TransService.hpp +++ b/src/util/Transcoders/Win32/Win32TransService.hpp @@ -56,6 +56,10 @@ /** * $Log$ + * Revision 1.5 2000/01/25 22:49:58 roddey + * Moved the supportsSrcOfs() method from the individual transcoder to the + * transcoding service, where it should have been to begin with. + * * Revision 1.4 2000/01/25 19:19:09 roddey * Simple addition of a getId() method to the xcode and netacess abstractions to * allow each impl to give back an id string. @@ -112,6 +116,8 @@ public : virtual XMLLCPTranscoder* makeNewLCPTranscoder(); + virtual bool supportsSrcOfs() const; + virtual void upperCase(XMLCh* const toUpperCase) const; @@ -150,8 +156,6 @@ public : // ----------------------------------------------------------------------- // Implementation of the virtual transcoder interface // ----------------------------------------------------------------------- - virtual bool supportsSrcOfs() const; - virtual XMLCh transcodeOne ( const XMLByte* const srcData -- GitLab