mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add Coding conventions section in CodingStyle file
Add section about string manipulation Moved some of the existing conventions into the new section: - variable declarations - text strings - UI text style Update CONTRIBUTING.md with references to CodingStyle file Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
This commit is contained in:
parent
5d96d4af0c
commit
65c91e833c
2 changed files with 25 additions and 3 deletions
24
CodingStyle
24
CodingStyle
|
@ -1,9 +1,9 @@
|
|||
Coding Style
|
||||
============
|
||||
|
||||
Here are some of the basics that we are trying to enforce for our coding
|
||||
style. The existing code (as of the commit that adds these lines) is not
|
||||
yet fully consistent to these rules, but following these rules will make
|
||||
Here are some of the basics that we are trying to enforce for our coding style
|
||||
and conventions. The existing code (as of the commit that adds these lines) is
|
||||
not yet fully consistent to these rules, but following these rules will make
|
||||
sure that no one yells at you about your patches.
|
||||
|
||||
We have a script that can be used to reformat code to be reasonably close
|
||||
|
@ -106,6 +106,9 @@ Basic rules
|
|||
}
|
||||
}
|
||||
|
||||
Coding conventions
|
||||
==================
|
||||
|
||||
- variable declarations
|
||||
in C code we really like them to be at the beginning of a code block,
|
||||
not interspersed in the middle.
|
||||
|
@ -143,6 +146,21 @@ Basic rules
|
|||
in use within Subsurface e.g. Cylinder vs. Tank.
|
||||
|
||||
|
||||
- string manipulation
|
||||
|
||||
-- user interface
|
||||
In UI part of the code use of QString methods is preferred, see this pretty
|
||||
good guide in QString documentation:
|
||||
http://doc.qt.io/qt-5/qstring.html#manipulating-string-data
|
||||
|
||||
-- core components
|
||||
In the core part of the code, C-string should be used.
|
||||
C-string manipulation is not always straightforward specifically when
|
||||
it comes to memory allocation, a set of helper functions has been developed
|
||||
to help with this. Documentation and usage examples can be found in
|
||||
core/membuffer.h file:
|
||||
https://github.com/Subsurface-divelog/subsurface/blob/master/core/membuffer.h
|
||||
|
||||
Sample Settings
|
||||
===============
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue