You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2001/01/25 20:19:46 UTC
cvs commit: xml-xerces/c/src/util TransService.cpp TransService.hpp
tng 01/01/25 11:19:46
Modified: c/src/util TransService.cpp TransService.hpp
Log:
Let user add their encoding to the intrinsic mapping table. Added by Khaled Noaman.
Revision Changes Path
1.22 +17 -2 xml-xerces/c/src/util/TransService.cpp
Index: TransService.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/util/TransService.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- TransService.cpp 2000/07/25 22:28:15 1.21
+++ TransService.cpp 2001/01/25 19:19:28 1.22
@@ -55,7 +55,7 @@
*/
/*
- * $Id: TransService.cpp,v 1.21 2000/07/25 22:28:15 aruna1 Exp $
+ * $Id: TransService.cpp,v 1.22 2001/01/25 19:19:28 tng Exp $
*/
// ---------------------------------------------------------------------------
// Includes
@@ -76,6 +76,7 @@
#include <util/TransENameMap.hpp>
+
// ---------------------------------------------------------------------------
// Local, static data
//
@@ -152,6 +153,18 @@
gMappings = 0; // the it, and so will be deleted by gMapping's destructor.
}
+// ---------------------------------------------------------------------------
+// Allow user specific encodings to be added to the mappings table.
+// Should be called after platform init
+// ---------------------------------------------------------------------------
+void XMLTransService::addEncoding(const XMLCh* const encoding,
+ ENameMap* const ownMapping) {
+
+ if (gMappings) {
+
+ gMappings->put((void *) encoding, ownMapping);
+ }
+}
// ---------------------------------------------------------------------------
// XLMTranscoder: Non-virtual API
@@ -259,7 +272,6 @@
{
}
-
// ---------------------------------------------------------------------------
// XLMTranscoder: Hidden Init Method
//
@@ -267,6 +279,7 @@
// ---------------------------------------------------------------------------
void XMLTransService::initTransService()
{
+
//
// Create our hash table that we will fill with mappings. The default
// is to adopt the elements, which is fine with us.
@@ -287,6 +300,7 @@
gMappings->put((void*)XMLUni::fgUSASCIIEncodingString3, new ENameMapFor<XMLASCIITranscoder>(XMLUni::fgUSASCIIEncodingString3));
gMappings->put((void*)XMLUni::fgUSASCIIEncodingString4, new ENameMapFor<XMLASCIITranscoder>(XMLUni::fgUSASCIIEncodingString4));
+
//
// Add in our mappings for UTF-8
//
@@ -418,4 +432,5 @@
// this one, so there is just one mapping.
//
gMappings->put((void*)XMLUni::fgWin1252EncodingString, new ENameMapFor<XMLWin1252Transcoder>(XMLUni::fgWin1252EncodingString));
+
}
1.12 +16 -0 xml-xerces/c/src/util/TransService.hpp
Index: TransService.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/util/TransService.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TransService.hpp 2000/04/12 22:57:45 1.11
+++ TransService.hpp 2001/01/25 19:19:32 1.12
@@ -56,6 +56,9 @@
/*
* $Log: TransService.hpp,v $
+ * Revision 1.12 2001/01/25 19:19:32 tng
+ * Let user add their encoding to the intrinsic mapping table. Added by Khaled Noaman.
+ *
* Revision 1.11 2000/04/12 22:57:45 roddey
* A couple of fixes to comments and parameter names to make them
* more correct.
@@ -112,6 +115,7 @@
class XMLPlatformUtils;
class XMLLCPTranscoder;
class XMLTranscoder;
+class ENameMap;
//
@@ -195,6 +199,17 @@
virtual bool supportsSrcOfs() const = 0;
virtual void upperCase(XMLCh* const toUpperCase) const = 0;
+
+ // -----------------------------------------------------------------------
+ // Allow users to add their own encodings to the intrinsinc mapping
+ // table
+ // Usage:
+ // XMLTransService::addEncoding (
+ // gMyEncodingNameString
+ // , new ENameMapFor<MyTransClassType>(gMyEncodingNameString)
+ // );
+ // -----------------------------------------------------------------------
+ static void addEncoding(const XMLCh* const encoding, ENameMap* const ownMapping);
protected :