Xalan-C++ API Reference  1.12.0
XalanMessageLoader.hpp
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #if !defined(XALANMESSAGELOADER_HEADER_GUARD_1357924680)
19 #define XALANMESSAGELOADER_HEADER_GUARD_1357924680
20 
21 
22 // Base include file. Must be first.
24 
25 
26 
28 
29 
30 
32 
33 
34 
35 #include "LocalMsgIndex.hpp"
36 
37 
38 
39 namespace XALAN_CPP_NAMESPACE {
40 
41 
42 
43 using xercesc::MemoryManager;
44 
45 
46 
47 // class for calling fom outside of the module
49 
50 
51 public:
52  template <class Type>
54  {
55  public:
56 
57  Type*
58  operator()(MemoryManager& theManager)
59  {
60  XalanAllocationGuard theGuard(theManager, theManager.allocate(sizeof(Type)));
61 
62  Type* const theResult =
63  new (theGuard.get()) Type(theManager);
64 
65  theGuard.release();
66 
67  return theResult;
68  }
69  };
70 
72  {
73  public:
74  void
76  MemoryManager& theManager,
78  {
79  assert(p != 0);
80 
81  XalanDestroy(theManager, *p);
82  }
83  };
84 
85  virtual
87 
89  {
90  }
91 
92  static void
93  initialize(MemoryManager& theManager);
94 
95  static void
96  terminate();
97 
98  static XalanDOMString&
99  getMessage(
100  XalanDOMString& theResultMessage,
101  XalanMessages::Codes msgToLoad,
102  const char* repText1 ,
103  const char* repText2 = 0,
104  const char* repText3 = 0,
105  const char* repText4 = 0);
106 
107  static XalanDOMString&
108  getMessage(
109  XalanDOMString& theResultMessage,
110  XalanMessages::Codes msgToLoad,
111  const XalanDOMChar* repText1,
112  const XalanDOMChar* repText2 = 0,
113  const XalanDOMChar* repText3 = 0,
114  const XalanDOMChar* repText4 = 0);
115 
116  static XalanDOMString&
117  getMessage(
118  XalanDOMString& theResultMessage,
119  XalanMessages::Codes msgToLoad);
120 
121  static XalanDOMString&
122  getMessage(
123  XalanDOMString& theResultMessage,
124  XalanMessages::Codes msgToLoad,
125  const XalanDOMString& repText1);
126 
127  static XalanDOMString&
128  getMessage(
129  XalanDOMString& theResultMessage,
130  XalanMessages::Codes msgToLoad,
131  const XalanDOMString& repText1,
132  const XalanDOMString& repText2);
133 
134  static XalanDOMString&
135  getMessage(
136  XalanDOMString& theResultMessage,
137  XalanMessages::Codes msgToLoad,
138  const XalanDOMString& repText1,
139  const XalanDOMString& repText2,
140  const XalanDOMString& repText3);
141 
142 protected:
143 
144  virtual bool
145  loadMsg(
146  XalanMessages::Codes msgToLoad,
147  XalanDOMChar* toFill,
148  XalanSize_t maxChars) = 0;
149 
150 private:
151 
152  bool
153  load(
154  XalanMessages::Codes msgToLoad,
155  MemoryManager& theMemoryManager,
156  XalanDOMChar* toFill,
157  XalanSize_t maxChars,
158  const XalanDOMChar* repText1,
159  const XalanDOMChar* repText2 = 0,
160  const XalanDOMChar* repText3 = 0,
161  const XalanDOMChar* repText4 = 0);
162 
163  bool
164  load(
165  XalanMessages::Codes msgToLoad,
166  MemoryManager& theManager,
167  XalanDOMChar* toFill,
168  XalanSize_t maxChars,
169  const char* repText1 ,
170  const char* repText2 = 0,
171  const char* repText3 = 0,
172  const char* repText4 = 0);
173 
175 
177  operator=(const XalanMessageLoader&);
178 
179  static XalanMessageLoader* s_msgLoader;
180 };
181 
182 
183 
184 }
185 
186 #endif // XALANMESSAGELOADER_HEADER_GUARD_1357924680
xalanc::XalanMessageLoader::XalanMessageLoaderDestructFunct
Definition: XalanMessageLoader.hpp:71
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
xalanc::XalanAllocationGuard::release
void release()
Definition: XalanMemoryManagement.hpp:133
XalanDOMString.hpp
xalanc::XalanMessageLoader
Definition: XalanMessageLoader.hpp:48
xalanc::XalanMessageLoader::XalanMessageLoaderCreateFunct::operator()
Type * operator()(MemoryManager &theManager)
Definition: XalanMessageLoader.hpp:58
XALAN_PLATFORMSUPPORT_EXPORT
#define XALAN_PLATFORMSUPPORT_EXPORT
Definition: PlatformSupportDefinitions.hpp:35
PlatformSupportDefinitions.hpp
xalanc::XalanAllocationGuard
Definition: XalanMemoryManagement.hpp:96
xalanc::XalanMessageLoader::XalanMessageLoaderCreateFunct
Definition: XalanMessageLoader.hpp:53
xalanc::XalanMessageLoader::XalanMessageLoaderDestructFunct::operator()
void operator()(MemoryManager &theManager, XalanMessageLoader *p)
Definition: XalanMessageLoader.hpp:75
xalanc::XalanMessageLoader::XalanMessageLoader
XalanMessageLoader()
Definition: XalanMessageLoader.hpp:88
xalanc::XalanAllocationGuard::get
void * get() const
Definition: XalanMemoryManagement.hpp:127
xalanc::XalanDestroy
void XalanDestroy(Type &theArg)
Definition: XalanMemoryManagement.hpp:150
xalanc::XalanDOMString
Definition: XalanDOMString.hpp:45
XalanMemMgrAutoPtr.hpp