diff --git a/src/core/model/command-line.cc b/src/core/model/command-line.cc index 56a4c1073..cc77b4072 100644 --- a/src/core/model/command-line.cc +++ b/src/core/model/command-line.cc @@ -116,7 +116,7 @@ CommandLine::CommandLine() NS_LOG_FUNCTION(this); } -CommandLine::CommandLine(const std::string filename) +CommandLine::CommandLine(const std::string& filename) : m_NNonOptions(0), m_nonOptionCount(0), m_usage() @@ -181,7 +181,7 @@ CommandLine::Clear() } void -CommandLine::Usage(const std::string usage) +CommandLine::Usage(const std::string& usage) { m_usage = usage; } @@ -198,7 +198,7 @@ CommandLine::Item::~Item() } void -CommandLine::Parse(std::vector args) +CommandLine::Parse(std::vector& args) { NS_LOG_FUNCTION(this << args.size() << args); @@ -724,7 +724,7 @@ CommandLine::CallbackItem::GetDefault() const } bool -CommandLine::CallbackItem::Parse(const std::string value) +CommandLine::CallbackItem::Parse(const std::string& value) { NS_LOG_FUNCTION(this); NS_LOG_DEBUG("CommandLine::CallbackItem::Parse \"" << value << "\""); @@ -735,7 +735,7 @@ void CommandLine::AddValue(const std::string& name, const std::string& help, ns3::Callback callback, - std::string defaultValue /* = "" */) + const std::string& defaultValue /* = "" */) { NS_LOG_FUNCTION(this << &name << &help << &callback); @@ -807,7 +807,7 @@ CommandLine::GetNExtraNonOptions() const /* static */ bool -CommandLine::HandleAttribute(const std::string name, const std::string value) +CommandLine::HandleAttribute(const std::string& name, const std::string& value) { bool success = true; if (!Config::SetGlobalFailSafe(name, StringValue(value)) && @@ -825,7 +825,7 @@ CommandLine::Item::HasDefault() const } bool -CommandLine::StringItem::Parse(const std::string value) +CommandLine::StringItem::Parse(const std::string& value) { m_value = value; return true; @@ -854,7 +854,7 @@ CommandLineHelper::GetDefault(const bool& val) template <> bool -CommandLineHelper::UserItemParse(const std::string value, bool& val) +CommandLineHelper::UserItemParse(const std::string& value, bool& val) { std::string src = value; std::transform(src.begin(), src.end(), src.begin(), [](char c) { @@ -895,7 +895,7 @@ CommandLineHelper::GetDefault