From: Rafał Długołęcki Date: Sat, 2 May 2015 16:42:05 +0000 (+0200) Subject: Make code safer. X-Git-Tag: v0.2~31 X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=254fa86ed70ecceab3ed3b91470d15e672783ee4;p=command.git Make code safer. --- diff --git a/include/argument.h b/include/argument.h index eee218f..3ac1d71 100644 --- a/include/argument.h +++ b/include/argument.h @@ -25,7 +25,7 @@ namespace command { * @param description Description of current Argument * @param function Function used to handle current Argument. */ - Argument(std::string description, void (*function)(ArgumentType)) + Argument(const std::string & description, void (*function)(ArgumentType)) : Parameter(description), Callable(function) { } virtual ~Argument() { } diff --git a/include/option.h b/include/option.h index be65e77..270bb76 100644 --- a/include/option.h +++ b/include/option.h @@ -30,7 +30,7 @@ namespace command { * @param description Description of current Option * @param function Function used to handle current Option. */ - Option(std::string name, std::string description, void (*function)(OptionType)) + Option(std::string name, const std::string & description, void (*function)(OptionType)) : Parameter(description), Callable(function), name(name) { } virtual ~Option() { } diff --git a/include/parameter.h b/include/parameter.h index ed79218..a96128c 100644 --- a/include/parameter.h +++ b/include/parameter.h @@ -21,7 +21,7 @@ namespace command { * * @param description Description of current Argument */ - Parameter(std::string description) + Parameter(const std::string & description) : Descriptive(description) { } virtual ~Parameter() {} diff --git a/tests/callable/invokes_provided_function.cpp b/tests/callable/invokes_provided_function.cpp index 7322da5..5defb08 100644 --- a/tests/callable/invokes_provided_function.cpp +++ b/tests/callable/invokes_provided_function.cpp @@ -14,7 +14,6 @@ void function(bool val) { }; int main() { - TestCallable callable(function); callable.callFunction(true); diff --git a/tests/parameter/TestParameter.h b/tests/parameter/TestParameter.h index 9736133..592c653 100644 --- a/tests/parameter/TestParameter.h +++ b/tests/parameter/TestParameter.h @@ -3,7 +3,7 @@ class TestParameter : public command::Parameter { public: - TestParameter(std::string description) : Parameter(description) { } + TestParameter(const std::string & description) : Parameter(description) { } virtual void handle() { } virtual bool understand(const std::string & argVal) { }