|
||||
File indexing completed on 2025-01-18 10:15:15
0001 /* 0002 * Licensed to the Apache Software Foundation (ASF) under one or more 0003 * contributor license agreements. See the NOTICE file distributed with 0004 * this work for additional information regarding copyright ownership. 0005 * The ASF licenses this file to You under the Apache License, Version 2.0 0006 * (the "License"); you may not use this file except in compliance with 0007 * the License. You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 */ 0017 0018 /* 0019 * $Id$ 0020 */ 0021 0022 #if !defined(XERCESC_INCLUDE_GUARD_XMLMSGLOADER_HPP) 0023 #define XERCESC_INCLUDE_GUARD_XMLMSGLOADER_HPP 0024 0025 #include <xercesc/util/XMemory.hpp> 0026 #include <xercesc/util/PlatformUtils.hpp> 0027 0028 XERCES_CPP_NAMESPACE_BEGIN 0029 0030 // 0031 // This header defines an abstract message loading API. This is the API via 0032 // which the parser system loads translatable text, and there can be multiple 0033 // actual implementations of this mechanism. The API is very simple because 0034 // there can be many kinds of underlying systems on which implementations are 0035 // based and we don't want to get into portability trouble by being overly 0036 // smart. 0037 // 0038 // Each instance of the message loader loads a file of messages, which are 0039 // accessed by key and which are associated with a particular language. The 0040 // actual source information may be in many forms, but by the time it is 0041 // extracted for use it will be in Unicode format. The language is always 0042 // the default language for the local machine. 0043 // 0044 // Msg loader derivatives are not required to be thread safe. The parser will 0045 // never use a single instance in more than one thread. 0046 // 0047 class XMLUTIL_EXPORT XMLMsgLoader : public XMemory 0048 { 0049 public : 0050 // ----------------------------------------------------------------------- 0051 // Class specific types 0052 // 0053 // XMLMsgId 0054 // A simple typedef to give us flexibility about the representation 0055 // of a message id. 0056 // ----------------------------------------------------------------------- 0057 typedef unsigned int XMLMsgId; 0058 0059 0060 // ----------------------------------------------------------------------- 0061 // Public Constructors and Destructor 0062 // ----------------------------------------------------------------------- 0063 virtual ~XMLMsgLoader(); 0064 0065 0066 // ----------------------------------------------------------------------- 0067 // The virtual message loader API 0068 // ----------------------------------------------------------------------- 0069 virtual bool loadMsg 0070 ( 0071 const XMLMsgId msgToLoad 0072 , XMLCh* const toFill 0073 , const XMLSize_t maxChars 0074 ) = 0; 0075 0076 virtual bool loadMsg 0077 ( 0078 const XMLMsgId msgToLoad 0079 , XMLCh* const toFill 0080 , const XMLSize_t maxChars 0081 , const XMLCh* const repText1 0082 , const XMLCh* const repText2 = 0 0083 , const XMLCh* const repText3 = 0 0084 , const XMLCh* const repText4 = 0 0085 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 0086 ) = 0; 0087 0088 virtual bool loadMsg 0089 ( 0090 const XMLMsgId msgToLoad 0091 , XMLCh* const toFill 0092 , const XMLSize_t maxChars 0093 , const char* const repText1 0094 , const char* const repText2 = 0 0095 , const char* const repText3 = 0 0096 , const char* const repText4 = 0 0097 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 0098 ) = 0; 0099 0100 /** @name Locale Handling */ 0101 //@{ 0102 /** 0103 * This function enables set the locale information which 0104 * all concrete message loaders shall refer to during instantiation. 0105 * 0106 * Note: for detailed discussion, refer to PlatformUtils::initialize() 0107 */ 0108 static void setLocale(const char* const localeToAdopt); 0109 0110 /** 0111 * For the derived to retrieve locale info during construction 0112 */ 0113 static const char* getLocale(); 0114 0115 //@} 0116 0117 /** @name NLSHome Handling */ 0118 //@{ 0119 /** 0120 * This function enables set the NLSHome information which 0121 * all concrete message loaders shall refer to during instantiation. 0122 * 0123 * Note: for detailed discussion, refer to PlatformUtils::initialize() 0124 */ 0125 static void setNLSHome(const char* const nlsHomeToAdopt); 0126 0127 /** 0128 * For the derived to retrieve NLSHome info during construction 0129 */ 0130 static const char* getNLSHome(); 0131 0132 //@} 0133 0134 protected : 0135 // ----------------------------------------------------------------------- 0136 // Hidden Constructors 0137 // ----------------------------------------------------------------------- 0138 XMLMsgLoader(); 0139 0140 private : 0141 // ----------------------------------------------------------------------- 0142 // Unimplemented constructors and operators 0143 // ----------------------------------------------------------------------- 0144 XMLMsgLoader(const XMLMsgLoader&); 0145 XMLMsgLoader& operator=(const XMLMsgLoader&); 0146 0147 0148 // ----------------------------------------------------------------------- 0149 // Private data members 0150 // 0151 // fLocale 0152 // Locale info set through PlatformUtils::init(). 0153 // The derived class may refer to this for locale information. 0154 // 0155 // fPath 0156 // NLSHome info set through PlatformUtils::init(). 0157 // The derived class may refer to this for NLSHome information. 0158 // 0159 // ----------------------------------------------------------------------- 0160 static char* fLocale; 0161 static char* fPath; 0162 }; 0163 0164 0165 // --------------------------------------------------------------------------- 0166 // XMLMsgLoader: Public Constructors and Destructor 0167 // --------------------------------------------------------------------------- 0168 inline XMLMsgLoader::~XMLMsgLoader() 0169 { 0170 } 0171 0172 0173 // --------------------------------------------------------------------------- 0174 // XMLMsgLoader: Hidden Constructors 0175 // --------------------------------------------------------------------------- 0176 inline XMLMsgLoader::XMLMsgLoader() 0177 { 0178 } 0179 0180 XERCES_CPP_NAMESPACE_END 0181 0182 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |