Commit 5f455af2 authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #6660: use const char * const, not std::string for globally visible constants

parent ce774cc5
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <sstream> #include <sstream>
#include "global.h" #include "global.h"
#include <cassert> #include <cassert>
const char * const Preferences::DFT_ZONE = "North America"; const char * const Preferences::DFT_ZONE = "North America";
namespace { namespace {
...@@ -140,17 +140,12 @@ void Preferences::unserialize (Conf::MappingNode *map) ...@@ -140,17 +140,12 @@ void Preferences::unserialize (Conf::MappingNode *map)
} }
VoipPreference::VoipPreference() : _playDtmf (true) VoipPreference::VoipPreference() : _playDtmf (true)
, _playTones (true) , _playTones (true)
, _pulseLength (atoi (DFT_PULSE_LENGTH_STR)) // DFT_PULSE_LENGTH_STR , _pulseLength (atoi (DFT_PULSE_LENGTH_STR)) // DFT_PULSE_LENGTH_STR
, _symmetricRtp (true) , _symmetricRtp (true)
, _zidFile (ZRTP_ZIDFILE) // ZRTP_ZID_FILENAME , _zidFile (ZRTP_ZIDFILE) // ZRTP_ZID_FILENAME
{ {}
}
VoipPreference::~VoipPreference() {}
void VoipPreference::serialize (Conf::YamlEmitter *emitter) void VoipPreference::serialize (Conf::YamlEmitter *emitter)
{ {
...@@ -196,11 +191,7 @@ AddressbookPreference::AddressbookPreference() : _photo (true) ...@@ -196,11 +191,7 @@ AddressbookPreference::AddressbookPreference() : _photo (true)
, _business (true) , _business (true)
, _home (true) , _home (true)
, _mobile (true) , _mobile (true)
{ {}
}
AddressbookPreference::~AddressbookPreference() {}
void AddressbookPreference::serialize (Conf::YamlEmitter *emitter) void AddressbookPreference::serialize (Conf::YamlEmitter *emitter)
{ {
...@@ -309,11 +300,7 @@ AudioPreference::AudioPreference() : _cardin (atoi (ALSA_DFT_CARD)) // ALSA_DFT_ ...@@ -309,11 +300,7 @@ AudioPreference::AudioPreference() : _cardin (atoi (ALSA_DFT_CARD)) // ALSA_DFT_
, _echocancel(false) , _echocancel(false)
, _echoCancelTailLength(100) , _echoCancelTailLength(100)
, _echoCancelDelay(0) , _echoCancelDelay(0)
{ {}
}
AudioPreference::~AudioPreference() {}
void AudioPreference::serialize (Conf::YamlEmitter *emitter) void AudioPreference::serialize (Conf::YamlEmitter *emitter)
{ {
...@@ -416,20 +403,6 @@ void AudioPreference::unserialize (Conf::MappingNode *map) ...@@ -416,20 +403,6 @@ void AudioPreference::unserialize (Conf::MappingNode *map)
} }
} }
ShortcutPreferences::ShortcutPreferences() : _hangup ("")
, _pickup ("")
, _popup ("")
, _toggleHold ("")
, _togglePickupHangup ("")
{
}
ShortcutPreferences::~ShortcutPreferences() {}
std::map<std::string, std::string> ShortcutPreferences::getShortcuts() const std::map<std::string, std::string> ShortcutPreferences::getShortcuts() const
{ {
std::map<std::string, std::string> shortcutsMap; std::map<std::string, std::string> shortcutsMap;
......
...@@ -34,68 +34,68 @@ ...@@ -34,68 +34,68 @@
#include "config/serializable.h" #include "config/serializable.h"
// general preferences // general preferences
const std::string orderKey ("order"); // : 1234/2345/ static const char * const orderKey = "order";
const std::string audioApiKey ("audioApi"); // : 0 static const char * const audioApiKey = "audioApi";
const std::string historyLimitKey ("historyLimit"); // : 30 static const char * const historyLimitKey = "historyLimit";
const std::string historyMaxCallsKey ("historyMaxCalls"); // : 20 static const char * const historyMaxCallsKey = "historyMaxCalls";
const std::string notifyMailsKey ("notifyMails"); // : false static const char * const notifyMailsKey = "notifyMails";
const std::string zoneToneChoiceKey ("zoneToneChoice"); // : North America static const char * const zoneToneChoiceKey = "zoneToneChoice";
const std::string registrationExpireKey ("registrationExpire");// : 180 static const char * const registrationExpireKey = "registrationExpire";
const std::string portNumKey ("portNum"); // : 5060 static const char * const portNumKey = "portNum";
const std::string searchBarDisplayKey ("searchBarDisplay"); // : true static const char * const searchBarDisplayKey = "searchBarDisplay";
const std::string zeroConfenableKey ("zeroConfenable"); // : false static const char * const zeroConfenableKey = "zeroConfenable";
const std::string md5HashKey ("md5Hash"); // : false static const char * const md5HashKey = "md5Hash";
// voip preferences // voip preferences
const std::string playDtmfKey ("playDtmf"); // true true static const char * const playDtmfKey = "playDtmf";
const std::string playTonesKey ("playTones"); // true static const char * const playTonesKey = "playTones";
const std::string pulseLengthKey ("pulseLength"); //=250 static const char * const pulseLengthKey = "pulseLength";
const std::string symmetricRtpKey ("symmetric");// =true static const char * const symmetricRtpKey = "symmetric";
const std::string zidFileKey ("zidFile");// =sfl.zid static const char * const zidFileKey = "zidFile";
// addressbook preferences // addressbook preferences
const std::string photoKey ("photo");// false static const char * const photoKey = "photo";
const std::string enabledKey ("enabled");// true static const char * const enabledKey = "enabled";
const std::string listKey ("list");// 1243608768.30329.0@emilou-desktop/1243456917.15690.23@emilou-desktop/ static const char * const listKey = "list";
const std::string maxResultsKey ("maxResults");// 25 static const char * const maxResultsKey = "maxResults";
const std::string businessKey ("business");// true static const char * const businessKey = "business";
const std::string homeKey ("home");// false static const char * const homeKey = "home";
const std::string mobileKey ("mobile");// false static const char * const mobileKey = "mobile";
// hooks preferences // hooks preferences
const std::string iax2EnabledKey ("iax2Enabled");// : false static const char * const iax2EnabledKey = "iax2Enabled";
const std::string numberAddPrefixKey ("numberAddPrefix");//: false static const char * const numberAddPrefixKey = "numberAddPrefix";
const std::string numberEnabledKey ("numberEnabled"); //: false static const char * const numberEnabledKey = "numberEnabled";
const std::string sipEnabledKey ("sipEnabled"); //: false static const char * const sipEnabledKey = "sipEnabled";
const std::string urlCommandKey ("urlCommand"); //: x-www-browser static const char * const urlCommandKey = "urlCommand";
const std::string urlSipFieldKey ("urlSipField"); //: X-sflphone-url static const char * const urlSipFieldKey = "urlSipField";
// audio preferences // audio preferences
const std::string alsamapKey ("alsa"); static const char * const alsamapKey = "alsa";
const std::string pulsemapKey ("pulse"); static const char * const pulsemapKey = "pulse";
const std::string cardinKey ("cardIn");// : 0 static const char * const cardinKey = "cardIn";
const std::string cardoutKey ("cardOut");// 0 static const char * const cardoutKey = "cardOut";
const std::string cardringKey ("cardRing");// : 0 static const char * const cardringKey = "cardRing";
const std::string pluginKey ("plugin"); //: default static const char * const pluginKey = "plugin";
const std::string smplrateKey ("smplRate");//: 44100 static const char * const smplrateKey = "smplRate";
const std::string devicePlaybackKey ("devicePlayback");//: static const char * const devicePlaybackKey = "devicePlayback";
const std::string deviceRecordKey ("deviceRecord");// : static const char * const deviceRecordKey = "deviceRecord";
const std::string deviceRingtoneKey ("deviceRingtone");// : static const char * const deviceRingtoneKey = "deviceRingtone";
const std::string recordpathKey ("recordPath");//: /home/msavard/Bureau static const char * const recordpathKey = "recordPath";
const std::string alwaysRecordingKey("alwaysRecording"); static const char * const alwaysRecordingKey = "alwaysRecording";
const std::string volumemicKey ("volumeMic");//: 100 static const char * const volumemicKey = "volumeMic";
const std::string volumespkrKey ("volumeSpkr");//: 100 static const char * const volumespkrKey = "volumeSpkr";
const std::string noiseReduceKey ("noiseReduce"); static const char * const noiseReduceKey = "noiseReduce";
const std::string echoCancelKey ("echoCancel"); static const char * const echoCancelKey = "echoCancel";
const std::string echoTailKey ("echoTailLength"); static const char * const echoTailKey = "echoTailLength";
const std::string echoDelayKey ("echoDelayLength"); static const char * const echoDelayKey = "echoDelayLength";
// shortcut preferences // shortcut preferences
const std::string hangupShortKey ("hangUp"); static const char * const hangupShortKey = "hangUp";
const std::string pickupShortKey ("pickUp"); static const char * const pickupShortKey = "pickUp";
const std::string popupShortKey ("popupWindow"); static const char * const popupShortKey = "popupWindow";
const std::string toggleHoldShortKey ("toggleHold"); static const char * const toggleHoldShortKey = "toggleHold";
const std::string togglePickupHangupShortKey ("togglePickupHangup"); static const char * const togglePickupHangupShortKey = "togglePickupHangup";
class AudioLayer; class AudioLayer;
...@@ -119,7 +119,7 @@ class Preferences : public Serializable ...@@ -119,7 +119,7 @@ class Preferences : public Serializable
std::string getAccountOrder (void) const { std::string getAccountOrder (void) const {
return _accountOrder; return _accountOrder;
} }
void setAccountOrder (std::string ord) { void setAccountOrder (const std::string &ord) {
_accountOrder = ord; _accountOrder = ord;
} }
...@@ -154,7 +154,7 @@ class Preferences : public Serializable ...@@ -154,7 +154,7 @@ class Preferences : public Serializable
std::string getZoneToneChoice (void) const { std::string getZoneToneChoice (void) const {
return _zoneToneChoice; return _zoneToneChoice;
} }
void setZoneToneChoice (std::string str) { void setZoneToneChoice (const std::string &str) {
_zoneToneChoice = str; _zoneToneChoice = str;
} }
...@@ -214,13 +214,9 @@ class Preferences : public Serializable ...@@ -214,13 +214,9 @@ class Preferences : public Serializable
class VoipPreference : public Serializable class VoipPreference : public Serializable
{ {
public: public:
VoipPreference(); VoipPreference();
~VoipPreference();
virtual void serialize (Conf::YamlEmitter *emitter); virtual void serialize (Conf::YamlEmitter *emitter);
virtual void unserialize (Conf::MappingNode *map); virtual void unserialize (Conf::MappingNode *map);
...@@ -256,7 +252,7 @@ class VoipPreference : public Serializable ...@@ -256,7 +252,7 @@ class VoipPreference : public Serializable
std::string getZidFile (void) const { std::string getZidFile (void) const {
return _zidFile; return _zidFile;
} }
void setZidFile (std::string file) { void setZidFile (const std::string &file) {
_zidFile = file; _zidFile = file;
} }
...@@ -272,13 +268,9 @@ class VoipPreference : public Serializable ...@@ -272,13 +268,9 @@ class VoipPreference : public Serializable
class AddressbookPreference : public Serializable class AddressbookPreference : public Serializable
{ {
public: public:
AddressbookPreference(); AddressbookPreference();
~AddressbookPreference();
virtual void serialize (Conf::YamlEmitter *emitter); virtual void serialize (Conf::YamlEmitter *emitter);
virtual void unserialize (Conf::MappingNode *map); virtual void unserialize (Conf::MappingNode *map);
...@@ -300,7 +292,7 @@ class AddressbookPreference : public Serializable ...@@ -300,7 +292,7 @@ class AddressbookPreference : public Serializable
std::string getList (void) const { std::string getList (void) const {
return _list; return _list;
} }
void setList (std::string l) { void setList (const std::string &l) {
_list = l; _list = l;
} }
...@@ -347,9 +339,7 @@ class AddressbookPreference : public Serializable ...@@ -347,9 +339,7 @@ class AddressbookPreference : public Serializable
class HookPreference : public Serializable class HookPreference : public Serializable
{ {
public: public:
HookPreference(); HookPreference();
virtual void serialize (Conf::YamlEmitter *emitter); virtual void serialize (Conf::YamlEmitter *emitter);
...@@ -366,7 +356,7 @@ class HookPreference : public Serializable ...@@ -366,7 +356,7 @@ class HookPreference : public Serializable
std::string getNumberAddPrefix (void) const { std::string getNumberAddPrefix (void) const {
return _numberAddPrefix; return _numberAddPrefix;
} }
void setNumberAddPrefix (std::string n) { void setNumberAddPrefix (const std::string &n) {
_numberAddPrefix = n; _numberAddPrefix = n;
} }
...@@ -387,19 +377,18 @@ class HookPreference : public Serializable ...@@ -387,19 +377,18 @@ class HookPreference : public Serializable
std::string getUrlCommand (void) const { std::string getUrlCommand (void) const {
return _urlCommand; return _urlCommand;
} }
void setUrlCommand (std::string u) { void setUrlCommand (const std::string &u) {
_urlCommand = u; _urlCommand = u;
} }
std::string getUrlSipField (void) const { std::string getUrlSipField (void) const {
return _urlSipField; return _urlSipField;
} }
void setUrlSipField (std::string u) { void setUrlSipField (const std::string &u) {
_urlSipField = u; _urlSipField = u;
} }
private: private:
bool _iax2Enabled;// : false bool _iax2Enabled;// : false
std::string _numberAddPrefix;//: false std::string _numberAddPrefix;//: false
bool _numberEnabled; //: false bool _numberEnabled; //: false
...@@ -409,16 +398,10 @@ class HookPreference : public Serializable ...@@ -409,16 +398,10 @@ class HookPreference : public Serializable
}; };
class AudioPreference : public Serializable class AudioPreference : public Serializable
{ {
public: public:
AudioPreference(); AudioPreference();
~AudioPreference();
virtual void serialize (Conf::YamlEmitter *emitter); virtual void serialize (Conf::YamlEmitter *emitter);
virtual void unserialize (Conf::MappingNode *map); virtual void unserialize (Conf::MappingNode *map);
...@@ -448,7 +431,8 @@ class AudioPreference : public Serializable ...@@ -448,7 +431,8 @@ class AudioPreference : public Serializable
std::string getPlugin (void) const { std::string getPlugin (void) const {
return _plugin; return _plugin;
} }
void setPlugin (std::string p) {
void setPlugin (const std::string &p) {
_plugin = p; _plugin = p;
} }
...@@ -463,6 +447,7 @@ class AudioPreference : public Serializable ...@@ -463,6 +447,7 @@ class AudioPreference : public Serializable
std::string getDevicePlayback (void) const { std::string getDevicePlayback (void) const {
return _devicePlayback; return _devicePlayback;
} }
void setDevicePlayback (const std::string &p) { void setDevicePlayback (const std::string &p) {
_devicePlayback = p; _devicePlayback = p;
} }
...@@ -477,7 +462,8 @@ class AudioPreference : public Serializable ...@@ -477,7 +462,8 @@ class AudioPreference : public Serializable
std::string getDeviceRingtone (void) const { std::string getDeviceRingtone (void) const {
return _deviceRingtone; return _deviceRingtone;
} }
void setDeviceRingtone (std::string r) {
void setDeviceRingtone (const std::string &r) {
_deviceRingtone = r; _deviceRingtone = r;
} }
...@@ -569,18 +555,10 @@ class AudioPreference : public Serializable ...@@ -569,18 +555,10 @@ class AudioPreference : public Serializable
int _echoCancelDelay; int _echoCancelDelay;
}; };
class ShortcutPreferences : public Serializable class ShortcutPreferences : public Serializable
{ {
public: public:
ShortcutPreferences();
~ShortcutPreferences();
virtual void serialize (Conf::YamlEmitter *emitter); virtual void serialize (Conf::YamlEmitter *emitter);
virtual void unserialize (Conf::MappingNode *map); virtual void unserialize (Conf::MappingNode *map);
void setShortcuts (std::map<std::string, std::string> shortcuts); void setShortcuts (std::map<std::string, std::string> shortcuts);
...@@ -589,21 +567,21 @@ class ShortcutPreferences : public Serializable ...@@ -589,21 +567,21 @@ class ShortcutPreferences : public Serializable
std::string getHangup (void) const { std::string getHangup (void) const {
return _hangup; return _hangup;
} }
void setHangup (std::string hangup) { void setHangup (const std::string &hangup) {
_hangup = hangup; _hangup = hangup;
} }
std::string getPickup (void) const { std::string getPickup (void) const {
return _pickup; return _pickup;
} }
void setPickup (std::string pickup) { void setPickup (const std::string &pickup) {
_pickup = pickup; _pickup = pickup;
} }
std::string getPopup (void) const { std::string getPopup (void) const {
return _popup; return _popup;
} }
void setPopup (std::string popup) { void setPopup (const std::string &popup) {
_popup = popup; _popup = popup;
} }
...@@ -617,12 +595,11 @@ class ShortcutPreferences : public Serializable ...@@ -617,12 +595,11 @@ class ShortcutPreferences : public Serializable
std::string getTogglePickupHangup (void) const { std::string getTogglePickupHangup (void) const {
return _togglePickupHangup; return _togglePickupHangup;
} }
void setTogglePickupHangup (std::string toggle) { void setTogglePickupHangup (const std::string &toggle) {
_togglePickupHangup = toggle; _togglePickupHangup = toggle;
} }
private: private:
std::string _hangup; std::string _hangup;
std::string _pickup; std::string _pickup;
std::string _popup; std::string _popup;
......
Supports Markdown
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