223 lines
19 KiB
HTML
223 lines
19 KiB
HTML
<!-- HTML header for doxygen 1.8.8-->
|
|
<!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="X-UA-Compatible" content="IE=edge">
|
|
<!-- For Mobile Devices -->
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta name="generator" content="Doxygen 1.8.12"/>
|
|
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
|
|
<title>Ewol: Ewol Widget in OpenGl: Ewol coding style</title>
|
|
<!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
|
|
<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" />
|
|
<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
|
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
|
|
<script type="text/javascript" src="doxy-boot.js"></script>
|
|
</head>
|
|
<body>
|
|
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
|
|
<div class="container">
|
|
<div class="navbar-header">
|
|
<a class="navbar-brand">Ewol: Ewol Widget in OpenGl 0.10.0</a>
|
|
</div>
|
|
<div id="navbar" class="navbar-collapse collapse">
|
|
<ul class="nav navbar-nav">
|
|
<li><a href="index.html">Main Page</a></li>
|
|
<li><a href="pages.html">Related Pages</a></li>
|
|
<li><a href="namespaces.html">Namespaces</a></li>
|
|
<li><a href="annotated.html">Classes</a></li>
|
|
<li><a href="files.html">Files</a></li>
|
|
</ul>
|
|
<ul class="nav navbar-nav navbar-right">
|
|
<li class="dropdown">
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
|
|
Link-libs<span class="caret"></span>
|
|
</a>
|
|
<ul class="dropdown-menu">
|
|
<li><a href="http://HeeroYui.github.io/lutin">lutin</a></li>
|
|
<li><a href="http://atria-soft.github.io/ewol">ewol</a></li>
|
|
<li><a href="http://atria-soft.github.io/echrono">echrono</a></li>
|
|
<li><a href="http://atria-soft.github.io/etk">etk</a></li>
|
|
<li><a href="http://atria-soft.github.io/ejson">ejson</a></li>
|
|
<li><a href="http://atria-soft.github.io/exml">exml</a></li>
|
|
<li><a href="http://atria-soft.github.io/esvg">esvg</a></li>
|
|
<li><a href="http://atria-soft.github.io/egami">egami</a></li>
|
|
<li><a href="http://atria-soft.github.io/gale">gale</a></li>
|
|
<li><a href="http://atria-soft.github.io/ege">ege</a></li>
|
|
<li><a href="http://atria-soft.github.io/elog">elog</a></li>
|
|
<li><a href="http://atria-soft.github.io/ememory">ememory</a></li>
|
|
<li><a href="http://atria-soft.github.io/enet">enet</a></li>
|
|
<li><a href="http://atria-soft.github.io/eproperty">eproperty</a></li>
|
|
<li><a href="http://atria-soft.github.io/esignal">esignal</a></li>
|
|
<li><a href="http://atria-soft.github.io/etranslate">etranslate</a></li>
|
|
<li><a href="http://atria-soft.github.io/zeus">zeus</a></li>
|
|
<li><a href="http://musicdsp.github.io/audio-ess">audio-ess</a></li>
|
|
<li><a href="http://musicdsp.github.io/audio">audio</a></li>
|
|
<li><a href="http://musicdsp.github.io/audio-drain">audio-drain</a></li>
|
|
<li><a href="http://musicdsp.github.io/audio-orchestra">audio-orchestra</a></li>
|
|
<li><a href="http://musicdsp.github.io/audio-river">audio-river</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div id="search-box" class="input-group">
|
|
<div class="input-group-btn">
|
|
<button aria-expanded="false" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
|
<span class="glyphicon glyphicon-search"></span>
|
|
<span class="caret"></span>
|
|
</button>
|
|
<ul class="dropdown-menu">
|
|
<li><a href="#">All</a></li>
|
|
<li><a href="#">Classes</a></li>
|
|
<li><a href="#">Namespaces</a></li>
|
|
<li><a href="#">Files</a></li>
|
|
<li><a href="#">Functions</a></li>
|
|
<li><a href="#">Variables</a></li>
|
|
<li><a href="#">Typedefs</a></li>
|
|
<li><a href="#">Enumerations</a></li>
|
|
<li><a href="#">Enumerator</a></li>
|
|
<li><a href="#">Friends</a></li>
|
|
<li><a href="#">Macros</a></li>
|
|
<li><a href="#">Pages</a></li>
|
|
</ul>
|
|
</div>
|
|
<button id="search-close" type="button" class="close" aria-label="Close">
|
|
<span aria-hidden="true"></span>
|
|
</button>
|
|
<input id="search-field" class="form-control" accesskey="S" onkeydown="searchBox.OnSearchFieldChange(event);" placeholder="Search ..." type="text">
|
|
</div>
|
|
</div><!--/.nav-collapse -->
|
|
</div>
|
|
</nav>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div class="content" id="content">
|
|
<div class="container">
|
|
<div class="row">
|
|
<div class="col-sm-12 panel panel-default" style="padding-bottom: 15px;">
|
|
<div style="margin-bottom: 15px;margin-top: 60px;">
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.12 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
</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><!-- top -->
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">Ewol coding style </div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="toc"><h3>Table of Contents</h3>
|
|
<ul><li class="level1"><a href="#ewol_coding_style_comment">Comments </a></li>
|
|
<li class="level1"><a href="#ewol_coding_style_number_of_colomn">Number of colomn </a></li>
|
|
<li class="level1"><a href="#ewol_coding_style_indent">Indentation & braces </a></li>
|
|
<li class="level1"><a href="#ewol_coding_style_type">Types </a></li>
|
|
<li class="level1"><a href="#ewol_coding_style_star">Star position </a></li>
|
|
<li class="level1"><a href="#ewol_coding_style_c_and_cpp">C and c++ </a></li>
|
|
<li class="level1"><a href="#ewol_coding_style_naming">Naming </a></li>
|
|
<li class="level1"><a href="#ewol_coding_style_types">Types </a></li>
|
|
<li class="level1"><a href="#ewol_coding_style_specific">C++ specificity </a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="textblock"><h1><a class="anchor" id="ewol_coding_style_comment"></a>
|
|
Comments </h1>
|
|
<ul>
|
|
<li>One line comment: (never in #define xxx ==> too dangerous) <div class="fragment"><div class="line"><span class="comment">//</span></div></div><!-- fragment --></li>
|
|
<li>Multiple line comment <div class="fragment"><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment"> * xxxx yyyy</span></div><div class="line"><span class="comment"> * zzzz</span></div><div class="line"><span class="comment"> */</span></div></div><!-- fragment --></li>
|
|
<li>Documentation : doxygen (do not set un-nneded field)</li>
|
|
</ul>
|
|
<pre class="fragment">/**
|
|
* @brief my summery
|
|
* @param[in,out] _xxxx Comment on the variable
|
|
* @return my return explanation
|
|
*/
|
|
</pre><ul>
|
|
<li>one line documlentation: <div class="fragment"><div class="line">xxxxx, <span class="comment">//!< my comment</span></div></div><!-- fragment --></li>
|
|
</ul>
|
|
<h1><a class="anchor" id="ewol_coding_style_number_of_colomn"></a>
|
|
Number of colomn </h1>
|
|
<p>I do not linit the number of colomn, but it could be good to limit at 150 char. Many screen have the main display like this</p>
|
|
<h1><a class="anchor" id="ewol_coding_style_indent"></a>
|
|
Indentation & braces </h1>
|
|
<p>Tab size is a personal choice then, when you write code, you might be tab proof. If someone want to have the golden number for theire tabs, he will be able to do it. When you set a brace '{' you need to add a brace, and when you set a stop brace '}' you need to remove a tab To be simple : (tab stop at the 'if' start)</p>
|
|
<ul>
|
|
<li>if: <div class="fragment"><div class="line"><span class="keywordflow">if</span> ( xxx == yyy</div><div class="line"> && ( xxx == kkk</div><div class="line"> || xxx == zzz )) {</div><div class="line"> <span class="comment">//your action ...;</span></div><div class="line">}</div></div><!-- fragment --></li>
|
|
<li>switch: <div class="fragment"><div class="line"><span class="keywordflow">switch</span> (suffix) {</div><div class="line"> <span class="keywordflow">case</span> <span class="charliteral">'G'</span>:</div><div class="line"> <span class="keywordflow">case</span> <span class="charliteral">'g'</span>:</div><div class="line"> mem <<= 30;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> <span class="charliteral">'M'</span>:</div><div class="line"> <span class="keywordflow">case</span> <span class="charliteral">'m'</span>:</div><div class="line"> mem <<= 20;</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line"> <span class="keywordflow">case</span> <span class="charliteral">'K'</span>:</div><div class="line"> <span class="keywordflow">case</span> <span class="charliteral">'k'</span>:</div><div class="line"> mem <<= 10;</div><div class="line"> <span class="comment">// fall through</span></div><div class="line"> <span class="keywordflow">default</span>:</div><div class="line"> <span class="keywordflow">break</span>;</div><div class="line">}</div></div><!-- fragment --></li>
|
|
<li>function: <div class="fragment"><div class="line"><span class="keywordtype">void</span> myFunction(<span class="keywordtype">void</span>) {</div><div class="line"> actions ...;</div><div class="line">}</div></div><!-- fragment --></li>
|
|
<li>classes: <div class="fragment"><div class="line"><span class="keyword">class </span>MyClass {</div><div class="line"> <span class="keyword">public</span>:</div><div class="line"> MyClass(<span class="keywordtype">void</span>);</div><div class="line"> ~MyClass(<span class="keywordtype">void</span>);</div><div class="line"> <span class="keyword">private</span>:</div><div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="codeRef" doxygen="/home/heero/dev/perso/out/doc/release/etk.tag:http://atria-soft.github.io/etk/" href="http://atria-soft.github.io/etk/_f_s_node_8hpp.html#adb042eb3c3641fb2d10af30b4be2e68b">getName</a>(<span class="keywordtype">void</span>);</div><div class="line">};</div></div><!-- fragment --></li>
|
|
<li>namespace: <div class="fragment"><div class="line"><span class="keyword">namespace </span>appl {</div><div class="line"> <span class="keywordtype">void</span> <span class="keyword">get</span>(void);</div><div class="line">}</div></div><!-- fragment --></li>
|
|
<li>For special element like : you might add a tabulation too <div class="fragment"><div class="line"><span class="keywordflow">case</span> xxx:</div><div class="line"> actions...</div><div class="line">public:</div><div class="line"> definition ...</div></div><!-- fragment --></li>
|
|
<li>An exception for the inline function inside c++ header: <div class="fragment"><div class="line"><span class="keyword">class </span>Plop {</div><div class="line"> <span class="keyword">private</span>:</div><div class="line"> int32_t m_value; </div><div class="line"> <span class="keyword">public</span>:</div><div class="line"> int32_t getValue(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_value; };</div></div><!-- fragment --></li>
|
|
</ul>
|
|
<h1><a class="anchor" id="ewol_coding_style_type"></a>
|
|
Types </h1>
|
|
<p>the element 'typedef' must not be use, like this it is not needed to add special element like '_te' or '_ts' to say respectively 'tpedef enum' and 'typedef struct' Structure is not availlable in c++, just use normal class, this is the same.</p>
|
|
<h1><a class="anchor" id="ewol_coding_style_star"></a>
|
|
Star position </h1>
|
|
<p>The star will be near the type : </p><div class="fragment"><div class="line"><span class="keywordtype">void</span>* myVariableName;</div></div><!-- fragment --><h1><a class="anchor" id="ewol_coding_style_c_and_cpp"></a>
|
|
C and c++ </h1>
|
|
<p>All C header files might have : </p><div class="fragment"><div class="line"><span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"> <span class="keyword">extern</span> <span class="stringliteral">"C"</span> {</div><div class="line"><span class="preprocessor">#endif</span></div><div class="line"></div><div class="line">...</div><div class="line"></div><div class="line">#ifdef __cplusplus</div><div class="line"> }</div><div class="line"><span class="preprocessor">#endif</span></div></div><!-- fragment --><h1><a class="anchor" id="ewol_coding_style_naming"></a>
|
|
Naming </h1>
|
|
<ul>
|
|
<li>Fonction/Methods: Camel case with first letter in lower case. <div class="fragment"><div class="line"><span class="keywordtype">void</span> myExampleFontionName(<span class="keywordtype">void</span>);</div></div><!-- fragment --></li>
|
|
<li>Variable: Camel case with first letter in lower case. <div class="fragment"><div class="line">nt32_t myVariableExample;</div></div><!-- fragment --></li>
|
|
<li>namespace: one world in lower case <div class="fragment"><div class="line">namspace <a class="code" href="namespaceewol.html">ewol</a> {</div></div><!-- fragment --></li>
|
|
<li>Class: Camel case with first letter in upper case. <div class="fragment"><div class="line"><span class="keyword">class </span>MyClass;</div></div><!-- fragment --></li>
|
|
<li>Members fields: Put a 'm' prefix and then a normal Variable name <div class="fragment"><div class="line">int32_t m_memberField;</div></div><!-- fragment --></li>
|
|
<li>enum: Camel case with first letter in lower case. <div class="fragment"><div class="line"><span class="keyword">enum</span> myEnum {</div><div class="line"> myEnum_def1,</div><div class="line"> myEnum_def2,</div><div class="line"> myEnum_def3,</div><div class="line">};</div></div><!-- fragment --></li>
|
|
<li>structure (C only) use naming like Classes (and for mamber too)</li>
|
|
<li>minimum size : Do not use variable with size <3, the for a iterator for a 'for' : <div class="fragment"><div class="line"><span class="keywordflow">for</span> (int32_t iii=0; iii<xxx; ++iii) {</div><div class="line"> <span class="comment">// actions ...</span></div><div class="line">}</div></div><!-- fragment --></li>
|
|
</ul>
|
|
<h1><a class="anchor" id="ewol_coding_style_types"></a>
|
|
Types </h1>
|
|
<p>Une stanndard Type : </p><div class="fragment"><div class="line"><span class="keywordtype">bool</span></div><div class="line">int8_t / uint8_t</div><div class="line">int16_t / uint16_t</div><div class="line">int32_t / uint32_t</div><div class="line">int64_t / uint64_t</div><div class="line"><span class="keywordtype">size_t</span></div><div class="line">int (some <span class="keywordflow">case</span> needed)</div><div class="line"><span class="keywordtype">float</span> / <span class="keywordtype">double</span></div><div class="line"><a class="codeRef" doxygen="/home/heero/dev/perso/out/doc/release/etk.tag:http://atria-soft.github.io/etk/" href="http://atria-soft.github.io/etk/types_8hpp.html#aef34e23d4cca9aba8d78eeb0ae8fcd2e">float_t</a> to automatic match whith the compilation choice between <span class="keywordtype">float</span> or <span class="keywordtype">double</span></div></div><!-- fragment --><h1><a class="anchor" id="ewol_coding_style_specific"></a>
|
|
C++ specificity </h1>
|
|
<ul>
|
|
<li>STL You can use the Stl, but the porting and the result can be different depending on the board you are.</li>
|
|
<li>Heritage: Simple Heritage is a good use of the C++, multiple heritage is not really supported in every compilators.</li>
|
|
<li>const: Set the parameter and fonction const all time you can.</li>
|
|
<li>exception: They are not manage in all platforms, then by restriction, do not use it. </li>
|
|
</ul>
|
|
</div></div><!-- contents -->
|
|
<!-- HTML footer for doxygen 1.8.8-->
|
|
<!-- start footer part -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated on Mon Oct 24 2016 15:35:52 for Ewol: Ewol Widget in OpenGl by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.12
|
|
</small></address>
|
|
</body>
|
|
</html>
|