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

158 lines
12 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_000000.html">include</a>&nbsp;/&nbsp;<a class="el" href="dir_000001.html">xqilla</a>&nbsp;/&nbsp;<a class="el" href="dir_000003.html">context</a></div>
<h1>Scope.hpp</h1><a href="Scope_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"> * Copyright (c) 2001-2008</span>
00003 <span class="comment"> * DecisionSoft Limited. All rights reserved.</span>
00004 <span class="comment"> * Copyright (c) 2004-2008</span>
00005 <span class="comment"> * Oracle. All rights reserved.</span>
00006 <span class="comment"> *</span>
00007 <span class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</span>
00008 <span class="comment"> * you may not use this file except in compliance with the License.</span>
00009 <span class="comment"> * You may obtain a copy of the License at</span>
00010 <span class="comment"> *</span>
00011 <span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span>
00012 <span class="comment"> *</span>
00013 <span class="comment"> * Unless required by applicable law or agreed to in writing, software</span>
00014 <span class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</span>
00015 <span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
00016 <span class="comment"> * See the License for the specific language governing permissions and</span>
00017 <span class="comment"> * limitations under the License.</span>
00018 <span class="comment"> *</span>
00019 <span class="comment"> * $Id: Scope.hpp 475 2008-01-08 18:47:44Z jpcs $</span>
00020 <span class="comment"> */</span>
00021
00022 <span class="comment">/*</span>
00023 <span class="comment"> Scope</span>
00024 <span class="comment">*/</span>
00025
00026 <span class="preprocessor">#ifndef _SCOPE_HPP</span>
00027 <span class="preprocessor"></span><span class="preprocessor">#define _SCOPE_HPP</span>
00028 <span class="preprocessor"></span>
00029 <span class="preprocessor">#include &lt;xqilla/framework/XQillaExport.hpp&gt;</span>
00030 <span class="preprocessor">#include &lt;<a class="code" href="VarHashEntry_8hpp.html">xqilla/context/VarHashEntry.hpp</a>&gt;</span>
00031 <span class="preprocessor">#include &lt;vector&gt;</span>
00032 <span class="preprocessor">#include &lt;xercesc/util/RefHash2KeysTableOf.hpp&gt;</span>
00033 <span class="preprocessor">#include &lt;<a class="code" href="XMemory_8hpp.html">xercesc/util/XMemory.hpp</a>&gt;</span>
00034
00035 <span class="keyword">template</span>&lt;<span class="keyword">class</span> TYPE&gt; <span class="keyword">class </span><a class="code" href="classVarHashEntry.html">VarHashEntry</a>;
00036
00038 <span class="keyword">template</span>&lt;<span class="keyword">class</span> TYPE&gt;
<a name="l00039"></a><a class="code" href="classScope.html">00039</a> <span class="keyword">class </span><a class="code" href="classScope.html">Scope</a> : <span class="keyword">public</span> XERCES_CPP_NAMESPACE_QUALIFIER XMemory
00040 {
00041 <span class="keyword">public</span>:
<a name="l00043"></a><a class="code" href="classScope.html#w4">00043</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> {
00044 GLOBAL_SCOPE,
00045 LOCAL_SCOPE,
00046 <a class="code" href="classScope.html#w4w3">LOGICAL_BLOCK_SCOPE</a>
00047 } Type;
00048
<a name="l00049"></a><a class="code" href="classScope.html#w0">00049</a> <span class="keyword">typedef</span> XERCES_CPP_NAMESPACE_QUALIFIER RefHash2KeysTableOf&lt; VarHashEntry&lt;TYPE&gt; &gt; VarHash;
00050
00052 <a class="code" href="classScope.html#a0">Scope</a>(<a class="code" href="classXPath2MemoryManager.html">XPath2MemoryManager</a>* memMgr, Type type);
00053 <a class="code" href="classScope.html#a1">~Scope</a>();
00054
00055 <span class="keywordtype">void</span> <a class="code" href="classScope.html#a2">clear</a>();
00056
00057 <a class="code" href="classScope.html#w4">Type</a> <a class="code" href="classScope.html#a3">getType</a>() <span class="keyword">const</span>;
00058 <a class="code" href="classVarHashEntry.html">VarHashEntry&lt;TYPE&gt;</a>* <a class="code" href="classScope.html#a4">get</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nsID, <span class="keyword">const</span> XMLCh* name);
00059 <span class="keywordtype">void</span> <a class="code" href="classScope.html#a5">put</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nsID, <span class="keyword">const</span> XMLCh* name, <a class="code" href="classVarHashEntry.html">VarHashEntry&lt;TYPE&gt;</a>* value);
00060 <span class="keywordtype">void</span> <a class="code" href="classScope.html#a6">remove</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nsID, <span class="keyword">const</span> XMLCh* name);
00061 std::vector&lt; std::pair&lt;unsigned int, const XMLCh*&gt; &gt; <a class="code" href="classScope.html#a7">getVars</a>() <span class="keyword">const</span>;
00062
00063 <a class="code" href="classScope.html">Scope</a>* <a class="code" href="classScope.html#a8">getNext</a>();
00064 <span class="keywordtype">void</span> <a class="code" href="classScope.html#a9">setNext</a>(<a class="code" href="classScope.html">Scope</a>* next);
00065
00066 <span class="keyword">private</span>:
00067 <span class="keyword">typename</span> <a class="code" href="classScope.html">Scope&lt;TYPE&gt;</a>::Type _type;
00068 <a class="code" href="classScope.html#w0">VarHash</a> _map;
00069 <a class="code" href="classXPath2MemoryManager.html">XPath2MemoryManager</a>* _memMgr;
00070 <a class="code" href="classScope.html">Scope&lt;TYPE&gt;</a>* _next;
00071 };
00072
00073 <span class="keyword">template</span>&lt;<span class="keyword">class</span> TYPE&gt;
<a name="l00074"></a><a class="code" href="classScope.html#a0">00074</a> <a class="code" href="classScope.html#a0">Scope&lt;TYPE&gt;::Scope</a>(<a class="code" href="classXPath2MemoryManager.html">XPath2MemoryManager</a>* memMgr, Type type) :
00075 _map(17, true, memMgr)
00076 {
00077 _memMgr=memMgr;
00078 _type = type;
00079 _next = NULL;
00080 }
00081
00082 <span class="keyword">template</span>&lt;<span class="keyword">class</span> TYPE&gt;
<a name="l00083"></a><a class="code" href="classScope.html#a2">00083</a> <span class="keywordtype">void</span> <a class="code" href="classScope.html#a2">Scope&lt;TYPE&gt;::clear</a>()
00084 {
00085 _map.removeAll();
00086 }
00087
00088 <span class="keyword">template</span>&lt;<span class="keyword">class</span> TYPE&gt;
<a name="l00089"></a><a class="code" href="classScope.html#a3">00089</a> <span class="keyword">typename</span> <a class="code" href="classScope.html">Scope&lt;TYPE&gt;</a>::Type <a class="code" href="classScope.html#a3">Scope&lt;TYPE&gt;::getType</a>()<span class="keyword"> const</span>
00090 <span class="keyword"></span>{
00091 <span class="keywordflow">return</span> _type;
00092 }
00093
00094 <span class="keyword">template</span>&lt;<span class="keyword">class</span> TYPE&gt;
<a name="l00095"></a><a class="code" href="classScope.html#a4">00095</a> <a class="code" href="classVarHashEntry.html">VarHashEntry&lt;TYPE&gt;</a>* <a class="code" href="classScope.html#a4">Scope&lt;TYPE&gt;::get</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nsID, <span class="keyword">const</span> XMLCh* name)
00096 {
00097 <span class="keywordflow">return</span> _map.get(name,nsID);
00098 }
00099
00100 <span class="keyword">template</span>&lt;<span class="keyword">class</span> TYPE&gt;
<a name="l00101"></a><a class="code" href="classScope.html#a5">00101</a> <span class="keywordtype">void</span> <a class="code" href="classScope.html#a5">Scope&lt;TYPE&gt;::put</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nsID, <span class="keyword">const</span> XMLCh* name, <a class="code" href="classVarHashEntry.html">VarHashEntry&lt;TYPE&gt;</a>* value)
00102 {
00103 _map.put((<span class="keywordtype">void</span>*)_memMgr-&gt;<a class="code" href="classXPath2MemoryManager.html#a2">getPooledString</a>(name),nsID,value);
00104 }
00105
00106 <span class="keyword">template</span>&lt;<span class="keyword">class</span> TYPE&gt;
<a name="l00107"></a><a class="code" href="classScope.html#a6">00107</a> <span class="keywordtype">void</span> <a class="code" href="classScope.html#a6">Scope&lt;TYPE&gt;::remove</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nsID, <span class="keyword">const</span> XMLCh* name)
00108 {
00109 _map.removeKey(name,nsID);
00110 }
00111
00112 <span class="keyword">template</span>&lt;<span class="keyword">class</span> TYPE&gt;
<a name="l00113"></a><a class="code" href="classScope.html#a7">00113</a> std::vector&lt; std::pair&lt;unsigned int, const XMLCh*&gt; &gt; <a class="code" href="classScope.html#a7">Scope&lt;TYPE&gt;::getVars</a>()<span class="keyword"> const</span>
00114 <span class="keyword"></span>{
00115 std::vector&lt; std::pair&lt;unsigned int, const XMLCh*&gt; &gt; result;
00116 XERCES_CPP_NAMESPACE_QUALIFIER RefHash2KeysTableOfEnumerator&lt; VarHashEntry&lt;TYPE&gt; &gt; iterator(const_cast&lt;VarHash*&gt;(&amp;_map));
00117 <span class="keywordflow">while</span>(iterator.hasMoreElements())
00118 {
00119 XMLCh* name;
00120 <span class="keywordtype">int</span> nsID;
00121 iterator.nextElementKey((<span class="keywordtype">void</span>*&amp;)name, nsID);
00122 result.push_back(std::pair&lt;unsigned int, const XMLCh*&gt;(nsID,name));
00123 }
00124 <span class="keywordflow">return</span> result;
00125 }
00126
00127 <span class="keyword">template</span>&lt;<span class="keyword">class</span> TYPE&gt;
<a name="l00128"></a><a class="code" href="classScope.html#a1">00128</a> <a class="code" href="classScope.html#a1">Scope&lt;TYPE&gt;::~Scope</a>()
00129 {
00130 _map.removeAll();
00131 }
00132
00133 <span class="keyword">template</span>&lt;<span class="keyword">class</span> TYPE&gt;
<a name="l00134"></a><a class="code" href="classScope.html#a8">00134</a> <a class="code" href="classScope.html">Scope&lt;TYPE&gt;</a>* <a class="code" href="classScope.html#a8">Scope&lt;TYPE&gt;::getNext</a>()
00135 {
00136 <span class="keywordflow">return</span> _next;
00137 }
00138
00139 <span class="keyword">template</span>&lt;<span class="keyword">class</span> TYPE&gt;
<a name="l00140"></a><a class="code" href="classScope.html#a9">00140</a> <span class="keywordtype">void</span> <a class="code" href="classScope.html#a9">Scope&lt;TYPE&gt;::setNext</a>(<a class="code" href="classScope.html">Scope&lt;TYPE&gt;</a>* next)
00141 {
00142 _next=next;
00143 }
00144
00145 <span class="preprocessor">#endif // _SCOPE_HPP</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>