289 lines
		
	
	
		
			15 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			289 lines
		
	
	
		
			15 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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"/>
 | |
| <meta http-equiv="X-UA-Compatible" content="IE=9"/>
 | |
| <meta name="generator" content="Doxygen 1.8.17"/>
 | |
| <meta name="viewport" content="width=device-width, initial-scale=1"/>
 | |
| <title>My Project: core::Command Class Reference</title>
 | |
| <link href="tabs.css" rel="stylesheet" type="text/css"/>
 | |
| <script type="text/javascript" src="jquery.js"></script>
 | |
| <script type="text/javascript" src="dynsections.js"></script>
 | |
| <link href="search/search.css" rel="stylesheet" type="text/css"/>
 | |
| <script type="text/javascript" src="search/searchdata.js"></script>
 | |
| <script type="text/javascript" src="search/search.js"></script>
 | |
| <link href="doxygen.css" rel="stylesheet" type="text/css" />
 | |
| </head>
 | |
| <body>
 | |
| <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
 | |
| <div id="titlearea">
 | |
| <table cellspacing="0" cellpadding="0">
 | |
|  <tbody>
 | |
|  <tr style="height: 56px;">
 | |
|   <td id="projectalign" style="padding-left: 0.5em;">
 | |
|    <div id="projectname">My Project
 | |
|    </div>
 | |
|   </td>
 | |
|  </tr>
 | |
|  </tbody>
 | |
| </table>
 | |
| </div>
 | |
| <!-- end header part -->
 | |
| <!-- Generated by Doxygen 1.8.17 -->
 | |
| <script type="text/javascript">
 | |
| /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
 | |
| var searchBox = new SearchBox("searchBox", "search",false,'Search');
 | |
| /* @license-end */
 | |
| </script>
 | |
| <script type="text/javascript" src="menudata.js"></script>
 | |
| <script type="text/javascript" src="menu.js"></script>
 | |
| <script type="text/javascript">
 | |
| /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
 | |
| $(function() {
 | |
|   initMenu('',true,false,'search.php','Search');
 | |
|   $(document).ready(function() { init_search(); });
 | |
| });
 | |
| /* @license-end */</script>
 | |
| <div id="main-nav"></div>
 | |
| <!-- window showing the filter options -->
 | |
| <div id="MSearchSelectWindow"
 | |
|      onmouseover="return searchBox.OnSearchSelectShow()"
 | |
|      onmouseout="return searchBox.OnSearchSelectHide()"
 | |
|      onkeydown="return searchBox.OnSearchSelectKey(event)">
 | |
| </div>
 | |
| 
 | |
| <!-- iframe showing the search results (closed by default) -->
 | |
| <div id="MSearchResultsWindow">
 | |
| <iframe src="javascript:void(0)" frameborder="0" 
 | |
|         name="MSearchResults" id="MSearchResults">
 | |
| </iframe>
 | |
| </div>
 | |
| 
 | |
| <div id="nav-path" class="navpath">
 | |
|   <ul>
 | |
| <li class="navelem"><b>core</b></li><li class="navelem"><a class="el" href="classcore_1_1Command.html">Command</a></li>  </ul>
 | |
| </div>
 | |
| </div><!-- top -->
 | |
| <div class="header">
 | |
|   <div class="summary">
 | |
| <a href="#pub-methods">Public Member Functions</a> |
 | |
| <a href="classcore_1_1Command-members.html">List of all members</a>  </div>
 | |
|   <div class="headertitle">
 | |
| <div class="title">core::Command Class Reference</div>  </div>
 | |
| </div><!--header-->
 | |
| <div class="contents">
 | |
| 
 | |
| <p><code>#include <<a class="el" href="Command_8h_source.html">Command.h</a>></code></p>
 | |
| <div class="dynheader">
 | |
| Inheritance diagram for core::Command:</div>
 | |
| <div class="dyncontent">
 | |
| <div class="center"><img src="classcore_1_1Command__inherit__graph.png" border="0" usemap="#core_1_1Command_inherit__map" alt="Inheritance graph"/></div>
 | |
| <map name="core_1_1Command_inherit__map" id="core_1_1Command_inherit__map">
 | |
| <area shape="rect" title=" " alt="" coords="226,80,351,107"/>
 | |
| <area shape="rect" href="classcore_1_1CommandList.html" title=" " alt="" coords="5,155,153,181"/>
 | |
| <area shape="rect" href="classcore_1_1EPoll.html" title=" " alt="" coords="178,155,269,181"/>
 | |
| <area shape="rect" href="classcore_1_1TCPServer.html" title=" " alt="" coords="293,155,418,181"/>
 | |
| <area shape="rect" href="classcore_1_1UDPServerSocket.html" title=" " alt="" coords="442,155,613,181"/>
 | |
| <area shape="rect" href="classcore_1_1Object.html" title=" " alt="" coords="239,5,339,32"/>
 | |
| <area shape="rect" href="classcore_1_1ConsoleServer.html" title=" " alt="" coords="199,229,351,256"/>
 | |
| <area shape="rect" href="classcore_1_1TLSServer.html" title=" " alt="" coords="375,229,498,256"/>
 | |
| </map>
 | |
| <center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
 | |
| <div class="dynheader">
 | |
| Collaboration diagram for core::Command:</div>
 | |
| <div class="dyncontent">
 | |
| <div class="center"><img src="classcore_1_1Command__coll__graph.png" border="0" usemap="#core_1_1Command_coll__map" alt="Collaboration graph"/></div>
 | |
| <map name="core_1_1Command_coll__map" id="core_1_1Command_coll__map">
 | |
| <area shape="rect" title=" " alt="" coords="5,80,131,107"/>
 | |
| <area shape="rect" href="classcore_1_1Object.html" title=" " alt="" coords="18,5,118,32"/>
 | |
| </map>
 | |
| <center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
 | |
| <table class="memberdecls">
 | |
| <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
 | |
| Public Member Functions</h2></td></tr>
 | |
| <tr class="memitem:af9b8d8b3a6d6566f86e0abcb0d10f905"><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classcore_1_1Command.html#af9b8d8b3a6d6566f86e0abcb0d10f905">check</a> (coreutils::ZString request)</td></tr>
 | |
| <tr class="separator:af9b8d8b3a6d6566f86e0abcb0d10f905"><td class="memSeparator" colspan="2"> </td></tr>
 | |
| <tr class="memitem:ad8eecee5b179a0030d2f34bcfa30d4f4"><td class="memItemLeft" align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="classcore_1_1Command.html#ad8eecee5b179a0030d2f34bcfa30d4f4">processCommand</a> (coreutils::ZString request, <a class="el" href="classcore_1_1TCPSession.html">TCPSession</a> *session, std::stringstream &data)</td></tr>
 | |
| <tr class="separator:ad8eecee5b179a0030d2f34bcfa30d4f4"><td class="memSeparator" colspan="2"> </td></tr>
 | |
| <tr class="memitem:a314aef05f78aacb802097f8ae0875291"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classcore_1_1Command.html#a314aef05f78aacb802097f8ae0875291">output</a> (Session *session)</td></tr>
 | |
| <tr class="separator:a314aef05f78aacb802097f8ae0875291"><td class="memSeparator" colspan="2"> </td></tr>
 | |
| <tr class="memitem:ad8b0321c64838f4d5c8f93461b97cfef"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classcore_1_1Command.html#ad8b0321c64838f4d5c8f93461b97cfef">setName</a> (std::string name)</td></tr>
 | |
| <tr class="separator:ad8b0321c64838f4d5c8f93461b97cfef"><td class="memSeparator" colspan="2"> </td></tr>
 | |
| <tr class="memitem:aa63cf88493b2a1b775b5b93b07e79324"><td class="memItemLeft" align="right" valign="top"><a id="aa63cf88493b2a1b775b5b93b07e79324"></a>
 | |
| std::string </td><td class="memItemRight" valign="bottom"><b>getName</b> ()</td></tr>
 | |
| <tr class="separator:aa63cf88493b2a1b775b5b93b07e79324"><td class="memSeparator" colspan="2"> </td></tr>
 | |
| </table><table class="memberdecls">
 | |
| <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="inherited"></a>
 | |
| Additional Inherited Members</h2></td></tr>
 | |
| <tr class="inherit_header pub_attribs_classcore_1_1Object"><td colspan="2" onclick="javascript:toggleInherit('pub_attribs_classcore_1_1Object')"><img src="closed.png" alt="-"/> Public Attributes inherited from <a class="el" href="classcore_1_1Object.html">core::Object</a></td></tr>
 | |
| <tr class="memitem:aa096b2bab35f1019c91077ef3ec106ce inherit pub_attribs_classcore_1_1Object"><td class="memItemLeft" align="right" valign="top"><a id="aa096b2bab35f1019c91077ef3ec106ce"></a>
 | |
| std::string </td><td class="memItemRight" valign="bottom"><b>name</b></td></tr>
 | |
| <tr class="separator:aa096b2bab35f1019c91077ef3ec106ce inherit pub_attribs_classcore_1_1Object"><td class="memSeparator" colspan="2"> </td></tr>
 | |
| <tr class="memitem:ad503c264c529c41c25528c34421c83df inherit pub_attribs_classcore_1_1Object"><td class="memItemLeft" align="right" valign="top"><a id="ad503c264c529c41c25528c34421c83df"></a>
 | |
| std::string </td><td class="memItemRight" valign="bottom"><b>tag</b></td></tr>
 | |
| <tr class="separator:ad503c264c529c41c25528c34421c83df inherit pub_attribs_classcore_1_1Object"><td class="memSeparator" colspan="2"> </td></tr>
 | |
| </table>
 | |
| <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
 | |
| <div class="textblock"><p><a class="el" href="classcore_1_1Command.html">Command</a></p>
 | |
| <p>Use the <a class="el" href="classcore_1_1Command.html">Command</a> object in combination with a <a class="el" href="classcore_1_1CommandList.html">CommandList</a> object to maintain a list of functions that can be invoked as a result of processing a request. </p>
 | |
| </div><h2 class="groupheader">Member Function Documentation</h2>
 | |
| <a id="af9b8d8b3a6d6566f86e0abcb0d10f905"></a>
 | |
| <h2 class="memtitle"><span class="permalink"><a href="#af9b8d8b3a6d6566f86e0abcb0d10f905">◆ </a></span>check()</h2>
 | |
| 
 | |
| <div class="memitem">
 | |
| <div class="memproto">
 | |
| <table class="mlabels">
 | |
|   <tr>
 | |
|   <td class="mlabels-left">
 | |
|       <table class="memname">
 | |
|         <tr>
 | |
|           <td class="memname">bool core::Command::check </td>
 | |
|           <td>(</td>
 | |
|           <td class="paramtype">coreutils::ZString </td>
 | |
|           <td class="paramname"><em>request</em></td><td>)</td>
 | |
|           <td></td>
 | |
|         </tr>
 | |
|       </table>
 | |
|   </td>
 | |
|   <td class="mlabels-right">
 | |
| <span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
 | |
|   </tr>
 | |
| </table>
 | |
| </div><div class="memdoc">
 | |
| <p>Implement check method to provide a special check rule upon the request to see if the command should be processed.</p>
 | |
| <p>The default rule is to verify that the first token in the request string matches the name given on the registration of the command to the <a class="el" href="classcore_1_1CommandList.html">CommandList</a>. This can be overridden by implementing the <a class="el" href="classcore_1_1Command.html#af9b8d8b3a6d6566f86e0abcb0d10f905">check()</a> method to perform the test and return the condition of the command.</p>
 | |
| <dl class="params"><dt>Parameters</dt><dd>
 | |
|   <table class="params">
 | |
|     <tr><td class="paramname">request</td><td>The request passed to the parser to check the rule. </td></tr>
 | |
|   </table>
 | |
|   </dd>
 | |
| </dl>
 | |
| <dl class="section return"><dt>Returns</dt><dd>Return true to execute the command. Returning false will cause no action on this command. </dd></dl>
 | |
| 
 | |
| </div>
 | |
| </div>
 | |
| <a id="a314aef05f78aacb802097f8ae0875291"></a>
 | |
| <h2 class="memtitle"><span class="permalink"><a href="#a314aef05f78aacb802097f8ae0875291">◆ </a></span>output()</h2>
 | |
| 
 | |
| <div class="memitem">
 | |
| <div class="memproto">
 | |
| <table class="mlabels">
 | |
|   <tr>
 | |
|   <td class="mlabels-left">
 | |
|       <table class="memname">
 | |
|         <tr>
 | |
|           <td class="memname">void core::Command::output </td>
 | |
|           <td>(</td>
 | |
|           <td class="paramtype">Session * </td>
 | |
|           <td class="paramname"><em>session</em></td><td>)</td>
 | |
|           <td></td>
 | |
|         </tr>
 | |
|       </table>
 | |
|   </td>
 | |
|   <td class="mlabels-right">
 | |
| <span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
 | |
|   </tr>
 | |
| </table>
 | |
| </div><div class="memdoc">
 | |
| <p>Specify the output that will occur to the specified session.</p>
 | |
| <dl class="params"><dt>Parameters</dt><dd>
 | |
|   <table class="params">
 | |
|     <tr><td class="paramname">session</td><td>The session that will receive the output. </td></tr>
 | |
|   </table>
 | |
|   </dd>
 | |
| </dl>
 | |
| 
 | |
| </div>
 | |
| </div>
 | |
| <a id="ad8eecee5b179a0030d2f34bcfa30d4f4"></a>
 | |
| <h2 class="memtitle"><span class="permalink"><a href="#ad8eecee5b179a0030d2f34bcfa30d4f4">◆ </a></span>processCommand()</h2>
 | |
| 
 | |
| <div class="memitem">
 | |
| <div class="memproto">
 | |
| <table class="mlabels">
 | |
|   <tr>
 | |
|   <td class="mlabels-left">
 | |
|       <table class="memname">
 | |
|         <tr>
 | |
|           <td class="memname">int core::Command::processCommand </td>
 | |
|           <td>(</td>
 | |
|           <td class="paramtype">coreutils::ZString </td>
 | |
|           <td class="paramname"><em>request</em>, </td>
 | |
|         </tr>
 | |
|         <tr>
 | |
|           <td class="paramkey"></td>
 | |
|           <td></td>
 | |
|           <td class="paramtype"><a class="el" href="classcore_1_1TCPSession.html">TCPSession</a> * </td>
 | |
|           <td class="paramname"><em>session</em>, </td>
 | |
|         </tr>
 | |
|         <tr>
 | |
|           <td class="paramkey"></td>
 | |
|           <td></td>
 | |
|           <td class="paramtype">std::stringstream & </td>
 | |
|           <td class="paramname"><em>data</em> </td>
 | |
|         </tr>
 | |
|         <tr>
 | |
|           <td></td>
 | |
|           <td>)</td>
 | |
|           <td></td><td></td>
 | |
|         </tr>
 | |
|       </table>
 | |
|   </td>
 | |
|   <td class="mlabels-right">
 | |
| <span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
 | |
|   </tr>
 | |
| </table>
 | |
| </div><div class="memdoc">
 | |
| <p>This method is used to implement the functionality of the requested command. This pure virtual function must be implemented in your inheriting object.</p>
 | |
| <dl class="params"><dt>Parameters</dt><dd>
 | |
|   <table class="params">
 | |
|     <tr><td class="paramname">request</td><td>The request that was entered by the user to invoke this command. </td></tr>
 | |
|     <tr><td class="paramname">session</td><td>Specify the requesting session so that the execution of the command process can return its output to the session. </td></tr>
 | |
|   </table>
 | |
|   </dd>
 | |
| </dl>
 | |
| <dl class="section return"><dt>Returns</dt><dd>Returns 0 if execution of the command was successful. Otherwise returns a non-zero value indicating an error condition. </dd></dl>
 | |
| 
 | |
| <p>Reimplemented in <a class="el" href="classcore_1_1EPoll.html#a5cb8a89fb45922c8c88472ec3eae7858">core::EPoll</a>, and <a class="el" href="classcore_1_1TCPServer.html#ad08e04a2ff44c9c40419cdc6bd0e4b79">core::TCPServer</a>.</p>
 | |
| 
 | |
| </div>
 | |
| </div>
 | |
| <a id="ad8b0321c64838f4d5c8f93461b97cfef"></a>
 | |
| <h2 class="memtitle"><span class="permalink"><a href="#ad8b0321c64838f4d5c8f93461b97cfef">◆ </a></span>setName()</h2>
 | |
| 
 | |
| <div class="memitem">
 | |
| <div class="memproto">
 | |
|       <table class="memname">
 | |
|         <tr>
 | |
|           <td class="memname">void core::Command::setName </td>
 | |
|           <td>(</td>
 | |
|           <td class="paramtype">std::string </td>
 | |
|           <td class="paramname"><em>name</em></td><td>)</td>
 | |
|           <td></td>
 | |
|         </tr>
 | |
|       </table>
 | |
| </div><div class="memdoc">
 | |
| <p>Set the name of this command used in default rule checking during request parsing. NOTE: You do not need to call this under normal conditions as adding a <a class="el" href="classcore_1_1Command.html">Command</a> to a <a class="el" href="classcore_1_1CommandList.html">CommandList</a> using the add() method contains a parameter to pass the name of the <a class="el" href="classcore_1_1Command.html">Command</a>.</p>
 | |
| <dl class="params"><dt>Parameters</dt><dd>
 | |
|   <table class="params">
 | |
|     <tr><td class="paramname">name</td><td>Specify the name of this command for default parsing. </td></tr>
 | |
|   </table>
 | |
|   </dd>
 | |
| </dl>
 | |
| 
 | |
| </div>
 | |
| </div>
 | |
| <hr/>The documentation for this class was generated from the following files:<ul>
 | |
| <li><a class="el" href="Command_8h_source.html">Command.h</a></li>
 | |
| <li>Command.cpp</li>
 | |
| </ul>
 | |
| </div><!-- contents -->
 | |
| <!-- start footer part -->
 | |
| <hr class="footer"/><address class="footer"><small>
 | |
| Generated by  <a href="http://www.doxygen.org/index.html">
 | |
| <img class="footer" src="doxygen.png" alt="doxygen"/>
 | |
| </a> 1.8.17
 | |
| </small></address>
 | |
| </body>
 | |
| </html>
 |