diff --git a/src/xercesc/util/PlatformUtils.cpp b/src/xercesc/util/PlatformUtils.cpp index c7e68524204559695858e462076c91c293f62673..703ed0be8f636d607fc843aa75743e103bfbe404 100644 --- a/src/xercesc/util/PlatformUtils.cpp +++ b/src/xercesc/util/PlatformUtils.cpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.7 2003/02/17 19:54:47 peiyongz + * Allow set user specified error message file location in PlatformUtils::Initialize(). + * * Revision 1.6 2002/12/20 22:10:20 tng * XML 1.1 * @@ -196,7 +199,8 @@ XMLTransService* XMLPlatformUtils::fgTransService = 0; // --------------------------------------------------------------------------- // XMLPlatformUtils: Init/term methods // --------------------------------------------------------------------------- -void XMLPlatformUtils::Initialize(const char* const locale) +void XMLPlatformUtils::Initialize(const char* const locale + , const char* const nlsHome) { // // Effects of overflow: @@ -272,11 +276,13 @@ void XMLPlatformUtils::Initialize(const char* const locale) fgNetAccessor = makeNetAccessor(); /*** - * Locale setting for Message Loader + * Message Loader: * + * Locale setting + * nlsHome setting ***/ XMLMsgLoader::setLocale(locale); - + XMLMsgLoader::setNLSHome(nlsHome); } @@ -339,6 +345,7 @@ void XMLPlatformUtils::Terminate() * refer to discussion in the Initialize() ***/ XMLMsgLoader::setLocale(0); + XMLMsgLoader::setNLSHome(0); // And say we are no longer initialized gInitFlag = 0; diff --git a/src/xercesc/util/PlatformUtils.hpp b/src/xercesc/util/PlatformUtils.hpp index 466c8b857caf12d27c1af00192f652f994da1ed6..15ef2c36cc9e02d4fded3009b1cff5c9f2bef84e 100644 --- a/src/xercesc/util/PlatformUtils.hpp +++ b/src/xercesc/util/PlatformUtils.hpp @@ -171,8 +171,13 @@ public : * * The default locale is "en_US". * + * nlsHome: user specified location where MsgLoader retrieves error message files. + * the discussion above with regard to locale, applies to this nlsHome + * as well. + * */ - static void Initialize(const char* const locale = XMLUni::fgXercescDefaultLocale); + static void Initialize(const char* const locale = XMLUni::fgXercescDefaultLocale + , const char* const nlsHome = 0); /** Perform per-process parser termination * diff --git a/src/xercesc/util/XMLMsgLoader.cpp b/src/xercesc/util/XMLMsgLoader.cpp index 760db118dda4c03bd5e715d5b61a0dde1f981eff..8bd01a56f30fe6878fb8824d3b7231e82b6ea0a3 100644 --- a/src/xercesc/util/XMLMsgLoader.cpp +++ b/src/xercesc/util/XMLMsgLoader.cpp @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.2 2003/02/17 19:54:47 peiyongz + * Allow set user specified error message file location in PlatformUtils::Initialize(). + * * Revision 1.1 2002/11/04 22:24:21 peiyongz * Locale setting for message loader * @@ -79,6 +82,8 @@ XERCES_CPP_NAMESPACE_BEGIN ***/ char* XMLMsgLoader::fLocale = 0; +char* XMLMsgLoader::fPath = 0; + XMLCh XMLMsgLoader::fLanguage[] = {chLatin_e, chLatin_n, chNull}; /*** @@ -118,6 +123,34 @@ const char* XMLMsgLoader::getLocale() return fLocale; } +/*** + * if nlsHomeToAdopt is 0, that is to release memory for + * the user defined NLSHome string + * + ***/ +void XMLMsgLoader::setNLSHome(const char* const nlsHomeToAdopt) +{ + /*** + * Release the current setting's memory, if any + ***/ + if (fPath) + { + delete [] fPath; + fPath = 0; + } + + if (nlsHomeToAdopt) + { + fPath = XMLString::replicate(nlsHomeToAdopt); + } + +} + +const char* XMLMsgLoader::getNLSHome() +{ + return fPath; +} + // --------------------------------------------------------------------------- // Deprecated // diff --git a/src/xercesc/util/XMLMsgLoader.hpp b/src/xercesc/util/XMLMsgLoader.hpp index afd1ca4dc50c7ce7e73375d96d98ea469d7253f4..b4b52eb6161f7b83574a9f21f7bf1b45faa2b72e 100644 --- a/src/xercesc/util/XMLMsgLoader.hpp +++ b/src/xercesc/util/XMLMsgLoader.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.4 2003/02/17 19:54:47 peiyongz + * Allow set user specified error message file location in PlatformUtils::Initialize(). + * * Revision 1.3 2002/11/04 22:24:21 peiyongz * Locale setting for message loader * @@ -166,7 +169,7 @@ public : /** @name Locale Handling */ //@{ - /** + /** * This function enables set the locale information which * all concrete message loaders shall refer to during instantiation. * @@ -175,12 +178,29 @@ public : static void setLocale(const char* const localeToAdopt); /** - * Fr the derived to retrieve locale info during construction + * For the derived to retrieve locale info during construction */ static const char* getLocale(); //@} + /** @name NLSHome Handling */ + //@{ + /** + * This function enables set the NLSHome information which + * all concrete message loaders shall refer to during instantiation. + * + * Note: for detailed discussion, refer to PlatformUtils::initalize() + */ + static void setNLSHome(const char* const nlsHomeToAdopt); + + /** + * For the derived to retrieve NLSHome info during construction + */ + static const char* getNLSHome(); + + //@} + // ----------------------------------------------------------------------- // Deprecated: Getter methods // ----------------------------------------------------------------------- @@ -213,8 +233,13 @@ private : // Locale info set through PlatformUtils::init(). // The derived class may refer to this for locale information. // + // fPath + // NLSHome info set through PlatformUtils::init(). + // The derived class may refer to this for NLSHome information. + // // ----------------------------------------------------------------------- static char* fLocale; + static char* fPath; static XMLCh fLanguage[]; };