From f0b716b9ae6b1cfe15d923a2064a5bc8cd66509c Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Mon, 30 Oct 2023 22:36:52 +0000 Subject: [PATCH] Consolidate namespaces: examples Signed-off-by: Michael Carroll --- .../custom_context_menu/CustomContext.cc | 7 +--- .../custom_context_menu/CustomContext.hh | 22 ++++------- .../dialog_from_plugin/DialogFromPlugin.cc | 7 +--- .../dialog_from_plugin/DialogFromPlugin.hh | 22 ++++------- examples/plugin/gz_components/GzComponents.hh | 18 +++------ examples/plugin/hello_plugin/HelloPlugin.cc | 7 +--- examples/plugin/hello_plugin/HelloPlugin.hh | 38 ++++++++----------- examples/plugin/multiple_qml/MultipleQml.cc | 7 +--- examples/plugin/multiple_qml/MultipleQml.hh | 28 ++++++-------- .../standalone/custom_drawer/custom_drawer.cc | 1 - .../standalone/custom_drawer/custom_drawer.hh | 31 ++++++--------- 11 files changed, 69 insertions(+), 119 deletions(-) diff --git a/examples/plugin/custom_context_menu/CustomContext.cc b/examples/plugin/custom_context_menu/CustomContext.cc index 4aeeb5809..58916be0c 100644 --- a/examples/plugin/custom_context_menu/CustomContext.cc +++ b/examples/plugin/custom_context_menu/CustomContext.cc @@ -20,12 +20,9 @@ #include "CustomContext.hh" -using namespace gz; -using namespace gui; - ///////////////////////////////////////////////// CustomContext::CustomContext() - : Plugin() + : gz::gui::Plugin() { } @@ -36,4 +33,4 @@ CustomContext::~CustomContext() // Register this plugin GZ_ADD_PLUGIN(gz::gui::CustomContext, - gz::gui::Plugin); + gz::gui::Plugin); diff --git a/examples/plugin/custom_context_menu/CustomContext.hh b/examples/plugin/custom_context_menu/CustomContext.hh index e87989f5b..af3139871 100644 --- a/examples/plugin/custom_context_menu/CustomContext.hh +++ b/examples/plugin/custom_context_menu/CustomContext.hh @@ -23,21 +23,15 @@ #include #endif -namespace gz +class CustomContext : public gz::gui::Plugin { - namespace gui - { - class CustomContext : public Plugin - { - Q_OBJECT + Q_OBJECT - /// \brief Constructor - public: CustomContext(); + /// \brief Constructor + public: CustomContext(); - /// \brief Destructor - public: virtual ~CustomContext(); - }; - } -} + /// \brief Destructor + public: virtual ~CustomContext(); +}; -#endif +#endif // GZ_GUI_CUSTOMCONTEXTPLUGIN_HH_ diff --git a/examples/plugin/dialog_from_plugin/DialogFromPlugin.cc b/examples/plugin/dialog_from_plugin/DialogFromPlugin.cc index 019a81a4d..e45a968bd 100644 --- a/examples/plugin/dialog_from_plugin/DialogFromPlugin.cc +++ b/examples/plugin/dialog_from_plugin/DialogFromPlugin.cc @@ -20,12 +20,9 @@ #include "DialogFromPlugin.hh" -using namespace gz; -using namespace gui; - ///////////////////////////////////////////////// DialogFromPlugin::DialogFromPlugin() - : Plugin() + : gz::gui::Plugin() { } @@ -36,4 +33,4 @@ DialogFromPlugin::~DialogFromPlugin() // Register this plugin GZ_ADD_PLUGIN(gz::gui::DialogFromPlugin, - gz::gui::Plugin); + gz::gui::Plugin); diff --git a/examples/plugin/dialog_from_plugin/DialogFromPlugin.hh b/examples/plugin/dialog_from_plugin/DialogFromPlugin.hh index e800d7732..8dd80bc89 100644 --- a/examples/plugin/dialog_from_plugin/DialogFromPlugin.hh +++ b/examples/plugin/dialog_from_plugin/DialogFromPlugin.hh @@ -23,21 +23,15 @@ #include #endif -namespace gz +class DialogFromPlugin : public gz::gui::Plugin { - namespace gui - { - class DialogFromPlugin : public Plugin - { - Q_OBJECT + Q_OBJECT - /// \brief Constructor - public: DialogFromPlugin(); + /// \brief Constructor + public: DialogFromPlugin(); - /// \brief Destructor - public: virtual ~DialogFromPlugin(); - }; - } -} + /// \brief Destructor + public: virtual ~DialogFromPlugin(); +}; -#endif +#endif // GZ_GUI_DIALOGFROMPLUGIN_HH_ diff --git a/examples/plugin/gz_components/GzComponents.hh b/examples/plugin/gz_components/GzComponents.hh index 6137c87b2..e7f0c97fa 100644 --- a/examples/plugin/gz_components/GzComponents.hh +++ b/examples/plugin/gz_components/GzComponents.hh @@ -20,18 +20,12 @@ #include -namespace gz +class GzComponents : public gz::gui::Plugin { - namespace gui - { - class GzComponents : public Plugin - { - Q_OBJECT + Q_OBJECT - /// \brief Constructor - public: GzComponents() = default; - }; - } -} + /// \brief Constructor + public: GzComponents() = default; +}; -#endif +#endif // GZ_GUI_EXAMPLES_PLUGIN_GZCOMPONENTS_HH_ diff --git a/examples/plugin/hello_plugin/HelloPlugin.cc b/examples/plugin/hello_plugin/HelloPlugin.cc index c95fa0516..c7bbce5f8 100644 --- a/examples/plugin/hello_plugin/HelloPlugin.cc +++ b/examples/plugin/hello_plugin/HelloPlugin.cc @@ -20,12 +20,9 @@ #include "HelloPlugin.hh" -using namespace gz; -using namespace gui; - ///////////////////////////////////////////////// HelloPlugin::HelloPlugin() - : Plugin() + : gz::gui::Plugin() { } @@ -54,4 +51,4 @@ void HelloPlugin::OnButton() // Register this plugin GZ_ADD_PLUGIN(gz::gui::HelloPlugin, - gz::gui::Plugin); + gz::gui::Plugin); diff --git a/examples/plugin/hello_plugin/HelloPlugin.hh b/examples/plugin/hello_plugin/HelloPlugin.hh index 4e545be2a..504d15e6c 100644 --- a/examples/plugin/hello_plugin/HelloPlugin.hh +++ b/examples/plugin/hello_plugin/HelloPlugin.hh @@ -23,32 +23,26 @@ #include #include -namespace gz +class HelloPlugin : public gz::gui::Plugin { - namespace gui - { - class HelloPlugin : public Plugin - { - Q_OBJECT + Q_OBJECT - /// \brief Constructor - public: HelloPlugin(); + /// \brief Constructor + public: HelloPlugin(); - /// \brief Destructor - public: virtual ~HelloPlugin(); + /// \brief Destructor + public: virtual ~HelloPlugin(); - /// \brief Called by Gazebo GUI when plugin is instantiated. - /// \param[in] _pluginElem XML configuration for this plugin. - public: virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem) - override; + /// \brief Called by Gazebo GUI when plugin is instantiated. + /// \param[in] _pluginElem XML configuration for this plugin. + public: virtual void LoadConfig(const tinyxml2::XMLElement *_pluginElem) + override; - /// \brief Callback trigged when the button is pressed. - protected slots: void OnButton(); + /// \brief Callback trigged when the button is pressed. + protected slots: void OnButton(); - /// \brief Message to be printed when button is pressed. - private: std::string message{"Hello, plugin!"}; - }; - } -} + /// \brief Message to be printed when button is pressed. + private: std::string message{"Hello, plugin!"}; +}; -#endif +#endif // GZ_GUI_HELLOPLUGIN_HH_ diff --git a/examples/plugin/multiple_qml/MultipleQml.cc b/examples/plugin/multiple_qml/MultipleQml.cc index 72f2c599f..7fa6b3500 100644 --- a/examples/plugin/multiple_qml/MultipleQml.cc +++ b/examples/plugin/multiple_qml/MultipleQml.cc @@ -20,12 +20,9 @@ #include "MultipleQml.hh" -using namespace gz; -using namespace gui; - ///////////////////////////////////////////////// MultipleQml::MultipleQml() - : Plugin() + : gz::gui::Plugin() { } @@ -42,4 +39,4 @@ void MultipleQml::OnButton(const QString &_text) // Register this plugin GZ_ADD_PLUGIN(gz::gui::MultipleQml, - gz::gui::Plugin); + gz::gui::Plugin); diff --git a/examples/plugin/multiple_qml/MultipleQml.hh b/examples/plugin/multiple_qml/MultipleQml.hh index ae0d9114f..63733dfac 100644 --- a/examples/plugin/multiple_qml/MultipleQml.hh +++ b/examples/plugin/multiple_qml/MultipleQml.hh @@ -23,25 +23,19 @@ #include #endif -namespace gz +class MultipleQml : public gz::gui::Plugin { - namespace gui - { - class MultipleQml : public Plugin - { - Q_OBJECT + Q_OBJECT - /// \brief Constructor - public: MultipleQml(); + /// \brief Constructor + public: MultipleQml(); - /// \brief Destructor - public: virtual ~MultipleQml(); + /// \brief Destructor + public: virtual ~MultipleQml(); - /// \brief Callback trigged when the button is pressed. - /// \param[in] _text Button text. - protected slots: void OnButton(const QString &_text); - }; - } -} + /// \brief Callback trigged when the button is pressed. + /// \param[in] _text Button text. + protected slots: void OnButton(const QString &_text); +}; -#endif +#endif // GZ_GUI_EXAMPLES_PLUGINS_MULTIPLEQML_HH_ diff --git a/examples/standalone/custom_drawer/custom_drawer.cc b/examples/standalone/custom_drawer/custom_drawer.cc index af975095b..38ff840ea 100644 --- a/examples/standalone/custom_drawer/custom_drawer.cc +++ b/examples/standalone/custom_drawer/custom_drawer.cc @@ -65,4 +65,3 @@ int main(int _argc, char **_argv) return 0; } - diff --git a/examples/standalone/custom_drawer/custom_drawer.hh b/examples/standalone/custom_drawer/custom_drawer.hh index e062afa69..5d6344ba4 100644 --- a/examples/standalone/custom_drawer/custom_drawer.hh +++ b/examples/standalone/custom_drawer/custom_drawer.hh @@ -24,25 +24,18 @@ #include #endif -namespace gz +/// \brief Object holding actions which can be triggered from the custom +/// drawer. +class CustomActions : public QObject { - namespace gui - { - /// \brief Object holding actions which can be triggered from the custom - /// drawer. - class CustomActions : public QObject - { - Q_OBJECT - - /// \brief Demonstrates a C++ function which can be called from the - /// drawer's QML code. - public: Q_INVOKABLE void cppActionFromQml() const - { - std::cout << "C++ action called from QML" << std::endl; - } - }; - } -} + Q_OBJECT -#endif + /// \brief Demonstrates a C++ function which can be called from the + /// drawer's QML code. + public: Q_INVOKABLE void cppActionFromQml() const + { + std::cout << "C++ action called from QML" << std::endl; + } +}; +#endif //GZ_GUI_EXAMPLES_STANDALONE_CUSTOMDRAWER_HH_