File: HACKING

package info (click to toggle)
librevenge 0.0.4-6
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 3,548 kB
  • ctags: 2,264
  • sloc: cpp: 13,022; sh: 4,534; makefile: 331; python: 291; ansic: 87
file content (45 lines) | stat: -rw-r--r-- 2,031 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
librevenge coding style
-----------------------

Indentation/spacing: We indent with tabs. Not spaces. This decision is, of
course, rather contentious, but it does have the force of inertia going for
it. Try to keep lines less than 120 columns wide. Please run

    astyle --options=astyle.options \*.h \*.cpp

before committing.

API: By agreement, public API does use neither C++ standard library nor Boost.
If a function takes or returns a dynamically allocated data buffer, it must be
documented who is responsible for freeing the memory.

Naming: All public classes, enumerations, and defines should be prefixed with
RVNG.

For better worse, we have decided on using the camel caps convention for naming 
variables (i.e.: tempJustification). Use of hungarian notation (i.e.: iNum) is
forbidden, with one exception: use the 'm_' prefix for naming class and struct
variables (i.e.: my_class->m_var). Short-hand for variable names is allowed,
but don't overdo it (m_var->len() instead of m_variable->length() is ok,
m_nam instead of m_name is stupid).

Memory allocation: Use the C++ standard operations for this (new, delete). 
Use of smart pointers, e.g., boost::shared_ptr and boost::scoped_ptr, is
strongly encouraged. The only exeption to that is public API, where only plain
pointers are allowed.

Data structures: Use the C++ standard library wherever appropriate and 
convenient. It should almost never be necessary to roll your own data 
structure.

Strings: You may use either the C++ standard strings or our very own 
UTF8-compliant RVNGString. Hand-allocated char *'s are discouraged.

Further information: The OpenOffice.org (http://tools.openoffice.org/coding.html)
and AbiWord (cvs://cvs.abisource.com/abi/docs/AbiSourceCodeGuidelines.abw) 
contain lots of useful information that will make you a better C++ coder. 
Follow their advice religiously, except when they contradict something in this 
document.

Fun: Remember, the important thing is to have fun. :-) These rules are a means,
not an end. Happy hacking!