2009-03-20 13:28:16 -07:00
|
|
|
Storage Module Style Guidelines
|
|
|
|
|
|
|
|
These guidelines should be followed for all new code in this module. Reviewers
|
|
|
|
will be enforcing them, so please obey them!
|
|
|
|
|
2009-03-31 07:26:08 -07:00
|
|
|
* All code should be contained within the namespace mozilla::storage at a
|
2009-03-20 13:28:16 -07:00
|
|
|
minimum. The use of namespaces is strongly encouraged.
|
|
|
|
|
2009-03-31 07:26:08 -07:00
|
|
|
* All functions being called in the global namespace should be prefixed with
|
|
|
|
"::" to indicate that they are in the global namespace.
|
|
|
|
|
2009-03-20 13:28:16 -07:00
|
|
|
* The indentation level to use in source code is two spaces. No tabs, please!
|
|
|
|
|
|
|
|
* All files should have the following emacs and vim mode lines:
|
|
|
|
-*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2009-04-13 09:29:41 -07:00
|
|
|
vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
|
2009-03-20 13:28:16 -07:00
|
|
|
|
|
|
|
* All functions that are not XPCOM should start with a lowercase letter.
|
|
|
|
|
|
|
|
* Function arguments that are not out parameters should be prefixed with a (for
|
|
|
|
pArameter), and use CamelCase.
|
|
|
|
|
|
|
|
* Function arguments that are out parameters should be prefixed with an
|
|
|
|
underscore and have a descriptive name.
|
|
|
|
|
|
|
|
* Function declarations should include javadoc style comments.
|
|
|
|
|
|
|
|
* For function implementations, each argument should be on its own line.
|
|
|
|
|
|
|
|
* All variables should use camelCase.
|
|
|
|
|
|
|
|
* The use of bool is encouraged whenever the variable does not have the
|
|
|
|
potential to go through xpconnect.
|
|
|
|
|
|
|
|
* For pointer variable types, include a space after the type before the asterisk
|
|
|
|
and no space between the asterisk and variable name.
|
|
|
|
|
|
|
|
* If any part of an if-else block requires braces, all blocks need braces.
|
|
|
|
|
|
|
|
* Every else should be on a newline after a brace.
|
|
|
|
|
|
|
|
* Bracing should start on the line after a function and class definition.
|
|
|
|
|
|
|
|
* If a return value is not going to be checked, the return value should be
|
|
|
|
explicitly casted to void (C style cast).
|