source: icXML/icXML-devel/src/xercesc/util/XMLMsgLoader.cpp @ 2722

Last change on this file since 2722 was 2722, checked in by cameron, 6 years ago

Original Xerces files with import mods for icxercesc

File size: 2.8 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 *  $Id: XMLMsgLoader.cpp 482395 2006-12-04 22:44:40Z dbertoni $
20 */
21
22// ---------------------------------------------------------------------------
23//  Includes
24// ---------------------------------------------------------------------------
25#include <xercesc/util/XMLMsgLoader.hpp>
26#include <icxercesc/util/PlatformUtils.hpp>
27#include <icxercesc/util/XMLString.hpp>
28#include <xercesc/util/XMLUniDefs.hpp>
29
30XERCES_CPP_NAMESPACE_BEGIN
31
32/***
33 *   The PlatformUtils::initialize() would set fLocale
34 *   to either a user-provided string or 0
35 *
36 ***/
37char* XMLMsgLoader::fLocale = 0;
38
39char* XMLMsgLoader::fPath = 0;
40
41/***
42 *  if localeToAdopt is 0, that is to release memory for
43 *  the user defined locale string
44 *
45 ***/
46void  XMLMsgLoader::setLocale(const char* const localeToAdopt)
47{
48    /***
49     * Release the current setting's memory, if any
50     ***/
51    if (fLocale)
52    {
53        XMLPlatformUtils::fgMemoryManager->deallocate(fLocale);//delete [] fLocale;
54        fLocale = 0;
55    }
56
57    /***
58     * 
59     *  REVISIT: later we may do locale format checking
60     *
61     *           refer to phttp://oss.software.ibm.com/icu/userguide/locale.html
62     *           for details.
63     */
64    if (localeToAdopt && (strlen(localeToAdopt) == 2 || (strlen(localeToAdopt) > 3 && localeToAdopt[2]=='_')))
65    {
66        fLocale   = XMLString::replicate(localeToAdopt, XMLPlatformUtils::fgMemoryManager);                   
67    }
68
69}
70
71const char* XMLMsgLoader::getLocale()
72{
73    return fLocale;
74}
75
76/***
77 *  if nlsHomeToAdopt is 0, that is to release memory for
78 *  the user defined NLSHome string
79 *
80 ***/
81void  XMLMsgLoader::setNLSHome(const char* const nlsHomeToAdopt)
82{
83    /***
84     * Release the current setting's memory, if any
85     ***/
86    if (fPath)
87    {
88        XMLPlatformUtils::fgMemoryManager->deallocate(fPath);//delete [] fPath;
89        fPath = 0;
90    }
91
92    if (nlsHomeToAdopt)
93    {
94        fPath = XMLString::replicate(nlsHomeToAdopt, XMLPlatformUtils::fgMemoryManager);
95    }
96
97}
98
99const char* XMLMsgLoader::getNLSHome()
100{
101    return fPath;
102}
103
104XERCES_CPP_NAMESPACE_END
Note: See TracBrowser for help on using the repository browser.