Skip to content
Snippets Groups Projects
Commit c0fd69d3 authored by Tinny Ng's avatar Tinny Ng
Browse files

Let user add their encoding to the intrinsic mapping table. Added by Khaled Noaman.

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@172513 13f79535-47bb-0310-9956-ffa450edef68
parent 3f50fdc6
No related branches found
No related tags found
No related merge requests found
......@@ -76,6 +76,7 @@
#include <util/TransENameMap.hpp>
// ---------------------------------------------------------------------------
// Local, static data
//
......@@ -152,6 +153,18 @@ XMLTransService::~XMLTransService()
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 @@ XMLLCPTranscoder::~XMLLCPTranscoder()
{
}
// ---------------------------------------------------------------------------
// XLMTranscoder: Hidden Init Method
//
......@@ -267,6 +279,7 @@ XMLLCPTranscoder::~XMLLCPTranscoder()
// ---------------------------------------------------------------------------
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 @@ void XMLTransService::initTransService()
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 @@ void XMLTransService::initTransService()
// this one, so there is just one mapping.
//
gMappings->put((void*)XMLUni::fgWin1252EncodingString, new ENameMapFor<XMLWin1252Transcoder>(XMLUni::fgWin1252EncodingString));
}
......@@ -56,6 +56,9 @@
/*
* $Log$
* 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;
//
......@@ -196,6 +200,17 @@ public :
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 :
// -----------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment