File: programming-guidelines.html

package info (click to toggle)
packagesearch 2.7.3
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 3,244 kB
  • sloc: cpp: 12,412; perl: 282; makefile: 69; sh: 13
file content (188 lines) | stat: -rw-r--r-- 6,450 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
  
  <meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8">
  <title>Packagesearch Programming Guidelines and Hints</title>

  
  
  <meta name="CREATED" content="20090409;8164100">

  
  <meta name="CHANGED" content="20090409;8223100">

</head><body dir="ltr" lang="de-DE">
<h1 lang="en-GB">Policy for Plugins</h1>

<p lang="en-GB">Main Identifier: Plugin Name</p>

<p style="margin-bottom: 0cm;" lang="en-GB">Additional Information:</p>

<ul>

  <li>
    <p style="margin-bottom: 0cm;" lang="en-GB">Author</p>
  </li>
  <li>
    <p style="margin-bottom: 0cm;" lang="en-GB">Version</p>
  </li>
  <li>
    <p style="margin-bottom: 0cm;" lang="en-GB">Location (Path, derived
from library location)</p>
    <ul>
      <li>
        <p style="margin-bottom: 0cm;" lang="en-GB">Implicit search
path order: plugins/, ../plugins/, /usr/lib/packagesearch</p>
      </li>
      <li>
        <p style="margin-bottom: 0cm;" lang="en-GB">If more than one
version is available use the one appearing first in the search path</p>
      </li>
    </ul>
  </li>
</ul>

<p lang="en-GB">Plugin file names must be of the format:<font face="Courier 10 Pitch">
lib&lt;pluginname&gt;.so</font></p>

<h3>Internationalisation i18n</h3>
Uses QT-Translation mechanism.<br>
<ul>
  <li>&nbsp;translation files located at <font face="Courier 10 Pitch">packagesearch/translations/</font> <br>
  </li>
  <li>one file per plugin, one for main application, names: <span style="font-family: Courier New,Courier,monospace;">&lt;pluginname&gt;_&lt;lang&gt;.ts</span></li>
</ul>
To add a new language<br>
<ul>
  <li>add reference to "ts"-file to each .pro file (i.e. each plugin and packagesearch.pro)</li>
  <li>run <span style="font-family: Courier New,Courier,monospace;">lupdate packagesearch.pro</span> and <span style="font-family: Courier New,Courier,monospace;">lupdate plugins/plugins.pro</span><br>
  </li>
</ul>
To compile the translations:<br>
<ul>
  <li>run <span style="font-family: monospace;">make debug</span> or <span style="font-family: monospace;">make release</span> within <span style="font-family: monospace;">packagesearch/</span><br>
  </li>
</ul>
<br>

<br>

<h3>Naming Conventions</h3>

<ul>

  <li>Typenames/Const</li>
  <ul>
    <li>typenames start with a capital letter - each word in it again</li>
    <li>constants are written in capital letters, different words are
seperated by an underscorde _</li>
  </ul>
  <li>Variables</li>
  <ul>
    <li>varibles start with a lower case letter</li>
    <li>member variables start with a underscore _</li>
    <li>pointers start with a p</li>
  </ul>
  <li>Filenames</li>
  <ul>
    <li>filenames and directories are written lowercase without
underscores</li>
    <li>Source files .cpp, Headerfiles .h</li>
  </ul>
  <li>Functions</li>
  <ul>
    <li>if the functions argument list goes over more then two lines,
the closing braclet will appear on a separate line and the line with
the function name will not contain&nbsp; a parameter&nbsp; e.g.<br>
    </li>
  </ul>
</ul>

<pre>// this is OK<br>func(aVeryLongVariableName1, aMuchMoreLongerVariableNameWhichFillsAllTheLine2,<br>     aVeryLongVariableNameWhichIsReallyLong3, aVeryLongVariableNameWhichIsReallyLong4);<br>// if more than this:<br>func (<br>	aVeryLongVariableNameWhichIsReallyLong1, aMuchMuchLongerVariableName2<br>	aVeryLongVariableNameWhichIsReallyLong3, aMuchMuchLongerVariableName4<br>	aVeryLongVariableNameWhichIsReallyLong5, aMuchMuchLongerVariableName5<br>);</pre>

<p lang="en-GB"><br>
</p>

<h3>Documentation</h3>

<ul>

  <li>tool tips and status tips start with a capital letter, all
following words are&nbsp; capitalized normally e.g. "Choose a package"</li>
  <li>What's this consist of normal text (i.e. sentences)<br>
  </li>
</ul>

<h3>User Interface</h3>

<ul>

  <li>options listed are to be formated as tool tips i.e. with a
leading
capital character an the rest capitalized normally &nbsp;&nbsp;&nbsp; <br>
  </li>
</ul>

<h3>Doxygen</h3>

&nbsp;Doxygen comments look like this:
<pre>&nbsp;&nbsp;&nbsp; /** @brief This holds the package collection ready to be used.<br>&nbsp;&nbsp;&nbsp; &nbsp; *<br>&nbsp;&nbsp;&nbsp; &nbsp; * Use the output function for your consumers <br>&nbsp;&nbsp;&nbsp; &nbsp; */</pre>

<p lang="en-GB">&nbsp;If they need only one line the closing */ must be
on the same line:<br>
</p>

<pre>&nbsp;&nbsp;&nbsp; /** This manages the include widgets (but not the labels belonging to them. */</pre>

<p lang="en-GB"><br>
</p>

<h3>Includes</h3>

<p lang="en-GB">&nbsp;&nbsp;&nbsp; #include &lt;...&gt; proceeds<br>
&nbsp;&nbsp;&nbsp; #include "..."<br>
&nbsp;&nbsp;&nbsp; include order:<br>
&nbsp;&nbsp;&nbsp; &nbsp;- stl includes<br>
&nbsp;&nbsp;&nbsp; &nbsp;- opengl includes<br>
&nbsp;&nbsp;&nbsp; &nbsp;- qt includes<br>
&nbsp;&nbsp;&nbsp; &nbsp;- other global includes (those with &lt;&gt;)<br>
&nbsp;&nbsp;&nbsp; &nbsp;- the corresponding header for the cpp file
("xmldata.h" for xmldata.cpp)<br>
&nbsp;&nbsp;&nbsp; &nbsp;- other local includes<br>
&nbsp;&nbsp;&nbsp; Grouping:<br>
&nbsp;&nbsp;&nbsp; &nbsp;- local includes from the same namespace are
grouped together (followed by an<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; empty line<br>
&nbsp;&nbsp;&nbsp; &nbsp;- includes from the same external library or
directory are grouped together<br>
&nbsp;&nbsp;&nbsp; &nbsp;<br>
<br>
</p>

<h3>Saving</h3>

<p lang="en-GB">&nbsp;&nbsp;&nbsp; Saving happens in XML<br>
&nbsp;&nbsp;&nbsp; Error handling:<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; - if something wasn't loaded
properly we will try to set a reasonable default value<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; - We will not go to the next
entry if loading of an element failed, so if there is a<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; broken tag (e.g. wrong
spelling) this will break all following parts. This is done<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; because if we added a new
item in the DTD and we have an incorrect XML file where<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; this entry is missing, it
will use a default value and the next tag will read the<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; correct entry.<br>
<br>
&nbsp;&nbsp;&nbsp; Saving in packagesearch:<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; - comments in the configuration
file are not allowed<br>
<br>
</p>

<p lang="en-GB"><br>
<br>
</p>

</body></html>