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.
 
 
 
 

326 lines
17 KiB

<!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>WORM: WSql::WormClassGenerator Class Reference</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.7.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<script type="text/javascript">
function hasClass(ele,cls) {
return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
if (hasClass(ele,cls)) {
var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
ele.className=ele.className.replace(reg,' ');
}
}
function toggleVisibility(linkObj) {
var base = linkObj.getAttribute('id');
var summary = document.getElementById(base + '-summary');
var content = document.getElementById(base + '-content');
var trigger = document.getElementById(base + '-trigger');
if ( hasClass(linkObj,'closed') ) {
summary.style.display = 'none';
content.style.display = 'block';
trigger.src = 'open.png';
removeClass(linkObj,'closed');
addClass(linkObj,'opened');
} else if ( hasClass(linkObj,'opened') ) {
summary.style.display = 'block';
content.style.display = 'none';
trigger.src = 'closed.png';
removeClass(linkObj,'opened');
addClass(linkObj,'closed');
}
return false;
}
</script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="worm_sm.png"></td>
<td style="padding-left: 0.5em;">
<div id="projectname">WORM&#160;<span id="projectnumber">0.2</span></div>
<div id="projectbrief">A C++ DAL/ORM code generation framework</div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li id="searchli">
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.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)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespace_w_sql.html">WSql</a> </li>
<li class="navelem"><a class="el" href="class_w_sql_1_1_worm_class_generator.html">WormClassGenerator</a> </li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> </div>
<div class="headertitle">
<h1>WSql::WormClassGenerator Class Reference</h1> </div>
</div>
<div class="contents">
<!-- doxytag: class="WSql::WormClassGenerator" -->
<p>The main class in the ORM generator.
<a href="#_details">More...</a></p>
<p><code>#include &lt;<a class="el" href="wormclassgenerator_8h_source.html">wormclassgenerator.h</a>&gt;</code></p>
<p><a href="class_w_sql_1_1_worm_class_generator-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_worm_class_generator.html#a03e364c4e63187824777694ccde7c45f">WormClassGenerator</a> (<a class="el" href="class_w_sql_1_1_w_sql_database.html">WSqlDatabase</a> &amp;db)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructs a generator with the database <em>db</em>. <a href="#a03e364c4e63187824777694ccde7c45f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_worm_class_generator.html#a99918905652f92668ded30d579830cbb">run</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Run the generator. <a href="#a99918905652f92668ded30d579830cbb"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_worm_class_generator.html#a3a753e5b47f8d8ccdfb21ec9022bfa69">init</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize templates and metadata. <a href="#a3a753e5b47f8d8ccdfb21ec9022bfa69"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_worm_class_generator.html#aa7e5ecc1276fb21e9067020039d7a89a">addTable</a> (const std::string tablename)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_worm_class_generator.html#ae33fa044cc6eca45643217603f78ead2">setTemplateDirectory</a> (const std::string dir)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_w_sql_1_1_worm_class_generator.html#ae18b5f7c5d9015a1b675cdb2a6c9264c">setOutputDirectory</a> (const std::string dir)</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>The main class in the ORM generator. </p>
<p>generator class This class is the central class in the ORM generator. It requires a valid <a class="el" href="class_w_sql_1_1_w_sql_database.html" title="The WSqlDatabase class represents a single database.">WSqlDatabase</a> object and is used in this manner: </p>
<div class="fragment"><pre class="fragment"> <a class="code" href="class_w_sql_1_1_w_sql_database.html" title="The WSqlDatabase class represents a single database.">WSql::WSqlDatabase</a> db( drivertype );
db.setDatabaseName( dbname );
db.setUserName( username );
db.setHostName( hostname );
db.setPassword( password );
<span class="keywordflow">if</span> ( !db.open() ) {
some_error_func();
}
<a class="code" href="class_w_sql_1_1_worm_class_generator.html" title="The main class in the ORM generator.">WSql::WormClassGenerator</a> gen(db);
gen.setTemplateDirectory(templatesdir);
gen.setOutputDirectory(outputdir);
<span class="keywordflow">if</span>(!gen.init())
some_error_func();
<span class="keywordflow">else</span>
gen.run();
</pre></div>
<p>Definition at line <a class="el" href="wormclassgenerator_8h_source.html#l00030">30</a> of file <a class="el" href="wormclassgenerator_8h_source.html">wormclassgenerator.h</a>.</p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a03e364c4e63187824777694ccde7c45f"></a><!-- doxytag: member="WSql::WormClassGenerator::WormClassGenerator" ref="a03e364c4e63187824777694ccde7c45f" args="(WSqlDatabase &amp;db)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">WSql::WormClassGenerator::WormClassGenerator </td>
<td>(</td>
<td class="paramtype"><a class="el" href="class_w_sql_1_1_w_sql_database.html">WSqlDatabase</a> &amp;&#160;</td>
<td class="paramname"><em>db</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Constructs a generator with the database <em>db</em>. </p>
<p>Definition at line <a class="el" href="wormclassgenerator_8cpp_source.html#l00088">88</a> of file <a class="el" href="wormclassgenerator_8cpp_source.html">wormclassgenerator.cpp</a>.</p>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="aa7e5ecc1276fb21e9067020039d7a89a"></a><!-- doxytag: member="WSql::WormClassGenerator::addTable" ref="aa7e5ecc1276fb21e9067020039d7a89a" args="(const std::string tablename)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WSql::WormClassGenerator::addTable </td>
<td>(</td>
<td class="paramtype">const std::string&#160;</td>
<td class="paramname"><em>tablename</em></td><td>)</td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="wormclassgenerator_8h_source.html#l00039">39</a> of file <a class="el" href="wormclassgenerator_8h_source.html">wormclassgenerator.h</a>.</p>
</div>
</div>
<a class="anchor" id="a3a753e5b47f8d8ccdfb21ec9022bfa69"></a><!-- doxytag: member="WSql::WormClassGenerator::init" ref="a3a753e5b47f8d8ccdfb21ec9022bfa69" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool WSql::WormClassGenerator::init </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Initialize templates and metadata. </p>
<p>This method initializes the database metadata and loads the available templates. It must be called (and optionally checked for success) <em>before</em> <a class="el" href="class_w_sql_1_1_worm_class_generator.html#a99918905652f92668ded30d579830cbb" title="Run the generator.">run()</a>.</p>
<p>On failure this sets a message in the database object and returns false.</p>
<dl><dt><b>Return values:</b></dt><dd>
<table class="retval">
<tr><td class="paramname">bool</td><td>- true if templates and metadata successfully initialized. </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="wormclassgenerator_8cpp_source.html#l00101">101</a> of file <a class="el" href="wormclassgenerator_8cpp_source.html">wormclassgenerator.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a99918905652f92668ded30d579830cbb"></a><!-- doxytag: member="WSql::WormClassGenerator::run" ref="a99918905652f92668ded30d579830cbb" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WSql::WormClassGenerator::run </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Run the generator. </p>
<p>This method iterates through the available templates for each configured table, calls expand() and writes the results to a class file. It is the principle control function for <a class="el" href="class_w_sql_1_1_worm_class_generator.html" title="The main class in the ORM generator.">WormClassGenerator</a>.</p>
<p>If no tables have been added it assumes that all tables in the database are to be generated.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="class_w_sql_1_1_worm_class_generator.html#aa7e5ecc1276fb21e9067020039d7a89a">addTable()</a> <a class="el" href="class_w_sql_1_1_worm_class_generator.html#ae33fa044cc6eca45643217603f78ead2">setTemplateDirectory()</a> <a class="el" href="class_w_sql_1_1_worm_class_generator.html#ae18b5f7c5d9015a1b675cdb2a6c9264c">setOutputDirectory()</a> </dd></dl>
<p>Definition at line <a class="el" href="wormclassgenerator_8cpp_source.html#l00155">155</a> of file <a class="el" href="wormclassgenerator_8cpp_source.html">wormclassgenerator.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="ae18b5f7c5d9015a1b675cdb2a6c9264c"></a><!-- doxytag: member="WSql::WormClassGenerator::setOutputDirectory" ref="ae18b5f7c5d9015a1b675cdb2a6c9264c" args="(const std::string dir)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WSql::WormClassGenerator::setOutputDirectory </td>
<td>(</td>
<td class="paramtype">const std::string&#160;</td>
<td class="paramname"><em>dir</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Sets the output directory to <em>dir</em> - also appends directory separator if necessary. </p>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000004">Todo:</a></b></dt><dd>make portable. </dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">std::string</td><td>dir - write generated files to this directory </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="wormclassgenerator_8cpp_source.html#l00345">345</a> of file <a class="el" href="wormclassgenerator_8cpp_source.html">wormclassgenerator.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="ae33fa044cc6eca45643217603f78ead2"></a><!-- doxytag: member="WSql::WormClassGenerator::setTemplateDirectory" ref="ae33fa044cc6eca45643217603f78ead2" args="(const std::string dir)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WSql::WormClassGenerator::setTemplateDirectory </td>
<td>(</td>
<td class="paramtype">const std::string&#160;</td>
<td class="paramname"><em>dir</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Sets the templates directory to <em>dir</em> - also appends directory separator if necessary. </p>
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000005">Todo:</a></b></dt><dd>make portable. </dd></dl>
<dl><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">std::string</td><td>dir - look for templates in this directory </td></tr>
</table>
</dd>
</dl>
<p>Definition at line <a class="el" href="wormclassgenerator_8cpp_source.html#l00356">356</a> of file <a class="el" href="wormclassgenerator_8cpp_source.html">wormclassgenerator.cpp</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>src/orm/<a class="el" href="wormclassgenerator_8h_source.html">wormclassgenerator.h</a></li>
<li>src/orm/<a class="el" href="wormclassgenerator_8cpp_source.html">wormclassgenerator.cpp</a></li>
</ul>
</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">&#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>
<!-- 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 class="footer"><small>Generated on Fri Nov 18 2011 21:01:46 for WORM by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>
</body>
</html>