[Spice-devel] [PATCH spice-server] style: Update style to include some C++ element

Frediano Ziglio fziglio at redhat.com
Tue Feb 6 22:28:49 UTC 2018


These style are used by other SPICE projects like spice-streaming-agent.
See discussion "Coding style and naming conventions for C++" at
https://lists.freedesktop.org/archives/spice-devel/2018-January/041562.html.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 docs/spice_style.txt | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/docs/spice_style.txt b/docs/spice_style.txt
index eb0e30ef..0e0028e9 100644
--- a/docs/spice_style.txt
+++ b/docs/spice_style.txt
@@ -1,7 +1,7 @@
 Spice project coding style and coding conventions
 =================================================
 
-Copyright (C) 2009-2016 Red Hat, Inc.
+Copyright (C) 2009-2018 Red Hat, Inc.
 Licensed under a Creative Commons Attribution-Share Alike 3.0
 United States License (see http://creativecommons.org/licenses/by-sa/3.0/us/legalcode).
 
@@ -379,3 +379,39 @@ Also in source (no header) files you must include `config.h` at the beginning so
 
 #include "spice_server.h"
 ----
+
+C++
+---
+C++ follows C style if not specified otherwise.
+
+Method names
+~~~~~~~~~~~~
+
+Method names should use lower case and separate words with
+underscores.
+
+
+Namespaces
+~~~~~~~~~~
+
+Namespaces should use lower case and separate words with underscores.
+Namespace blocks should not increase indentation.
+Namespaces can be nested and closure can be collapsed but for
+readability reasons the closure should specify the namespace with a
+comment.
+
+[source,cpp]
+----
+namespace spice {
+namespace streaming_agent {
+
+class ClassInsideNamespace
+{
+...
+};
+
+}} // namespace spice::streaming_agent
+----
+
+You should not import an entire namespace but use qualified names
+instead.
-- 
2.14.3



More information about the Spice-devel mailing list