Changed to astyle format and added comment

This commit is contained in:
Klaus Basan
2014-01-13 13:26:30 +01:00
parent 11666da76a
commit 959f171edf
2 changed files with 170 additions and 146 deletions

View File

@@ -8,63 +8,86 @@
namespace BlackCore namespace BlackCore
{ {
/* /*
* Constructor * Constructor
*/ */
CCoreRuntime::CCoreRuntime(bool withDbus, QObject *parent) : CCoreRuntime::CCoreRuntime(bool withDbus, QObject *parent) :
QObject(parent), m_init(false), m_dbusServer(nullptr), QObject(parent), m_init(false), m_dbusServer(nullptr),
m_contextNetwork(nullptr), m_contextVoice(nullptr), m_contextNetwork(nullptr), m_contextVoice(nullptr),
m_contextSettings(nullptr), m_contextApplication(nullptr) m_contextSettings(nullptr), m_contextApplication(nullptr)
{ {
this->init(withDbus); this->init(withDbus);
} }
/* /*
* Init runtime * Init runtime
*/ */
void CCoreRuntime::init(bool withDbus) void CCoreRuntime::init(bool withDbus)
{ {
if (m_init) return; if (m_init) return;
BlackMisc::registerMetadata(); BlackMisc::registerMetadata();
BlackMisc::initResources(); BlackMisc::initResources();
// TODO: read settings // TODO: read settings
if (withDbus) if (withDbus) {
{ QString dBusAddress = "session";
QString dBusAddress = "session"; this->m_dbusServer = new CDBusServer(dBusAddress, this);
this->m_dbusServer = new CDBusServer(dBusAddress, this); }
}
// contexts
// contexts this->m_contextSettings = new CContextSettings(this);
this->m_contextSettings = new CContextSettings(this); if (withDbus) this->m_contextSettings->registerWithDBus(this->m_dbusServer);
if (withDbus) this->m_contextSettings->registerWithDBus(this->m_dbusServer);
this->m_contextNetwork = new CContextNetwork(this);
this->m_contextNetwork = new CContextNetwork(this); if (withDbus) this->m_contextNetwork->registerWithDBus(this->m_dbusServer);
if (withDbus) this->m_contextNetwork->registerWithDBus(this->m_dbusServer);
this->m_contextApplication = new CContextApplication(this);
this->m_contextApplication = new CContextApplication(this); if (withDbus) this->m_contextApplication->registerWithDBus(this->m_dbusServer);
if (withDbus) this->m_contextApplication->registerWithDBus(this->m_dbusServer);
this->m_contextVoice = new CContextVoice(this);
this->m_contextVoice = new CContextVoice(this); if (withDbus) this->m_contextVoice->registerWithDBus(this->m_dbusServer);
if (withDbus) this->m_contextVoice->registerWithDBus(this->m_dbusServer);
// flag
// flag m_init = true;
m_init = true; }
}
IContextNetwork *CCoreRuntime::getIContextNetwork()
IContextNetwork *CCoreRuntime::getIContextNetwork() { return this->m_contextNetwork; } {
return this->m_contextNetwork;
const IContextNetwork *CCoreRuntime::getIContextNetwork() const { return this->m_contextNetwork; } }
IContextVoice *CCoreRuntime::getIContextVoice() { return this->m_contextVoice; } const IContextNetwork *CCoreRuntime::getIContextNetwork() const
{
const IContextVoice *CCoreRuntime::getIContextVoice() const { return this->m_contextVoice; } return this->m_contextNetwork;
}
IContextSettings *CCoreRuntime::getIContextSettings() { return this->m_contextSettings; }
IContextVoice *CCoreRuntime::getIContextVoice()
const IContextSettings *CCoreRuntime::getIContextSettings() const { return this->m_contextSettings; } {
return this->m_contextVoice;
const IContextApplication *CCoreRuntime::getIContextApplication() const { return this->m_contextApplication; } }
IContextApplication *CCoreRuntime::getIContextApplication() { return this->m_contextApplication; } const IContextVoice *CCoreRuntime::getIContextVoice() const
{
return this->m_contextVoice;
}
IContextSettings *CCoreRuntime::getIContextSettings()
{
return this->m_contextSettings;
}
const IContextSettings *CCoreRuntime::getIContextSettings() const
{
return this->m_contextSettings;
}
const IContextApplication *CCoreRuntime::getIContextApplication() const
{
return this->m_contextApplication;
}
IContextApplication *CCoreRuntime::getIContextApplication()
{
return this->m_contextApplication;
}
} }

View File

@@ -5,108 +5,109 @@
namespace BlackCore namespace BlackCore
{ {
class CDBusServer; // forward declaration, see review
class CContextNetwork; // https://dev.vatsim-germany.org/boards/22/topics/1350?r=1359#message-1359
class CContextVoice; class CDBusServer;
class CContextSettings; class CContextNetwork;
class CContextApplication; class CContextVoice;
class IContextNetwork; class CContextSettings;
class IContextVoice; class CContextApplication;
class IContextSettings; class IContextNetwork;
class IContextApplication; class IContextVoice;
class IContextSettings;
class IContextApplication;
/*!
* \brief The CCoreRuntime class
*/
class CCoreRuntime : public QObject
{
Q_OBJECT
private:
bool m_init; /*!< flag */
CDBusServer *m_dbusServer;
CContextNetwork *m_contextNetwork;
CContextVoice *m_contextVoice;
CContextSettings *m_contextSettings;
CContextApplication *m_contextApplication;
/*! /*!
* \brief The CCoreRuntime class * \brief Init
* \param withDbus
*/ */
class CCoreRuntime : public QObject void init(bool withDbus);
{
Q_OBJECT
private: public:
bool m_init; /*!< flag */ /*!
CDBusServer *m_dbusServer; * \brief Constructor
CContextNetwork *m_contextNetwork; * \param withDbus
CContextVoice *m_contextVoice; * \param parent
CContextSettings *m_contextSettings; */
CContextApplication *m_contextApplication; CCoreRuntime(bool withDbus = true, QObject *parent = nullptr);
/*! /*!
* \brief Init * \brief Destructor
* \param withDbus */
*/ virtual ~CCoreRuntime() {}
void init(bool withDbus);
public: /*!
/*! * \brief DBus server
* \brief Constructor * \return
* \param withDbus */
* \param parent const CDBusServer *getDBusServer() const {
*/ return this->m_dbusServer;
CCoreRuntime(bool withDbus = true, QObject *parent = nullptr); }
/*! /*!
* \brief Destructor * \brief Context for network
*/ * \return
virtual ~CCoreRuntime() {} */
IContextNetwork *getIContextNetwork();
/*! /*!
* \brief DBus server * \brief Context for network
* \return * \return
*/ */
const CDBusServer *getDBusServer() const const IContextNetwork *getIContextNetwork() const;
{
return this->m_dbusServer;
}
/*! /*!
* \brief Context for network * \brief Context for network
* \return * \return
*/ */
IContextNetwork *getIContextNetwork(); IContextVoice *getIContextVoice();
/*! /*!
* \brief Context for network * \brief Context for network
* \return * \return
*/ */
const IContextNetwork *getIContextNetwork() const; const IContextVoice *getIContextVoice() const;
/*!
* \brief Context for network
* \return
*/
IContextVoice *getIContextVoice();
/*!
* \brief Context for network
* \return
*/
const IContextVoice *getIContextVoice() const;
/*! /*!
* \brief Settings * \brief Settings
* \return * \return
*/ */
IContextSettings *getIContextSettings(); IContextSettings *getIContextSettings();
/*! /*!
* \brief Settings * \brief Settings
* \return * \return
*/ */
const IContextSettings *getIContextSettings() const; const IContextSettings *getIContextSettings() const;
/*! /*!
* \brief Context for application * \brief Context for application
* \return * \return
*/ */
const IContextApplication *getIContextApplication() const; const IContextApplication *getIContextApplication() const;
/*! /*!
* \brief Application * \brief Application
* \return * \return
*/ */
IContextApplication *getIContextApplication(); IContextApplication *getIContextApplication();
}; };
} }
#endif // guard #endif // guard