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

321 lines
24 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 Documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<a style="float:right;" href="http://sourceforge.net/projects/xqilla"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=152021&amp;type=2" border="0" alt="SourceForge.net Logo" /></a>
<!-- Generated by Doxygen 1.3.9.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a> | <a class="qindex" href="examples.html">Examples</a></div>
<div class="nav">
<a class="el" href="dir_000007.html">xerces-c-3.0.1</a>&nbsp;/&nbsp;<a class="el" href="dir_000008.html">src</a>&nbsp;/&nbsp;<a class="el" href="dir_000009.html">xercesc</a>&nbsp;/&nbsp;<a class="el" href="dir_000016.html">util</a></div>
<h1>PlatformUtils.hpp</h1><a href="PlatformUtils_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*</span>
00002 <span class="comment"> * Licensed to the Apache Software Foundation (ASF) under one or more</span>
00003 <span class="comment"> * contributor license agreements. See the NOTICE file distributed with</span>
00004 <span class="comment"> * this work for additional information regarding copyright ownership.</span>
00005 <span class="comment"> * The ASF licenses this file to You under the Apache License, Version 2.0</span>
00006 <span class="comment"> * (the "License"); you may not use this file except in compliance with</span>
00007 <span class="comment"> * the License. You may obtain a copy of the License at</span>
00008 <span class="comment"> *</span>
00009 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span>
00010 <span class="comment"> *</span>
00011 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
00012 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span>
00013 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
00014 <span class="comment"> * See the License for the specific language governing permissions and</span>
00015 <span class="comment"> * limitations under the License.</span>
00016 <span class="comment"> */</span>
00017
00018 <span class="comment">/*</span>
00019 <span class="comment"> * $Id: PlatformUtils.hpp 695427 2008-09-15 11:05:36Z borisk $</span>
00020 <span class="comment"> */</span>
00021
00022 <span class="preprocessor">#if !defined(XERCESC_INCLUDE_GUARD_PLATFORMUTILS_HPP)</span>
<a name="l00023"></a><a class="code" href="PlatformUtils_8hpp.html#a0">00023</a> <span class="preprocessor"></span><span class="preprocessor">#define XERCESC_INCLUDE_GUARD_PLATFORMUTILS_HPP</span>
00024 <span class="preprocessor"></span>
00025 <span class="preprocessor">#include &lt;xercesc/util/XercesDefs.hpp&gt;</span>
00026 <span class="preprocessor">#include &lt;xercesc/util/XMLException.hpp&gt;</span>
00027 <span class="preprocessor">#include &lt;xercesc/util/PanicHandler.hpp&gt;</span>
00028
00029 <span class="preprocessor">#include &lt;xercesc/util/XMLFileMgr.hpp&gt;</span>
00030 <span class="preprocessor">#include &lt;xercesc/util/XMLMutexMgr.hpp&gt;</span>
00031
00032 XERCES_CPP_NAMESPACE_BEGIN
00033
00034 <span class="keyword">class </span>XMLMsgLoader;
00035 <span class="keyword">class </span>XMLNetAccessor;
00036 <span class="keyword">class </span>XMLTransService;
00037 <span class="keyword">class </span>MemoryManager;
00038 <span class="keyword">class </span>XMLMutex;
00039
00040 <span class="comment">//</span>
00041 <span class="comment">// For internal use only</span>
00042 <span class="comment">//</span>
00043 <span class="comment">// This class provides a simple abstract API via which lazily evaluated</span>
00044 <span class="comment">// data can be cleaned up.</span>
00045 <span class="comment">//</span>
<a name="l00046"></a><a class="code" href="classxercesc_1_1XMLDeleter.html">00046</a> <span class="keyword">class </span>XMLUTIL_EXPORT XMLDeleter
00047 {
00048 <span class="keyword">public</span> :
00049 <span class="keyword">virtual</span> ~XMLDeleter();
00050
00051 <span class="keyword">protected</span> :
00052 XMLDeleter();
00053
00054 <span class="keyword">private</span> :
00055 XMLDeleter(<span class="keyword">const</span> XMLDeleter&amp;);
00056 XMLDeleter&amp; operator=(<span class="keyword">const</span> XMLDeleter&amp;);
00057 };
00058
00059
<a name="l00068"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html">00068</a> <span class="keyword">class </span>XMLUTIL_EXPORT XMLPlatformUtils
00069 {
00070 <span class="keyword">public</span> :
00071
00074
<a name="l00087"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html#z73_0">00087</a> <span class="keyword">static</span> XMLNetAccessor* fgNetAccessor;
00088
<a name="l00099"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html#z73_1">00099</a> <span class="keyword">static</span> XMLTransService* fgTransService;
00100 <span class="preprocessor">#ifdef OS390</span>
00101 <span class="preprocessor"></span> <span class="keyword">static</span> XMLTransService* fgTransService2;
00102 <span class="preprocessor">#endif</span>
00103 <span class="preprocessor"></span>
<a name="l00108"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html#z73_2">00108</a> <span class="keyword">static</span> PanicHandler* fgUserPanicHandler;
00109
<a name="l00114"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html#z73_3">00114</a> <span class="keyword">static</span> PanicHandler* fgDefaultPanicHandler;
00115
<a name="l00121"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html#z73_4">00121</a> <span class="keyword">static</span> <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* fgMemoryManager;
00122
<a name="l00123"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html#z73_5">00123</a> <span class="keyword">static</span> XMLFileMgr* fgFileMgr;
<a name="l00124"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html#z73_6">00124</a> <span class="keyword">static</span> XMLMutexMgr* fgMutexMgr;
00125
<a name="l00132"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html#z73_7">00132</a> <span class="keyword">static</span> XMLMutex* fgAtomicMutex;
00133
<a name="l00134"></a><a class="code" href="classxercesc_1_1XMLPlatformUtils.html#z73_8">00134</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> fgXMLChBigEndian;
00135
00137
00138
00141
00173 <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
00174 , <span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> nlsHome = 0
00175 , PanicHandler* <span class="keyword">const</span> panicHandler = 0
00176 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> memoryManager = 0);
00177
00227 <span class="keyword">static</span> <span class="keywordtype">void</span> Initialize(XMLSize_t initialDOMHeapAllocSize
00228 , XMLSize_t maxDOMHeapAllocSize
00229 , XMLSize_t maxDOMSubAllocationSize
00230 , <span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> locale = XMLUni::fgXercescDefaultLocale
00231 , <span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> nlsHome = 0
00232 , PanicHandler* <span class="keyword">const</span> panicHandler = 0
00233 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> memoryManager = 0);
00234
00241 <span class="keyword">static</span> <span class="keywordtype">void</span> Terminate();
00242
00259 <span class="keyword">static</span> <span class="keywordtype">void</span> panic
00260 (
00261 <span class="keyword">const</span> PanicHandler::PanicReasons reason
00262 );
00263
00265
00268
00273 <span class="keyword">static</span> XMLFileMgr* makeFileMgr(<a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager);
00274
00288 <span class="keyword">static</span> XMLFilePos curFilePos(FileHandle theFile
00289 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
00290
00301 <span class="keyword">static</span> <span class="keywordtype">void</span> closeFile(FileHandle theFile
00302 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
00303
00314 <span class="keyword">static</span> XMLFilePos fileSize(FileHandle theFile
00315 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
00316
00327 <span class="keyword">static</span> FileHandle openFile(<span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> fileName
00328 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
00329
00340 <span class="keyword">static</span> FileHandle openFile(<span class="keyword">const</span> XMLCh* <span class="keyword">const</span> fileName
00341 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
00342
00353 <span class="keyword">static</span> FileHandle openFileToWrite(<span class="keyword">const</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> fileName
00354 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
00355
00366 <span class="keyword">static</span> FileHandle openFileToWrite(<span class="keyword">const</span> XMLCh* <span class="keyword">const</span> fileName
00367 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
00368
00379 <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);
00380
00397 <span class="keyword">static</span> XMLSize_t readFileBuffer
00398 (
00399 FileHandle theFile
00400 , <span class="keyword">const</span> XMLSize_t toRead
00401 , XMLByte* <span class="keyword">const</span> toFill
00402 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager
00403 );
00404
00419 <span class="keyword">static</span> <span class="keywordtype">void</span> writeBufferToFile
00420 (
00421 FileHandle <span class="keyword">const</span> theFile
00422 , XMLSize_t toWrite
00423 , <span class="keyword">const</span> XMLByte* <span class="keyword">const</span> toFlush
00424 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager
00425 );
00426
00436 <span class="keyword">static</span> <span class="keywordtype">void</span> resetFile(FileHandle theFile
00437 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
00438
00440
00441
00465 <span class="keyword">static</span> XMLCh* getFullPath
00466 (
00467 <span class="keyword">const</span> XMLCh* <span class="keyword">const</span> srcPath
00468 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager
00469 );
00470
00484 <span class="keyword">static</span> XMLCh* getCurrentDirectory
00485 (
00486 <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager
00487 );
00488
00498 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> isAnySlash(XMLCh c);
00499
00509 <span class="keyword">static</span> <span class="keywordtype">void</span> removeDotSlash(XMLCh* <span class="keyword">const</span> srcPath
00510 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
00511
00522 <span class="keyword">static</span> <span class="keywordtype">void</span> removeDotDotSlash(XMLCh* <span class="keyword">const</span> srcPath
00523 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
00524
00538 <span class="keyword">static</span> <span class="keywordtype">bool</span> isRelative(<span class="keyword">const</span> XMLCh* <span class="keyword">const</span> toCheck
00539 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager
00540 );
00541
00561 <span class="keyword">static</span> XMLCh* weavePaths
00562 (
00563 <span class="keyword">const</span> XMLCh* <span class="keyword">const</span> basePath
00564 , <span class="keyword">const</span> XMLCh* <span class="keyword">const</span> relativePath
00565 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager
00566 );
00568
00571
00581 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> getCurrentMillis();
00583
00586
00594 <span class="keyword">static</span> XMLMutexMgr* makeMutexMgr(<a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager);
00595
00604 <span class="keyword">static</span> <span class="keywordtype">void</span> closeMutex(<span class="keywordtype">void</span>* <span class="keyword">const</span> mtxHandle, <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
00605
00613 <span class="keyword">static</span> <span class="keywordtype">void</span> lockMutex(<span class="keywordtype">void</span>* <span class="keyword">const</span> mtxHandle);
00614
00624 <span class="keyword">static</span> <span class="keywordtype">void</span>* makeMutex(<a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
00625
00638 <span class="keyword">static</span> <span class="keywordtype">void</span> unlockMutex(<span class="keywordtype">void</span>* <span class="keyword">const</span> mtxHandle);
00639
00641
00642
00645
00653 <span class="keyword">static</span> XMLMsgLoader* loadMsgSet(<span class="keyword">const</span> XMLCh* <span class="keyword">const</span> msgDomain);
00654
00656
00657
00671 <span class="keyword">static</span> <span class="keywordtype">void</span> recognizeNEL(<span class="keywordtype">bool</span> state
00672 , <a class="code" href="classxercesc_1_1MemoryManager.html">MemoryManager</a>* <span class="keyword">const</span> manager = XMLPlatformUtils::fgMemoryManager);
00673
00677 <span class="keyword">static</span> <span class="keywordtype">bool</span> isNELRecognized();
00679
00691 <span class="keyword">static</span> <span class="keywordtype">void</span> strictIANAEncoding(<span class="keyword">const</span> <span class="keywordtype">bool</span> state);
00692
00697 <span class="keyword">static</span> <span class="keywordtype">bool</span> isStrictIANAEncoding();
00699
00707 <span class="keyword">static</span> <span class="keyword">inline</span> XMLSize_t alignPointerForNewBlockAllocation(XMLSize_t ptrSize);
00708
00709 <span class="keyword">private</span> :
00710 <span class="comment">// -----------------------------------------------------------------------</span>
00711 <span class="comment">// Unimplemented constructors and operators</span>
00712 <span class="comment">// -----------------------------------------------------------------------</span>
00713 XMLPlatformUtils();
00714
00717
00723 <span class="keyword">static</span> XMLMsgLoader* loadAMsgSet(<span class="keyword">const</span> XMLCh* <span class="keyword">const</span> msgDomain);
00724
00734 <span class="keyword">static</span> XMLNetAccessor* makeNetAccessor();
00735
00746 <span class="keyword">static</span> XMLTransService* makeTransService();
00747
00755 <span class="keyword">static</span> <span class="keywordtype">int</span> searchSlashDotDotSlash(XMLCh* <span class="keyword">const</span> srcPath);
00756
00758
00761
00768 <span class="keyword">static</span> <span class="keywordtype">bool</span> fgMemMgrAdopted;
00769
00771 };
00772
00773
<a name="l00774"></a><a class="code" href="namespacexercesc.html#a0">00774</a> <a class="code" href="namespacexercesc.html#a0">MakeXMLException</a>(XMLPlatformUtilsException, XMLUTIL_EXPORT)
00775
00776
00777 <span class="comment">// ---------------------------------------------------------------------------</span>
00778 <span class="comment">// XMLPlatformUtils: alignPointerForNewBlockAllocation</span>
00779 <span class="comment">// ---------------------------------------------------------------------------</span>
00780 <span class="comment">// Calculate alignment required by platform for a new</span>
00781 <span class="comment">// block allocation. We use this in our custom allocators</span>
00782 <span class="comment">// to ensure that returned blocks are properly aligned.</span>
00783 <span class="comment">// Note that, although this will take a pointer and return the position</span>
00784 <span class="comment">// at which it should be placed for correct alignment, in our code</span>
00785 <span class="comment">// we normally use XMLSize_t parameters to discover what the alignment</span>
00786 <span class="comment">// of header blocks should be. Thus, if this is to be</span>
00787 <span class="comment">// used for the former purpose, to make compilers happy</span>
00788 <span class="comment">// some casting will be necessary - neilg.</span>
00789 <span class="comment">//</span>
00790 <span class="comment">// Note: XML_PLATFORM_NEW_BLOCK_ALIGNMENT may be specified on a</span>
00791 <span class="comment">// per-architecture basis to dictate the alignment requirements</span>
00792 <span class="comment">// of the architecture. In the absense of this specification,</span>
00793 <span class="comment">// this routine guesses at the correct alignment value.</span>
00794 <span class="comment">//</span>
00795 <span class="comment">// A XML_PLATFORM_NEW_BLOCK_ALIGNMENT value of zero is illegal.</span>
00796 <span class="comment">// If a platform requires absolutely no alignment, a value</span>
00797 <span class="comment">// of 1 should be specified ("align pointers on 1 byte boundaries").</span>
00798 <span class="comment">//</span>
00799 inline XMLSize_t
00800 XMLPlatformUtils::alignPointerForNewBlockAllocation(XMLSize_t ptrSize)
00801 {
00802 <span class="comment">// Macro XML_PLATFORM_NEW_BLOCK_ALIGNMENT may be defined</span>
00803 <span class="comment">// as needed to dictate alignment requirements on a</span>
00804 <span class="comment">// per-architecture basis. In the absense of that we</span>
00805 <span class="comment">// take an educated guess.</span>
00806 <span class="preprocessor">#ifdef XML_PLATFORM_NEW_BLOCK_ALIGNMENT</span>
00807 <span class="preprocessor"></span> <span class="keyword">static</span> <span class="keyword">const</span> XMLSize_t alignment = XML_PLATFORM_NEW_BLOCK_ALIGNMENT;
00808 <span class="preprocessor">#else</span>
00809 <span class="preprocessor"></span> <span class="keyword">static</span> <span class="keyword">const</span> XMLSize_t alignment = (<span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*) &gt;= <span class="keyword">sizeof</span>(double)) ? <span class="keyword">sizeof</span>(<span class="keywordtype">void</span>*) : <span class="keyword">sizeof</span>(double);
00810 <span class="preprocessor">#endif</span>
00811 <span class="preprocessor"></span>
00812 <span class="comment">// Calculate current alignment of pointer</span>
00813 XMLSize_t current = ptrSize % alignment;
00814
00815 <span class="comment">// Adjust pointer alignment as needed</span>
00816 <span class="keywordflow">return</span> (current == 0)
00817 ? ptrSize
00818 : (ptrSize + alignment - current);
00819 }
00820
00821
00822
00823 <span class="comment">// ---------------------------------------------------------------------------</span>
00824 <span class="comment">// XMLDeleter: Public Destructor</span>
00825 <span class="comment">// ---------------------------------------------------------------------------</span>
<a name="l00826"></a><a class="code" href="classxercesc_1_1XMLDeleter.html#a0">00826</a> <span class="keyword">inline</span> XMLDeleter::~XMLDeleter()
00827 {
00828 }
00829
00830 <span class="comment">// ---------------------------------------------------------------------------</span>
00831 <span class="comment">// XMLDeleter: Hidden constructors and operators</span>
00832 <span class="comment">// ---------------------------------------------------------------------------</span>
<a name="l00833"></a><a class="code" href="classxercesc_1_1XMLDeleter.html#b0">00833</a> <span class="keyword">inline</span> XMLDeleter::XMLDeleter()
00834 {
00835 }
00836
00837 XERCES_CPP_NAMESPACE_END
00838
00839 <span class="preprocessor">#endif</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Sep 25 06:55:26 2009 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.3.9.1 </small></address>
</body>
</html>