source: icXML/icXML-devel/src/xercesc/util/XMLMsgLoader.hpp @ 2732

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

Original Xerces files with import mods for icxercesc

File size: 6.3 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.hpp 932887 2010-04-11 13:04:59Z borisk $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_XMLMSGLOADER_HPP)
23#define XERCESC_INCLUDE_GUARD_XMLMSGLOADER_HPP
24
25#include <xercesc/util/XMemory.hpp>
26#include <icxercesc/util/PlatformUtils.hpp>
27
28XERCES_CPP_NAMESPACE_BEGIN
29
30//
31//  This header defines an abstract message loading API. This is the API via
32//  which the parser system loads translatable text, and there can be multiple
33//  actual implementations of this mechanism. The API is very simple because
34//  there can be many kinds of underlying systems on which implementations are
35//  based and we don't want to get into portability trouble by being overly
36//  smart.
37//
38//  Each instance of the message loader loads a file of messages, which are
39//  accessed by key and which are associated with a particular language. The
40//  actual source information may be in many forms, but by the time it is
41//  extracted for use it will be in Unicode format. The language is always
42//  the default language for the local machine.
43//
44//  Msg loader derivatives are not required to be thread safe. The parser will
45//  never use a single instance in more than one thread.
46//
47class XMLUTIL_EXPORT XMLMsgLoader : public XMemory
48{
49public :
50    // -----------------------------------------------------------------------
51    //  Class specific types
52    //
53    //  XMLMsgId
54    //      A simple typedef to give us flexibility about the representation
55    //      of a message id.
56    // -----------------------------------------------------------------------
57    typedef unsigned int    XMLMsgId;
58
59
60    // -----------------------------------------------------------------------
61    //  Public Constructors and Destructor
62    // -----------------------------------------------------------------------
63    virtual ~XMLMsgLoader();
64
65
66    // -----------------------------------------------------------------------
67    //  The virtual message loader API
68    // -----------------------------------------------------------------------
69    virtual bool loadMsg
70    (
71        const   XMLMsgId        msgToLoad
72        ,       XMLCh* const    toFill
73        , const XMLSize_t       maxChars
74    ) = 0;
75
76    virtual bool loadMsg
77    (
78        const   XMLMsgId        msgToLoad
79        ,       XMLCh* const    toFill
80        , const XMLSize_t       maxChars
81        , const XMLCh* const    repText1
82        , const XMLCh* const    repText2 = 0
83        , const XMLCh* const    repText3 = 0
84        , const XMLCh* const    repText4 = 0
85        , MemoryManager* const  manager   = XMLPlatformUtils::fgMemoryManager
86    ) = 0;
87
88    virtual bool loadMsg
89    (
90        const   XMLMsgId        msgToLoad
91        ,       XMLCh* const    toFill
92        , const XMLSize_t       maxChars
93        , const char* const     repText1
94        , const char* const     repText2 = 0
95        , const char* const     repText3 = 0
96        , const char* const     repText4 = 0
97        , MemoryManager* const  manager  = XMLPlatformUtils::fgMemoryManager
98    ) = 0;
99
100    /** @name Locale Handling  */
101    //@{
102    /**
103      * This function enables set the locale information which
104      * all concrete message loaders shall refer to during instantiation.
105      *
106      * Note: for detailed discussion, refer to PlatformUtils::initialize()
107      */
108    static void           setLocale(const char* const localeToAdopt);
109
110    /**
111      * For the derived to retrieve locale info during construction
112      */
113    static const char*    getLocale();
114
115    //@}
116
117    /** @name NLSHome Handling  */
118    //@{
119    /**
120      * This function enables set the NLSHome information which
121      * all concrete message loaders shall refer to during instantiation.
122      *
123      * Note: for detailed discussion, refer to PlatformUtils::initialize()
124      */
125    static void           setNLSHome(const char* const nlsHomeToAdopt);
126
127    /**
128      * For the derived to retrieve NLSHome info during construction
129      */
130    static const char*    getNLSHome();
131
132    //@}
133
134protected :
135    // -----------------------------------------------------------------------
136    //  Hidden Constructors
137    // -----------------------------------------------------------------------
138    XMLMsgLoader();
139
140private :
141    // -----------------------------------------------------------------------
142    //  Unimplemented constructors and operators
143    // -----------------------------------------------------------------------
144    XMLMsgLoader(const XMLMsgLoader&);
145    XMLMsgLoader& operator=(const XMLMsgLoader&);
146
147
148    // -----------------------------------------------------------------------
149    //  Private data members
150    //
151    //  fLocale
152    //      Locale info set through PlatformUtils::init().
153    //      The derived class may refer to this for locale information.
154    //
155    //  fPath
156    //      NLSHome info set through PlatformUtils::init().
157    //      The derived class may refer to this for NLSHome information.
158    //
159    // -----------------------------------------------------------------------
160    static char*    fLocale;
161    static char*    fPath;
162};
163
164
165// ---------------------------------------------------------------------------
166//  XMLMsgLoader: Public Constructors and Destructor
167// ---------------------------------------------------------------------------
168inline XMLMsgLoader::~XMLMsgLoader()
169{
170}
171
172
173// ---------------------------------------------------------------------------
174//  XMLMsgLoader: Hidden Constructors
175// ---------------------------------------------------------------------------
176inline XMLMsgLoader::XMLMsgLoader()
177{
178}
179
180XERCES_CPP_NAMESPACE_END
181
182#endif
Note: See TracBrowser for help on using the repository browser.