File: CODING

package info (click to toggle)
marble 4:17.08.3-3.2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 141,596 kB
  • sloc: cpp: 189,322; xml: 39,420; ansic: 7,204; python: 2,244; sh: 1,137; makefile: 236; perl: 222; ruby: 97; java: 66
file content (117 lines) | stat: -rw-r--r-- 3,375 bytes parent folder | download | duplicates (2)
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
                     Coding Standards for Marble
                     ===========================


This file contains the coding standards for Marble.  If you want to
add or change code in Marble, you must follow these standards.


Foundation
----------

The foundation for these standards is the kdelibs coding style.  It is
described here: https://community.kde.org/Policies/Kdelibs_Coding_Style
I suggest that you start by reading that document, it's not long.


Recapitulation
--------------

Let's recapitulate a few key points from the kdelibs coding
style. This is not the full standard, but just the most important
points.

 - 4 spaces indentation
 - no tabs in the source code
 - opening braces at end of line (except struct, class, functions and
   namespaces)
 - as little abbreviation in variable names as possible
 - one variable declaration per line
 - whitespace after control statements
 - no space after pointer or reference ('*foo', not '* foo')
 - no lines longer than 100 chars.

That's a very short recapitulation of the above mentioned document.
The full document contains lots of examples to show how it should be
done.

Class names and Variables
-------------------------

 - Class names should have the ("namespace") prefix "Marble" if

    * they are parts of the Marble library that get exported.
    * they resemble widgets or similar visually exposed items

   The remaining part of the name should reflect the purpose of the 
   class and should be camel cased with the first letter being upper 
   cased.

   All other classes should not have the "Marble" prefix. 

 - All header files should contain an include guard which prevents from
   including a header file more than once. The include guard name consists
   of the Marble namespace prefix (if the class is part of the Marble 
   namespace), the name of the class and an H. The name is in full upper case
   and separated with an underscore.

   Correct:
      #ifndef MARBLE_ROUTINGWIDGET_H
      #define MARBLE_ROUTINGWIDGET_H
      ...
      #endif // MARBLE_ROUTINGWIDGET_H

   Wrong:
      MARBLE_ROUTING_WIDGET_H
      MARBLEROUTINGWIDGET_H
      ROUTINGWIDGET_H
      ROUTING_WIDGET_H

 - camelCasing with the first letter being lower cased should be used 
   for methods and variables (e.g. myMethodName()). Full 
   upper cased names should be used for constants (e.g. RAD2DEG).

Extensions
----------

The style defined above is not complete, so we have added the
following item:


Broken Lines in Expressions
- - - - - - - - - - - - - -

If an expression is so long that the line has to be broken, the break
should occur *in front of* an operator, not *behind* it.

Example:

   var = very_long_sub_expression
         + another_very_long_sub_expression;

Another common case for this is logical expressions for if statements:

    if (very_long_sub_expression
        && another_very_long_sub_expression) {
        doSomething();
    }

See also below for how to handle braces in this case.


Special considerations for Marble
---------------------------------

Some things are only applicable for Marble.

Abbreviations
- - - - - - -

Use the following abbreviations in variable names and comments:

lon     longitude (not lng!)
lat     latitude

As parameters (and preferably in other places as well) 
longitude and latitude should appear in lon-lat order
(not lat-lon!).