1*b5088357SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*b5088357SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b5088357SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b5088357SAndrew Rist  * distributed with this work for additional information
6*b5088357SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b5088357SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b5088357SAndrew Rist  * "License"); you may not use this file except in compliance
9*b5088357SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*b5088357SAndrew Rist  *
11*b5088357SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*b5088357SAndrew Rist  *
13*b5088357SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b5088357SAndrew Rist  * software distributed under the License is distributed on an
15*b5088357SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b5088357SAndrew Rist  * KIND, either express or implied.  See the License for the
17*b5088357SAndrew Rist  * specific language governing permissions and limitations
18*b5088357SAndrew Rist  * under the License.
19*b5088357SAndrew Rist  *
20*b5088357SAndrew Rist  *************************************************************/
21*b5088357SAndrew Rist 
22*b5088357SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_unotools.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <unotools/confignode.hxx>
28cdf0e10cSrcweir #include <unotools/configpathes.hxx>
29cdf0e10cSrcweir #include <tools/diagnose_ex.h>
30cdf0e10cSrcweir #include <osl/diagnose.h>
31cdf0e10cSrcweir #include <com/sun/star/container/XHierarchicalName.hpp>
32cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
33cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
34cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
35cdf0e10cSrcweir #include <com/sun/star/util/XStringEscape.hpp>
36cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
37cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp>
38cdf0e10cSrcweir #include <comphelper/extract.hxx>
39cdf0e10cSrcweir #include <comphelper/componentcontext.hxx>
40cdf0e10cSrcweir #include <comphelper/namedvaluecollection.hxx>
41cdf0e10cSrcweir #include <rtl/string.hxx>
42cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
43cdf0e10cSrcweir #include <rtl/strbuf.hxx>
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir 
46cdf0e10cSrcweir //........................................................................
47cdf0e10cSrcweir namespace utl
48cdf0e10cSrcweir {
49cdf0e10cSrcweir //........................................................................
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
52cdf0e10cSrcweir 	using namespace ::com::sun::star::lang;
53cdf0e10cSrcweir 	using namespace ::com::sun::star::util;
54cdf0e10cSrcweir 	using namespace ::com::sun::star::beans;
55cdf0e10cSrcweir 	using namespace ::com::sun::star::container;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 	//========================================================================
58cdf0e10cSrcweir 	//= OConfigurationNode
59cdf0e10cSrcweir 	//========================================================================
60cdf0e10cSrcweir 	//------------------------------------------------------------------------
OConfigurationNode(const Reference<XInterface> & _rxNode)61cdf0e10cSrcweir 	OConfigurationNode::OConfigurationNode(const Reference< XInterface >& _rxNode )
62cdf0e10cSrcweir 		:m_bEscapeNames(sal_False)
63cdf0e10cSrcweir 	{
64cdf0e10cSrcweir 		OSL_ENSURE(_rxNode.is(), "OConfigurationNode::OConfigurationNode: invalid node interface!");
65cdf0e10cSrcweir 		if (_rxNode.is())
66cdf0e10cSrcweir 		{
67cdf0e10cSrcweir 			// collect all interfaces necessary
68cdf0e10cSrcweir 			m_xHierarchyAccess = Reference< XHierarchicalNameAccess >(_rxNode, UNO_QUERY);
69cdf0e10cSrcweir 			m_xDirectAccess = Reference< XNameAccess >(_rxNode, UNO_QUERY);
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 			// reset _all_ interfaces if _one_ of them is not supported
72cdf0e10cSrcweir 			if (!m_xHierarchyAccess.is() || !m_xDirectAccess.is())
73cdf0e10cSrcweir 			{
74cdf0e10cSrcweir 				m_xHierarchyAccess = NULL;
75cdf0e10cSrcweir 				m_xDirectAccess = NULL;
76cdf0e10cSrcweir 			}
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 			// now for the non-critical interfaces
79cdf0e10cSrcweir 			m_xReplaceAccess = Reference< XNameReplace >(_rxNode, UNO_QUERY);
80cdf0e10cSrcweir 			m_xContainerAccess = Reference< XNameContainer >(_rxNode, UNO_QUERY);
81cdf0e10cSrcweir 		}
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 		Reference< XComponent > xConfigNodeComp(m_xDirectAccess, UNO_QUERY);
84cdf0e10cSrcweir 		if (xConfigNodeComp.is())
85cdf0e10cSrcweir 			startComponentListening(xConfigNodeComp);
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 		if (isValid())
88cdf0e10cSrcweir 			setEscape(isSetNode());
89cdf0e10cSrcweir 	}
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	//------------------------------------------------------------------------
OConfigurationNode(const OConfigurationNode & _rSource)92cdf0e10cSrcweir 	OConfigurationNode::OConfigurationNode(const OConfigurationNode& _rSource)
93cdf0e10cSrcweir 		:OEventListenerAdapter()
94cdf0e10cSrcweir 		,m_xHierarchyAccess(_rSource.m_xHierarchyAccess)
95cdf0e10cSrcweir 		,m_xDirectAccess(_rSource.m_xDirectAccess)
96cdf0e10cSrcweir 		,m_xReplaceAccess(_rSource.m_xReplaceAccess)
97cdf0e10cSrcweir 		,m_xContainerAccess(_rSource.m_xContainerAccess)
98cdf0e10cSrcweir 		,m_bEscapeNames(_rSource.m_bEscapeNames)
99cdf0e10cSrcweir 		,m_sCompletePath(_rSource.m_sCompletePath)
100cdf0e10cSrcweir 	{
101cdf0e10cSrcweir 		Reference< XComponent > xConfigNodeComp(m_xDirectAccess, UNO_QUERY);
102cdf0e10cSrcweir 		if (xConfigNodeComp.is())
103cdf0e10cSrcweir 			startComponentListening(xConfigNodeComp);
104cdf0e10cSrcweir 	}
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	//------------------------------------------------------------------------
operator =(const OConfigurationNode & _rSource)107cdf0e10cSrcweir 	const OConfigurationNode& OConfigurationNode::operator=(const OConfigurationNode& _rSource)
108cdf0e10cSrcweir 	{
109cdf0e10cSrcweir 		stopAllComponentListening();
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 		m_xHierarchyAccess = _rSource.m_xHierarchyAccess;
112cdf0e10cSrcweir 		m_xDirectAccess = _rSource.m_xDirectAccess;
113cdf0e10cSrcweir 		m_xContainerAccess = _rSource.m_xContainerAccess;
114cdf0e10cSrcweir 		m_xReplaceAccess = _rSource.m_xReplaceAccess;
115cdf0e10cSrcweir 		m_bEscapeNames = _rSource.m_bEscapeNames;
116cdf0e10cSrcweir 		m_sCompletePath = _rSource.m_sCompletePath;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 		Reference< XComponent > xConfigNodeComp(m_xDirectAccess, UNO_QUERY);
119cdf0e10cSrcweir 		if (xConfigNodeComp.is())
120cdf0e10cSrcweir 			startComponentListening(xConfigNodeComp);
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 		return *this;
123cdf0e10cSrcweir 	}
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	//------------------------------------------------------------------------
_disposing(const EventObject & _rSource)126cdf0e10cSrcweir 	void OConfigurationNode::_disposing( const EventObject& _rSource )
127cdf0e10cSrcweir 	{
128cdf0e10cSrcweir 		Reference< XComponent > xDisposingSource(_rSource.Source, UNO_QUERY);
129cdf0e10cSrcweir 		Reference< XComponent > xConfigNodeComp(m_xDirectAccess, UNO_QUERY);
130cdf0e10cSrcweir 		if (xDisposingSource.get() == xConfigNodeComp.get())
131cdf0e10cSrcweir 			clear();
132cdf0e10cSrcweir 	}
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	//------------------------------------------------------------------------
getLocalName() const135cdf0e10cSrcweir     ::rtl::OUString OConfigurationNode::getLocalName() const
136cdf0e10cSrcweir     {
137cdf0e10cSrcweir         ::rtl::OUString sLocalName;
138cdf0e10cSrcweir         try
139cdf0e10cSrcweir         {
140cdf0e10cSrcweir             Reference< XNamed > xNamed( m_xDirectAccess, UNO_QUERY_THROW );
141cdf0e10cSrcweir             sLocalName = xNamed->getName();
142cdf0e10cSrcweir         }
143cdf0e10cSrcweir         catch( const Exception& )
144cdf0e10cSrcweir         {
145cdf0e10cSrcweir         	DBG_UNHANDLED_EXCEPTION();
146cdf0e10cSrcweir         }
147cdf0e10cSrcweir         return sLocalName;
148cdf0e10cSrcweir     }
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 	//------------------------------------------------------------------------
getNodePath() const151cdf0e10cSrcweir     ::rtl::OUString OConfigurationNode::getNodePath() const
152cdf0e10cSrcweir     {
153cdf0e10cSrcweir         ::rtl::OUString sNodePath;
154cdf0e10cSrcweir         try
155cdf0e10cSrcweir         {
156cdf0e10cSrcweir             Reference< XHierarchicalName > xNamed( m_xDirectAccess, UNO_QUERY_THROW );
157cdf0e10cSrcweir             sNodePath = xNamed->getHierarchicalName();
158cdf0e10cSrcweir         }
159cdf0e10cSrcweir         catch( const Exception& )
160cdf0e10cSrcweir         {
161cdf0e10cSrcweir         	DBG_UNHANDLED_EXCEPTION();
162cdf0e10cSrcweir         }
163cdf0e10cSrcweir         return sNodePath;
164cdf0e10cSrcweir     }
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 	//------------------------------------------------------------------------
normalizeName(const::rtl::OUString & _rName,NAMEORIGIN _eOrigin) const167cdf0e10cSrcweir 	::rtl::OUString OConfigurationNode::normalizeName(const ::rtl::OUString& _rName, NAMEORIGIN _eOrigin) const
168cdf0e10cSrcweir 	{
169cdf0e10cSrcweir 		::rtl::OUString sName(_rName);
170cdf0e10cSrcweir 		if (getEscape())
171cdf0e10cSrcweir 		{
172cdf0e10cSrcweir 			Reference< XStringEscape > xEscaper(m_xDirectAccess, UNO_QUERY);
173cdf0e10cSrcweir 			if (xEscaper.is() && sName.getLength())
174cdf0e10cSrcweir 			{
175cdf0e10cSrcweir 				try
176cdf0e10cSrcweir 				{
177cdf0e10cSrcweir 					if (NO_CALLER == _eOrigin)
178cdf0e10cSrcweir 						sName = xEscaper->escapeString(sName);
179cdf0e10cSrcweir 					else
180cdf0e10cSrcweir 						sName = xEscaper->unescapeString(sName);
181cdf0e10cSrcweir 				}
182cdf0e10cSrcweir 				catch(Exception&)
183cdf0e10cSrcweir 				{
184cdf0e10cSrcweir 					DBG_UNHANDLED_EXCEPTION();
185cdf0e10cSrcweir 				}
186cdf0e10cSrcweir 			}
187cdf0e10cSrcweir 		}
188cdf0e10cSrcweir 		return sName;
189cdf0e10cSrcweir 	}
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 	//------------------------------------------------------------------------
getNodeNames() const192cdf0e10cSrcweir 	Sequence< ::rtl::OUString > OConfigurationNode::getNodeNames() const throw()
193cdf0e10cSrcweir 	{
194cdf0e10cSrcweir 		OSL_ENSURE(m_xDirectAccess.is(), "OConfigurationNode::getNodeNames: object is invalid!");
195cdf0e10cSrcweir 		Sequence< ::rtl::OUString > aReturn;
196cdf0e10cSrcweir 		if (m_xDirectAccess.is())
197cdf0e10cSrcweir 		{
198cdf0e10cSrcweir 			try
199cdf0e10cSrcweir 			{
200cdf0e10cSrcweir 				aReturn = m_xDirectAccess->getElementNames();
201cdf0e10cSrcweir 				// normalize the names
202cdf0e10cSrcweir 				::rtl::OUString* pNames = aReturn.getArray();
203cdf0e10cSrcweir 				for (sal_Int32 i=0; i<aReturn.getLength(); ++i, ++pNames)
204cdf0e10cSrcweir 					*pNames = normalizeName(*pNames, NO_CONFIGURATION);
205cdf0e10cSrcweir 			}
206cdf0e10cSrcweir 			catch(Exception&)
207cdf0e10cSrcweir 			{
208cdf0e10cSrcweir 				OSL_ENSURE(sal_False, "OConfigurationNode::getNodeNames: caught a generic exception!");
209cdf0e10cSrcweir 			}
210cdf0e10cSrcweir 		}
211cdf0e10cSrcweir 
212cdf0e10cSrcweir 		return aReturn;
213cdf0e10cSrcweir 	}
214cdf0e10cSrcweir 
215cdf0e10cSrcweir 	//------------------------------------------------------------------------
removeNode(const::rtl::OUString & _rName) const216cdf0e10cSrcweir 	sal_Bool OConfigurationNode::removeNode(const ::rtl::OUString& _rName) const throw()
217cdf0e10cSrcweir 	{
218cdf0e10cSrcweir 		OSL_ENSURE(m_xContainerAccess.is(), "OConfigurationNode::removeNode: object is invalid!");
219cdf0e10cSrcweir 		if (m_xContainerAccess.is())
220cdf0e10cSrcweir 		{
221cdf0e10cSrcweir 			try
222cdf0e10cSrcweir 			{
223cdf0e10cSrcweir 				::rtl::OUString sName = normalizeName(_rName, NO_CALLER);
224cdf0e10cSrcweir 				m_xContainerAccess->removeByName(sName);
225cdf0e10cSrcweir 				return sal_True;
226cdf0e10cSrcweir 			}
227cdf0e10cSrcweir 			catch (NoSuchElementException&)
228cdf0e10cSrcweir 			{
229cdf0e10cSrcweir                 #if OSL_DEBUG_LEVEL > 0
230cdf0e10cSrcweir                 rtl::OStringBuffer aBuf( 256 );
231cdf0e10cSrcweir                 aBuf.append("OConfigurationNode::removeNode: there is no element named!");
232cdf0e10cSrcweir                 aBuf.append( rtl::OUStringToOString( _rName, RTL_TEXTENCODING_ASCII_US ) );
233cdf0e10cSrcweir                 aBuf.append( "!" );
234cdf0e10cSrcweir 				OSL_ENSURE(sal_False, aBuf.getStr());
235cdf0e10cSrcweir                 #endif
236cdf0e10cSrcweir 			}
237cdf0e10cSrcweir 			catch (WrappedTargetException&)
238cdf0e10cSrcweir 			{
239cdf0e10cSrcweir 				OSL_ENSURE(sal_False, "OConfigurationNode::removeNode: caught a WrappedTargetException!");
240cdf0e10cSrcweir 			}
241cdf0e10cSrcweir 			catch(Exception&)
242cdf0e10cSrcweir 			{
243cdf0e10cSrcweir 				OSL_ENSURE(sal_False, "OConfigurationNode::removeNode: caught a generic exception!");
244cdf0e10cSrcweir 			}
245cdf0e10cSrcweir 		}
246cdf0e10cSrcweir 		return sal_False;
247cdf0e10cSrcweir 	}
248cdf0e10cSrcweir 	//------------------------------------------------------------------------
insertNode(const::rtl::OUString & _rName,const Reference<XInterface> & _xNode) const249cdf0e10cSrcweir 	OConfigurationNode OConfigurationNode::insertNode(const ::rtl::OUString& _rName,const Reference< XInterface >& _xNode) const throw()
250cdf0e10cSrcweir 	{
251cdf0e10cSrcweir 		if(_xNode.is())
252cdf0e10cSrcweir 		{
253cdf0e10cSrcweir 			try
254cdf0e10cSrcweir 			{
255cdf0e10cSrcweir 				::rtl::OUString sName = normalizeName(_rName, NO_CALLER);
256cdf0e10cSrcweir 				m_xContainerAccess->insertByName(sName, makeAny(_xNode));
257cdf0e10cSrcweir 				// if we're here, all was ok ...
258cdf0e10cSrcweir 				return OConfigurationNode( _xNode );
259cdf0e10cSrcweir 			}
260cdf0e10cSrcweir 			catch(const Exception&)
261cdf0e10cSrcweir 			{
262cdf0e10cSrcweir                 DBG_UNHANDLED_EXCEPTION();
263cdf0e10cSrcweir 			}
264cdf0e10cSrcweir 
265cdf0e10cSrcweir 			// dispose the child if it has already been created, but could not be inserted
266cdf0e10cSrcweir 			Reference< XComponent > xChildComp(_xNode, UNO_QUERY);
267cdf0e10cSrcweir 			if (xChildComp.is())
268cdf0e10cSrcweir 				try { xChildComp->dispose(); } catch(Exception&) { }
269cdf0e10cSrcweir 		}
270cdf0e10cSrcweir 
271cdf0e10cSrcweir 		return OConfigurationNode();
272cdf0e10cSrcweir 	}
273cdf0e10cSrcweir 	//------------------------------------------------------------------------
createNode(const::rtl::OUString & _rName) const274cdf0e10cSrcweir 	OConfigurationNode OConfigurationNode::createNode(const ::rtl::OUString& _rName) const throw()
275cdf0e10cSrcweir 	{
276cdf0e10cSrcweir 		Reference< XSingleServiceFactory > xChildFactory(m_xContainerAccess, UNO_QUERY);
277cdf0e10cSrcweir 		OSL_ENSURE(xChildFactory.is(), "OConfigurationNode::createNode: object is invalid or read-only!");
278cdf0e10cSrcweir 
279cdf0e10cSrcweir 		if (xChildFactory.is())	// implies m_xContainerAccess.is()
280cdf0e10cSrcweir 		{
281cdf0e10cSrcweir 			Reference< XInterface > xNewChild;
282cdf0e10cSrcweir 			try
283cdf0e10cSrcweir 			{
284cdf0e10cSrcweir 				xNewChild = xChildFactory->createInstance();
285cdf0e10cSrcweir 			}
286cdf0e10cSrcweir 			catch(const Exception&)
287cdf0e10cSrcweir 			{
288cdf0e10cSrcweir                 DBG_UNHANDLED_EXCEPTION();
289cdf0e10cSrcweir 			}
290cdf0e10cSrcweir 			return insertNode(_rName,xNewChild);
291cdf0e10cSrcweir 		}
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 		return OConfigurationNode();
294cdf0e10cSrcweir 	}
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 	//------------------------------------------------------------------------
appendNode(const::rtl::OUString & _rName,const OConfigurationNode & _aNewNode) const297cdf0e10cSrcweir 	OConfigurationNode OConfigurationNode::appendNode(const ::rtl::OUString& _rName,const OConfigurationNode& _aNewNode) const throw()
298cdf0e10cSrcweir 	{
299cdf0e10cSrcweir 		return insertNode(_rName,_aNewNode.m_xDirectAccess);
300cdf0e10cSrcweir 	}
301cdf0e10cSrcweir 	//------------------------------------------------------------------------
openNode(const::rtl::OUString & _rPath) const302cdf0e10cSrcweir 	OConfigurationNode OConfigurationNode::openNode(const ::rtl::OUString& _rPath) const throw()
303cdf0e10cSrcweir 	{
304cdf0e10cSrcweir 		OSL_ENSURE(m_xDirectAccess.is(), "OConfigurationNode::openNode: object is invalid!");
305cdf0e10cSrcweir 		OSL_ENSURE(m_xHierarchyAccess.is(), "OConfigurationNode::openNode: object is invalid!");
306cdf0e10cSrcweir 		try
307cdf0e10cSrcweir 		{
308cdf0e10cSrcweir 			::rtl::OUString sNormalized = normalizeName(_rPath, NO_CALLER);
309cdf0e10cSrcweir 
310cdf0e10cSrcweir 			Reference< XInterface > xNode;
311cdf0e10cSrcweir 			if (m_xDirectAccess.is() && m_xDirectAccess->hasByName(sNormalized))
312cdf0e10cSrcweir 			{
313cdf0e10cSrcweir 				if (!::cppu::extractInterface(xNode, m_xDirectAccess->getByName(sNormalized)))
314cdf0e10cSrcweir 				    OSL_ENSURE(sal_False, "OConfigurationNode::openNode: could not open the node!");
315cdf0e10cSrcweir 			}
316cdf0e10cSrcweir 			else if (m_xHierarchyAccess.is())
317cdf0e10cSrcweir 			{
318cdf0e10cSrcweir 				if (!::cppu::extractInterface(xNode, m_xHierarchyAccess->getByHierarchicalName(_rPath)))
319cdf0e10cSrcweir 				    OSL_ENSURE(sal_False, "OConfigurationNode::openNode: could not open the node!");
320cdf0e10cSrcweir 			}
321cdf0e10cSrcweir             if (xNode.is())
322cdf0e10cSrcweir 			    return OConfigurationNode( xNode );
323cdf0e10cSrcweir 		}
324cdf0e10cSrcweir 		catch(NoSuchElementException& e)
325cdf0e10cSrcweir 		{
326cdf0e10cSrcweir             (void)e;
327cdf0e10cSrcweir             #if OSL_DEBUG_LEVEL > 0
328cdf0e10cSrcweir             rtl::OStringBuffer aBuf( 256 );
329cdf0e10cSrcweir             aBuf.append("OConfigurationNode::openNode: there is no element named ");
330cdf0e10cSrcweir             aBuf.append( rtl::OUStringToOString( _rPath, RTL_TEXTENCODING_ASCII_US ) );
331cdf0e10cSrcweir             aBuf.append("!");
332cdf0e10cSrcweir 			OSL_ENSURE(sal_False, aBuf.getStr());
333cdf0e10cSrcweir             #endif
334cdf0e10cSrcweir 		}
335cdf0e10cSrcweir 		catch(Exception&)
336cdf0e10cSrcweir 		{
337cdf0e10cSrcweir 			OSL_ENSURE(sal_False, "OConfigurationNode::openNode: caught an exception while retrieving the node!");
338cdf0e10cSrcweir 		}
339cdf0e10cSrcweir 		return OConfigurationNode();
340cdf0e10cSrcweir 	}
341cdf0e10cSrcweir 
342cdf0e10cSrcweir 	//------------------------------------------------------------------------
setEscape(sal_Bool _bEnable)343cdf0e10cSrcweir 	void OConfigurationNode::setEscape(sal_Bool _bEnable)
344cdf0e10cSrcweir 	{
345cdf0e10cSrcweir         m_bEscapeNames = _bEnable && Reference< XStringEscape >::query(m_xDirectAccess).is();
346cdf0e10cSrcweir 	}
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 	//------------------------------------------------------------------------
isSetNode() const349cdf0e10cSrcweir 	sal_Bool OConfigurationNode::isSetNode() const
350cdf0e10cSrcweir 	{
351cdf0e10cSrcweir 		sal_Bool bIsSet = sal_False;
352cdf0e10cSrcweir 		Reference< XServiceInfo > xSI(m_xHierarchyAccess, UNO_QUERY);
353cdf0e10cSrcweir 		if (xSI.is())
354cdf0e10cSrcweir 		{
355cdf0e10cSrcweir 			try { bIsSet = xSI->supportsService(::rtl::OUString::createFromAscii("com.sun.star.configuration.SetAccess")); }
356cdf0e10cSrcweir 			catch(Exception&) { }
357cdf0e10cSrcweir 		}
358cdf0e10cSrcweir 		return bIsSet;
359cdf0e10cSrcweir 	}
360cdf0e10cSrcweir 
361cdf0e10cSrcweir 	//---------------------------------------------------------------------
362cdf0e10cSrcweir 	//--- 20.08.01 19:03:20 -----------------------------------------------
363cdf0e10cSrcweir 
hasByHierarchicalName(const::rtl::OUString & _rName) const364cdf0e10cSrcweir 	sal_Bool OConfigurationNode::hasByHierarchicalName( const ::rtl::OUString& _rName ) const throw()
365cdf0e10cSrcweir 	{
366cdf0e10cSrcweir 		OSL_ENSURE( m_xHierarchyAccess.is(), "OConfigurationNode::hasByHierarchicalName: no hierarchy access!" );
367cdf0e10cSrcweir 		try
368cdf0e10cSrcweir 		{
369cdf0e10cSrcweir 			if ( m_xHierarchyAccess.is() )
370cdf0e10cSrcweir 			{
371cdf0e10cSrcweir 				::rtl::OUString sName = normalizeName( _rName, NO_CALLER );
372cdf0e10cSrcweir 				return m_xHierarchyAccess->hasByHierarchicalName( sName );
373cdf0e10cSrcweir 			}
374cdf0e10cSrcweir 		}
375cdf0e10cSrcweir 		catch(Exception&)
376cdf0e10cSrcweir 		{
377cdf0e10cSrcweir 		}
378cdf0e10cSrcweir 		return sal_False;
379cdf0e10cSrcweir 	}
380cdf0e10cSrcweir 
381cdf0e10cSrcweir 	//------------------------------------------------------------------------
hasByName(const::rtl::OUString & _rName) const382cdf0e10cSrcweir 	sal_Bool OConfigurationNode::hasByName(const ::rtl::OUString& _rName) const throw()
383cdf0e10cSrcweir 	{
384cdf0e10cSrcweir 		OSL_ENSURE(m_xDirectAccess.is(), "OConfigurationNode::hasByName: object is invalid!");
385cdf0e10cSrcweir 		try
386cdf0e10cSrcweir 		{
387cdf0e10cSrcweir 			::rtl::OUString sName = normalizeName(_rName, NO_CALLER);
388cdf0e10cSrcweir 			if (m_xDirectAccess.is())
389cdf0e10cSrcweir 				return m_xDirectAccess->hasByName(sName);
390cdf0e10cSrcweir 		}
391cdf0e10cSrcweir 		catch(Exception&)
392cdf0e10cSrcweir 		{
393cdf0e10cSrcweir 		}
394cdf0e10cSrcweir 		return sal_False;
395cdf0e10cSrcweir 	}
396cdf0e10cSrcweir 
397cdf0e10cSrcweir 	//------------------------------------------------------------------------
setNodeValue(const::rtl::OUString & _rPath,const Any & _rValue) const398cdf0e10cSrcweir 	sal_Bool OConfigurationNode::setNodeValue(const ::rtl::OUString& _rPath, const Any& _rValue) const throw()
399cdf0e10cSrcweir 	{
400cdf0e10cSrcweir         sal_Bool bResult = false;
401cdf0e10cSrcweir 
402cdf0e10cSrcweir 		OSL_ENSURE(m_xReplaceAccess.is(), "OConfigurationNode::setNodeValue: object is invalid!");
403cdf0e10cSrcweir 		if (m_xReplaceAccess.is())
404cdf0e10cSrcweir 		{
405cdf0e10cSrcweir 			try
406cdf0e10cSrcweir 			{
407cdf0e10cSrcweir 			    // check if _rPath is a level-1 path
408cdf0e10cSrcweir 			    ::rtl::OUString sNormalizedName = normalizeName(_rPath, NO_CALLER);
409cdf0e10cSrcweir                 if (m_xReplaceAccess->hasByName(sNormalizedName))
410cdf0e10cSrcweir                 {
411cdf0e10cSrcweir 				    m_xReplaceAccess->replaceByName(sNormalizedName, _rValue);
412cdf0e10cSrcweir 				    bResult = true;
413cdf0e10cSrcweir                 }
414cdf0e10cSrcweir 
415cdf0e10cSrcweir 		    	// check if the name refers to a indirect descendant
416cdf0e10cSrcweir                 else if (m_xHierarchyAccess.is() && m_xHierarchyAccess->hasByHierarchicalName(_rPath))
417cdf0e10cSrcweir                 {
418cdf0e10cSrcweir                     OSL_ASSERT(_rPath.getLength());
419cdf0e10cSrcweir 
420cdf0e10cSrcweir                     ::rtl::OUString sParentPath, sLocalName;
421cdf0e10cSrcweir 
422cdf0e10cSrcweir                     if ( splitLastFromConfigurationPath(_rPath, sParentPath, sLocalName) )
423cdf0e10cSrcweir 			        {
424cdf0e10cSrcweir 				        OConfigurationNode aParentAccess = openNode(sParentPath);
425cdf0e10cSrcweir 				        if (aParentAccess.isValid())
426cdf0e10cSrcweir 					        bResult = aParentAccess.setNodeValue(sLocalName, _rValue);
427cdf0e10cSrcweir 			        }
428cdf0e10cSrcweir                     else
429cdf0e10cSrcweir                     {
430cdf0e10cSrcweir 				        m_xReplaceAccess->replaceByName(sLocalName, _rValue);
431cdf0e10cSrcweir                         bResult = true;
432cdf0e10cSrcweir                     }
433cdf0e10cSrcweir                 }
434cdf0e10cSrcweir 
435cdf0e10cSrcweir 			}
436cdf0e10cSrcweir 			catch(IllegalArgumentException&)
437cdf0e10cSrcweir 			{
438cdf0e10cSrcweir 				OSL_ENSURE(sal_False, "OConfigurationNode::setNodeValue: could not replace the value: caught an IllegalArgumentException!");
439cdf0e10cSrcweir 			}
440cdf0e10cSrcweir 			catch(NoSuchElementException&)
441cdf0e10cSrcweir 			{
442cdf0e10cSrcweir 				OSL_ENSURE(sal_False, "OConfigurationNode::setNodeValue: could not replace the value: caught a NoSuchElementException!");
443cdf0e10cSrcweir 			}
444cdf0e10cSrcweir 			catch(WrappedTargetException&)
445cdf0e10cSrcweir 			{
446cdf0e10cSrcweir 				OSL_ENSURE(sal_False, "OConfigurationNode::setNodeValue: could not replace the value: caught a WrappedTargetException!");
447cdf0e10cSrcweir 			}
448cdf0e10cSrcweir 			catch(Exception&)
449cdf0e10cSrcweir 			{
450cdf0e10cSrcweir 				OSL_ENSURE(sal_False, "OConfigurationNode::setNodeValue: could not replace the value: caught a generic Exception!");
451cdf0e10cSrcweir 			}
452cdf0e10cSrcweir 
453cdf0e10cSrcweir 
454cdf0e10cSrcweir 		}
455cdf0e10cSrcweir 		return bResult;
456cdf0e10cSrcweir 	}
457cdf0e10cSrcweir 
458cdf0e10cSrcweir 	//------------------------------------------------------------------------
getNodeValue(const::rtl::OUString & _rPath) const459cdf0e10cSrcweir 	Any OConfigurationNode::getNodeValue(const ::rtl::OUString& _rPath) const throw()
460cdf0e10cSrcweir 	{
461cdf0e10cSrcweir 		OSL_ENSURE(m_xDirectAccess.is(), "OConfigurationNode::hasByName: object is invalid!");
462cdf0e10cSrcweir 		OSL_ENSURE(m_xHierarchyAccess.is(), "OConfigurationNode::hasByName: object is invalid!");
463cdf0e10cSrcweir 		Any aReturn;
464cdf0e10cSrcweir 		try
465cdf0e10cSrcweir 		{
466cdf0e10cSrcweir 			::rtl::OUString sNormalizedPath = normalizeName(_rPath, NO_CALLER);
467cdf0e10cSrcweir 		    if (m_xDirectAccess.is() && m_xDirectAccess->hasByName(sNormalizedPath) )
468cdf0e10cSrcweir 		    {
469cdf0e10cSrcweir 				aReturn = m_xDirectAccess->getByName(sNormalizedPath);
470cdf0e10cSrcweir             }
471cdf0e10cSrcweir 		    else if (m_xHierarchyAccess.is())
472cdf0e10cSrcweir 		    {
473cdf0e10cSrcweir 				aReturn = m_xHierarchyAccess->getByHierarchicalName(_rPath);
474cdf0e10cSrcweir 		    }
475cdf0e10cSrcweir 		}
476cdf0e10cSrcweir 		catch(const NoSuchElementException&)
477cdf0e10cSrcweir 		{
478cdf0e10cSrcweir             DBG_UNHANDLED_EXCEPTION();
479cdf0e10cSrcweir 		}
480cdf0e10cSrcweir 		return aReturn;
481cdf0e10cSrcweir 	}
482cdf0e10cSrcweir 
483cdf0e10cSrcweir 	//------------------------------------------------------------------------
clear()484cdf0e10cSrcweir 	void OConfigurationNode::clear() throw()
485cdf0e10cSrcweir 	{
486cdf0e10cSrcweir 		m_xHierarchyAccess.clear();
487cdf0e10cSrcweir 		m_xDirectAccess.clear();
488cdf0e10cSrcweir 		m_xReplaceAccess.clear();
489cdf0e10cSrcweir 		m_xContainerAccess.clear();
490cdf0e10cSrcweir 	}
491cdf0e10cSrcweir 
492cdf0e10cSrcweir 	//========================================================================
493cdf0e10cSrcweir 	//= helper
494cdf0e10cSrcweir 	//========================================================================
495cdf0e10cSrcweir     namespace
496cdf0e10cSrcweir     {
497cdf0e10cSrcweir 	    //--------------------------------------------------------------------
lcl_getProviderServiceName()498cdf0e10cSrcweir 		static const ::rtl::OUString& lcl_getProviderServiceName( )
499cdf0e10cSrcweir 		{
500cdf0e10cSrcweir 			static ::rtl::OUString s_sProviderServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) );
501cdf0e10cSrcweir 			return s_sProviderServiceName;
502cdf0e10cSrcweir 		}
503cdf0e10cSrcweir 
504cdf0e10cSrcweir 	    //--------------------------------------------------------------------
lcl_getConfigProvider(const::comphelper::ComponentContext & i_rContext)505cdf0e10cSrcweir         Reference< XMultiServiceFactory > lcl_getConfigProvider( const ::comphelper::ComponentContext& i_rContext )
506cdf0e10cSrcweir         {
507cdf0e10cSrcweir 		    try
508cdf0e10cSrcweir 		    {
509cdf0e10cSrcweir 			    Reference< XMultiServiceFactory > xProvider( i_rContext.createComponent( lcl_getProviderServiceName() ), UNO_QUERY_THROW );
510cdf0e10cSrcweir                 return xProvider;
511cdf0e10cSrcweir 		    }
512cdf0e10cSrcweir 		    catch ( const Exception& )
513cdf0e10cSrcweir 		    {
514cdf0e10cSrcweir                 DBG_UNHANDLED_EXCEPTION();
515cdf0e10cSrcweir 		    }
516cdf0e10cSrcweir             return NULL;
517cdf0e10cSrcweir         }
518cdf0e10cSrcweir 
519cdf0e10cSrcweir 	    //--------------------------------------------------------------------
lcl_createConfigurationRoot(const Reference<XMultiServiceFactory> & i_rxConfigProvider,const::rtl::OUString & i_rNodePath,const bool i_bUpdatable,const sal_Int32 i_nDepth,const bool i_bLazyWrite)520cdf0e10cSrcweir         Reference< XInterface > lcl_createConfigurationRoot( const Reference< XMultiServiceFactory >& i_rxConfigProvider,
521cdf0e10cSrcweir             const ::rtl::OUString& i_rNodePath, const bool i_bUpdatable, const sal_Int32 i_nDepth, const bool i_bLazyWrite )
522cdf0e10cSrcweir         {
523cdf0e10cSrcweir             ENSURE_OR_RETURN( i_rxConfigProvider.is(), "invalid provider", NULL );
524cdf0e10cSrcweir 			try
525cdf0e10cSrcweir 			{
526cdf0e10cSrcweir                 ::comphelper::NamedValueCollection aArgs;
527cdf0e10cSrcweir                 aArgs.put( "nodepath", i_rNodePath );
528cdf0e10cSrcweir                 aArgs.put( "lazywrite", i_bLazyWrite );
529cdf0e10cSrcweir                 aArgs.put( "depth", i_nDepth );
530cdf0e10cSrcweir 
531cdf0e10cSrcweir 				::rtl::OUString sAccessService = ::rtl::OUString::createFromAscii(
532cdf0e10cSrcweir                         i_bUpdatable
533cdf0e10cSrcweir 					? "com.sun.star.configuration.ConfigurationUpdateAccess"
534cdf0e10cSrcweir 					: "com.sun.star.configuration.ConfigurationAccess" );
535cdf0e10cSrcweir 
536cdf0e10cSrcweir 				Reference< XInterface > xRoot(
537cdf0e10cSrcweir                     i_rxConfigProvider->createInstanceWithArguments( sAccessService, aArgs.getWrappedPropertyValues() ),
538cdf0e10cSrcweir                     UNO_SET_THROW
539cdf0e10cSrcweir                 );
540cdf0e10cSrcweir 				return xRoot;
541cdf0e10cSrcweir 			}
542cdf0e10cSrcweir 			catch ( const Exception& )
543cdf0e10cSrcweir 			{
544cdf0e10cSrcweir                 DBG_UNHANDLED_EXCEPTION();
545cdf0e10cSrcweir 			}
546cdf0e10cSrcweir             return NULL;
547cdf0e10cSrcweir         }
548cdf0e10cSrcweir     }
549cdf0e10cSrcweir 	//========================================================================
550cdf0e10cSrcweir 	//= OConfigurationTreeRoot
551cdf0e10cSrcweir 	//========================================================================
552cdf0e10cSrcweir 	//------------------------------------------------------------------------
OConfigurationTreeRoot(const Reference<XChangesBatch> & _rxRootNode)553cdf0e10cSrcweir 	OConfigurationTreeRoot::OConfigurationTreeRoot( const Reference< XChangesBatch >& _rxRootNode )
554cdf0e10cSrcweir 		:OConfigurationNode( _rxRootNode.get() )
555cdf0e10cSrcweir 		,m_xCommitter(_rxRootNode)
556cdf0e10cSrcweir 	{
557cdf0e10cSrcweir 	}
558cdf0e10cSrcweir 
559cdf0e10cSrcweir 	//------------------------------------------------------------------------
OConfigurationTreeRoot(const Reference<XInterface> & _rxRootNode)560cdf0e10cSrcweir 	OConfigurationTreeRoot::OConfigurationTreeRoot( const Reference< XInterface >& _rxRootNode )
561cdf0e10cSrcweir 		:OConfigurationNode( _rxRootNode )
562cdf0e10cSrcweir         ,m_xCommitter( _rxRootNode, UNO_QUERY )
563cdf0e10cSrcweir 	{
564cdf0e10cSrcweir 	}
565cdf0e10cSrcweir 
566cdf0e10cSrcweir 	//------------------------------------------------------------------------
OConfigurationTreeRoot(const::comphelper::ComponentContext & i_rContext,const sal_Char * i_pAsciiNodePath,const bool i_bUpdatable)567cdf0e10cSrcweir     OConfigurationTreeRoot::OConfigurationTreeRoot( const ::comphelper::ComponentContext& i_rContext, const sal_Char* i_pAsciiNodePath, const bool i_bUpdatable )
568cdf0e10cSrcweir         :OConfigurationNode( lcl_createConfigurationRoot( lcl_getConfigProvider( i_rContext.getLegacyServiceFactory() ),
569cdf0e10cSrcweir             ::rtl::OUString::createFromAscii( i_pAsciiNodePath ), i_bUpdatable, -1, false ).get() )
570cdf0e10cSrcweir         ,m_xCommitter()
571cdf0e10cSrcweir     {
572cdf0e10cSrcweir         if ( i_bUpdatable )
573cdf0e10cSrcweir         {
574cdf0e10cSrcweir             m_xCommitter.set( getUNONode(), UNO_QUERY );
575cdf0e10cSrcweir             OSL_ENSURE( m_xCommitter.is(), "OConfigurationTreeRoot::OConfigurationTreeRoot: could not create an updatable node!" );
576cdf0e10cSrcweir         }
577cdf0e10cSrcweir     }
578cdf0e10cSrcweir 
579cdf0e10cSrcweir 	//------------------------------------------------------------------------
OConfigurationTreeRoot(const::comphelper::ComponentContext & i_rContext,const::rtl::OUString & i_rNodePath,const bool i_bUpdatable)580cdf0e10cSrcweir     OConfigurationTreeRoot::OConfigurationTreeRoot( const ::comphelper::ComponentContext& i_rContext, const ::rtl::OUString& i_rNodePath, const bool i_bUpdatable )
581cdf0e10cSrcweir         :OConfigurationNode( lcl_createConfigurationRoot( lcl_getConfigProvider( i_rContext.getLegacyServiceFactory() ),
582cdf0e10cSrcweir             i_rNodePath, i_bUpdatable, -1, false ).get() )
583cdf0e10cSrcweir         ,m_xCommitter()
584cdf0e10cSrcweir     {
585cdf0e10cSrcweir         if ( i_bUpdatable )
586cdf0e10cSrcweir         {
587cdf0e10cSrcweir             m_xCommitter.set( getUNONode(), UNO_QUERY );
588cdf0e10cSrcweir             OSL_ENSURE( m_xCommitter.is(), "OConfigurationTreeRoot::OConfigurationTreeRoot: could not create an updatable node!" );
589cdf0e10cSrcweir         }
590cdf0e10cSrcweir     }
591cdf0e10cSrcweir 
592cdf0e10cSrcweir 	//------------------------------------------------------------------------
clear()593cdf0e10cSrcweir 	void OConfigurationTreeRoot::clear() throw()
594cdf0e10cSrcweir 	{
595cdf0e10cSrcweir 		OConfigurationNode::clear();
596cdf0e10cSrcweir 		m_xCommitter.clear();
597cdf0e10cSrcweir 	}
598cdf0e10cSrcweir 
599cdf0e10cSrcweir 	//------------------------------------------------------------------------
commit() const600cdf0e10cSrcweir 	sal_Bool OConfigurationTreeRoot::commit() const throw()
601cdf0e10cSrcweir 	{
602cdf0e10cSrcweir 		OSL_ENSURE(isValid(), "OConfigurationTreeRoot::commit: object is invalid!");
603cdf0e10cSrcweir 		if (!isValid())
604cdf0e10cSrcweir 			return sal_False;
605cdf0e10cSrcweir 		OSL_ENSURE(m_xCommitter.is(), "OConfigurationTreeRoot::commit: I'm a readonly node!");
606cdf0e10cSrcweir 		if (!m_xCommitter.is())
607cdf0e10cSrcweir 			return sal_False;
608cdf0e10cSrcweir 
609cdf0e10cSrcweir 		try
610cdf0e10cSrcweir 		{
611cdf0e10cSrcweir 			m_xCommitter->commitChanges();
612cdf0e10cSrcweir 			return sal_True;
613cdf0e10cSrcweir 		}
614cdf0e10cSrcweir 		catch(const Exception&)
615cdf0e10cSrcweir 		{
616cdf0e10cSrcweir             DBG_UNHANDLED_EXCEPTION();
617cdf0e10cSrcweir 		}
618cdf0e10cSrcweir 		return sal_False;
619cdf0e10cSrcweir 	}
620cdf0e10cSrcweir 
621cdf0e10cSrcweir 	//------------------------------------------------------------------------
createWithProvider(const Reference<XMultiServiceFactory> & _rxConfProvider,const::rtl::OUString & _rPath,sal_Int32 _nDepth,CREATION_MODE _eMode,sal_Bool _bLazyWrite)622cdf0e10cSrcweir 	OConfigurationTreeRoot OConfigurationTreeRoot::createWithProvider(const Reference< XMultiServiceFactory >& _rxConfProvider, const ::rtl::OUString& _rPath, sal_Int32 _nDepth, CREATION_MODE _eMode, sal_Bool _bLazyWrite)
623cdf0e10cSrcweir 	{
624cdf0e10cSrcweir         Reference< XInterface > xRoot( lcl_createConfigurationRoot(
625cdf0e10cSrcweir             _rxConfProvider, _rPath, _eMode != CM_READONLY, _nDepth, _bLazyWrite ) );
626cdf0e10cSrcweir         if ( xRoot.is() )
627cdf0e10cSrcweir             return OConfigurationTreeRoot( xRoot );
628cdf0e10cSrcweir         return OConfigurationTreeRoot();
629cdf0e10cSrcweir 	}
630cdf0e10cSrcweir 
631cdf0e10cSrcweir 	//------------------------------------------------------------------------
createWithServiceFactory(const Reference<XMultiServiceFactory> & _rxORB,const::rtl::OUString & _rPath,sal_Int32 _nDepth,CREATION_MODE _eMode,sal_Bool _bLazyWrite)632cdf0e10cSrcweir 	OConfigurationTreeRoot OConfigurationTreeRoot::createWithServiceFactory( const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rPath, sal_Int32 _nDepth, CREATION_MODE _eMode, sal_Bool _bLazyWrite )
633cdf0e10cSrcweir 	{
634cdf0e10cSrcweir         return createWithProvider( lcl_getConfigProvider( _rxORB ), _rPath, _nDepth, _eMode, _bLazyWrite );
635cdf0e10cSrcweir 	}
636cdf0e10cSrcweir 
637cdf0e10cSrcweir 	//------------------------------------------------------------------------
tryCreateWithServiceFactory(const Reference<XMultiServiceFactory> & _rxORB,const::rtl::OUString & _rPath,sal_Int32 _nDepth,CREATION_MODE _eMode,sal_Bool _bLazyWrite)638cdf0e10cSrcweir 	OConfigurationTreeRoot OConfigurationTreeRoot::tryCreateWithServiceFactory( const Reference< XMultiServiceFactory >& _rxORB,
639cdf0e10cSrcweir 		const ::rtl::OUString& _rPath, sal_Int32 _nDepth , CREATION_MODE _eMode , sal_Bool _bLazyWrite )
640cdf0e10cSrcweir 	{
641cdf0e10cSrcweir 		OSL_ENSURE( _rxORB.is(), "OConfigurationTreeRoot::tryCreateWithServiceFactory: invalid service factory!" );
642cdf0e10cSrcweir 		if ( _rxORB.is() )
643cdf0e10cSrcweir 		{
644cdf0e10cSrcweir 			try
645cdf0e10cSrcweir 			{
646cdf0e10cSrcweir 				Reference< XMultiServiceFactory > xConfigFactory( _rxORB->createInstance( lcl_getProviderServiceName( ) ), UNO_QUERY );
647cdf0e10cSrcweir 				if ( xConfigFactory.is() )
648cdf0e10cSrcweir 					return createWithProvider( xConfigFactory, _rPath, _nDepth, _eMode, _bLazyWrite );
649cdf0e10cSrcweir 			}
650cdf0e10cSrcweir 			catch(const Exception&)
651cdf0e10cSrcweir 			{
652cdf0e10cSrcweir 				// silence this, 'cause the contract of this method states "no assertions"
653cdf0e10cSrcweir 			}
654cdf0e10cSrcweir 		}
655cdf0e10cSrcweir 		return OConfigurationTreeRoot();
656cdf0e10cSrcweir 	}
657cdf0e10cSrcweir 
658cdf0e10cSrcweir //........................................................................
659cdf0e10cSrcweir }	// namespace utl
660cdf0e10cSrcweir //........................................................................
661cdf0e10cSrcweir 
662