Expand Up
@@ -209,15 +209,15 @@ Enumerated types should be named in CamelCase with a leading capital e.g.:
Feet,
Degrees,
UnknownUnit
} ;
};
```
Do not use generic type names that will conflict with other types. e.g. use
"UnkownUnit" rather than "Unknown"
== Global Constants ==
== Global Constants & Macros ==
Global constants should be written in upper case underscore separated e.g.:
Global constants and macros should be written in upper case underscore separated e.g.:
```
const long GEOCRS_ID = 3344;
Expand All
@@ -231,11 +231,19 @@ requirements are met.
Set your editor to emulate tabs with spaces. Tab spacing should be set to 2
spaces.
**Note:** In vim this is done with set expandtab ts=2
=== Indentation ===
Source code should be indented to improve readability. There is a .indent.pro
file in the QGIS src directory that contains the switches to be used when
indenting code using the GNU indent program. If you don't use GNU indent, you
should emulate these settings.
Source code should be indented to improve readability. There is a
scripts/prepare-commit.sh that looks up the changed files and reindents them
using astyle. This should be run before committing. You can also use
``scripts/astyle.sh`` to indent individual files.
As newer versions of astyle indent differently than the version used to do a
complete reindentation of the source, the script uses an old astyle version,
that we include in our repository (enable WITH_ASTYLE in cmake to include it in
the build).
=== Braces ===
Braces should start on the line following the expression:
Expand All
@@ -251,20 +259,10 @@ Braces should start on the line following the expression:
}
```
There is a scripts/prepare-commit.sh that looks up the changed files and
reindents them using astyle. This should be run before committing.
As newer versions of astyle indent differently than the version used to do a
complete reindentation of the source, the script uses an old astyle version,
that we include in our repository.
== API Compatibility ==
From QGIS 1.0 we will provide a stable, backwards compatible API. This will
provide a stable basis for people to develop against, knowing their code will
work against any of the 1.x QGIS releases (although recompiling may be
required).Cleanups to the API should be done in a manner similar to the
Trolltech developers e.g.
We try to keep the API stable and backwards compatible. Cleanups to the API
should be done in a manner similar to the Trolltech developers e.g.
```
Expand All
@@ -273,15 +271,28 @@ class Foo
public:
/** This method will be deprecated, you are encouraged to use
doSomethingBetter() rather.
@see doSomethingBetter()
@deprecated doSomethingBetter()
*/
bool doSomething();
Q_DECL_DEPRECATED bool doSomething();
/** Does something a better way.
@note This method was introduced in QGIS version 1.1
@note added in 1.1
*/
bool doSomethingBetter();
signal:
/** This signal will be deprecated, you are encouraged to
connect to somethingHappenedBetter() rather.
@deprecated use somethingHappenedBetter()
*/
#ifndef Q_MOC_RUN
Q_DECL_DEPRECATED
#endif
bool somethingHappened();
/** Something happened
@note added in 1.1
bool somethingHappenedBetter();
}
```
Expand Down
Expand Up
@@ -335,28 +346,7 @@ or this:
if ( ! a && b )
```
=== Add Trailing Identifying Comments ===
Adding comments at the end of function, struct and class implementations makes
it easier to find them later.
Consider that you're at the bottom of a source file and need to find a very
long function -- without these kinds of trailing comments you will have to page
up past the body of the function to find its name. Of course this is ok if you
wanted to find the beginning of the function; but what if you were interested
at code near its end? You'd have to page up and then back down again to the
desired part.
e.g.,
```
void foo::bar()
{
// ... imagine a lot of code here
} // foo::bar()
```
**Note:** prepare-commit.sh will take care of this.
=== Use Braces Even for Single Line Statements ===
Expand All
@@ -370,7 +360,7 @@ Consider:
```
if (foo)
bar();
else
else
baz();
```
Expand All
@@ -387,7 +377,7 @@ So, prefer this:
}
else
{
baz();
baz();
}
```
Expand Down
Expand Up
@@ -421,7 +411,7 @@ sudo apt-get install git
=== Install git for Windows ===
Windows users can obtain [msys git http://code.google.com/p/msysgit/].
Windows users can obtain [msys git http://code.google.com/p/msysgit/] or use git distributed with [cygwin http://cygwin.com] .
=== Install git for OSX ===
Expand Down
Expand Up
@@ -679,8 +669,6 @@ submit patches which are unencumbered by conflicting intellectual property
rights. Also do not submit code that you are not happy to have made available
under the GPL.
== Obtaining GIT Write Access ==
Write access to QGIS source tree is by invitation. Typically when a person
Expand Down
Expand Up
@@ -1506,12 +1494,3 @@ guidelines are followed in layout and design of GUIs.
- Marco Hugentobler
-
Original pages from wiki to deprecate:
- http://wiki.qgis.org/qgiswiki/CodingGuidelines (./)
- http://wiki.qgis.org/qgiswiki/CodingStandards (./)
- http://wiki.qgis.org/qgiswiki/UsingSubversion (./)
- http://www.qgis.org/wiki/How_to_debug_QGIS_Plugins
- http://wiki.qgis.org/qgiswiki/DevelopmentInBranches (./)
- http://wiki.qgis.org/qgiswiki/SubmittingPatchesAndSvnAccess (./)