A C++ DAL / ORM code generation framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

392 lines
42 KiB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <title>WORM: src/orm/wormclassgenerator.cpp Source File</title>
  6. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  7. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  8. <script type="text/javascript" src="search/search.js"></script>
  9. <link href="doxygen.css" rel="stylesheet" type="text/css"/>
  10. </head>
  11. <body onload='searchBox.OnSelectItem(0);'>
  12. <!-- Generated by Doxygen 1.7.3 -->
  13. <script type="text/javascript"><!--
  14. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  15. --></script>
  16. <script type="text/javascript">
  17. function hasClass(ele,cls) {
  18. return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
  19. }
  20. function addClass(ele,cls) {
  21. if (!this.hasClass(ele,cls)) ele.className += " "+cls;
  22. }
  23. function removeClass(ele,cls) {
  24. if (hasClass(ele,cls)) {
  25. var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
  26. ele.className=ele.className.replace(reg,' ');
  27. }
  28. }
  29. function toggleVisibility(linkObj) {
  30. var base = linkObj.getAttribute('id');
  31. var summary = document.getElementById(base + '-summary');
  32. var content = document.getElementById(base + '-content');
  33. var trigger = document.getElementById(base + '-trigger');
  34. if ( hasClass(linkObj,'closed') ) {
  35. summary.style.display = 'none';
  36. content.style.display = 'block';
  37. trigger.src = 'open.png';
  38. removeClass(linkObj,'closed');
  39. addClass(linkObj,'opened');
  40. } else if ( hasClass(linkObj,'opened') ) {
  41. summary.style.display = 'block';
  42. content.style.display = 'none';
  43. trigger.src = 'closed.png';
  44. removeClass(linkObj,'opened');
  45. addClass(linkObj,'closed');
  46. }
  47. return false;
  48. }
  49. </script>
  50. <div id="top">
  51. <div id="titlearea">
  52. <table cellspacing="0" cellpadding="0">
  53. <tbody>
  54. <tr style="height: 56px;">
  55. <td id="projectlogo"><img alt="Logo" src="worm_sm.png"></td>
  56. <td style="padding-left: 0.5em;">
  57. <div id="projectname">WORM&#160;<span id="projectnumber">0.2</span></div>
  58. <div id="projectbrief">A C++ DAL/ORM code generation framework</div>
  59. </td>
  60. </tr>
  61. </tbody>
  62. </table>
  63. </div>
  64. <div id="navrow1" class="tabs">
  65. <ul class="tablist">
  66. <li><a href="index.html"><span>Main&#160;Page</span></a></li>
  67. <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
  68. <li><a href="namespaces.html"><span>Namespaces</span></a></li>
  69. <li><a href="annotated.html"><span>Classes</span></a></li>
  70. <li class="current"><a href="files.html"><span>Files</span></a></li>
  71. <li id="searchli">
  72. <div id="MSearchBox" class="MSearchBoxInactive">
  73. <span class="left">
  74. <img id="MSearchSelect" src="search/mag_sel.png"
  75. onmouseover="return searchBox.OnSearchSelectShow()"
  76. onmouseout="return searchBox.OnSearchSelectHide()"
  77. alt=""/>
  78. <input type="text" id="MSearchField" value="Search" accesskey="S"
  79. onfocus="searchBox.OnSearchFieldFocus(true)"
  80. onblur="searchBox.OnSearchFieldFocus(false)"
  81. onkeyup="searchBox.OnSearchFieldChange(event)"/>
  82. </span><span class="right">
  83. <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
  84. </span>
  85. </div>
  86. </li>
  87. </ul>
  88. </div>
  89. <div id="navrow2" class="tabs2">
  90. <ul class="tablist">
  91. <li><a href="files.html"><span>File&#160;List</span></a></li>
  92. <li><a href="globals.html"><span>File&#160;Members</span></a></li>
  93. </ul>
  94. </div>
  95. <div class="header">
  96. <div class="headertitle">
  97. <h1>src/orm/wormclassgenerator.cpp</h1> </div>
  98. </div>
  99. <div class="contents">
  100. <a href="wormclassgenerator_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
  101. <a name="l00002"></a>00002 <span class="comment"> WORM - a DAL/ORM code generation framework</span>
  102. <a name="l00003"></a>00003 <span class="comment"> Copyright (C) 2011 Erik Winn &lt;sidewalksoftware@gmail.com&gt;</span>
  103. <a name="l00004"></a>00004 <span class="comment"></span>
  104. <a name="l00005"></a>00005 <span class="comment"> This program is free software: you can redistribute it and/or modify</span>
  105. <a name="l00006"></a>00006 <span class="comment"> it under the terms of the GNU General Public License as published by</span>
  106. <a name="l00007"></a>00007 <span class="comment"> the Free Software Foundation, either version 3 of the License, or</span>
  107. <a name="l00008"></a>00008 <span class="comment"> (at your option) any later version.</span>
  108. <a name="l00009"></a>00009 <span class="comment"></span>
  109. <a name="l00010"></a>00010 <span class="comment"> This program is distributed in the hope that it will be useful,</span>
  110. <a name="l00011"></a>00011 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
  111. <a name="l00012"></a>00012 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
  112. <a name="l00013"></a>00013 <span class="comment"> GNU General Public License for more details.</span>
  113. <a name="l00014"></a>00014 <span class="comment"></span>
  114. <a name="l00015"></a>00015 <span class="comment"> You should have received a copy of the GNU General Public License</span>
  115. <a name="l00016"></a>00016 <span class="comment"> along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
  116. <a name="l00017"></a>00017 <span class="comment">*/</span>
  117. <a name="l00018"></a>00018
  118. <a name="l00019"></a>00019 <span class="comment">//class_definition.tpl is currently the shortest ..</span>
  119. <a name="l00020"></a><a class="code" href="wormclassgenerator_8cpp.html#a7da7455c29f8520e0ae3a9237c7aafce">00020</a> <span class="preprocessor">#define MIN_TPL_FILENAME_SIZE 20 </span>
  120. <a name="l00021"></a>00021 <span class="preprocessor"></span>
  121. <a name="l00022"></a>00022 <span class="preprocessor">#include &quot;<a class="code" href="wormclassgenerator_8h.html">wormclassgenerator.h</a>&quot;</span>
  122. <a name="l00023"></a>00023 <span class="preprocessor">#include &lt;ctemplate/template.h&gt;</span>
  123. <a name="l00024"></a>00024 <span class="preprocessor">#include &lt;dirent.h&gt;</span>
  124. <a name="l00025"></a>00025 <span class="preprocessor">#include &lt;errno.h&gt;</span>
  125. <a name="l00026"></a>00026 <span class="preprocessor">#include &lt;fstream&gt;</span>
  126. <a name="l00027"></a>00027
  127. <a name="l00028"></a>00028 <span class="keyword">using namespace </span>ctemplate;
  128. <a name="l00029"></a>00029
  129. <a name="l00030"></a><a class="code" href="namespace_w_sql.html">00030</a> <span class="keyword">namespace </span>WSql {
  130. <a name="l00035"></a><a class="code" href="namespace_w_sql.html#a32f959e9da78600affe97c38b84f2729">00035</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#abb14e5cd3eefa6ec1349041dd8553c82">kcd_INCLUDES</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#abb14e5cd3eefa6ec1349041dd8553c82">kcd_INCLUDES</a>, <span class="stringliteral">&quot;INCLUDES&quot;</span>, 7699670683738647257LLU);
  131. <a name="l00036"></a><a class="code" href="namespace_w_sql.html#a22fbfb35e7c9977f5bcd002b12e2adf5">00036</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#a5432edb409c732d3b75224d02a111614">kcd_INCLUDE</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#a5432edb409c732d3b75224d02a111614">kcd_INCLUDE</a>, <span class="stringliteral">&quot;INCLUDE&quot;</span>, 434435386609578605LLU);
  132. <a name="l00037"></a><a class="code" href="namespace_w_sql.html#a9e0d5eba9b94c663778a10ee004262bc">00037</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#acc678e189c024b59c4c7dbf3336a5d0c">kcd_FORWARD_DECLARATIONS</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#acc678e189c024b59c4c7dbf3336a5d0c">kcd_FORWARD_DECLARATIONS</a>, <span class="stringliteral">&quot;FORWARD_DECLARATIONS&quot;</span>, 15273852411010322531LLU);
  133. <a name="l00038"></a><a class="code" href="namespace_w_sql.html#a36c399903f8b1e9055def9422c088221">00038</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#ab6d30229a7121ede6b2c22010aecd171">kcd_REFERENCED_CLASSNAME</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#ab6d30229a7121ede6b2c22010aecd171">kcd_REFERENCED_CLASSNAME</a>, <span class="stringliteral">&quot;REFERENCED_CLASSNAME&quot;</span>, 5376938313052943395LLU);
  134. <a name="l00039"></a><a class="code" href="namespace_w_sql.html#a624c8aa68c1a9811bea34266f4b7f6bf">00039</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#a7942a7f5a2746621846598ab85572a49">kcd_CLASS_NAME</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#a7942a7f5a2746621846598ab85572a49">kcd_CLASS_NAME</a>, <span class="stringliteral">&quot;CLASS_NAME&quot;</span>, 13981977283673860485LLU);
  135. <a name="l00040"></a><a class="code" href="namespace_w_sql.html#a5018cd77220a19bf12455531e7e3eaf3">00040</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#a85df8fbf85bb1e837f0a0c0e15571595">kcd_BELONGS_TO</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#a85df8fbf85bb1e837f0a0c0e15571595">kcd_BELONGS_TO</a>, <span class="stringliteral">&quot;BELONGS_TO&quot;</span>, 15166195752158467517LLU);
  136. <a name="l00041"></a><a class="code" href="namespace_w_sql.html#a27f6478e0c83b69b2615229abace414e">00041</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#acc0fa525608d855426f75f13806c7402">kcd_HAS_MANY</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#acc0fa525608d855426f75f13806c7402">kcd_HAS_MANY</a>, <span class="stringliteral">&quot;HAS_MANY&quot;</span>, 12417993436827992317LLU);
  137. <a name="l00042"></a><a class="code" href="namespace_w_sql.html#af8672a60f75250a618fe9745b560a8ef">00042</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#ae9c91a1a67b3fe99e3e9db8dbdb793c5">kcd_FOREIGNKEY_CLASSNAME</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#ae9c91a1a67b3fe99e3e9db8dbdb793c5">kcd_FOREIGNKEY_CLASSNAME</a>, <span class="stringliteral">&quot;FOREIGNKEY_CLASSNAME&quot;</span>, 14113744978891695861LLU);
  138. <a name="l00043"></a><a class="code" href="namespace_w_sql.html#aa0d121588c9416d5c2602415218c126e">00043</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#af5763371207db409fa5f708c3d7b47d8">kcd_FOREIGNKEY_CLASS_PLURAL</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#af5763371207db409fa5f708c3d7b47d8">kcd_FOREIGNKEY_CLASS_PLURAL</a>, <span class="stringliteral">&quot;FOREIGNKEY_CLASS_PLURAL&quot;</span>, 13464148753922874173LLU);
  139. <a name="l00044"></a><a class="code" href="namespace_w_sql.html#ac5d782825cae6dc3208602e02f5ff38d">00044</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#a53225bf3ca7db82674e4754297aea205">kcd_COLUMNS</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#a53225bf3ca7db82674e4754297aea205">kcd_COLUMNS</a>, <span class="stringliteral">&quot;COLUMNS&quot;</span>, 15302874640052016969LLU);
  140. <a name="l00045"></a><a class="code" href="namespace_w_sql.html#a4d6f3f293d868bf467778eb03dda047c">00045</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#a2dde8c3267ab8d8d8287c0fe0eeaa433">kcd_UNSUPPORTED</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#a2dde8c3267ab8d8d8287c0fe0eeaa433">kcd_UNSUPPORTED</a>, <span class="stringliteral">&quot;UNSUPPORTED&quot;</span>, 8112833089436120679LLU);
  141. <a name="l00046"></a><a class="code" href="namespace_w_sql.html#aee4fb8709c5d533895b7f302b0064fba">00046</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#a7ee30b9baae76963a7bbb01930d1624a">kcd_UNSIGNED</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#a7ee30b9baae76963a7bbb01930d1624a">kcd_UNSIGNED</a>, <span class="stringliteral">&quot;UNSIGNED&quot;</span>, 10867561526856517727LLU);
  142. <a name="l00047"></a><a class="code" href="namespace_w_sql.html#a5e717f1d92272bbc2debf78eed72d1c6">00047</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#af3143da9b91f92aaae2c1807c0ef947f">kcd_DATATYPE</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#af3143da9b91f92aaae2c1807c0ef947f">kcd_DATATYPE</a>, <span class="stringliteral">&quot;DATATYPE&quot;</span>, 6518949878326190781LLU);
  143. <a name="l00048"></a><a class="code" href="namespace_w_sql.html#a56003b4c3badb9192aa77a29745a1c38">00048</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#a1e1cb63c9dce87ec05ecdf8d5e4340b2">kcd_VARIABLE_GETTOR</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#a1e1cb63c9dce87ec05ecdf8d5e4340b2">kcd_VARIABLE_GETTOR</a>, <span class="stringliteral">&quot;VARIABLE_GETTOR&quot;</span>, 4376112485907229951LLU);
  144. <a name="l00049"></a><a class="code" href="namespace_w_sql.html#aa398174c2c459c998bec894e45941360">00049</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#a4a26c6bfb0faee44e91066987f5f68b2">kcd_VARIABLE_NAME</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#a4a26c6bfb0faee44e91066987f5f68b2">kcd_VARIABLE_NAME</a>, <span class="stringliteral">&quot;VARIABLE_NAME&quot;</span>, 5051229879184672055LLU);
  145. <a name="l00050"></a><a class="code" href="namespace_w_sql.html#a51157cf76ce296aa46162b4ec55ef0a0">00050</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#a2682bf4433565d3c850f1d4895668a85">kcd_VARIABLE_SETTOR</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#a2682bf4433565d3c850f1d4895668a85">kcd_VARIABLE_SETTOR</a>, <span class="stringliteral">&quot;VARIABLE_SETTOR&quot;</span>, 18309610407346123363LLU);
  146. <a name="l00051"></a><a class="code" href="namespace_w_sql.html#aa2e687b7b6d092dd73ec19da1a8d8255">00051</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#a521b0e113f64c97e7a1b96b804243178">kcd_COLUMN_NAME</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#a521b0e113f64c97e7a1b96b804243178">kcd_COLUMN_NAME</a>, <span class="stringliteral">&quot;COLUMN_NAME&quot;</span>, 16524890828269290931LLU);
  147. <a name="l00052"></a><a class="code" href="namespace_w_sql.html#a56fb57dd4ab04e11aed4f93c34e1b758">00052</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#a7f065525a1da390502ebfa2a0762c324">kcd_REFERENCED_TABLENAME</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#a7f065525a1da390502ebfa2a0762c324">kcd_REFERENCED_TABLENAME</a>, <span class="stringliteral">&quot;REFERENCED_TABLENAME&quot;</span>, 14486319327059551333LLU);
  148. <a name="l00053"></a><a class="code" href="namespace_w_sql.html#ad2fb8b6751a7eaa954e284534cb68593">00053</a> <span class="keyword">static</span> const ::ctemplate::StaticTemplateString <a class="code" href="class__declaration_8tpl_8varnames_8h.html#ae61adac3784bd271abcc50bf2a2325ba">kcd_TABLE_NAME</a> = STS_INIT_WITH_HASH(<a class="code" href="class__declaration_8tpl_8varnames_8h.html#ae61adac3784bd271abcc50bf2a2325ba">kcd_TABLE_NAME</a>, <span class="stringliteral">&quot;TABLE_NAME&quot;</span>, 3760310134096538793LLU);
  149. <a name="l00088"></a><a class="code" href="class_w_sql_1_1_worm_class_generator.html#a03e364c4e63187824777694ccde7c45f">00088</a> WormClassGenerator::WormClassGenerator(<a class="code" href="class_w_sql_1_1_w_sql_database.html" title="The WSqlDatabase class represents a single database.">WSqlDatabase</a>&amp; db):_db(db)
  150. <a name="l00089"></a>00089 {
  151. <a name="l00090"></a>00090 }
  152. <a name="l00101"></a><a class="code" href="class_w_sql_1_1_worm_class_generator.html#a3a753e5b47f8d8ccdfb21ec9022bfa69">00101</a> <span class="keywordtype">bool</span> <a class="code" href="class_w_sql_1_1_worm_class_generator.html#a3a753e5b47f8d8ccdfb21ec9022bfa69" title="Initialize templates and metadata.">WormClassGenerator::init</a>()
  153. <a name="l00102"></a>00102 {
  154. <a name="l00103"></a>00103 <span class="comment">//load available templates</span>
  155. <a name="l00104"></a>00104 DIR *dir;
  156. <a name="l00105"></a>00105 <span class="keyword">struct </span>dirent *ent;
  157. <a name="l00106"></a>00106
  158. <a name="l00107"></a>00107 dir = opendir (_templateDirectory.c_str());
  159. <a name="l00108"></a>00108 <span class="keywordflow">if</span> (dir != NULL)
  160. <a name="l00109"></a>00109 {
  161. <a name="l00110"></a>00110 <a class="code" href="class_w_sql_1_1_worm_code_template.html">WormCodeTemplate</a> tpl;
  162. <a name="l00111"></a>00111 <span class="keywordflow">while</span> ((ent = readdir (dir)) != NULL)
  163. <a name="l00112"></a>00112 {
  164. <a name="l00113"></a>00113 <span class="keywordflow">if</span>(ent-&gt;d_type != DT_REG)
  165. <a name="l00114"></a>00114 <span class="keywordflow">continue</span>;
  166. <a name="l00115"></a>00115 std::string entry = ent-&gt;d_name;
  167. <a name="l00116"></a>00116 <span class="keywordtype">size_t</span> sz = entry.size();
  168. <a name="l00117"></a>00117 <span class="keywordflow">if</span>(sz &lt; <a class="code" href="wormclassgenerator_8cpp.html#a7da7455c29f8520e0ae3a9237c7aafce">MIN_TPL_FILENAME_SIZE</a> )
  169. <a name="l00118"></a>00118 <span class="keywordflow">continue</span>;
  170. <a name="l00119"></a>00119 <span class="comment">//only accept .tpl files</span>
  171. <a name="l00120"></a>00120 std::string ext = entry.substr(sz - 4);
  172. <a name="l00121"></a>00121 <span class="keywordflow">if</span>( ext.compare(<span class="stringliteral">&quot;.tpl&quot;</span>))
  173. <a name="l00122"></a>00122 <span class="keywordflow">continue</span>;
  174. <a name="l00123"></a>00123 tpl.<a class="code" href="class_w_sql_1_1_worm_code_template.html#a777365c4f3a57595c2a7e350a2ed3061" title="Set the URI or filename containing the template.">setUri</a>(entry);
  175. <a name="l00124"></a>00124 _templates.push_back(tpl);
  176. <a name="l00125"></a>00125
  177. <a name="l00126"></a>00126 <span class="comment">/* maybe use, pass a string to ctemplate: std::string tmp;</span>
  178. <a name="l00127"></a>00127 <span class="comment"> fs.open(entry.c_str());</span>
  179. <a name="l00128"></a>00128 <span class="comment"> while(fs)</span>
  180. <a name="l00129"></a>00129 <span class="comment"> std::getline(fs,tmp);</span>
  181. <a name="l00130"></a>00130 <span class="comment"> tpl.setContent(tmp);</span>
  182. <a name="l00131"></a>00131 <span class="comment"> */</span>
  183. <a name="l00132"></a>00132 }
  184. <a name="l00133"></a>00133 closedir (dir);
  185. <a name="l00134"></a>00134 } <span class="keywordflow">else</span> {
  186. <a name="l00135"></a>00135 std::string msg = <span class="stringliteral">&quot;Cannot open directory: &quot;</span> + _templateDirectory;
  187. <a name="l00136"></a>00136 <span class="keywordflow">if</span>(errno == EACCES )
  188. <a name="l00137"></a>00137 msg.append(<span class="stringliteral">&quot; - Access denied.&quot;</span>);
  189. <a name="l00138"></a>00138 _db.<a class="code" href="class_w_sql_1_1_w_sql_database.html#a7770c27b068eb51aa856c0ae37d726de">addError</a>(<a class="code" href="class_w_sql_1_1_w_sql_error.html" title="The WSqlError class provides SQL database and driver error information.">WSqlError</a>(msg, errno,<a class="code" href="class_w_sql_1_1_w_sql_error.html#a8bcabd8bf1016ca27304a717ef3d78dbaacc793148eebd48878f5e1b7bb4dfc70">WSql::WSqlError::SYSTEM</a>, <a class="code" href="class_w_sql_1_1_w_sql_error.html#a63b2672eb5c68164c4ff43443037f6d9ac6ac27cbc8f55f680a218784311e15a3">WSql::WSqlError::FATAL</a>));
  190. <a name="l00139"></a>00139 <span class="keywordflow">return</span> <span class="keyword">false</span>;
  191. <a name="l00140"></a>00140 }
  192. <a name="l00141"></a>00141 _db.<a class="code" href="class_w_sql_1_1_w_sql_database.html#a9bd1765f14443afbb875981321d4c529" title="Initializes the metadata for all tables in the database.">initMetaData</a>();
  193. <a name="l00142"></a>00142 <span class="keywordflow">return</span> <span class="keyword">true</span>;
  194. <a name="l00143"></a>00143 }
  195. <a name="l00155"></a><a class="code" href="class_w_sql_1_1_worm_class_generator.html#a99918905652f92668ded30d579830cbb">00155</a> <span class="keywordtype">void</span> <a class="code" href="class_w_sql_1_1_worm_class_generator.html#a99918905652f92668ded30d579830cbb" title="Run the generator.">WormClassGenerator::run</a>()
  196. <a name="l00156"></a>00156 {
  197. <a name="l00157"></a>00157 <span class="keywordflow">if</span>(_tablesToGenerate.empty())
  198. <a name="l00158"></a>00158 {
  199. <a name="l00159"></a>00159 std::cerr &lt;&lt; <span class="stringliteral">&quot;No tables specified - assuming all tables ..&quot;</span> &lt;&lt; std::endl;
  200. <a name="l00160"></a>00160 _tablesToGenerate = _db.<a class="code" href="class_w_sql_1_1_w_sql_database.html#a86df7db5900c3a2d1483375195c7b025" title="Returns a vector of the database&amp;#39;s table names.">tableNames</a>();
  201. <a name="l00161"></a>00161 }
  202. <a name="l00162"></a>00162
  203. <a name="l00163"></a>00163 std::string outbuffer;
  204. <a name="l00164"></a>00164 std::string outfilename;
  205. <a name="l00165"></a>00165 std::vector&lt;WormCodeTemplate&gt;::iterator tpl_it;
  206. <a name="l00166"></a>00166 std::vector&lt;std::string&gt;::const_iterator tbl_it = _tablesToGenerate.begin();
  207. <a name="l00167"></a>00167 <span class="comment">//each table translates to a class object ..</span>
  208. <a name="l00168"></a>00168 <span class="keywordflow">for</span>(; tbl_it != _tablesToGenerate.end();++tbl_it)
  209. <a name="l00169"></a>00169 {
  210. <a name="l00170"></a>00170 <a class="code" href="class_w_sql_1_1_w_sql_table.html" title="WSqlTable is an abstraction for a single table, collection or view in a database.">WSqlTable</a> table = _db.<a class="code" href="class_w_sql_1_1_w_sql_database.html#a2f068c8103068f0b4cab897b824144b9" title="Fetch metadata for table tableName.">tableMetaData</a>(*tbl_it);
  211. <a name="l00171"></a>00171 <span class="comment">//foreach template, expand for this table</span>
  212. <a name="l00172"></a>00172 <span class="keywordflow">for</span>(tpl_it = _templates.begin(); tpl_it != _templates.end();++ tpl_it)
  213. <a name="l00173"></a>00173 {
  214. <a name="l00174"></a>00174 <span class="keyword">const</span> std::string tplfilename = _templateDirectory + tpl_it-&gt;uri();
  215. <a name="l00175"></a>00175 outbuffer = expand(tplfilename, table);
  216. <a name="l00176"></a>00176 outfilename = createOutFileName(tpl_it-&gt;type(), table);
  217. <a name="l00177"></a>00177 <span class="keywordflow">if</span>(!writeFile(outbuffer, outfilename))
  218. <a name="l00178"></a>00178 std::cerr &lt;&lt; <span class="stringliteral">&quot;Warning: failed to write File &quot;</span> &lt;&lt; outfilename &lt;&lt; std::endl;
  219. <a name="l00179"></a>00179 }
  220. <a name="l00180"></a>00180 }
  221. <a name="l00181"></a>00181 }
  222. <a name="l00182"></a>00182
  223. <a name="l00194"></a>00194 std::string WormClassGenerator::expand( <span class="keyword">const</span> std::string&amp; filename, <span class="keyword">const</span> <a class="code" href="class_w_sql_1_1_w_sql_table.html" title="WSqlTable is an abstraction for a single table, collection or view in a database.">WSqlTable</a>&amp; table)
  224. <a name="l00195"></a>00195 {
  225. <a name="l00196"></a>00196 <span class="comment">// std::cerr &lt;&lt; &quot;============= Processing table &quot; &lt;&lt; table.name() &lt;&lt; std::endl;</span>
  226. <a name="l00197"></a>00197 std::string strToReturn;
  227. <a name="l00198"></a>00198 <span class="keywordtype">bool</span> has_string=<span class="keyword">false</span>;
  228. <a name="l00199"></a>00199 std::string type_declaration;
  229. <a name="l00200"></a>00200 std::string variable_name;
  230. <a name="l00201"></a>00201 std::string variable_settor;
  231. <a name="l00202"></a>00202 std::string variable_gettor;
  232. <a name="l00203"></a>00203 std::vector&lt;std::string&gt; forward_declarations;
  233. <a name="l00204"></a>00204
  234. <a name="l00205"></a>00205 TemplateDictionary *topdict = <span class="keyword">new</span> TemplateDictionary(filename);
  235. <a name="l00206"></a>00206 TemplateDictionary *forwarddecls_dict;
  236. <a name="l00207"></a>00207 TemplateDictionary *belongsto_dict;
  237. <a name="l00208"></a>00208 TemplateDictionary *hasmany_dict;
  238. <a name="l00209"></a>00209 TemplateDictionary *coldict;
  239. <a name="l00210"></a>00210 topdict-&gt;SetValue(<a class="code" href="namespace_w_sql.html#a624c8aa68c1a9811bea34266f4b7f6bf">kcd_CLASS_NAME</a>, table.<a class="code" href="class_w_sql_1_1_w_sql_table.html#ac9a982900d31ae351ff89b576f43388b">className</a>());
  240. <a name="l00211"></a>00211 topdict-&gt;SetValue(<a class="code" href="namespace_w_sql.html#ad2fb8b6751a7eaa954e284534cb68593">kcd_TABLE_NAME</a>, table.<a class="code" href="class_w_sql_1_1_w_sql_table.html#a27a8e1e92061bebb56b1d3a79e216ff4">name</a>());
  241. <a name="l00212"></a>00212
  242. <a name="l00213"></a>00213 <span class="keyword">const</span> std::vector&lt;WSqlColumn&gt;&amp; columns = table.<a class="code" href="class_w_sql_1_1_w_sql_table.html#acfdf1961dd9401c8c6946a03d1da5651">columns</a>();
  243. <a name="l00214"></a>00214 std::vector&lt;WSqlColumn&gt;::const_iterator col_it = columns.begin();
  244. <a name="l00215"></a>00215
  245. <a name="l00216"></a>00216 <span class="keywordflow">if</span>(table.<a class="code" href="class_w_sql_1_1_w_sql_table.html#a9fd4f99e267750bafe697523e7dbc09a">hasForeignKeys</a>())
  246. <a name="l00217"></a>00217 {
  247. <a name="l00218"></a>00218 std::vector&lt; WSqlForeignKey &gt;fks = table.<a class="code" href="class_w_sql_1_1_w_sql_table.html#a6376a1c1783991391d0ae0224e4e7279">foreignKeys</a>();
  248. <a name="l00219"></a>00219 std::vector&lt; WSqlForeignKey &gt;::const_iterator fks_it = fks.begin();
  249. <a name="l00220"></a>00220 <span class="keywordflow">for</span>(;fks_it != fks.end();++fks_it)
  250. <a name="l00221"></a>00221 {
  251. <a name="l00222"></a>00222 <span class="comment">//fks_it-&gt;dump();</span>
  252. <a name="l00223"></a>00223 std::vector&lt;std::string&gt;::const_iterator it = std::find(forward_declarations.begin(), forward_declarations.end(), fks_it-&gt;referencedClassName());
  253. <a name="l00224"></a>00224 <span class="keywordflow">if</span> (it== forward_declarations.end())
  254. <a name="l00225"></a>00225 {
  255. <a name="l00226"></a>00226 forwarddecls_dict = topdict-&gt;AddSectionDictionary(<a class="code" href="namespace_w_sql.html#a9e0d5eba9b94c663778a10ee004262bc">kcd_FORWARD_DECLARATIONS</a>);
  256. <a name="l00227"></a>00227 forwarddecls_dict-&gt;SetValue(<a class="code" href="namespace_w_sql.html#a36c399903f8b1e9055def9422c088221">kcd_REFERENCED_CLASSNAME</a>, fks_it-&gt;referencedClassName());
  257. <a name="l00228"></a>00228 forward_declarations.push_back(fks_it-&gt;referencedClassName());
  258. <a name="l00229"></a>00229 }
  259. <a name="l00230"></a>00230 belongsto_dict = topdict-&gt;AddSectionDictionary(<a class="code" href="namespace_w_sql.html#a5018cd77220a19bf12455531e7e3eaf3">kcd_BELONGS_TO</a>);
  260. <a name="l00231"></a>00231 belongsto_dict-&gt;SetValue(<a class="code" href="namespace_w_sql.html#a36c399903f8b1e9055def9422c088221">kcd_REFERENCED_CLASSNAME</a>, fks_it-&gt;referencedClassName());
  261. <a name="l00232"></a>00232 belongsto_dict-&gt;SetValue(<a class="code" href="namespace_w_sql.html#a56fb57dd4ab04e11aed4f93c34e1b758">kcd_REFERENCED_TABLENAME</a>, fks_it-&gt;referencedTableName());
  262. <a name="l00233"></a>00233 }
  263. <a name="l00234"></a>00234 }
  264. <a name="l00235"></a>00235 <span class="keywordflow">if</span>(table.<a class="code" href="class_w_sql_1_1_w_sql_table.html#a1c04777c5f9393415fb62668dc902eb9">hasReferencedKeys</a>())
  265. <a name="l00236"></a>00236 {
  266. <a name="l00237"></a>00237 std::vector&lt; WSqlReferencedKey &gt;rks = table.<a class="code" href="class_w_sql_1_1_w_sql_table.html#aeb424ef06d4e5978e861be12f3689fa5">referencedKeys</a>();
  267. <a name="l00238"></a>00238 std::vector&lt; WSqlReferencedKey &gt;::const_iterator rks_it = rks.begin();
  268. <a name="l00239"></a>00239 <span class="keywordflow">for</span>(;rks_it != rks.end();++rks_it)
  269. <a name="l00240"></a>00240 {
  270. <a name="l00241"></a>00241 <span class="comment">//rks_it-&gt;dump();</span>
  271. <a name="l00242"></a>00242 std::vector&lt;std::string&gt;::const_iterator it = std::find(forward_declarations.begin(), forward_declarations.end(), rks_it-&gt;referingClassName());
  272. <a name="l00243"></a>00243 <span class="keywordflow">if</span> (it == forward_declarations.end())
  273. <a name="l00244"></a>00244 {
  274. <a name="l00245"></a>00245 forwarddecls_dict = topdict-&gt;AddSectionDictionary(<a class="code" href="namespace_w_sql.html#a9e0d5eba9b94c663778a10ee004262bc">kcd_FORWARD_DECLARATIONS</a>);
  275. <a name="l00246"></a>00246 forwarddecls_dict-&gt;SetValue(<a class="code" href="namespace_w_sql.html#a36c399903f8b1e9055def9422c088221">kcd_REFERENCED_CLASSNAME</a>, rks_it-&gt;referingClassName());
  276. <a name="l00247"></a>00247 forward_declarations.push_back(rks_it-&gt;referingClassName());
  277. <a name="l00248"></a>00248 }
  278. <a name="l00249"></a>00249 hasmany_dict = topdict-&gt;AddSectionDictionary(<a class="code" href="namespace_w_sql.html#a27f6478e0c83b69b2615229abace414e">kcd_HAS_MANY</a>);
  279. <a name="l00250"></a>00250 hasmany_dict-&gt;SetValue(<a class="code" href="namespace_w_sql.html#af8672a60f75250a618fe9745b560a8ef">kcd_FOREIGNKEY_CLASSNAME</a>, rks_it-&gt;referingClassName());
  280. <a name="l00251"></a>00251 hasmany_dict-&gt;SetValue(<a class="code" href="namespace_w_sql.html#aa0d121588c9416d5c2602415218c126e">kcd_FOREIGNKEY_CLASS_PLURAL</a>, rks_it-&gt;referingClassNamePlural());
  281. <a name="l00252"></a>00252 }
  282. <a name="l00253"></a>00253 }
  283. <a name="l00254"></a>00254 <span class="keywordflow">for</span>(;col_it != columns.end();++col_it)
  284. <a name="l00255"></a>00255 {
  285. <a name="l00256"></a>00256 coldict = topdict-&gt;AddSectionDictionary(<a class="code" href="namespace_w_sql.html#ac5d782825cae6dc3208602e02f5ff38d">kcd_COLUMNS</a>);
  286. <a name="l00257"></a>00257 type_declaration = col_it-&gt;typeDeclaration();
  287. <a name="l00258"></a>00258 variable_name = col_it-&gt;variableName();
  288. <a name="l00259"></a>00259 std::string tmp = variable_name;
  289. <a name="l00260"></a>00260 tmp[0] = toupper(tmp[0]);
  290. <a name="l00261"></a>00261 variable_settor = <span class="stringliteral">&quot;set&quot;</span> + tmp;
  291. <a name="l00262"></a>00262 variable_gettor = <span class="stringliteral">&quot;get&quot;</span> + tmp;
  292. <a name="l00263"></a>00263 <span class="keywordflow">if</span>(type_declaration.compare(<span class="stringliteral">&quot;std::string&quot;</span>) == 0)
  293. <a name="l00264"></a>00264 has_string=<span class="keyword">true</span>;
  294. <a name="l00265"></a>00265 <span class="keywordflow">if</span>(! col_it-&gt;typeIsSupported())
  295. <a name="l00266"></a>00266 coldict-&gt;ShowSection(<a class="code" href="namespace_w_sql.html#a4d6f3f293d868bf467778eb03dda047c">kcd_UNSUPPORTED</a>);
  296. <a name="l00267"></a>00267 coldict-&gt;SetValue(<a class="code" href="namespace_w_sql.html#aa2e687b7b6d092dd73ec19da1a8d8255">kcd_COLUMN_NAME</a>, col_it-&gt;columnName());
  297. <a name="l00268"></a>00268 coldict-&gt;SetValue(<a class="code" href="namespace_w_sql.html#a5e717f1d92272bbc2debf78eed72d1c6">kcd_DATATYPE</a>, type_declaration);
  298. <a name="l00269"></a>00269 coldict-&gt;SetValue(<a class="code" href="namespace_w_sql.html#aa398174c2c459c998bec894e45941360">kcd_VARIABLE_NAME</a>, variable_name );
  299. <a name="l00270"></a>00270 coldict-&gt;SetValue(<a class="code" href="namespace_w_sql.html#a51157cf76ce296aa46162b4ec55ef0a0">kcd_VARIABLE_SETTOR</a>, variable_settor);
  300. <a name="l00271"></a>00271 coldict-&gt;SetValue(<a class="code" href="namespace_w_sql.html#a56003b4c3badb9192aa77a29745a1c38">kcd_VARIABLE_GETTOR</a>, variable_gettor);
  301. <a name="l00272"></a>00272
  302. <a name="l00273"></a>00273 <span class="comment">//FIXME always unsigned .. deep strangeness .. </span>
  303. <a name="l00274"></a>00274 <span class="comment">/* if(col_it-&gt;isUnsigned())</span>
  304. <a name="l00275"></a>00275 <span class="comment"> {</span>
  305. <a name="l00276"></a>00276 <span class="comment"> coldict-&gt;ShowSection(kcd_UNSIGNED);</span>
  306. <a name="l00277"></a>00277 <span class="comment"> std::cerr &lt;&lt; &quot;in table &quot; &lt;&lt; tbl.className() &lt;&lt; &quot; &quot; &lt;&lt; col_it-&gt;columnName() &lt;&lt; &quot;is unsigned ..&quot; &lt;&lt; std::endl</span>
  307. <a name="l00278"></a>00278 <span class="comment"> &lt;&lt; &quot; type: &quot; &lt;&lt; WSqlDataType::toString(col_it-&gt;type()) &lt;&lt; std::endl; </span>
  308. <a name="l00279"></a>00279 <span class="comment"> } */</span>
  309. <a name="l00280"></a>00280 }
  310. <a name="l00281"></a>00281
  311. <a name="l00283"></a>00283 <span class="keywordflow">if</span>(has_string)
  312. <a name="l00284"></a>00284 topdict-&gt;SetValueAndShowSection(<span class="stringliteral">&quot;INCLUDE&quot;</span>,<span class="stringliteral">&quot;#include &lt;string&gt;&quot;</span>, <a class="code" href="namespace_w_sql.html#a32f959e9da78600affe97c38b84f2729">kcd_INCLUDES</a>);
  313. <a name="l00285"></a>00285
  314. <a name="l00286"></a>00286 ExpandTemplate(filename, DO_NOT_STRIP, topdict, &amp;strToReturn);
  315. <a name="l00287"></a>00287 <span class="keyword">delete</span> topdict;
  316. <a name="l00288"></a>00288 <span class="keywordflow">return</span> strToReturn;
  317. <a name="l00289"></a>00289 }
  318. <a name="l00290"></a>00290
  319. <a name="l00301"></a>00301 std::string WormClassGenerator::createOutFileName(<span class="keyword">const</span> <a class="code" href="class_w_sql_1_1_worm_code_template.html#a6c3faf9576eb86f71e7e1270f02cda1b">WormCodeTemplate::Type</a> type, <span class="keyword">const</span> WSqlTable&amp; table)
  320. <a name="l00302"></a>00302 {
  321. <a name="l00303"></a>00303 std::string strToReturn;
  322. <a name="l00304"></a>00304 <span class="keywordflow">switch</span>(type){
  323. <a name="l00305"></a>00305 <span class="keywordflow">case</span> <a class="code" href="class_w_sql_1_1_worm_code_template.html#a6c3faf9576eb86f71e7e1270f02cda1ba12a930ae6aa6b1c82f14cca0de4a95bf">WormCodeTemplate::ClassDeclarationBase</a>:
  324. <a name="l00306"></a>00306 strToReturn = table.className() + <span class="stringliteral">&quot;Base.h&quot;</span>;
  325. <a name="l00307"></a>00307 <span class="keywordflow">break</span>;
  326. <a name="l00308"></a>00308 <span class="keywordflow">case</span> <a class="code" href="class_w_sql_1_1_worm_code_template.html#a6c3faf9576eb86f71e7e1270f02cda1babd60733af048e610900651ce3bb88462">WormCodeTemplate::ClassDefinitionBase</a>:
  327. <a name="l00309"></a>00309 strToReturn = table.className() + <span class="stringliteral">&quot;Base.cpp&quot;</span>;
  328. <a name="l00310"></a>00310 <span class="keywordflow">break</span>;
  329. <a name="l00311"></a>00311 <span class="keywordflow">case</span> <a class="code" href="class_w_sql_1_1_worm_code_template.html#a6c3faf9576eb86f71e7e1270f02cda1bade0a459ad25b7d10f96b91b2518a07d8">WormCodeTemplate::ClassDeclaration</a>:
  330. <a name="l00312"></a>00312 strToReturn = table.className() + <span class="stringliteral">&quot;.h&quot;</span>;
  331. <a name="l00313"></a>00313 <span class="keywordflow">break</span>;
  332. <a name="l00314"></a>00314 <span class="keywordflow">case</span> <a class="code" href="class_w_sql_1_1_worm_code_template.html#a6c3faf9576eb86f71e7e1270f02cda1badacce5fdfa6887f72abd87a863b82208">WormCodeTemplate::ClassDefinition</a>:
  333. <a name="l00315"></a>00315 strToReturn = table.className() + <span class="stringliteral">&quot;.cpp&quot;</span>;
  334. <a name="l00316"></a>00316 <span class="keywordflow">break</span>;
  335. <a name="l00317"></a>00317 <span class="keywordflow">default</span>:
  336. <a name="l00318"></a>00318 std::cerr &lt;&lt; <span class="stringliteral">&quot;WormClassGenerator: WARNING: template type unsupported!&quot;</span>;
  337. <a name="l00319"></a>00319 ;
  338. <a name="l00320"></a>00320 }
  339. <a name="l00321"></a>00321 <span class="keywordflow">return</span> strToReturn;
  340. <a name="l00322"></a>00322 }
  341. <a name="l00323"></a>00323
  342. <a name="l00328"></a>00328 <span class="keywordtype">bool</span> WormClassGenerator::writeFile( <span class="keyword">const</span> std::string content, <span class="keyword">const</span> std::string filename )
  343. <a name="l00329"></a>00329 {
  344. <a name="l00330"></a>00330 std::ofstream fs;
  345. <a name="l00331"></a>00331 std::string target = _outputDirectory + <span class="stringliteral">&quot;/&quot;</span> + filename;
  346. <a name="l00332"></a>00332 fs.open(target.c_str());
  347. <a name="l00333"></a>00333 <span class="keywordflow">if</span>(!fs)
  348. <a name="l00334"></a>00334 <span class="keywordflow">return</span> <span class="keyword">false</span>;
  349. <a name="l00335"></a>00335 fs &lt;&lt; content;
  350. <a name="l00336"></a>00336 fs.close();
  351. <a name="l00337"></a>00337 <span class="keywordflow">return</span> <span class="keyword">true</span>;
  352. <a name="l00338"></a>00338 }
  353. <a name="l00339"></a>00339
  354. <a name="l00345"></a><a class="code" href="class_w_sql_1_1_worm_class_generator.html#ae18b5f7c5d9015a1b675cdb2a6c9264c">00345</a> <span class="keywordtype">void</span> <a class="code" href="class_w_sql_1_1_worm_class_generator.html#ae18b5f7c5d9015a1b675cdb2a6c9264c">WormClassGenerator::setOutputDirectory</a>( <span class="keyword">const</span> std::string dir )
  355. <a name="l00346"></a>00346 {
  356. <a name="l00347"></a>00347 _outputDirectory = dir;
  357. <a name="l00348"></a>00348 <span class="keywordflow">if</span>(<span class="charliteral">&#39;/&#39;</span> != _outputDirectory[ _outputDirectory.size()-1])
  358. <a name="l00349"></a>00349 _outputDirectory.append(<span class="stringliteral">&quot;/&quot;</span>);
  359. <a name="l00350"></a>00350 }
  360. <a name="l00356"></a><a class="code" href="class_w_sql_1_1_worm_class_generator.html#ae33fa044cc6eca45643217603f78ead2">00356</a> <span class="keywordtype">void</span> <a class="code" href="class_w_sql_1_1_worm_class_generator.html#ae33fa044cc6eca45643217603f78ead2">WormClassGenerator::setTemplateDirectory</a>( <span class="keyword">const</span> std::string dir )
  361. <a name="l00357"></a>00357 {
  362. <a name="l00358"></a>00358 _templateDirectory = dir;
  363. <a name="l00359"></a>00359 <span class="keywordflow">if</span>(<span class="charliteral">&#39;/&#39;</span> != _templateDirectory[ _templateDirectory.size()-1])
  364. <a name="l00360"></a>00360 _templateDirectory.append(<span class="stringliteral">&quot;/&quot;</span>);
  365. <a name="l00361"></a>00361 }
  366. <a name="l00362"></a>00362
  367. <a name="l00363"></a>00363
  368. <a name="l00364"></a>00364 } <span class="comment">//namespace WSql</span>
  369. </pre></div></div>
  370. </div>
  371. <!--- window showing the filter options -->
  372. <div id="MSearchSelectWindow"
  373. onmouseover="return searchBox.OnSearchSelectShow()"
  374. onmouseout="return searchBox.OnSearchSelectHide()"
  375. onkeydown="return searchBox.OnSearchSelectKey(event)">
  376. <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Defines</a></div>
  377. <!-- iframe showing the search results (closed by default) -->
  378. <div id="MSearchResultsWindow">
  379. <iframe src="" frameborder="0"
  380. name="MSearchResults" id="MSearchResults">
  381. </iframe>
  382. </div>
  383. <hr class="footer"/><address class="footer"><small>Generated on Fri Nov 18 2011 21:01:45 for WORM by&#160;
  384. <a href="http://www.doxygen.org/index.html">
  385. <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
  386. </body>
  387. </html>