From c1da0ac7cca49e0b96dbb359ee48000cb04df15b Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 14 Feb 2014 18:49:04 +0100 Subject: improve RC constness --- src/RemoteControl.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/RemoteControl.h') diff --git a/src/RemoteControl.h b/src/RemoteControl.h index a39af09..e76ba68 100644 --- a/src/RemoteControl.h +++ b/src/RemoteControl.h @@ -84,7 +84,7 @@ class RemoteControllable { * It might be used in the commands the user has to type, so keep * it short */ - virtual std::string get_rc_name() { return m_name; } + virtual std::string get_rc_name() const { return m_name; } /* Tell the controllable to enrol at the given controller */ virtual void enrol_at(BaseRemoteController& controller) { @@ -92,9 +92,9 @@ class RemoteControllable { } /* Return a list of possible parameters that can be set */ - virtual list get_supported_parameters() { + virtual list get_supported_parameters() const { list parameterlist; - for (list< vector >::iterator it = m_parameters.begin(); + for (list< vector >::const_iterator it = m_parameters.begin(); it != m_parameters.end(); ++it) { parameterlist.push_back((*it)[0]); } @@ -102,15 +102,17 @@ class RemoteControllable { } /* Return a mapping of the descriptions of all parameters */ - virtual std::list< std::vector > get_parameter_descriptions() { + virtual std::list< std::vector > + get_parameter_descriptions() const { return m_parameters; } /* Base function to set parameters. */ - virtual void set_parameter(string parameter, string value) = 0; + virtual void set_parameter(const string& parameter, + const string& value) = 0; /* Getting a parameter always returns a string. */ - virtual string get_parameter(string parameter) = 0; + virtual const string get_parameter(const string& parameter) const = 0; protected: std::string m_name; -- cgit v1.2.3