XQuilla/docs/simple-api/PlatformUtils_8hpp-source.html
2020-02-17 22:05:20 +01:00

327 lines
29 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>XQilla Simple API: PlatformUtils.hpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.6 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="classes.html"><span>Classes</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul></div>
<h1>PlatformUtils.hpp</h1><a href="PlatformUtils_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright 1999-2004 The Apache Software Foundation.</span>
<a name="l00003"></a>00003 <span class="comment"> * </span>
<a name="l00004"></a>00004 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span>
<a name="l00005"></a>00005 <span class="comment"> * you may not use this file except in compliance with the License.</span>
<a name="l00006"></a>00006 <span class="comment"> * You may obtain a copy of the License at</span>
<a name="l00007"></a>00007 <span class="comment"> * </span>
<a name="l00008"></a>00008 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span>
<a name="l00009"></a>00009 <span class="comment"> * </span>
<a name="l00010"></a>00010 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
<a name="l00011"></a>00011 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span>
<a name="l00012"></a>00012 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<a name="l00013"></a>00013 <span class="comment"> * See the License for the specific language governing permissions and</span>
<a name="l00014"></a>00014 <span class="comment"> * limitations under the License.</span>
<a name="l00015"></a>00015 <span class="comment"> */</span>
<a name="l00016"></a>00016
<a name="l00017"></a>00017 <span class="comment">/*</span>
<a name="l00018"></a>00018 <span class="comment"> * $Id: PlatformUtils.hpp 180016 2005-06-04 19:49:30Z jberry $</span>
<a name="l00019"></a>00019 <span class="comment"> */</span>
<a name="l00020"></a>00020
<a name="l00021"></a>00021
<a name="l00022"></a>00022 <span class="preprocessor">#if !defined(PLATFORMUTILS_HPP)</span>
<a name="l00023"></a><a class="code" href="PlatformUtils_8hpp.html#442046e6c289b50d860c8c5cf3ec544b">00023</a> <span class="preprocessor"></span><span class="preprocessor">#define PLATFORMUTILS_HPP</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;xercesc/util/XMLException.hpp&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;xercesc/util/PanicHandler.hpp&gt;</span>
<a name="l00027"></a>00027
<a name="l00028"></a>00028 XERCES_CPP_NAMESPACE_BEGIN
<a name="l00029"></a>00029
<a name="l00030"></a>00030 <span class="keyword">class </span>XMLMsgLoader;
<a name="l00031"></a>00031 <span class="keyword">class </span>XMLNetAccessor;
<a name="l00032"></a>00032 <span class="keyword">class </span>XMLTransService;
<a name="l00033"></a>00033 <span class="keyword">class </span>MemoryManager;
<a name="l00034"></a>00034 <span class="keyword">class </span>XMLMutex;
<a name="l00035"></a>00035
<a name="l00036"></a>00036 <span class="comment">//</span>
<a name="l00037"></a>00037 <span class="comment">// For internal use only</span>
<a name="l00038"></a>00038 <span class="comment">//</span>
<a name="l00039"></a>00039 <span class="comment">// This class provides a simple abstract API via which lazily evaluated</span>
<a name="l00040"></a>00040 <span class="comment">// data can be cleaned up.</span>
<a name="l00041"></a>00041 <span class="comment">//</span>
<a name="l00042"></a><a class="code" href="classxercesc_1_1XMLDeleter.html">00042</a> <span class="keyword">class </span>XMLUTIL_EXPORT <a class="code" href="classxercesc_1_1XMLDeleter.html">XMLDeleter</a>
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044 <span class="keyword">public</span> :
<a name="l00045"></a>00045 <span class="keyword">virtual</span> ~<a class="code" href="classxercesc_1_1XMLDeleter.html">XMLDeleter</a>();
<a name="l00046"></a>00046
<a name="l00047"></a>00047 <span class="keyword">protected</span> :
<a name="l00048"></a>00048 <a class="code" href="classxercesc_1_1XMLDeleter.html">XMLDeleter</a>();
<a name="l00049"></a>00049
<a name="l00050"></a>00050 <span class="keyword">private</span> :
<a name="l00051"></a>00051 <a class="code" href="classxercesc_1_1XMLDeleter.html">XMLDeleter</a>(<span class="keyword">const</span> <a class="code" href="classxercesc_1_1XMLDeleter.html">XMLDeleter</a>&amp;);
<a name="l00052"></a>00052 <a class="code" href="classxercesc_1_1XMLDeleter.html">XMLDeleter</a>&amp; operator=(<span class="keyword">const</span> <a class="code" href="classxercesc_1_1XMLDeleter.html">XMLDeleter</a>&amp;);
<a name="l00053"></a>00053 };
<a name="l00054"></a>00054
<a name="l00055"></a>00055
<a name="l00064"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html">00064</a> <span class="keyword">class </span>XMLUTIL_EXPORT XMLPlatformUtils
<a name="l00065"></a>00065 {
<a name="l00066"></a>00066 <span class="keyword">public</span> :
<a name="l00067"></a>00067
<a name="l00070"></a>00070
<a name="l00083"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html#6e4eda2fc24324bb88266ef99c79f66c">00083</a> <span class="keyword">static</span> XMLNetAccessor* fgNetAccessor;
<a name="l00084"></a>00084
<a name="l00095"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html#189b268974c4e937e22a1f6fc4ee7ab3">00095</a> <span class="keyword">static</span> XMLTransService* fgTransService;
<a name="l00096"></a>00096
<a name="l00101"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html#26ff562f840d78b925e1ff4755b513e9">00101</a> <span class="keyword">static</span> PanicHandler* fgUserPanicHandler;
<a name="l00102"></a>00102
<a name="l00107"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html#dcd97086ea0267e69bad7a7401ed93a5">00107</a> <span class="keyword">static</span> PanicHandler* fgDefaultPanicHandler;
<a name="l00108"></a>00108
<a name="l00114"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html#2521473ea52894e9313573d330a264b4">00114</a> <span class="keyword">static</span> <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* fgMemoryManager;
<a name="l00115"></a>00115
<a name="l00124"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html#3bc852dc1bdb6da8a85c9ccd0ac6acd3">00124</a> <span class="keyword">static</span> <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* fgArrayMemoryManager;
<a name="l00125"></a>00125
<a name="l00126"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html#290cdb4f617a825e9217c5613ee97881">00126</a> <span class="keyword">static</span> XMLMutex* fgAtomicMutex;
<a name="l00127"></a>00127
<a name="l00129"></a>00129
<a name="l00130"></a>00130
<a name="l00133"></a>00133
<a name="l00164"></a>00164 <span class="keyword">static</span> <span class="keywordtype">void</span> Initialize(<span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> locale = XMLUni::fgXercescDefaultLocale
<a name="l00165"></a>00165 , <span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> nlsHome = 0
<a name="l00166"></a>00166 , PanicHandler* <span class="keyword">const</span> panicHandler = 0
<a name="l00167"></a>00167 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> memoryManager = 0
<a name="l00168"></a>00168 , <span class="keywordtype">bool</span> toInitStatics = <span class="keyword">false</span>);
<a name="l00169"></a>00169
<a name="l00176"></a>00176 <span class="keyword">static</span> <span class="keywordtype">void</span> Terminate();
<a name="l00177"></a>00177
<a name="l00194"></a>00194 <span class="keyword">static</span> <span class="keywordtype">void</span> panic
<a name="l00195"></a>00195 (
<a name="l00196"></a>00196 <span class="keyword">const</span> PanicHandler::PanicReasons reason
<a name="l00197"></a>00197 );
<a name="l00198"></a>00198
<a name="l00200"></a>00200
<a name="l00203"></a>00203
<a name="l00217"></a>00217 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> curFilePos(FileHandle theFile
<a name="l00218"></a>00218 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
<a name="l00219"></a>00219
<a name="l00230"></a>00230 <span class="keyword">static</span> <span class="keywordtype">void</span> closeFile(FileHandle theFile
<a name="l00231"></a>00231 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
<a name="l00232"></a>00232
<a name="l00243"></a>00243 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> fileSize(FileHandle theFile
<a name="l00244"></a>00244 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
<a name="l00245"></a>00245
<a name="l00256"></a>00256 <span class="keyword">static</span> FileHandle openFile(<span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> fileName
<a name="l00257"></a>00257 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
<a name="l00258"></a>00258
<a name="l00269"></a>00269 <span class="keyword">static</span> FileHandle openFile(<span class="keyword">const</span> XMLCh* <span class="keyword">const</span> fileName
<a name="l00270"></a>00270 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
<a name="l00271"></a>00271
<a name="l00282"></a>00282 <span class="keyword">static</span> FileHandle openFileToWrite(<span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> fileName
<a name="l00283"></a>00283 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
<a name="l00284"></a>00284
<a name="l00295"></a>00295 <span class="keyword">static</span> FileHandle openFileToWrite(<span class="keyword">const</span> XMLCh* <span class="keyword">const</span> fileName
<a name="l00296"></a>00296 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
<a name="l00297"></a>00297
<a name="l00308"></a>00308 <span class="keyword">static</span> FileHandle openStdInHandle(<a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
<a name="l00309"></a>00309
<a name="l00326"></a>00326 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> readFileBuffer
<a name="l00327"></a>00327 (
<a name="l00328"></a>00328 FileHandle theFile
<a name="l00329"></a>00329 , <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> toRead
<a name="l00330"></a>00330 , XMLByte* <span class="keyword">const</span> toFill
<a name="l00331"></a>00331 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager
<a name="l00332"></a>00332 );
<a name="l00333"></a>00333
<a name="l00348"></a>00348 <span class="keyword">static</span> <span class="keywordtype">void</span> writeBufferToFile
<a name="l00349"></a>00349 (
<a name="l00350"></a>00350 FileHandle <span class="keyword">const</span> theFile
<a name="l00351"></a>00351 , <span class="keywordtype">long</span> toWrite
<a name="l00352"></a>00352 , <span class="keyword">const</span> XMLByte* <span class="keyword">const</span> toFlush
<a name="l00353"></a>00353 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager
<a name="l00354"></a>00354 );
<a name="l00355"></a>00355
<a name="l00365"></a>00365 <span class="keyword">static</span> <span class="keywordtype">void</span> resetFile(FileHandle theFile
<a name="l00366"></a>00366 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
<a name="l00367"></a>00367
<a name="l00369"></a>00369
<a name="l00370"></a>00370
<a name="l00394"></a>00394 <span class="keyword">static</span> XMLCh* getFullPath
<a name="l00395"></a>00395 (
<a name="l00396"></a>00396 <span class="keyword">const</span> XMLCh* <span class="keyword">const</span> srcPath
<a name="l00397"></a>00397 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager
<a name="l00398"></a>00398 );
<a name="l00399"></a>00399
<a name="l00413"></a>00413 <span class="keyword">static</span> XMLCh* getCurrentDirectory
<a name="l00414"></a>00414 (
<a name="l00415"></a>00415 <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager
<a name="l00416"></a>00416 );
<a name="l00417"></a>00417
<a name="l00427"></a>00427 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> isAnySlash(XMLCh c);
<a name="l00428"></a>00428
<a name="l00438"></a>00438 <span class="keyword">static</span> <span class="keywordtype">void</span> removeDotSlash(XMLCh* <span class="keyword">const</span> srcPath
<a name="l00439"></a>00439 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
<a name="l00440"></a>00440
<a name="l00451"></a>00451 <span class="keyword">static</span> <span class="keywordtype">void</span> removeDotDotSlash(XMLCh* <span class="keyword">const</span> srcPath
<a name="l00452"></a>00452 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
<a name="l00453"></a>00453
<a name="l00467"></a>00467 <span class="keyword">static</span> <span class="keywordtype">bool</span> isRelative(<span class="keyword">const</span> XMLCh* <span class="keyword">const</span> toCheck
<a name="l00468"></a>00468 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager
<a name="l00469"></a>00469 );
<a name="l00470"></a>00470
<a name="l00490"></a>00490 <span class="keyword">static</span> XMLCh* weavePaths
<a name="l00491"></a>00491 (
<a name="l00492"></a>00492 <span class="keyword">const</span> XMLCh* <span class="keyword">const</span> basePath
<a name="l00493"></a>00493 , <span class="keyword">const</span> XMLCh* <span class="keyword">const</span> relativePath
<a name="l00494"></a>00494 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager
<a name="l00495"></a>00495 );
<a name="l00497"></a>00497
<a name="l00500"></a>00500
<a name="l00510"></a>00510 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> getCurrentMillis();
<a name="l00512"></a>00512
<a name="l00515"></a>00515
<a name="l00523"></a>00523 <span class="keyword">static</span> <span class="keywordtype">void</span> closeMutex(<span class="keywordtype">void</span>* <span class="keyword">const</span> mtxHandle);
<a name="l00524"></a>00524
<a name="l00532"></a>00532 <span class="keyword">static</span> <span class="keywordtype">void</span> lockMutex(<span class="keywordtype">void</span>* <span class="keyword">const</span> mtxHandle);
<a name="l00533"></a>00533
<a name="l00543"></a>00543 <span class="keyword">static</span> <span class="keywordtype">void</span>* makeMutex(<a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* manager = XMLPlatformUtils::fgMemoryManager);
<a name="l00544"></a>00544
<a name="l00557"></a>00557 <span class="keyword">static</span> <span class="keywordtype">void</span> unlockMutex(<span class="keywordtype">void</span>* <span class="keyword">const</span> mtxHandle);
<a name="l00558"></a>00558
<a name="l00560"></a>00560
<a name="l00561"></a>00561
<a name="l00564"></a>00564
<a name="l00572"></a>00572 <span class="keyword">static</span> XMLMsgLoader* loadMsgSet(<span class="keyword">const</span> XMLCh* <span class="keyword">const</span> msgDomain);
<a name="l00573"></a>00573
<a name="l00575"></a>00575
<a name="l00578"></a>00578
<a name="l00604"></a>00604 <span class="keyword">static</span> <span class="keywordtype">void</span>* compareAndSwap
<a name="l00605"></a>00605 (
<a name="l00606"></a>00606 <span class="keywordtype">void</span>** toFill
<a name="l00607"></a>00607 , <span class="keyword">const</span> <span class="keywordtype">void</span>* <span class="keyword">const</span> newValue
<a name="l00608"></a>00608 , <span class="keyword">const</span> <span class="keywordtype">void</span>* <span class="keyword">const</span> toCompare
<a name="l00609"></a>00609 );
<a name="l00610"></a>00610
<a name="l00612"></a>00612
<a name="l00613"></a>00613
<a name="l00616"></a>00616
<a name="l00636"></a>00636 <span class="keyword">static</span> <span class="keywordtype">int</span> atomicIncrement(<span class="keywordtype">int</span>&amp; location);
<a name="l00637"></a>00637
<a name="l00657"></a>00657 <span class="keyword">static</span> <span class="keywordtype">int</span> atomicDecrement(<span class="keywordtype">int</span>&amp; location);
<a name="l00658"></a>00658
<a name="l00660"></a>00660
<a name="l00674"></a>00674 <span class="keyword">static</span> <span class="keywordtype">void</span> recognizeNEL(<span class="keywordtype">bool</span> state
<a name="l00675"></a>00675 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
<a name="l00676"></a>00676
<a name="l00680"></a>00680 <span class="keyword">static</span> <span class="keywordtype">bool</span> isNELRecognized();
<a name="l00682"></a>00682
<a name="l00694"></a>00694 <span class="keyword">static</span> <span class="keywordtype">void</span> strictIANAEncoding(<span class="keyword">const</span> <span class="keywordtype">bool</span> state);
<a name="l00695"></a>00695
<a name="l00700"></a>00700 <span class="keyword">static</span> <span class="keywordtype">bool</span> isStrictIANAEncoding();
<a name="l00702"></a>00702
<a name="l00710"></a>00710 <span class="keyword">static</span> <span class="keyword">inline</span> size_t alignPointerForNewBlockAllocation(size_t ptrSize);
<a name="l00711"></a>00711
<a name="l00712"></a>00712 <span class="keyword">private</span> :
<a name="l00713"></a>00713 <span class="comment">// -----------------------------------------------------------------------</span>
<a name="l00714"></a>00714 <span class="comment">// Unimplemented constructors and operators</span>
<a name="l00715"></a>00715 <span class="comment">// -----------------------------------------------------------------------</span>
<a name="l00716"></a>00716 XMLPlatformUtils();
<a name="l00717"></a>00717
<a name="l00720"></a>00720
<a name="l00726"></a>00726 <span class="keyword">static</span> XMLMsgLoader* loadAMsgSet(<span class="keyword">const</span> XMLCh* <span class="keyword">const</span> msgDomain);
<a name="l00727"></a>00727
<a name="l00737"></a>00737 <span class="keyword">static</span> XMLNetAccessor* makeNetAccessor();
<a name="l00738"></a>00738
<a name="l00749"></a>00749 <span class="keyword">static</span> XMLTransService* makeTransService();
<a name="l00750"></a>00750
<a name="l00757"></a>00757 <span class="keyword">static</span> <span class="keywordtype">void</span> platformInit();
<a name="l00758"></a>00758
<a name="l00765"></a>00765 <span class="keyword">static</span> <span class="keywordtype">void</span> platformTerm();
<a name="l00766"></a>00766
<a name="l00774"></a>00774 <span class="keyword">static</span> <span class="keywordtype">int</span> searchSlashDotDotSlash(XMLCh* <span class="keyword">const</span> srcPath);
<a name="l00775"></a>00775
<a name="l00777"></a>00777
<a name="l00780"></a>00780
<a name="l00787"></a>00787 <span class="keyword">static</span> <span class="keywordtype">bool</span> fgMemMgrAdopted;
<a name="l00788"></a>00788
<a name="l00790"></a>00790 };
<a name="l00791"></a>00791
<a name="l00792"></a>00792
<a name="l00793"></a><a class="code" href="namespacexercesc.html#fbb2c52415d1c4a2ffbd1fa46a55a3bf">00793</a> <a class="code" href="namespacexercesc.html#fbb2c52415d1c4a2ffbd1fa46a55a3bf">MakeXMLException</a>(XMLPlatformUtilsException, XMLUTIL_EXPORT)
<a name="l00794"></a>00794
<a name="l00795"></a>00795
<a name="l00796"></a>00796 <span class="comment">// ---------------------------------------------------------------------------</span>
<a name="l00797"></a>00797 <span class="comment">// XMLPlatformUtils: alignPointerForNewBlockAllocation</span>
<a name="l00798"></a>00798 <span class="comment">// ---------------------------------------------------------------------------</span>
<a name="l00799"></a>00799 <span class="comment">// Calculate alignment required by platform for a new</span>
<a name="l00800"></a>00800 <span class="comment">// block allocation. We use this in our custom allocators</span>
<a name="l00801"></a>00801 <span class="comment">// to ensure that returned blocks are properly aligned.</span>
<a name="l00802"></a>00802 <span class="comment">// Note that, although this will take a pointer and return the position</span>
<a name="l00803"></a>00803 <span class="comment">// at which it should be placed for correct alignment, in our code</span>
<a name="l00804"></a>00804 <span class="comment">// we normally use size_t parameters to discover what the alignment</span>
<a name="l00805"></a>00805 <span class="comment">// of header blocks should be. Thus, if this is to be</span>
<a name="l00806"></a>00806 <span class="comment">// used for the former purpose, to make compilers happy</span>
<a name="l00807"></a>00807 <span class="comment">// some casting will be necessary - neilg.</span>
<a name="l00808"></a>00808 <span class="comment">//</span>
<a name="l00809"></a>00809 <span class="comment">// Note: XML_PLATFORM_NEW_BLOCK_ALIGNMENT may be specified on a</span>
<a name="l00810"></a>00810 <span class="comment">// per-architecture basis to dictate the alignment requirements</span>
<a name="l00811"></a>00811 <span class="comment">// of the architecture. In the absense of this specification,</span>
<a name="l00812"></a>00812 <span class="comment">// this routine guesses at the correct alignment value.</span>
<a name="l00813"></a>00813 <span class="comment">//</span>
<a name="l00814"></a>00814 <span class="comment">// A XML_PLATFORM_NEW_BLOCK_ALIGNMENT value of zero is illegal.</span>
<a name="l00815"></a>00815 <span class="comment">// If a platform requires absolutely no alignment, a value</span>
<a name="l00816"></a>00816 <span class="comment">// of 1 should be specified ("align pointers on 1 byte boundaries").</span>
<a name="l00817"></a>00817 <span class="comment">//</span>
<a name="l00818"></a>00818 inline size_t
<a name="l00819"></a>00819 XMLPlatformUtils::alignPointerForNewBlockAllocation(size_t ptrSize)
<a name="l00820"></a>00820 {
<a name="l00821"></a>00821 <span class="comment">// Macro XML_PLATFORM_NEW_BLOCK_ALIGNMENT may be defined</span>
<a name="l00822"></a>00822 <span class="comment">// as needed to dictate alignment requirements on a</span>
<a name="l00823"></a>00823 <span class="comment">// per-architecture basis. In the absense of that we</span>
<a name="l00824"></a>00824 <span class="comment">// take an educated guess.</span>
<a name="l00825"></a>00825 <span class="preprocessor"> #ifdef XML_PLATFORM_NEW_BLOCK_ALIGNMENT</span>
<a name="l00826"></a>00826 <span class="preprocessor"></span> size_t alignment = XML_PLATFORM_NEW_BLOCK_ALIGNMENT;
<a name="l00827"></a>00827 <span class="preprocessor"> #else</span>
<a name="l00828"></a>00828 <span class="preprocessor"></span> size_t alignment = (<span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*) &gt;= <span class="keyword">sizeof</span>(<span class="keywordtype">double</span>)) ? <span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*) : <span class="keyword">sizeof</span>(double);
<a name="l00829"></a>00829 <span class="preprocessor"> #endif</span>
<a name="l00830"></a>00830 <span class="preprocessor"></span>
<a name="l00831"></a>00831 <span class="comment">// Calculate current alignment of pointer</span>
<a name="l00832"></a>00832 size_t current = ptrSize % alignment;
<a name="l00833"></a>00833
<a name="l00834"></a>00834 <span class="comment">// Adjust pointer alignment as needed</span>
<a name="l00835"></a>00835 <span class="keywordflow">return</span> (current == 0)
<a name="l00836"></a>00836 ? ptrSize
<a name="l00837"></a>00837 : (ptrSize + alignment - current);
<a name="l00838"></a>00838 }
<a name="l00839"></a>00839
<a name="l00840"></a>00840
<a name="l00841"></a>00841
<a name="l00842"></a>00842 <span class="comment">// ---------------------------------------------------------------------------</span>
<a name="l00843"></a>00843 <span class="comment">// XMLDeleter: Public Destructor</span>
<a name="l00844"></a>00844 <span class="comment">// ---------------------------------------------------------------------------</span>
<a name="l00845"></a><a class="code" href="classxercesc_1_1XMLDeleter.html#945e3f144ab339164855fbeb57094e9c">00845</a> <span class="keyword">inline</span> XMLDeleter::~XMLDeleter()
<a name="l00846"></a>00846 {
<a name="l00847"></a>00847 }
<a name="l00848"></a>00848
<a name="l00849"></a>00849 <span class="comment">// ---------------------------------------------------------------------------</span>
<a name="l00850"></a>00850 <span class="comment">// XMLDeleter: Hidden constructors and operators</span>
<a name="l00851"></a>00851 <span class="comment">// ---------------------------------------------------------------------------</span>
<a name="l00852"></a><a class="code" href="classxercesc_1_1XMLDeleter.html#a675cce1ed0974a1cffc5a70df20cd45">00852</a> <span class="keyword">inline</span> <a class="code" href="classxercesc_1_1XMLDeleter.html#a675cce1ed0974a1cffc5a70df20cd45">XMLDeleter::XMLDeleter</a>()
<a name="l00853"></a>00853 {
<a name="l00854"></a>00854 }
<a name="l00855"></a>00855
<a name="l00856"></a>00856 XERCES_CPP_NAMESPACE_END
<a name="l00857"></a>00857
<a name="l00858"></a>00858 <span class="preprocessor">#endif</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue Dec 12 00:18:56 2006 for XQilla Simple API by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address>
</body>
</html>