summaryrefslogtreecommitdiff
path: root/doc/api
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2011-11-11 16:24:30 +0100
committerLeena Miettinen <riitta-leena.miettinen@nokia.com>2011-11-14 10:02:43 +0100
commitcd0673f78788e3eada78fca68762719260f04cfe (patch)
treea85d3fcbdd738c4841c7d64ab9012363d2fbf696 /doc/api
parent213e20052a1c0bde4e788d4fa8f28209ab440575 (diff)
downloadqt-creator-cd0673f78788e3eada78fca68762719260f04cfe.tar.gz
codingstyle: add namespace rules
Change-Id: Ib6b3e37376084e2305143e42c85d13ce66ec9f2b Reviewed-by: Eike Ziller <eike.ziller@nokia.com> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@nokia.com>
Diffstat (limited to 'doc/api')
-rw-r--r--doc/api/coding-style.qdoc23
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/api/coding-style.qdoc b/doc/api/coding-style.qdoc
index 6e9745ea16..8836532846 100644
--- a/doc/api/coding-style.qdoc
+++ b/doc/api/coding-style.qdoc
@@ -492,6 +492,29 @@
important when initialization is done at the same time.
\endlist
+ \section2 Namespaces
+
+ \list
+ \o Put the left curly brace on the same line as the \namespace keyword.
+ \o Do not indent declarations or definitions inside.
+ \o Optional, but recommended if the namespaces spans more than a few lines:
+ Add a comment after the right curly brace repeating the namespace.
+
+ \code
+ namespace MyPlugin {
+
+ void someFunction() { ... }
+
+ } // namespace MyPlugin
+ \endcode
+
+ \o As an exception, if there is only a single class declaration inside
+ the namespace, all can go on a single line:
+ \code
+ namespace MyPlugin { class MyClass; }
+ \endcode
+ \endlist
+
\section1 Patterns and Practices
\section2 Namespacing