Commit 6a5fa49c authored by Adrien Béraud's avatar Adrien Béraud

serializable: make serialize const

Change-Id: I983b9255b34f36a89dc9a0b09422c5b284dd8e34
parent b322fb79
......@@ -211,7 +211,7 @@ join_string(const std::vector<unsigned> &v)
}
void
Account::serialize(YAML::Emitter& out)
Account::serialize(YAML::Emitter& out) const
{
const auto& activeCodecs = join_string(getActiveCodecs(MEDIA_ALL));
......
......@@ -105,7 +105,7 @@ class Account : public Serializable, public std::enable_shared_from_this<Account
*/
virtual void loadConfig() = 0;
virtual void serialize(YAML::Emitter &out);
virtual void serialize(YAML::Emitter &out) const;
virtual void unserialize(const YAML::Node &node);
/**
......
......@@ -32,7 +32,7 @@ class Serializable {
public:
virtual ~Serializable() {};
virtual void serialize(YAML::Emitter &out) = 0;
virtual void serialize(YAML::Emitter &out) const = 0;
virtual void unserialize(const YAML::Node &node) = 0;
};
......
......@@ -637,7 +637,7 @@ JamiAccount::SIPStartCall(SIPCall& call, IpAddr target)
return true;
}
void JamiAccount::serialize(YAML::Emitter &out)
void JamiAccount::serialize(YAML::Emitter &out) const
{
std::lock_guard<std::mutex> lock(configurationMutex_);
......
......@@ -121,7 +121,7 @@ class JamiAccount : public SIPAccountBase {
* Serialize internal state of this account for configuration
* @param YamlEmitter the configuration engine which generate the configuration file
*/
virtual void serialize(YAML::Emitter &out) override;
virtual void serialize(YAML::Emitter &out) const override;
/**
* Populate the internal state for this account based on info stored in the configuration file
......
......@@ -312,7 +312,7 @@ VideoDeviceMonitor::overwritePreferences(VideoSettings settings)
}
void
VideoDeviceMonitor::serialize(YAML::Emitter &out)
VideoDeviceMonitor::serialize(YAML::Emitter &out) const
{
std::lock_guard<std::mutex> l(lock_);
out << YAML::Key << "devices" << YAML::Value << preferences_;
......
......@@ -69,8 +69,8 @@ class VideoDeviceMonitor : public Serializable
/*
* Interface to load from/store to the (YAML) configuration file.
*/
void serialize(YAML::Emitter &out);
virtual void unserialize(const YAML::Node &in);
void serialize(YAML::Emitter &out) const override;
virtual void unserialize(const YAML::Node &in) override;
private:
NON_COPYABLE(VideoDeviceMonitor);
......
......@@ -205,7 +205,7 @@ void Preferences::removeAccount(const std::string &oldAccountID)
accountOrder_.erase(start, oldAccountID.length() + 1);
}
void Preferences::serialize(YAML::Emitter &out)
void Preferences::serialize(YAML::Emitter &out) const
{
out << YAML::Key << CONFIG_LABEL << YAML::Value << YAML::BeginMap;
......@@ -243,7 +243,7 @@ VoipPreference::VoipPreference() :
, symmetricRtp_(true)
{}
void VoipPreference::serialize(YAML::Emitter &out)
void VoipPreference::serialize(YAML::Emitter &out) const
{
out << YAML::Key << CONFIG_LABEL << YAML::Value << YAML::BeginMap;
out << YAML::Key << PLAY_DTMF_KEY << YAML::Value << playDtmf_;
......@@ -292,7 +292,7 @@ std::map<std::string, std::string> HookPreference::toMap() const
return settings;
}
void HookPreference::serialize(YAML::Emitter &out)
void HookPreference::serialize(YAML::Emitter &out) const
{
out << YAML::Key << CONFIG_LABEL << YAML::Value << YAML::BeginMap;
out << YAML::Key << NUMBER_ADD_PREFIX_KEY << YAML::Value << numberAddPrefix_;
......@@ -431,7 +431,7 @@ AudioPreference::createAudioLayer()
return nullptr;
}
void AudioPreference::serialize(YAML::Emitter &out)
void AudioPreference::serialize(YAML::Emitter &out) const
{
out << YAML::Key << CONFIG_LABEL << YAML::Value << YAML::BeginMap;
// alsa submap
......@@ -538,7 +538,7 @@ void ShortcutPreferences::setShortcuts(std::map<std::string, std::string> map)
}
void ShortcutPreferences::serialize(YAML::Emitter &out)
void ShortcutPreferences::serialize(YAML::Emitter &out) const
{
out << YAML::Key << CONFIG_LABEL << YAML::Value << YAML::BeginMap;
out << YAML::Key << HANGUP_SHORT_KEY << YAML::Value << hangup_;
......@@ -567,7 +567,7 @@ VideoPreferences::VideoPreferences()
{
}
void VideoPreferences::serialize(YAML::Emitter &out)
void VideoPreferences::serialize(YAML::Emitter &out) const
{
out << YAML::Key << CONFIG_LABEL << YAML::Value << YAML::BeginMap;
#ifdef RING_ACCEL
......
......@@ -45,8 +45,8 @@ class Preferences : public Serializable {
Preferences();
void serialize(YAML::Emitter &out);
void unserialize(const YAML::Node &in);
void serialize(YAML::Emitter &out) const override;
void unserialize(const YAML::Node &in) override;
std::string getAccountOrder() const {
return accountOrder_;
......@@ -142,8 +142,8 @@ class VoipPreference : public Serializable {
public:
VoipPreference();
void serialize(YAML::Emitter &out);
void unserialize(const YAML::Node &in);
void serialize(YAML::Emitter &out) const override;
void unserialize(const YAML::Node &in) override;
bool getPlayDtmf() const {
return playDtmf_;
......@@ -197,8 +197,8 @@ class HookPreference : public Serializable {
HookPreference();
HookPreference(const std::map<std::string, std::string> &settings);
void serialize(YAML::Emitter &out);
void unserialize(const YAML::Node &in);
void serialize(YAML::Emitter &out) const override;
void unserialize(const YAML::Node &in) override;
std::string getNumberAddPrefix() const {
if (numberEnabled_)
......@@ -235,8 +235,8 @@ class AudioPreference : public Serializable {
audioApi_ = api;
}
void serialize(YAML::Emitter &out);
void unserialize(const YAML::Node &in);
void serialize(YAML::Emitter &out) const override;
void unserialize(const YAML::Node &in) override;
// alsa preference
int getAlsaCardin() const {
......@@ -394,8 +394,8 @@ class AudioPreference : public Serializable {
class ShortcutPreferences : public Serializable {
public:
ShortcutPreferences();
void serialize(YAML::Emitter &out);
void unserialize(const YAML::Node &in);
void serialize(YAML::Emitter &out) const override;
void unserialize(const YAML::Node &in) override;
void setShortcuts(std::map<std::string, std::string> shortcuts);
std::map<std::string, std::string> getShortcuts() const;
......@@ -454,8 +454,8 @@ class VideoPreferences : public Serializable {
public:
VideoPreferences();
void serialize(YAML::Emitter &out);
void unserialize(const YAML::Node &in);
void serialize(YAML::Emitter &out) const override;
void unserialize(const YAML::Node &in) override;
bool getDecodingAccelerated() const {
return decodingAccelerated_;
......
......@@ -390,7 +390,7 @@ SIPAccount::SIPStartCall(std::shared_ptr<SIPCall>& call)
return true;
}
void SIPAccount::serialize(YAML::Emitter &out)
void SIPAccount::serialize(YAML::Emitter &out) const
{
std::lock_guard<std::mutex> lock(configurationMutex_);
......
......@@ -116,7 +116,7 @@ class SIPAccount : public SIPAccountBase {
* Serialize internal state of this account for configuration
* @param out Emitter to which state will be saved
*/
virtual void serialize(YAML::Emitter &out) override;
virtual void serialize(YAML::Emitter &out) const override;
/**
* Populate the internal state for this account based on info stored in the configuration file
......
......@@ -142,7 +142,7 @@ addRangeToDetails(std::map<std::string, std::string> &a, const char *minKey,
a.emplace(maxKey, jami::to_string(range.second));
}
void SIPAccountBase::serialize(YAML::Emitter &out)
void SIPAccountBase::serialize(YAML::Emitter &out) const
{
Account::serialize(out);
......@@ -167,7 +167,7 @@ void SIPAccountBase::serialize(YAML::Emitter &out)
out << YAML::Key << Conf::TURN_SERVER_REALM_KEY << YAML::Value << turnServerRealm_;
}
void SIPAccountBase::serializeTls(YAML::Emitter &out)
void SIPAccountBase::serializeTls(YAML::Emitter &out) const
{
out << YAML::Key << Conf::CALIST_KEY << YAML::Value << tlsCaListFile_;
out << YAML::Key << Conf::CERTIFICATE_KEY << YAML::Value << tlsCertificateFile_;
......
......@@ -298,8 +298,8 @@ public: // overloaded methods
virtual void flush() override;
protected:
virtual void serialize(YAML::Emitter &out) override;
virtual void serializeTls(YAML::Emitter &out);
virtual void serialize(YAML::Emitter &out) const override;
virtual void serializeTls(YAML::Emitter &out) const;
virtual void unserialize(const YAML::Node &node) override;
virtual void setAccountDetails(const std::map<std::string, std::string> &details) override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment