peiyongz 2003/02/17 11:54:47 Modified: c/src/xercesc/util XMLMsgLoader.hpp XMLMsgLoader.cpp PlatformUtils.hpp PlatformUtils.cpp Log: Allow set user specified error message file location in PlatformUtils::Initialize(). Revision Changes Path 1.4 +27 -2 xml-xerces/c/src/xercesc/util/XMLMsgLoader.hpp Index: XMLMsgLoader.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLMsgLoader.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- XMLMsgLoader.hpp 4 Nov 2002 22:24:21 -0000 1.3 +++ XMLMsgLoader.hpp 17 Feb 2003 19:54:47 -0000 1.4 @@ -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 @@ /** @name Locale Handling */ //@{ - /** + /** * This function enables set the locale information which * all concrete message loaders shall refer to during instantiation. * @@ -175,12 +178,29 @@ 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 @@ // 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[]; }; 1.2 +35 -2 xml-xerces/c/src/xercesc/util/XMLMsgLoader.cpp Index: XMLMsgLoader.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLMsgLoader.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- XMLMsgLoader.cpp 4 Nov 2002 22:24:21 -0000 1.1 +++ XMLMsgLoader.cpp 17 Feb 2003 19:54:47 -0000 1.2 @@ -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 @@ ***/ char* XMLMsgLoader::fLocale = 0; +char* XMLMsgLoader::fPath = 0; + XMLCh XMLMsgLoader::fLanguage[] = {chLatin_e, chLatin_n, chNull}; /*** @@ -116,6 +121,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; } // --------------------------------------------------------------------------- 1.9 +7 -2 xml-xerces/c/src/xercesc/util/PlatformUtils.hpp Index: PlatformUtils.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/PlatformUtils.hpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- PlatformUtils.hpp 20 Dec 2002 22:10:20 -0000 1.8 +++ PlatformUtils.hpp 17 Feb 2003 19:54:47 -0000 1.9 @@ -171,8 +171,13 @@ * * 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 * 1.7 +10 -3 xml-xerces/c/src/xercesc/util/PlatformUtils.cpp Index: PlatformUtils.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/PlatformUtils.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- PlatformUtils.cpp 20 Dec 2002 22:10:20 -0000 1.6 +++ PlatformUtils.cpp 17 Feb 2003 19:54:47 -0000 1.7 @@ -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 @@ // --------------------------------------------------------------------------- // 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 @@ fgNetAccessor = makeNetAccessor(); /*** - * Locale setting for Message Loader + * Message Loader: * + * Locale setting + * nlsHome setting ***/ XMLMsgLoader::setLocale(locale); - + XMLMsgLoader::setNLSHome(nlsHome); } @@ -339,6 +345,7 @@ * refer to discussion in the Initialize() ***/ XMLMsgLoader::setLocale(0); + XMLMsgLoader::setNLSHome(0); // And say we are no longer initialized gInitFlag = 0;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]