[Spice-devel] [PATCH spice-streaming-agent] Change name space to spice::streaming_agent

Lukáš Hrázký lhrazky at redhat.com
Thu Feb 8 14:20:50 UTC 2018


On Thu, 2018-02-08 at 14:00 +0000, Frediano Ziglio wrote:
> Discussed recently on the mailing list.
> This patch changes the namespace name only.
> 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>
> ---
>  include/spice-streaming-agent/frame-capture.hpp | 5 +++--
>  include/spice-streaming-agent/plugin.hpp        | 9 +++++----
>  src/concrete-agent.cpp                          | 2 +-
>  src/concrete-agent.hpp                          | 5 +++--
>  src/mjpeg-fallback.cpp                          | 2 +-
>  src/mjpeg-fallback.hpp                          | 5 +++--
>  src/spice-streaming-agent.cpp                   | 2 +-
>  src/static-plugin.cpp                           | 2 +-
>  src/static-plugin.hpp                           | 5 +++--
>  9 files changed, 21 insertions(+), 16 deletions(-)
> 
> diff --git a/include/spice-streaming-agent/frame-capture.hpp b/include/spice-streaming-agent/frame-capture.hpp
> index 6c41e04..313e07b 100644
> --- a/include/spice-streaming-agent/frame-capture.hpp
> +++ b/include/spice-streaming-agent/frame-capture.hpp
> @@ -10,7 +10,8 @@
>  
>  #include <spice/enums.h>
>  
> -namespace SpiceStreamingAgent {
> +namespace spice {
> +namespace streaming_agent {
>  
>  struct FrameSize
>  {
> @@ -57,6 +58,6 @@ protected:
>      void operator=(const FrameCapture&) = delete;
>  };
>  
> -}
> +}} // spice::streaming_agent
>  
>  #endif // SPICE_STREAMING_AGENT_FRAME_CAPTURE_HPP
> diff --git a/include/spice-streaming-agent/plugin.hpp b/include/spice-streaming-agent/plugin.hpp
> index f1d5d60..28096dc 100644
> --- a/include/spice-streaming-agent/plugin.hpp
> +++ b/include/spice-streaming-agent/plugin.hpp
> @@ -17,7 +17,8 @@
>   * Plugins and register them.
>   */
>  
> -namespace SpiceStreamingAgent {
> +namespace spice {
> +namespace streaming_agent {
>  
>  class FrameCapture;
>  
> @@ -129,9 +130,9 @@ public:
>      virtual const ConfigureOption* Options() const = 0;
>  };
>  
> -typedef bool PluginInitFunc(SpiceStreamingAgent::Agent* agent);
> +typedef bool PluginInitFunc(spice::streaming_agent::Agent* agent);
>  
> -}
> +}} // spice::streaming_agent
>  
>  #ifndef SPICE_STREAMING_AGENT_PROGRAM
>  /*!
> @@ -146,7 +147,7 @@ typedef bool PluginInitFunc(SpiceStreamingAgent::Agent* agent);
>   * the plugin which could be a problem in some systems.
>   * \return true if plugin should stay loaded, false otherwise
>   */
> -extern "C" SpiceStreamingAgent::PluginInitFunc spice_streaming_agent_plugin_init;
> +extern "C" spice::streaming_agent::PluginInitFunc spice_streaming_agent_plugin_init;
>  #endif
>  
>  #endif // SPICE_STREAMING_AGENT_PLUGIN_HPP
> diff --git a/src/concrete-agent.cpp b/src/concrete-agent.cpp
> index 873a69e..ebeef33 100644
> --- a/src/concrete-agent.cpp
> +++ b/src/concrete-agent.cpp
> @@ -14,7 +14,7 @@
>  #include "static-plugin.hpp"
>  
>  using namespace std;
> -using namespace SpiceStreamingAgent;
> +using namespace spice::streaming_agent;
>  
>  static inline unsigned MajorVersion(unsigned version)
>  {
> diff --git a/src/concrete-agent.hpp b/src/concrete-agent.hpp
> index b5876a5..0a8aeec 100644
> --- a/src/concrete-agent.hpp
> +++ b/src/concrete-agent.hpp
> @@ -11,7 +11,8 @@
>  #include <memory>
>  #include <spice-streaming-agent/plugin.hpp>
>  
> -namespace SpiceStreamingAgent {
> +namespace spice {
> +namespace streaming_agent {
>  
>  struct ConcreteConfigureOption: ConfigureOption
>  {
> @@ -42,6 +43,6 @@ private:
>      std::vector<ConcreteConfigureOption> options;
>  };
>  
> -}
> +}} // spice::streaming_agent
>  
>  #endif // SPICE_STREAMING_AGENT_CONCRETE_AGENT_HPP
> diff --git a/src/mjpeg-fallback.cpp b/src/mjpeg-fallback.cpp
> index 7c918a7..10543ad 100644
> --- a/src/mjpeg-fallback.cpp
> +++ b/src/mjpeg-fallback.cpp
> @@ -19,7 +19,7 @@
>  #include "jpeg.hpp"
>  
>  using namespace std;
> -using namespace SpiceStreamingAgent;
> +using namespace spice::streaming_agent;
>  
>  #define ERROR(args) do { \
>      std::ostringstream _s; \
> diff --git a/src/mjpeg-fallback.hpp b/src/mjpeg-fallback.hpp
> index 8044244..a5f1037 100644
> --- a/src/mjpeg-fallback.hpp
> +++ b/src/mjpeg-fallback.hpp
> @@ -10,7 +10,8 @@
>  #include <spice-streaming-agent/frame-capture.hpp>
>  
>  
> -namespace SpiceStreamingAgent {
> +namespace spice {
> +namespace streaming_agent {
>  
>  struct MjpegSettings
>  {
> @@ -29,6 +30,6 @@ private:
>      MjpegSettings settings = { 10, 80 };
>  };
>  
> -} // namespace SpiceStreamingAgent
> +}} // spice::streaming_agent
>  
>  #endif // SPICE_STREAMING_AGENT_MJPEG_FALLBACK_HPP
> diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
> index 94d9d25..0e7641e 100644
> --- a/src/spice-streaming-agent.cpp
> +++ b/src/spice-streaming-agent.cpp
> @@ -36,7 +36,7 @@
>  #include "concrete-agent.hpp"
>  
>  using namespace std;
> -using namespace SpiceStreamingAgent;
> +using namespace spice::streaming_agent;
>  
>  static ConcreteAgent agent;
>  
> diff --git a/src/static-plugin.cpp b/src/static-plugin.cpp
> index d5feb22..c8d55f0 100644
> --- a/src/static-plugin.cpp
> +++ b/src/static-plugin.cpp
> @@ -11,7 +11,7 @@
>  #include <stdlib.h>
>  #include "static-plugin.hpp"
>  
> -using namespace SpiceStreamingAgent;
> +using namespace spice::streaming_agent;
>  
>  const StaticPlugin *StaticPlugin::list = nullptr;
>  
> diff --git a/src/static-plugin.hpp b/src/static-plugin.hpp
> index 5436b41..4399a9a 100644
> --- a/src/static-plugin.hpp
> +++ b/src/static-plugin.hpp
> @@ -8,7 +8,8 @@
>  
>  #include <spice-streaming-agent/plugin.hpp>
>  
> -namespace SpiceStreamingAgent {
> +namespace spice {
> +namespace streaming_agent {
>  
>  class StaticPlugin final {
>  public:
> @@ -30,6 +31,6 @@ private:
>      static const StaticPlugin *list;
>  };
>  
> -}
> +}} // spice::streaming_agent
>  
>  #endif // SPICE_STREAMING_AGENT_STATIC_PLUGIN_HPP

As per our style guide :) :) the closing comment should be:

}} // namespace spice::streaming_agent

This is imo better since with anonymous namespaces you can do:

} // namespace

With that,
Acked-by: Lukáš Hrázký <lhrazky at redhat.com>


More information about the Spice-devel mailing list