mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Ref T709 Prevent instantiation of CXSwiftBusSettingsQtFree, to avoid slicing.
- Constructors and destructor are protected. - Therefore destructor doesn't need to be virtual. - objectUpdated is pure virtual, so the class is abstract. - Both derived classes are declared final.
This commit is contained in:
@@ -27,7 +27,7 @@ namespace BlackMisc
|
|||||||
namespace Settings
|
namespace Settings
|
||||||
{
|
{
|
||||||
//! XSwiftBus settings
|
//! XSwiftBus settings
|
||||||
class BLACKMISC_EXPORT CXSwiftBusSettings :
|
class BLACKMISC_EXPORT CXSwiftBusSettings final :
|
||||||
public CValueObject<CXSwiftBusSettings>,
|
public CValueObject<CXSwiftBusSettings>,
|
||||||
public CXSwiftBusSettingsQtFree,
|
public CXSwiftBusSettingsQtFree,
|
||||||
public ITimestampBased
|
public ITimestampBased
|
||||||
@@ -88,7 +88,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! \copydoc CXSwiftBusSettingsQtFree::objectUpdated
|
//! \copydoc CXSwiftBusSettingsQtFree::objectUpdated
|
||||||
virtual void objectUpdated() override;
|
virtual void objectUpdated() override final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BLACK_METACLASS(
|
BLACK_METACLASS(
|
||||||
|
|||||||
@@ -147,11 +147,6 @@ namespace BlackMisc
|
|||||||
const milliseconds ms = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
|
const milliseconds ms = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
|
||||||
m_msSinceEpochQtFree = static_cast<int64_t>(ms.count());
|
m_msSinceEpochQtFree = static_cast<int64_t>(ms.count());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXSwiftBusSettingsQtFree::objectUpdated()
|
|
||||||
{
|
|
||||||
// void
|
|
||||||
}
|
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -24,16 +24,17 @@ namespace BlackMisc
|
|||||||
*/
|
*/
|
||||||
class CXSwiftBusSettingsQtFree
|
class CXSwiftBusSettingsQtFree
|
||||||
{
|
{
|
||||||
public:
|
protected:
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
CXSwiftBusSettingsQtFree();
|
CXSwiftBusSettingsQtFree();
|
||||||
|
|
||||||
//! JSON Constructor.
|
//! JSON Constructor.
|
||||||
CXSwiftBusSettingsQtFree(const std::string &json);
|
CXSwiftBusSettingsQtFree(const std::string &json);
|
||||||
|
|
||||||
//! Dtor
|
//! Destructor.
|
||||||
virtual ~CXSwiftBusSettingsQtFree() {}
|
~CXSwiftBusSettingsQtFree() = default;
|
||||||
|
|
||||||
|
public:
|
||||||
//! DBus server
|
//! DBus server
|
||||||
const std::string &getDBusServerAddress() const { return m_dBusServerAddress; }
|
const std::string &getDBusServerAddress() const { return m_dBusServerAddress; }
|
||||||
|
|
||||||
@@ -112,7 +113,7 @@ namespace BlackMisc
|
|||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
//! Object has been updated
|
//! Object has been updated
|
||||||
virtual void objectUpdated();
|
virtual void objectUpdated() = 0;
|
||||||
|
|
||||||
std::string m_dBusServerAddress { "tcp:host=127.0.0.1,port=45001" }; //!< DBus server
|
std::string m_dBusServerAddress { "tcp:host=127.0.0.1,port=45001" }; //!< DBus server
|
||||||
std::string m_nightTextureMode { "auto" }; //!< night texture mode
|
std::string m_nightTextureMode { "auto" }; //!< night texture mode
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace XSwiftBus
|
|||||||
/*!
|
/*!
|
||||||
* XSwiftBus/swift side settings class, JSON capable, shared among all services
|
* XSwiftBus/swift side settings class, JSON capable, shared among all services
|
||||||
*/
|
*/
|
||||||
class CSettings : public BlackMisc::Simulation::Settings::CXSwiftBusSettingsQtFree
|
class CSettings final : public BlackMisc::Simulation::Settings::CXSwiftBusSettingsQtFree
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
@@ -27,8 +27,9 @@ namespace XSwiftBus
|
|||||||
//! JSON constructor
|
//! JSON constructor
|
||||||
CSettings(const std::string &json);
|
CSettings(const std::string &json);
|
||||||
|
|
||||||
//! Destructor;
|
protected:
|
||||||
virtual ~CSettings() {}
|
//! \copydoc CXSwiftBusSettingsQtFree::objectUpdated
|
||||||
|
virtual void objectUpdated() override final {}
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Something owning the settings
|
//! Something owning the settings
|
||||||
|
|||||||
Reference in New Issue
Block a user