<!-- This comment will put IE 6, 7 and 8 in quirks mode --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>wsdlpull: /builddir/build/BUILD/wsdlpull-1.23/src/schemaparser/SimpleType.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javaScript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body onload='searchBox.OnSelectItem(0);'> <!-- Generated by Doxygen 1.6.2-20100208 --> <script type="text/javascript"><!-- var searchBox = new SearchBox("searchBox", "search",false,'Search'); --></script> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <img id="MSearchSelect" src="search/search.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </div> </li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="dir_02f058d422e7266632662d1436e7c90d.html">src</a> » <a class="el" href="dir_aa09c601595277e3f572f9f53a7da262.html">schemaparser</a> </div> </div> <div class="contents"> <h1>SimpleType.h</h1><a href="SimpleType_8h.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"> * wsdlpull - A C++ parser for WSDL (Web services description language)</span> <a name="l00003"></a>00003 <span class="comment"> * Copyright (C) 2005-2007 Vivek Krishna</span> <a name="l00004"></a>00004 <span class="comment"> *</span> <a name="l00005"></a>00005 <span class="comment"> * This library is free software; you can redistribute it and/or</span> <a name="l00006"></a>00006 <span class="comment"> * modify it under the terms of the GNU Library General Public</span> <a name="l00007"></a>00007 <span class="comment"> * License as published by the Free Software Foundation; either</span> <a name="l00008"></a>00008 <span class="comment"> * version 2 of the License, or (at your option) any later version.</span> <a name="l00009"></a>00009 <span class="comment"> *</span> <a name="l00010"></a>00010 <span class="comment"> * This library is distributed in the hope that it will be useful,</span> <a name="l00011"></a>00011 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00012"></a>00012 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00013"></a>00013 <span class="comment"> * Library General Public License for more details.</span> <a name="l00014"></a>00014 <span class="comment"> *</span> <a name="l00015"></a>00015 <span class="comment"> * You should have received a copy of the GNU Library General Public</span> <a name="l00016"></a>00016 <span class="comment"> * License along with this library; if not, write to the Free</span> <a name="l00017"></a>00017 <span class="comment"> * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span> <a name="l00018"></a>00018 <span class="comment"> *</span> <a name="l00019"></a>00019 <span class="comment"> *</span> <a name="l00020"></a>00020 <span class="comment"> */</span> <a name="l00021"></a>00021 <span class="preprocessor">#ifndef _SIMPLETYPEH</span> <a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#define _SIMPLETYPEH</span> <a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#include <list></span> <a name="l00024"></a>00024 <span class="preprocessor">#include <map></span> <a name="l00025"></a>00025 <span class="preprocessor">#include <vector></span> <a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="XSDType_8h.html">schemaparser/XSDType.h</a>"</span> <a name="l00028"></a>00028 <span class="preprocessor">#include "<a class="code" href="wsdlpull__export_8h.html">xmlpull/wsdlpull_export.h</a>"</span> <a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="Qname_8h.html">xmlpull/Qname.h</a>"</span> <a name="l00030"></a>00030 <span class="preprocessor">#include "<a class="code" href="XmlUtils_8h.html">xmlpull/XmlUtils.h</a>"</span> <a name="l00031"></a>00031 <span class="preprocessor">#include "<a class="code" href="SchemaParserException_8h.html">schemaparser/SchemaParserException.h</a>"</span> <a name="l00032"></a>00032 <a name="l00033"></a>00033 <span class="keyword">namespace </span>Schema { <a name="l00034"></a>00034 <span class="comment">//union to store the values for various facets</span> <a name="l00035"></a><a class="code" href="unionSchema_1_1facetValueType.html">00035</a> <span class="keyword">typedef</span> <span class="keyword">union</span> <a name="l00036"></a>00036 { <a name="l00037"></a><a class="code" href="unionSchema_1_1facetValueType.html#a1ed750f27e438da69f01f472a298784f">00037</a> <span class="keywordtype">int</span> length; <a name="l00038"></a>00038 <span class="keyword">struct</span> <a name="l00039"></a>00039 { <a name="l00040"></a><a class="code" href="unionSchema_1_1facetValueType.html#a44437a3481ccffead90d4c8e7b428d1d">00040</a> <span class="keywordtype">int</span> minlen, maxlen; <a name="l00041"></a>00041 } lenRange; <a name="l00042"></a><a class="code" href="unionSchema_1_1facetValueType.html#a01557684afca8099181b97ce26edc2e4">00042</a> <span class="keywordtype">int</span> numEnums; <a name="l00043"></a><a class="code" href="unionSchema_1_1facetValueType.html#a6dd8ca4084c09ec8f3a531d6c71278ca">00043</a> <span class="keywordtype">int</span> wsp; <a name="l00044"></a>00044 <span class="keyword">struct</span> <a name="l00045"></a>00045 { <a name="l00046"></a><a class="code" href="unionSchema_1_1facetValueType.html#abeab03bfe0910bb2d7db4ef19a31ffaf">00046</a> <span class="keywordtype">int</span> maxinc, mininc, maxex, minex; <a name="l00047"></a>00047 } valRange; <a name="l00048"></a><a class="code" href="unionSchema_1_1facetValueType.html#a4f1b4f783b0972432fd95b43f221698f">00048</a> <span class="keywordtype">int</span> tot; <a name="l00049"></a><a class="code" href="unionSchema_1_1facetValueType.html#a7208a268b0c2644e0a1ad95fc3025a9c">00049</a> <span class="keywordtype">int</span> frac; <a name="l00050"></a><a class="code" href="unionSchema_1_1facetValueType.html#a4f8e42a0ad60eb0148e61e04e2f297cb">00050</a> <span class="keyword">const</span> <span class="keywordtype">char</span> *pattern; <a name="l00051"></a>00051 } <a class="code" href="unionSchema_1_1facetValueType.html">facetValueType</a>; <a name="l00052"></a>00052 <a name="l00053"></a><a class="code" href="classSchema_1_1SimpleType.html">00053</a> <span class="keyword">class </span><a class="code" href="wsdlpull__export_8h.html#ad360158cff99879c80a7072c29529f50">WSDLPULL_EXPORT</a> <a class="code" href="classSchema_1_1SimpleType.html">SimpleType</a>:<span class="keyword">public</span> <a class="code" href="classSchema_1_1XSDType.html">XSDType</a> <a name="l00054"></a>00054 { <a name="l00055"></a>00055 <span class="keyword">public</span>: <a name="l00061"></a>00061 <a class="code" href="classSchema_1_1SimpleType.html">SimpleType</a>(<span class="keyword">const</span> std::string & ns); <a name="l00062"></a>00062 ~<a class="code" href="classSchema_1_1SimpleType.html">SimpleType</a>(); <a name="l00064"></a>00064 <a name="l00071"></a>00071 <span class="keywordtype">bool</span> isList() <span class="keyword">const</span>; <a name="l00076"></a>00076 <span class="keywordtype">bool</span> isUnion() <span class="keyword">const</span>; <a name="l00081"></a>00081 <span class="keywordtype">bool</span> isSimple() <span class="keyword">const</span>; <a name="l00082"></a>00082 <a name="l00083"></a>00083 <span class="comment">//facet and restriction methods</span> <a name="l00084"></a>00084 <span class="keywordtype">bool</span> isvalidFacet(std::string facet); <a name="l00085"></a>00085 <span class="keywordtype">bool</span> isValidInt(<span class="keywordtype">int</span> val)<span class="keyword">const</span>; <a name="l00086"></a>00086 <span class="keywordtype">bool</span> isValidFloat(<span class="keywordtype">float</span> val)<span class="keyword">const</span>; <a name="l00087"></a>00087 <span class="keywordtype">bool</span> isValidString(std::string val)<span class="keyword">const</span>; <a name="l00088"></a>00088 <span class="keywordtype">bool</span> getFacetValue(<span class="keywordtype">int</span> facet, <span class="keywordtype">void</span>* &val); <a name="l00089"></a>00089 <span class="keyword">const</span> std::list<int>* unionTypes()<span class="keyword">const</span>; <a name="l00090"></a>00090 <a name="l00092"></a>00092 <a name="l00094"></a>00094 <span class="keywordtype">void</span> setUnionType(<span class="keywordtype">int</span> <span class="keywordtype">id</span>); <a name="l00095"></a>00095 <span class="keywordtype">void</span> setListType(<span class="keywordtype">int</span> <span class="keywordtype">id</span>); <a name="l00096"></a>00096 <span class="keywordtype">void</span> setFacetValue(std::string facet,std::string val); <a name="l00098"></a>00098 <a name="l00099"></a>00099 <span class="comment">//enum for facet Ids</span> <a name="l00100"></a>00100 <span class="keyword">enum</span> <a name="l00101"></a>00101 { <a name="l00102"></a><a class="code" href="classSchema_1_1SimpleType.html#a77e0b82e198c11aee837bb266815161ba259c43548c309b8cf095bc521e473bf9">00102</a> NONE = 0, <a name="l00103"></a><a class="code" href="classSchema_1_1SimpleType.html#a77e0b82e198c11aee837bb266815161ba71224a26092a9ea9b9d3f6592b53cf6d">00103</a> LENGTH = 0x1, <a name="l00104"></a><a class="code" href="classSchema_1_1SimpleType.html#a77e0b82e198c11aee837bb266815161ba15dae36c743546b3098087da493ea9df">00104</a> MINLEN = 0x2, <a name="l00105"></a><a class="code" href="classSchema_1_1SimpleType.html#a77e0b82e198c11aee837bb266815161ba09b8e54ca73554f2f4bd5bd6ecdd562e">00105</a> MAXLEN = 0x4, <a name="l00106"></a><a class="code" href="classSchema_1_1SimpleType.html#a77e0b82e198c11aee837bb266815161bad74e578447664c911ad9251c03907010">00106</a> ENUM =0x8, <a name="l00107"></a><a class="code" href="classSchema_1_1SimpleType.html#a77e0b82e198c11aee837bb266815161ba3f78c91ce557abdc38e0f2228e8b8572">00107</a> WSP = 0x10, <a name="l00108"></a><a class="code" href="classSchema_1_1SimpleType.html#a77e0b82e198c11aee837bb266815161ba844590b5ddeeaf5f1d4e078c1be5b738">00108</a> MAXINC = 0x20, <a name="l00109"></a><a class="code" href="classSchema_1_1SimpleType.html#a77e0b82e198c11aee837bb266815161ba4e07854a34101fc7b9e1a6ff604c2545">00109</a> MININC = 0x40, <a name="l00110"></a><a class="code" href="classSchema_1_1SimpleType.html#a77e0b82e198c11aee837bb266815161bafe7171db6dabb8325f52d4fc8173f3fa">00110</a> MAXEX =0x80, <a name="l00111"></a><a class="code" href="classSchema_1_1SimpleType.html#a77e0b82e198c11aee837bb266815161baab9f301bfc3a672f537e18ab2a4834b0">00111</a> MINEX = 0x100, <a name="l00112"></a><a class="code" href="classSchema_1_1SimpleType.html#a77e0b82e198c11aee837bb266815161bae8972d03f08e2c1fc34a8eaa13b8665c">00112</a> TOTALDIGITS = 0x200, <a name="l00113"></a><a class="code" href="classSchema_1_1SimpleType.html#a77e0b82e198c11aee837bb266815161ba964c14997f8fbba15156377e1e1e6693">00113</a> FRAC = 0x400, <a name="l00114"></a><a class="code" href="classSchema_1_1SimpleType.html#a77e0b82e198c11aee837bb266815161bacc78bee3d65fcc09e613c36dce0a8092">00114</a> PATTERN = 0x800 <a name="l00115"></a>00115 }; <a name="l00116"></a>00116 <a name="l00117"></a>00117 <span class="comment">//whitespace values</span> <a name="l00118"></a>00118 <span class="keyword">enum</span> <a name="l00119"></a>00119 { <a name="l00120"></a><a class="code" href="classSchema_1_1SimpleType.html#a1f8aae80505add26a0838d14d8e10ca8a1bfb56a9205a134cf0ab386dae077be6">00120</a> PRESERVE = 1, <a name="l00121"></a><a class="code" href="classSchema_1_1SimpleType.html#a1f8aae80505add26a0838d14d8e10ca8adc7eb93a6541f5d4c1e063181486a81e">00121</a> REPLACE, <a name="l00122"></a><a class="code" href="classSchema_1_1SimpleType.html#a1f8aae80505add26a0838d14d8e10ca8a5aa418d10d9904d3e6ed015c5fad88a4">00122</a> COLLAPSE <a name="l00123"></a>00123 }; <a name="l00124"></a>00124 <span class="preprocessor">#ifdef LOGGING</span> <a name="l00125"></a>00125 <span class="preprocessor"></span> <span class="keywordtype">void</span> print(std::ostream & out); <a name="l00126"></a>00126 <span class="preprocessor">#endif</span> <a name="l00127"></a>00127 <span class="preprocessor"></span> <span class="keyword">private</span>: <a name="l00128"></a>00128 std::vector<int> facetId_; <a name="l00129"></a>00129 std::map<std::string,int> facets_; <a name="l00130"></a>00130 std::list < std::string > enumValues_; <a name="l00131"></a>00131 <span class="keywordtype">int</span> *validFacets_; <a name="l00132"></a>00132 <a class="code" href="unionSchema_1_1facetValueType.html">facetValueType</a> facetValue_; <a name="l00133"></a>00133 <span class="keywordtype">void</span> error(std::string msg); <a name="l00134"></a>00134 <span class="keywordtype">bool</span> isList_; <a name="l00135"></a>00135 <span class="keywordtype">bool</span> isUnion_; <a name="l00136"></a>00136 std::list<int> * uTypes_; <a name="l00137"></a>00137 }; <a name="l00138"></a>00138 <a name="l00139"></a>00139 <span class="keyword">inline</span> <a name="l00140"></a>00140 <span class="keywordtype">bool</span> <a name="l00141"></a><a class="code" href="classSchema_1_1SimpleType.html#a66bc42a690d0a11f77d258663a2f93e0">00141</a> <a class="code" href="classSchema_1_1SimpleType.html#a66bc42a690d0a11f77d258663a2f93e0">SimpleType::isList</a>()<span class="keyword"> const</span> <a name="l00142"></a>00142 <span class="keyword"></span>{ <a name="l00143"></a>00143 <span class="keywordflow">return</span> isList_; <a name="l00144"></a>00144 } <a name="l00145"></a>00145 <a name="l00146"></a>00146 <span class="keyword">inline</span> <a name="l00147"></a>00147 <span class="keywordtype">bool</span> <a name="l00148"></a><a class="code" href="classSchema_1_1SimpleType.html#ab98dbe6066799f921d64785e4e459293">00148</a> <a class="code" href="classSchema_1_1SimpleType.html#ab98dbe6066799f921d64785e4e459293">SimpleType::isUnion</a>()<span class="keyword"> const</span> <a name="l00149"></a>00149 <span class="keyword"></span>{ <a name="l00150"></a>00150 <span class="keywordflow">return</span> isUnion_; <a name="l00151"></a>00151 } <a name="l00152"></a>00152 <a name="l00153"></a>00153 <span class="keyword">inline</span> <a name="l00154"></a>00154 <span class="keywordtype">void</span> <a name="l00155"></a><a class="code" href="classSchema_1_1SimpleType.html#a5c114800b669b062793b4a4d76e0072d">00155</a> <a class="code" href="classSchema_1_1SimpleType.html#a5c114800b669b062793b4a4d76e0072d">SimpleType::setListType</a>(<span class="keywordtype">int</span> typeId) <a name="l00156"></a>00156 { <a name="l00157"></a>00157 isList_ = <span class="keyword">true</span>; <a name="l00158"></a>00158 <a class="code" href="classSchema_1_1XSDType.html#a2ae7bba8cf0d11f709b361fce00c6df0">setBaseType</a>(typeId); <a name="l00159"></a>00159 } <a name="l00160"></a>00160 <a name="l00161"></a>00161 <span class="keyword">inline</span> <a name="l00162"></a>00162 <span class="keywordtype">void</span> <a name="l00163"></a><a class="code" href="classSchema_1_1SimpleType.html#a8fd1774735a3bb31d1a6bfb9c75b652b">00163</a> <a class="code" href="classSchema_1_1SimpleType.html#a8fd1774735a3bb31d1a6bfb9c75b652b">SimpleType::setUnionType</a>(<span class="keywordtype">int</span> typeId) <a name="l00164"></a>00164 { <a name="l00165"></a>00165 isUnion_ = <span class="keyword">true</span>; <a name="l00166"></a>00166 <span class="keywordflow">if</span>(uTypes_ == 0){ <a name="l00167"></a>00167 uTypes_ = <span class="keyword">new</span> std::list<int>(); <a name="l00168"></a>00168 } <a name="l00169"></a>00169 uTypes_->push_back(typeId); <a name="l00170"></a>00170 } <a name="l00171"></a>00171 <a name="l00172"></a>00172 <span class="keyword">inline</span> <a name="l00173"></a>00173 <span class="keywordtype">bool</span> <a name="l00174"></a><a class="code" href="classSchema_1_1SimpleType.html#a5009938407646b10294e21c8ba07b525">00174</a> <a class="code" href="classSchema_1_1SimpleType.html#a5009938407646b10294e21c8ba07b525">SimpleType::isSimple</a>()<span class="keyword"> const</span> <a name="l00175"></a>00175 <span class="keyword"></span>{ <a name="l00176"></a>00176 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00177"></a>00177 } <a name="l00178"></a>00178 <span class="keyword">inline</span> <a name="l00179"></a>00179 <span class="keyword">const</span> std::list<int>* <a name="l00180"></a><a class="code" href="classSchema_1_1SimpleType.html#af10d14f6302e21e2ab5efdbb703f210e">00180</a> <a class="code" href="classSchema_1_1SimpleType.html#af10d14f6302e21e2ab5efdbb703f210e">SimpleType::unionTypes</a>()<span class="keyword">const</span> <a name="l00181"></a>00181 <span class="keyword"></span>{ <a name="l00182"></a>00182 <span class="keywordflow">return</span> uTypes_; <a name="l00183"></a>00183 } <a name="l00184"></a>00184 } <a name="l00185"></a>00185 <span class="preprocessor">#endif </span><span class="comment">/* */</span> </pre></div></div> <!--- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Defines</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <hr class="footer"/><address style="text-align: right;"><small>Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address> </body> </html>