Apply clang-tidy fix 'modernize-pass-by-value'

This commit is contained in:
Gunnar Beutner 2018-01-04 08:54:18 +01:00
parent 6da7d48d25
commit 621eed3f13
101 changed files with 220 additions and 244 deletions

View File

@ -86,23 +86,11 @@ void Array::Set(SizeType index, Value&& value)
*
* @param value The value.
*/
void Array::Add(const Value& value)
void Array::Add(Value value)
{
ObjectLock olock(this);
m_Data.push_back(value);
}
/**
* Adds a value to the array.
*
* @param value The value.
*/
void Array::Add(Value&& value)
{
ObjectLock olock(this);
m_Data.emplace_back(std::move(value));
m_Data.push_back(std::move(value));
}
/**
@ -164,13 +152,13 @@ bool Array::Contains(const Value& value) const
* @param index The index
* @param value The value to add
*/
void Array::Insert(SizeType index, const Value& value)
void Array::Insert(SizeType index, Value value)
{
ObjectLock olock(this);
ASSERT(index <= m_Data.size());
m_Data.insert(m_Data.begin() + index, value);
m_Data.insert(m_Data.begin() + index, std::move(value));
}
/**
@ -314,12 +302,12 @@ void Array::SetFieldByName(const String& field, const Value& value, const DebugI
Set(index, value);
}
Array::Iterator icinga::begin(Array::Ptr x)
Array::Iterator icinga::begin(const Array::Ptr& x)
{
return x->Begin();
}
Array::Iterator icinga::end(Array::Ptr x)
Array::Iterator icinga::end(const Array::Ptr& x)
{
return x->End();
}

View File

@ -55,8 +55,7 @@ public:
Value Get(SizeType index) const;
void Set(SizeType index, const Value& value);
void Set(SizeType index, Value&& value);
void Add(const Value& value);
void Add(Value&& value);
void Add(Value value);
Iterator Begin();
Iterator End();
@ -64,7 +63,7 @@ public:
size_t GetLength() const;
bool Contains(const Value& value) const;
void Insert(SizeType index, const Value& value);
void Insert(SizeType index, Value value);
void Remove(SizeType index);
void Remove(Iterator it);
@ -118,8 +117,8 @@ private:
std::vector<Value> m_Data; /**< The data for the array. */
};
Array::Iterator begin(Array::Ptr x);
Array::Iterator end(Array::Ptr x);
Array::Iterator begin(const Array::Ptr& x);
Array::Iterator end(const Array::Ptr& x);
}

View File

@ -54,7 +54,8 @@ public:
{
std::vector<intrusive_ptr<ConfigObject> > objects = GetObjectsHelper(T::TypeInstance.get());
std::vector<intrusive_ptr<T> > result;
for (const auto& object : objects) {
result.reserve(objects.size());
for (const auto& object : objects) {
result.push_back(static_pointer_cast<T>(object));
}
return result;

View File

@ -269,8 +269,8 @@ const std::vector<String>& ConfigWriter::GetKeywords()
return keywords;
}
ConfigIdentifier::ConfigIdentifier(const String& identifier)
: m_Name(identifier)
ConfigIdentifier::ConfigIdentifier(String identifier)
: m_Name(std::move(identifier))
{ }
String ConfigIdentifier::GetName() const

View File

@ -38,7 +38,7 @@ class ConfigIdentifier final : public Object
public:
DECLARE_PTR_TYPEDEFS(ConfigIdentifier);
ConfigIdentifier(const String& name);
ConfigIdentifier(String name);
String GetName() const;

View File

@ -79,20 +79,7 @@ bool Dictionary::Get(const String& key, Value *result) const
* @param key The key.
* @param value The value.
*/
void Dictionary::Set(const String& key, const Value& value)
{
ObjectLock olock(this);
m_Data[key] = value;
}
/**
* Sets a value in the dictionary.
*
* @param key The key.
* @param value The value.
*/
void Dictionary::Set(const String& key, Value&& value)
void Dictionary::Set(const String& key, Value value)
{
ObjectLock olock(this);
@ -282,12 +269,12 @@ bool Dictionary::GetOwnField(const String& field, Value *result) const
return Get(field, result);
}
Dictionary::Iterator icinga::begin(Dictionary::Ptr x)
Dictionary::Iterator icinga::begin(const Dictionary::Ptr& x)
{
return x->Begin();
}
Dictionary::Iterator icinga::end(Dictionary::Ptr x)
Dictionary::Iterator icinga::end(const Dictionary::Ptr& x)
{
return x->End();
}

View File

@ -55,8 +55,7 @@ public:
Value Get(const String& key) const;
bool Get(const String& key, Value *result) const;
void Set(const String& key, const Value& value);
void Set(const String& key, Value&& value);
void Set(const String& key, Value value);
bool Contains(const String& key) const;
Iterator Begin();
@ -90,8 +89,8 @@ private:
std::map<String, Value> m_Data; /**< The data for the dictionary. */
};
Dictionary::Iterator begin(Dictionary::Ptr x);
Dictionary::Iterator end(Dictionary::Ptr x);
Dictionary::Iterator begin(const Dictionary::Ptr& x);
Dictionary::Iterator end(const Dictionary::Ptr& x);
}

View File

@ -260,7 +260,7 @@ String icinga::DiagnosticInformation(const std::exception& ex, bool verbose, Sta
return result.str();
}
String icinga::DiagnosticInformation(boost::exception_ptr eptr, bool verbose)
String icinga::DiagnosticInformation(const boost::exception_ptr& eptr, bool verbose)
{
StackTrace *pt = GetLastExceptionStack();
StackTrace stack;
@ -283,12 +283,12 @@ String icinga::DiagnosticInformation(boost::exception_ptr eptr, bool verbose)
return boost::diagnostic_information(eptr);
}
ScriptError::ScriptError(const String& message)
: m_Message(message), m_IncompleteExpr(false)
ScriptError::ScriptError(String message)
: m_Message(std::move(message)), m_IncompleteExpr(false)
{ }
ScriptError::ScriptError(const String& message, const DebugInfo& di, bool incompleteExpr)
: m_Message(message), m_DebugInfo(di), m_IncompleteExpr(incompleteExpr), m_HandledByDebugger(false)
ScriptError::ScriptError(String message, DebugInfo di, bool incompleteExpr)
: m_Message(std::move(message)), m_DebugInfo(std::move(di)), m_IncompleteExpr(incompleteExpr), m_HandledByDebugger(false)
{ }
ScriptError::~ScriptError() throw()

View File

@ -51,8 +51,8 @@ class user_error : virtual public std::exception, virtual public boost::exceptio
class ScriptError : virtual public user_error
{
public:
ScriptError(const String& message);
ScriptError(const String& message, const DebugInfo& di, bool incompleteExpr = false);
ScriptError(String message);
ScriptError(String message, DebugInfo di, bool incompleteExpr = false);
~ScriptError() throw() override;
const char *what(void) const throw() final;
@ -121,7 +121,7 @@ inline std::string to_string(const ContextTraceErrorInfo& e)
}
String DiagnosticInformation(const std::exception& ex, bool verbose = true, StackTrace *stack = nullptr, ContextTrace *context = nullptr);
String DiagnosticInformation(boost::exception_ptr eptr, bool verbose = true);
String DiagnosticInformation(const boost::exception_ptr& eptr, bool verbose = true);
class posix_error : virtual public std::exception, virtual public boost::exception {
public:

View File

@ -26,9 +26,9 @@ using namespace icinga;
REGISTER_TYPE_WITH_PROTOTYPE(Function, Function::GetPrototype());
Function::Function(const String& name, const Callback& function, const std::vector<String>& args,
Function::Function(const String& name, Callback function, const std::vector<String>& args,
bool side_effect_free, bool deprecated)
: m_Callback(function)
: m_Callback(std::move(function))
{
SetName(name, true);
SetSideEffectFree(side_effect_free, true);

View File

@ -68,7 +68,7 @@ public:
private:
Callback m_Callback;
Function(const String& name, const Callback& function, const std::vector<String>& args,
Function(const String& name, Callback function, const std::vector<String>& args,
bool side_effect_free, bool deprecated);
};

View File

@ -31,8 +31,8 @@ namespace icinga
struct DeferredInitializer
{
public:
DeferredInitializer(const std::function<void ()>& callback, int priority)
: m_Callback(callback), m_Priority(priority)
DeferredInitializer(std::function<void ()> callback, int priority)
: m_Callback(std::move(callback)), m_Priority(priority)
{ }
bool operator<(const DeferredInitializer& other) const

View File

@ -194,14 +194,14 @@ void Logger::ValidateSeverity(const String& value, const ValidationUtils& utils)
}
}
Log::Log(LogSeverity severity, const String& facility, const String& message)
: m_Severity(severity), m_Facility(facility)
Log::Log(LogSeverity severity, String facility, const String& message)
: m_Severity(severity), m_Facility(std::move(facility))
{
m_Buffer << message;
}
Log::Log(LogSeverity severity, const String& facility)
: m_Severity(severity), m_Facility(facility)
Log::Log(LogSeverity severity, String facility)
: m_Severity(severity), m_Facility(std::move(facility))
{ }
/**

View File

@ -111,8 +111,8 @@ public:
Log(const Log& other) = delete;
Log& operator=(const Log& rhs) = delete;
Log(LogSeverity severity, const String& facility, const String& message);
Log(LogSeverity severity, const String& facility);
Log(LogSeverity severity, String facility, const String& message);
Log(LogSeverity severity, String facility);
~Log();

View File

@ -21,8 +21,8 @@
using namespace icinga;
NetworkStream::NetworkStream(const Socket::Ptr& socket)
: m_Socket(socket), m_Eof(false)
NetworkStream::NetworkStream(Socket::Ptr socket)
: m_Socket(std::move(socket)), m_Eof(false)
{ }
void NetworkStream::Close()

View File

@ -37,7 +37,7 @@ class NetworkStream final : public Stream
public:
DECLARE_PTR_TYPEDEFS(NetworkStream);
NetworkStream(const Socket::Ptr& socket);
NetworkStream(Socket::Ptr socket);
size_t Read(void *buffer, size_t count, bool allow_partial = false) override;
void Write(const void *buffer, size_t count) override;

View File

@ -35,7 +35,7 @@ REGISTER_SCRIPTFUNCTION_NS(System, parse_performance_data, PerfdataValue::Parse,
PerfdataValue::PerfdataValue()
{ }
PerfdataValue::PerfdataValue(String label, double value, bool counter,
PerfdataValue::PerfdataValue(const String& label, double value, bool counter,
const String& unit, const Value& warn, const Value& crit, const Value& min,
const Value& max)
{

View File

@ -38,7 +38,7 @@ public:
PerfdataValue();
PerfdataValue(String label, double value, bool counter = false, const String& unit = "",
PerfdataValue(const String& label, double value, bool counter = false, const String& unit = "",
const Value& warn = Empty, const Value& crit = Empty,
const Value& min = Empty, const Value& max = Empty);

View File

@ -22,8 +22,8 @@
using namespace icinga;
PrimitiveType::PrimitiveType(const String& name, const String& base, const ObjectFactory& factory)
: m_Name(name), m_Base(base), m_Factory(factory)
PrimitiveType::PrimitiveType(String name, String base, const ObjectFactory& factory)
: m_Name(std::move(name)), m_Base(std::move(base)), m_Factory(factory)
{ }
String PrimitiveType::GetName() const

View File

@ -30,7 +30,7 @@ namespace icinga
class PrimitiveType final : public Type
{
public:
PrimitiveType(const String& name, const String& base, const ObjectFactory& factory = ObjectFactory());
PrimitiveType(String name, String base, const ObjectFactory& factory = ObjectFactory());
String GetName() const override;
Type::Ptr GetBaseType() const override;

View File

@ -65,8 +65,8 @@ static pid_t l_ProcessControlPID;
static boost::once_flag l_ProcessOnceFlag = BOOST_ONCE_INIT;
static boost::once_flag l_SpawnHelperOnceFlag = BOOST_ONCE_INIT;
Process::Process(const Process::Arguments& arguments, const Dictionary::Ptr& extraEnvironment)
: m_Arguments(arguments), m_ExtraEnvironment(extraEnvironment), m_Timeout(600), m_AdjustPriority(false)
Process::Process(Process::Arguments arguments, Dictionary::Ptr extraEnvironment)
: m_Arguments(std::move(arguments)), m_ExtraEnvironment(std::move(extraEnvironment)), m_Timeout(600), m_AdjustPriority(false)
#ifdef _WIN32
, m_ReadPending(false), m_ReadFailed(false), m_Overlapped()
#endif /* _WIN32 */

View File

@ -66,7 +66,7 @@ public:
static const std::deque<Process::Ptr>::size_type MaxTasksPerThread = 512;
Process(const Arguments& arguments, const Dictionary::Ptr& extraEnvironment = nullptr);
Process(Arguments arguments, Dictionary::Ptr extraEnvironment = nullptr);
~Process() override;
void SetTimeout(double timeout);

View File

@ -46,8 +46,8 @@ ScriptFrame::ScriptFrame(bool allocLocals)
InitializeFrame();
}
ScriptFrame::ScriptFrame(bool allocLocals, const Value& self)
: Locals(allocLocals ? new Dictionary() : nullptr), Self(self), Sandboxed(false), Depth(0)
ScriptFrame::ScriptFrame(bool allocLocals, Value self)
: Locals(allocLocals ? new Dictionary() : nullptr), Self(std::move(self)), Sandboxed(false), Depth(0)
{
InitializeFrame();
}

View File

@ -37,7 +37,7 @@ struct ScriptFrame
int Depth;
ScriptFrame(bool allocLocals);
ScriptFrame(bool allocLocals, const Value& self);
ScriptFrame(bool allocLocals, Value self);
~ScriptFrame();
void IncreaseStackDepth();

View File

@ -39,11 +39,7 @@ String::String(const char *data)
: m_Data(data)
{ }
String::String(const std::string& data)
: m_Data(data)
{ }
String::String(std::string&& data)
String::String(std::string data)
: m_Data(std::move(data))
{ }

View File

@ -60,8 +60,7 @@ public:
String();
String(const char *data);
String(const std::string& data);
String(std::string&& data);
String(std::string data);
String(String::SizeType n, char c);
String(const String& other);
String(String&& other);

View File

@ -502,7 +502,7 @@ incomplete:
}
void ConsoleCommand::ExecuteScriptCompletionHandler(boost::mutex& mutex, boost::condition_variable& cv,
bool& ready, boost::exception_ptr eptr, const Value& result, Value& resultOut, boost::exception_ptr& eptrOut)
bool& ready, const boost::exception_ptr& eptr, const Value& result, Value& resultOut, boost::exception_ptr& eptrOut)
{
if (eptr) {
try {
@ -526,7 +526,7 @@ void ConsoleCommand::ExecuteScriptCompletionHandler(boost::mutex& mutex, boost::
}
void ConsoleCommand::AutocompleteScriptCompletionHandler(boost::mutex& mutex, boost::condition_variable& cv,
bool& ready, boost::exception_ptr eptr, const Array::Ptr& result, Array::Ptr& resultOut)
bool& ready, const boost::exception_ptr& eptr, const Array::Ptr& result, Array::Ptr& resultOut)
{
if (eptr) {
try {

View File

@ -55,10 +55,10 @@ private:
mutable boost::condition_variable m_CV;
static void ExecuteScriptCompletionHandler(boost::mutex& mutex, boost::condition_variable& cv,
bool& ready, boost::exception_ptr eptr, const Value& result, Value& resultOut,
bool& ready, const boost::exception_ptr& eptr, const Value& result, Value& resultOut,
boost::exception_ptr& eptrOut);
static void AutocompleteScriptCompletionHandler(boost::mutex& mutex, boost::condition_variable& cv,
bool& ready, boost::exception_ptr eptr, const Array::Ptr& result, Array::Ptr& resultOut);
bool& ready, const boost::exception_ptr& eptr, const Array::Ptr& result, Array::Ptr& resultOut);
#ifdef HAVE_EDITLINE
static char *ConsoleCompleteHelper(const char *word, int state);

View File

@ -324,9 +324,9 @@ bool TroubleshootCommand::CheckFeatures(InfoLog& log)
return false;
}
for (const String feature : disabled_features)
for (const String& feature : disabled_features)
features->Set(feature, false);
for (const String feature : enabled_features)
for (const String& feature : enabled_features)
features->Set(feature, true);
InfoLogLine(log)

View File

@ -57,8 +57,8 @@ ActivationContext::Ptr ActivationContext::GetCurrentContext()
return astack.top();
}
ActivationScope::ActivationScope(const ActivationContext::Ptr& context)
: m_Context(context)
ActivationScope::ActivationScope(ActivationContext::Ptr context)
: m_Context(std::move(context))
{
if (!m_Context)
m_Context = new ActivationContext();

View File

@ -49,7 +49,7 @@ private:
class ActivationScope
{
public:
ActivationScope(const ActivationContext::Ptr& context = nullptr);
ActivationScope(ActivationContext::Ptr context = nullptr);
~ActivationScope();
ActivationContext::Ptr GetContext() const;

View File

@ -26,11 +26,11 @@ using namespace icinga;
ApplyRule::RuleMap ApplyRule::m_Rules;
ApplyRule::TypeMap ApplyRule::m_Types;
ApplyRule::ApplyRule(const String& targetType, const String& name, const std::shared_ptr<Expression>& expression,
const std::shared_ptr<Expression>& filter, const String& package, const String& fkvar, const String& fvvar, const std::shared_ptr<Expression>& fterm,
bool ignoreOnError, const DebugInfo& di, const Dictionary::Ptr& scope)
: m_TargetType(targetType), m_Name(name), m_Expression(expression), m_Filter(filter), m_Package(package), m_FKVar(fkvar),
m_FVVar(fvvar), m_FTerm(fterm), m_IgnoreOnError(ignoreOnError), m_DebugInfo(di), m_Scope(scope), m_HasMatches(false)
ApplyRule::ApplyRule(String targetType, String name, std::shared_ptr<Expression> expression,
std::shared_ptr<Expression> filter, String package, String fkvar, String fvvar, std::shared_ptr<Expression> fterm,
bool ignoreOnError, DebugInfo di, Dictionary::Ptr scope)
: m_TargetType(std::move(targetType)), m_Name(std::move(name)), m_Expression(std::move(expression)), m_Filter(std::move(filter)), m_Package(std::move(package)), m_FKVar(std::move(fkvar)),
m_FVVar(std::move(fvvar)), m_FTerm(std::move(fterm)), m_IgnoreOnError(ignoreOnError), m_DebugInfo(std::move(di)), m_Scope(std::move(scope)), m_HasMatches(false)
{ }
String ApplyRule::GetTargetType() const

View File

@ -81,9 +81,9 @@ private:
static TypeMap m_Types;
static RuleMap m_Rules;
ApplyRule(const String& targetType, const String& name, const std::shared_ptr<Expression>& expression,
const std::shared_ptr<Expression>& filter, const String& package, const String& fkvar, const String& fvvar, const std::shared_ptr<Expression>& fterm,
bool ignoreOnError, const DebugInfo& di, const Dictionary::Ptr& scope);
ApplyRule(String targetType, String name, std::shared_ptr<Expression> expression,
std::shared_ptr<Expression> filter, String package, String fkvar, String fvvar, std::shared_ptr<Expression> fterm,
bool ignoreOnError, DebugInfo di, Dictionary::Ptr scope);
};
}

View File

@ -40,10 +40,10 @@ std::map<String, std::vector<ZoneFragment> > ConfigCompiler::m_ZoneDirs;
* @param input Input stream for the configuration file.
* @param zone The zone.
*/
ConfigCompiler::ConfigCompiler(const String& path, std::istream *input,
const String& zone, const String& package)
: m_Path(path), m_Input(input), m_Zone(zone), m_Package(package),
m_Eof(false), m_OpenBraces(0)
ConfigCompiler::ConfigCompiler(String path, std::istream *input,
String zone, String package)
: m_Path(std::move(path)), m_Input(input), m_Zone(std::move(zone)),
m_Package(std::move(package)), m_Eof(false), m_OpenBraces(0)
{
InitializeScanner();
}
@ -339,7 +339,8 @@ bool ConfigCompiler::HasZoneConfigAuthority(const String& zoneName)
if (!empty) {
std::vector<String> paths;
for (const ZoneFragment& zf : zoneDirs) {
paths.reserve(zoneDirs.size());
for (const ZoneFragment& zf : zoneDirs) {
paths.push_back(zf.Path);
}

View File

@ -86,8 +86,8 @@ struct ZoneFragment
class ConfigCompiler
{
public:
explicit ConfigCompiler(const String& path, std::istream *input,
const String& zone = String(), const String& package = String());
explicit ConfigCompiler(String path, std::istream *input,
String zone = String(), String package = String());
virtual ~ConfigCompiler();
std::unique_ptr<Expression> Compile();

View File

@ -59,16 +59,16 @@ REGISTER_SCRIPTFUNCTION_NS(Internal, run_with_activation_context, &ConfigItem::R
* @param exprl Expression list for the item.
* @param debuginfo Debug information.
*/
ConfigItem::ConfigItem(const Type::Ptr& type, const String& name,
bool abstract, const std::shared_ptr<Expression>& exprl,
const std::shared_ptr<Expression>& filter, bool defaultTmpl, bool ignoreOnError,
const DebugInfo& debuginfo, const Dictionary::Ptr& scope,
const String& zone, const String& package)
: m_Type(type), m_Name(name), m_Abstract(abstract),
m_Expression(exprl), m_Filter(filter),
ConfigItem::ConfigItem(Type::Ptr type, String name,
bool abstract, std::shared_ptr<Expression> exprl,
std::shared_ptr<Expression> filter, bool defaultTmpl, bool ignoreOnError,
DebugInfo debuginfo, Dictionary::Ptr scope,
String zone, String package)
: m_Type(std::move(type)), m_Name(std::move(name)), m_Abstract(abstract),
m_Expression(std::move(exprl)), m_Filter(std::move(filter)),
m_DefaultTmpl(defaultTmpl), m_IgnoreOnError(ignoreOnError),
m_DebugInfo(debuginfo), m_Scope(scope), m_Zone(zone),
m_Package(package)
m_DebugInfo(std::move(debuginfo)), m_Scope(std::move(scope)), m_Zone(std::move(zone)),
m_Package(std::move(package))
{
}

View File

@ -40,12 +40,12 @@ class ConfigItem final : public Object {
public:
DECLARE_PTR_TYPEDEFS(ConfigItem);
ConfigItem(const Type::Ptr& type, const String& name, bool abstract,
const std::shared_ptr<Expression>& exprl,
const std::shared_ptr<Expression>& filter,
bool defaultTmpl, bool ignoreOnError, const DebugInfo& debuginfo,
const Dictionary::Ptr& scope, const String& zone,
const String& package);
ConfigItem(Type::Ptr type, String name, bool abstract,
std::shared_ptr<Expression> exprl,
std::shared_ptr<Expression> filter,
bool defaultTmpl, bool ignoreOnError, DebugInfo debuginfo,
Dictionary::Ptr scope, String zone,
String package);
Type::Ptr GetType() const;
String GetName() const;

View File

@ -101,8 +101,8 @@ void DictExpression::MakeInline()
m_Inline = true;
}
LiteralExpression::LiteralExpression(const Value& value)
: m_Value(value)
LiteralExpression::LiteralExpression(Value value)
: m_Value(std::move(value))
{ }
ExpressionResult LiteralExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const

View File

@ -36,8 +36,8 @@ namespace icinga
struct DebugHint
{
public:
DebugHint(const Dictionary::Ptr& hints = nullptr)
: m_Hints(hints)
DebugHint(Dictionary::Ptr hints = nullptr)
: m_Hints(std::move(hints))
{ }
DebugHint(Dictionary::Ptr&& hints)
@ -154,8 +154,8 @@ struct ExpressionResult
{
public:
template<typename T>
ExpressionResult(const T& value, ExpressionResultCode code = ResultOK)
: m_Value(value), m_Code(code)
ExpressionResult(T value, ExpressionResultCode code = ResultOK)
: m_Value(std::move(value)), m_Code(code)
{ }
operator const Value&() const
@ -220,8 +220,8 @@ std::unique_ptr<Expression> MakeIndexer(ScopeSpecifier scopeSpec, const String&
class OwnedExpression final : public Expression
{
public:
OwnedExpression(const std::shared_ptr<Expression>& expression)
: m_Expression(expression)
OwnedExpression(std::shared_ptr<Expression> expression)
: m_Expression(std::move(expression))
{ }
protected:
@ -242,7 +242,7 @@ private:
class LiteralExpression final : public Expression
{
public:
LiteralExpression(const Value& value = Value());
LiteralExpression(Value value = Value());
const Value& GetValue() const
{
@ -269,8 +269,8 @@ inline std::unique_ptr<LiteralExpression> MakeLiteral(const Value& literal = Val
class DebuggableExpression : public Expression
{
public:
DebuggableExpression(const DebugInfo& debugInfo = DebugInfo())
: m_DebugInfo(debugInfo)
DebuggableExpression(DebugInfo debugInfo = DebugInfo())
: m_DebugInfo(std::move(debugInfo))
{ }
protected:
@ -305,8 +305,8 @@ protected:
class VariableExpression final : public DebuggableExpression
{
public:
VariableExpression(const String& variable, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Variable(variable)
VariableExpression(String variable, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Variable(std::move(variable))
{ }
String GetVariable() const
@ -768,9 +768,9 @@ protected:
class FunctionExpression final : public DebuggableExpression
{
public:
FunctionExpression(const String& name, const std::vector<String>& args,
FunctionExpression(String name, std::vector<String> args,
std::map<String, std::unique_ptr<Expression> >&& closedVars, std::unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Name(name), m_Args(args), m_ClosedVars(std::move(closedVars)), m_Expression(std::move(expression))
: DebuggableExpression(debugInfo), m_Name(std::move(name)), m_Args(std::move(args)), m_ClosedVars(std::move(closedVars)), m_Expression(std::move(expression))
{ }
protected:
@ -786,12 +786,12 @@ private:
class ApplyExpression final : public DebuggableExpression
{
public:
ApplyExpression(const String& type, const String& target, std::unique_ptr<Expression> name,
std::unique_ptr<Expression> filter, const String& package, const String& fkvar, const String& fvvar,
ApplyExpression(String type, String target, std::unique_ptr<Expression> name,
std::unique_ptr<Expression> filter, String package, String fkvar, String fvvar,
std::unique_ptr<Expression> fterm, std::map<String, std::unique_ptr<Expression> >&& closedVars, bool ignoreOnError,
std::unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Type(type), m_Target(target),
m_Name(std::move(name)), m_Filter(std::move(filter)), m_Package(package), m_FKVar(fkvar), m_FVVar(fvvar),
: DebuggableExpression(debugInfo), m_Type(std::move(type)), m_Target(std::move(target)),
m_Name(std::move(name)), m_Filter(std::move(filter)), m_Package(std::move(package)), m_FKVar(std::move(fkvar)), m_FVVar(std::move(fvvar)),
m_FTerm(std::move(fterm)), m_IgnoreOnError(ignoreOnError), m_ClosedVars(std::move(closedVars)),
m_Expression(std::move(expression))
{ }
@ -817,10 +817,10 @@ class ObjectExpression final : public DebuggableExpression
{
public:
ObjectExpression(bool abstract, std::unique_ptr<Expression> type, std::unique_ptr<Expression> name, std::unique_ptr<Expression> filter,
const String& zone, const String& package, std::map<String, std::unique_ptr<Expression> >&& closedVars,
String zone, String package, std::map<String, std::unique_ptr<Expression> >&& closedVars,
bool defaultTmpl, bool ignoreOnError, std::unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Abstract(abstract), m_Type(std::move(type)),
m_Name(std::move(name)), m_Filter(std::move(filter)), m_Zone(zone), m_Package(package), m_DefaultTmpl(defaultTmpl),
m_Name(std::move(name)), m_Filter(std::move(filter)), m_Zone(std::move(zone)), m_Package(std::move(package)), m_DefaultTmpl(defaultTmpl),
m_IgnoreOnError(ignoreOnError), m_ClosedVars(std::move(closedVars)), m_Expression(std::move(expression))
{ }
@ -843,8 +843,8 @@ private:
class ForExpression final : public DebuggableExpression
{
public:
ForExpression(const String& fkvar, const String& fvvar, std::unique_ptr<Expression> value, std::unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_FKVar(fkvar), m_FVVar(fvvar), m_Value(std::move(value)), m_Expression(std::move(expression))
ForExpression(String fkvar, String fvvar, std::unique_ptr<Expression> value, std::unique_ptr<Expression> expression, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_FKVar(std::move(fkvar)), m_FVVar(std::move(fvvar)), m_Value(std::move(value)), m_Expression(std::move(expression))
{ }
protected:
@ -878,10 +878,10 @@ enum IncludeType
class IncludeExpression final : public DebuggableExpression
{
public:
IncludeExpression(const String& relativeBase, std::unique_ptr<Expression> path, std::unique_ptr<Expression> pattern, std::unique_ptr<Expression> name,
IncludeType type, bool searchIncludes, const String& zone, const String& package, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_RelativeBase(relativeBase), m_Path(std::move(path)), m_Pattern(std::move(pattern)),
m_Name(std::move(name)), m_Type(type), m_SearchIncludes(searchIncludes), m_Zone(zone), m_Package(package)
IncludeExpression(String relativeBase, std::unique_ptr<Expression> path, std::unique_ptr<Expression> pattern, std::unique_ptr<Expression> name,
IncludeType type, bool searchIncludes, String zone, String package, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_RelativeBase(std::move(relativeBase)), m_Path(std::move(path)), m_Pattern(std::move(pattern)),
m_Name(std::move(name)), m_Type(type), m_SearchIncludes(searchIncludes), m_Zone(std::move(zone)), m_Package(std::move(package))
{ }
protected:

View File

@ -1247,7 +1247,7 @@ void DbEvents::AddEnableFlappingChangedLogHistory(const Checkable::Ptr& checkabl
AddLogHistory(checkable, msgbuf.str(), LogEntryTypeInfoMessage);
}
void DbEvents::AddLogHistory(const Checkable::Ptr& checkable, String buffer, LogEntryType type)
void DbEvents::AddLogHistory(const Checkable::Ptr& checkable, const String& buffer, LogEntryType type)
{
Log(LogDebug, "DbEvents")
<< "add log entry history for '" << checkable->GetName() << "'";

View File

@ -66,7 +66,7 @@ public:
static void AddDowntimes(const Checkable::Ptr& checkable);
static void RemoveDowntimes(const Checkable::Ptr& checkable);
static void AddLogHistory(const Checkable::Ptr& checkable, String buffer, LogEntryType type);
static void AddLogHistory(const Checkable::Ptr& checkable, const String& buffer, LogEntryType type);
/* Status */
static void NextCheckUpdatedHandler(const Checkable::Ptr& checkable);

View File

@ -45,8 +45,8 @@ boost::signals2::signal<void (const std::vector<DbQuery>&)> DbObject::OnMultiple
INITIALIZE_ONCE(&DbObject::StaticInitialize);
DbObject::DbObject(const intrusive_ptr<DbType>& type, const String& name1, const String& name2)
: m_Name1(name1), m_Name2(name2), m_Type(type), m_LastConfigUpdate(0), m_LastStatusUpdate(0)
DbObject::DbObject(intrusive_ptr<DbType> type, String name1, String name2)
: m_Name1(std::move(name1)), m_Name2(std::move(name2)), m_Type(std::move(type)), m_LastConfigUpdate(0), m_LastStatusUpdate(0)
{ }
void DbObject::StaticInitialize()

View File

@ -93,7 +93,7 @@ public:
virtual String CalculateConfigHash(const Dictionary::Ptr& configFields) const;
protected:
DbObject(const intrusive_ptr<DbType>& type, const String& name1, const String& name2);
DbObject(intrusive_ptr<DbType> type, String name1, String name2);
virtual void OnConfigUpdateHeavy();
virtual void OnConfigUpdateLight();

View File

@ -25,8 +25,8 @@
using namespace icinga;
DbType::DbType(const String& name, const String& table, long tid, const String& idcolumn, const DbType::ObjectFactory& factory)
: m_Name(name), m_Table(table), m_TypeID(tid), m_IDColumn(idcolumn), m_ObjectFactory(factory)
DbType::DbType(String name, String table, long tid, String idcolumn, DbType::ObjectFactory factory)
: m_Name(std::move(name)), m_Table(std::move(table)), m_TypeID(tid), m_IDColumn(std::move(idcolumn)), m_ObjectFactory(std::move(factory))
{ }
String DbType::GetName() const

View File

@ -45,7 +45,7 @@ public:
typedef std::map<String, DbType::Ptr> TypeMap;
typedef std::map<std::pair<String, String>, intrusive_ptr<DbObject> > ObjectMap;
DbType(const String& name, const String& table, long tid, const String& idcolumn, const ObjectFactory& factory);
DbType(String name, String table, long tid, String idcolumn, ObjectFactory factory);
String GetName() const;
String GetTable() const;

View File

@ -21,8 +21,8 @@
using namespace icinga;
DbValue::DbValue(DbValueType type, const Value& value)
: m_Type(type), m_Value(value)
DbValue::DbValue(DbValueType type, Value value)
: m_Type(type), m_Value(std::move(value))
{ }
Value DbValue::FromTimestamp(const Value& ts)

View File

@ -44,7 +44,7 @@ struct DbValue final : public Object
public:
DECLARE_PTR_TYPEDEFS(DbValue);
DbValue(DbValueType type, const Value& value);
DbValue(DbValueType type, Value value);
static Value FromTimestamp(const Value& ts);
static Value FromTimestampNow();

View File

@ -31,6 +31,7 @@
#include "base/exception.hpp"
#include "base/statsfunction.hpp"
#include <boost/tuple/tuple.hpp>
#include <utility>
using namespace icinga;
@ -132,7 +133,7 @@ void IdoMysqlConnection::ExceptionHandler(boost::exception_ptr exp)
Log(LogCritical, "IdoMysqlConnection", "Exception during database operation: Verify that your database is operational!");
Log(LogDebug, "IdoMysqlConnection")
<< "Exception during database operation: " << DiagnosticInformation(exp);
<< "Exception during database operation: " << DiagnosticInformation(std::move(exp));
if (GetConnected()) {
m_Mysql->close(&m_Connection);

View File

@ -32,6 +32,7 @@
#include "base/context.hpp"
#include "base/statsfunction.hpp"
#include <boost/tuple/tuple.hpp>
#include <utility>
using namespace icinga;
@ -131,7 +132,7 @@ void IdoPgsqlConnection::ExceptionHandler(boost::exception_ptr exp)
Log(LogWarning, "IdoPgsqlConnection", "Exception during database operation: Verify that your database is operational!");
Log(LogDebug, "IdoPgsqlConnection")
<< "Exception during database operation: " << DiagnosticInformation(exp);
<< "Exception during database operation: " << DiagnosticInformation(std::move(exp));
if (GetConnected()) {
m_Pgsql->finish(m_Connection);

View File

@ -55,7 +55,7 @@ String CompatUtility::GetCommandLine(const Command::Ptr& command)
return result;
}
String CompatUtility::GetCommandNamePrefix(const Command::Ptr command)
String CompatUtility::GetCommandNamePrefix(const Command::Ptr& command)
{
if (!command)
return Empty;
@ -71,7 +71,7 @@ String CompatUtility::GetCommandNamePrefix(const Command::Ptr command)
return prefix;
}
String CompatUtility::GetCommandName(const Command::Ptr command)
String CompatUtility::GetCommandName(const Command::Ptr& command)
{
if (!command)
return Empty;

View File

@ -41,7 +41,7 @@ class CompatUtility
public:
/* command */
static String GetCommandLine(const Command::Ptr& command);
static String GetCommandName(const Command::Ptr command);
static String GetCommandName(const Command::Ptr& command);
/* host */
static int GetHostCurrentState(const Host::Ptr& host);
@ -122,7 +122,7 @@ public:
private:
CompatUtility();
static String GetCommandNamePrefix(const Command::Ptr command);
static String GetCommandNamePrefix(const Command::Ptr& command);
};
}

View File

@ -23,7 +23,6 @@
#include "icinga/i2-icinga.hpp"
#include "icinga/scheduleddowntime.thpp"
#include "icinga/checkable.hpp"
#include <utility>
namespace icinga
{

View File

@ -24,7 +24,6 @@
#include "icinga/service.thpp"
#include "icinga/macroresolver.hpp"
#include "icinga/host.hpp"
#include <utility>
#include <tuple>
using std::tie;

View File

@ -27,8 +27,8 @@
using namespace icinga;
AttributeFilter::AttributeFilter(const String& column, const String& op, const String& operand)
: m_Column(column), m_Operator(op), m_Operand(operand)
AttributeFilter::AttributeFilter(String column, String op, String operand)
: m_Column(std::move(column)), m_Operator(std::move(op)), m_Operand(std::move(operand))
{ }
bool AttributeFilter::Apply(const Table::Ptr& table, const Value& row)

View File

@ -35,7 +35,7 @@ class AttributeFilter final : public Filter
public:
DECLARE_PTR_TYPEDEFS(AttributeFilter);
AttributeFilter(const String& column, const String& op, const String& operand);
AttributeFilter(String column, String op, String operand);
bool Apply(const Table::Ptr& table, const Value& row) override;

View File

@ -21,8 +21,8 @@
using namespace icinga;
AvgAggregator::AvgAggregator(const String& attr)
: m_AvgAttr(attr)
AvgAggregator::AvgAggregator(String attr)
: m_AvgAttr(std::move(attr))
{ }
AvgAggregatorState *AvgAggregator::EnsureState(AggregatorState **state)

View File

@ -47,7 +47,7 @@ class AvgAggregator final : public Aggregator
public:
DECLARE_PTR_TYPEDEFS(AvgAggregator);
AvgAggregator(const String& attr);
AvgAggregator(String attr);
void Apply(const Table::Ptr& table, const Value& row, AggregatorState **state) override;
double GetResultAndFreeState(AggregatorState *state) const override;

View File

@ -21,8 +21,8 @@
using namespace icinga;
Column::Column(const ValueAccessor& valueAccessor, const ObjectAccessor& objectAccessor)
: m_ValueAccessor(valueAccessor), m_ObjectAccessor(objectAccessor)
Column::Column(ValueAccessor valueAccessor, ObjectAccessor objectAccessor)
: m_ValueAccessor(std::move(valueAccessor)), m_ObjectAccessor(std::move(objectAccessor))
{ }
Value Column::ExtractValue(const Value& urow, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject) const

View File

@ -40,7 +40,7 @@ public:
typedef std::function<Value (const Value&)> ValueAccessor;
typedef std::function<Value (const Value&, LivestatusGroupByType, const Object::Ptr&)> ObjectAccessor;
Column(const ValueAccessor& valueAccessor, const ObjectAccessor& objectAccessor);
Column(ValueAccessor valueAccessor, ObjectAccessor objectAccessor);
Value ExtractValue(const Value& urow, LivestatusGroupByType groupByType = LivestatusGroupByNone, const Object::Ptr& groupByObject = Empty) const;

View File

@ -37,7 +37,7 @@ public:
virtual bool Apply(const Table::Ptr& table, const Value& row) = 0;
protected:
Filter();
Filter() = default;
};
}

View File

@ -21,8 +21,8 @@
using namespace icinga;
InvAvgAggregator::InvAvgAggregator(const String& attr)
: m_InvAvgAttr(attr)
InvAvgAggregator::InvAvgAggregator(String attr)
: m_InvAvgAttr(std::move(attr))
{ }
InvAvgAggregatorState *InvAvgAggregator::EnsureState(AggregatorState **state)

View File

@ -47,7 +47,7 @@ class InvAvgAggregator final : public Aggregator
public:
DECLARE_PTR_TYPEDEFS(InvAvgAggregator);
InvAvgAggregator(const String& attr);
InvAvgAggregator(String attr);
void Apply(const Table::Ptr& table, const Value& row, AggregatorState **state) override;
double GetResultAndFreeState(AggregatorState *state) const override;

View File

@ -21,8 +21,8 @@
using namespace icinga;
InvSumAggregator::InvSumAggregator(const String& attr)
: m_InvSumAttr(attr)
InvSumAggregator::InvSumAggregator(String attr)
: m_InvSumAttr(std::move(attr))
{ }
InvSumAggregatorState *InvSumAggregator::EnsureState(AggregatorState **state)

View File

@ -46,7 +46,7 @@ class InvSumAggregator final : public Aggregator
public:
DECLARE_PTR_TYPEDEFS(InvSumAggregator);
InvSumAggregator(const String& attr);
InvSumAggregator(String attr);
void Apply(const Table::Ptr& table, const Value& row, AggregatorState **state) override;
double GetResultAndFreeState(AggregatorState *state) const override;

View File

@ -534,7 +534,7 @@ void LivestatusQuery::ExecuteGetHelper(const Stream::Ptr& stream)
int index = 0;
for (const Aggregator::Ptr aggregator : m_Aggregators) {
for (const Aggregator::Ptr& aggregator : m_Aggregators) {
aggregator->Apply(table, object.Row, &stats[index]);
index++;
}

View File

@ -21,8 +21,8 @@
using namespace icinga;
MaxAggregator::MaxAggregator(const String& attr)
: m_MaxAttr(attr)
MaxAggregator::MaxAggregator(String attr)
: m_MaxAttr(std::move(attr))
{ }
MaxAggregatorState *MaxAggregator::EnsureState(AggregatorState **state)

View File

@ -46,7 +46,7 @@ class MaxAggregator final : public Aggregator
public:
DECLARE_PTR_TYPEDEFS(MaxAggregator);
MaxAggregator(const String& attr);
MaxAggregator(String attr);
void Apply(const Table::Ptr& table, const Value& row, AggregatorState **state) override;
double GetResultAndFreeState(AggregatorState *state) const override;

View File

@ -21,8 +21,8 @@
using namespace icinga;
MinAggregator::MinAggregator(const String& attr)
: m_MinAttr(attr)
MinAggregator::MinAggregator(String attr)
: m_MinAttr(std::move(attr))
{ }
MinAggregatorState *MinAggregator::EnsureState(AggregatorState **state)

View File

@ -47,7 +47,7 @@ class MinAggregator final : public Aggregator
public:
DECLARE_PTR_TYPEDEFS(MinAggregator);
MinAggregator(const String& attr);
MinAggregator(String attr);
void Apply(const Table::Ptr& table, const Value& row, AggregatorState **state) override;
double GetResultAndFreeState(AggregatorState *state) const override;

View File

@ -21,8 +21,8 @@
using namespace icinga;
NegateFilter::NegateFilter(const Filter::Ptr& inner)
: m_Inner(inner)
NegateFilter::NegateFilter(Filter::Ptr inner)
: m_Inner(std::move(inner))
{ }
bool NegateFilter::Apply(const Table::Ptr& table, const Value& row)

View File

@ -35,7 +35,7 @@ class NegateFilter final : public Filter
public:
DECLARE_PTR_TYPEDEFS(NegateFilter);
NegateFilter(const Filter::Ptr& inner);
NegateFilter(Filter::Ptr inner);
bool Apply(const Table::Ptr& table, const Value& row) override;

View File

@ -22,8 +22,8 @@
using namespace icinga;
StdAggregator::StdAggregator(const String& attr)
: m_StdAttr(attr)
StdAggregator::StdAggregator(String attr)
: m_StdAttr(std::move(attr))
{ }
StdAggregatorState *StdAggregator::EnsureState(AggregatorState **state)

View File

@ -48,7 +48,7 @@ class StdAggregator final : public Aggregator
public:
DECLARE_PTR_TYPEDEFS(StdAggregator);
StdAggregator(const String& attr);
StdAggregator(String attr);
void Apply(const Table::Ptr& table, const Value& row, AggregatorState **state) override;
double GetResultAndFreeState(AggregatorState *state) const override;

View File

@ -21,8 +21,8 @@
using namespace icinga;
SumAggregator::SumAggregator(const String& attr)
: m_SumAttr(attr)
SumAggregator::SumAggregator(String attr)
: m_SumAttr(std::move(attr))
{ }
SumAggregatorState *SumAggregator::EnsureState(AggregatorState **state)

View File

@ -46,7 +46,7 @@ class SumAggregator final : public Aggregator
public:
DECLARE_PTR_TYPEDEFS(SumAggregator);
SumAggregator(const String& attr);
SumAggregator(String attr);
void Apply(const Table::Ptr& table, const Value& row, AggregatorState **state) override;
double GetResultAndFreeState(AggregatorState *state) const override;

View File

@ -91,7 +91,7 @@ Value ZonesTable::EndpointsAccessor(const Value& row)
Array::Ptr endpoint_names = new Array();
for (const Endpoint::Ptr endpoint : endpoints) {
for (const Endpoint::Ptr& endpoint : endpoints) {
endpoint_names->Add(endpoint->GetName());
}

View File

@ -109,7 +109,7 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& service, const CheckResul
double bytesSentPerSecond = 0;
double bytesReceivedPerSecond = 0;
for (Endpoint::Ptr endpoint : endpoints)
for (const Endpoint::Ptr& endpoint : endpoints)
{
if (endpoint->GetLastMessageSent() > lastMessageSent)
lastMessageSent = endpoint->GetLastMessageSent();

View File

@ -36,6 +36,7 @@
#include "base/statsfunction.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/scoped_array.hpp>
#include <utility>
using namespace icinga;
@ -341,7 +342,7 @@ void ElasticsearchWriter::NotificationSentToAllUsersHandlerInternal(const Notifi
Enqueue("notification", fields, ts);
}
void ElasticsearchWriter::Enqueue(String type, const Dictionary::Ptr& fields, double ts)
void ElasticsearchWriter::Enqueue(const String& type, const Dictionary::Ptr& fields, double ts)
{
/* Atomically buffer the data point. */
boost::mutex::scoped_lock lock(m_DataBufferMutex);
@ -575,7 +576,7 @@ void ElasticsearchWriter::ExceptionHandler(boost::exception_ptr exp)
Log(LogCritical, "ElasticsearchWriter", "Exception during Elastic operation: Verify that your backend is operational!");
Log(LogDebug, "ElasticsearchWriter")
<< "Exception during Elasticsearch operation: " << DiagnosticInformation(exp);
<< "Exception during Elasticsearch operation: " << DiagnosticInformation(std::move(exp));
}
String ElasticsearchWriter::FormatTimestamp(double ts)

View File

@ -66,7 +66,7 @@ private:
const Checkable::Ptr& checkable, const std::set<User::Ptr>& users, NotificationType type,
const CheckResult::Ptr& cr, const String& author, const String& text);
void Enqueue(String type, const Dictionary::Ptr& fields, double ts);
void Enqueue(const String& type, const Dictionary::Ptr& fields, double ts);
Stream::Ptr Connect();
void AssertOnWorkQueue();

View File

@ -38,6 +38,7 @@
#include "base/json.hpp"
#include "base/statsfunction.hpp"
#include <boost/algorithm/string/replace.hpp>
#include <utility>
using namespace icinga;
@ -122,7 +123,7 @@ void GelfWriter::ExceptionHandler(boost::exception_ptr exp)
Log(LogCritical, "GelfWriter", "Exception during Graylog Gelf operation: Verify that your backend is operational!");
Log(LogDebug, "GelfWriter")
<< "Exception during Graylog Gelf operation: " << DiagnosticInformation(exp);
<< "Exception during Graylog Gelf operation: " << DiagnosticInformation(std::move(exp));
if (GetConnected()) {
m_Stream->Close();

View File

@ -38,6 +38,7 @@
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <utility>
using namespace icinga;
@ -119,7 +120,7 @@ void GraphiteWriter::ExceptionHandler(boost::exception_ptr exp)
Log(LogCritical, "GraphiteWriter", "Exception during Graphite operation: Verify that your backend is operational!");
Log(LogDebug, "GraphiteWriter")
<< "Exception during Graphite operation: " << DiagnosticInformation(exp);
<< "Exception during Graphite operation: " << DiagnosticInformation(std::move(exp));
if (GetConnected()) {
m_Stream->Close();

View File

@ -46,6 +46,7 @@
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/regex.hpp>
#include <boost/scoped_array.hpp>
#include <utility>
using namespace icinga;
@ -147,7 +148,7 @@ void InfluxdbWriter::ExceptionHandler(boost::exception_ptr exp)
Log(LogCritical, "InfluxdbWriter", "Exception during InfluxDB operation: Verify that your backend is operational!");
Log(LogDebug, "InfluxdbWriter")
<< "Exception during InfluxDB operation: " << DiagnosticInformation(exp);
<< "Exception during InfluxDB operation: " << DiagnosticInformation(std::move(exp));
//TODO: Close the connection, if we keep it open.
}

View File

@ -22,8 +22,8 @@
using namespace icinga;
ApiAction::ApiAction(const std::vector<String>& types, const Callback& action)
: m_Types(types), m_Callback(action)
ApiAction::ApiAction(std::vector<String> types, Callback action)
: m_Types(std::move(types)), m_Callback(std::move(action))
{ }
Value ApiAction::Invoke(const ConfigObject::Ptr& target, const Dictionary::Ptr& params)

View File

@ -45,7 +45,7 @@ public:
typedef std::function<Value(const ConfigObject::Ptr& target, const Dictionary::Ptr& params)> Callback;
ApiAction(const std::vector<String>& registerTypes, const Callback& function);
ApiAction(std::vector<String> registerTypes, Callback function);
Value Invoke(const ConfigObject::Ptr& target, const Dictionary::Ptr& params);

View File

@ -27,8 +27,8 @@
using namespace icinga;
ApiClient::ApiClient(const String& host, const String& port,
const String& user, const String& password)
: m_Connection(new HttpClientConnection(host, port, true)), m_User(user), m_Password(password)
String user, String password)
: m_Connection(new HttpClientConnection(host, port, true)), m_User(std::move(user)), m_Password(std::move(password))
{
m_Connection->Start();
}

View File

@ -90,7 +90,7 @@ public:
DECLARE_PTR_TYPEDEFS(ApiClient);
ApiClient(const String& host, const String& port,
const String& user, const String& password);
String user, String password);
typedef std::function<void(boost::exception_ptr, const std::vector<ApiType::Ptr>&)> TypesCompletionCallback;
void GetTypes(const TypesCompletionCallback& callback) const;

View File

@ -22,8 +22,8 @@
using namespace icinga;
ApiFunction::ApiFunction(const Callback& function)
: m_Callback(function)
ApiFunction::ApiFunction(Callback function)
: m_Callback(std::move(function))
{ }
Value ApiFunction::Invoke(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& arguments)

View File

@ -42,7 +42,7 @@ public:
typedef std::function<Value(const MessageOrigin::Ptr& origin, const Dictionary::Ptr&)> Callback;
ApiFunction(const Callback& function);
ApiFunction(Callback function);
Value Invoke(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& arguments);

View File

@ -24,8 +24,8 @@
using namespace icinga;
EventQueue::EventQueue(const String& name)
: m_Name(name)
EventQueue::EventQueue(String name)
: m_Name(std::move(name))
{ }
bool EventQueue::CanProcessEvent(const String& type) const

View File

@ -37,7 +37,7 @@ class EventQueue final : public Object
public:
DECLARE_PTR_TYPEDEFS(EventQueue);
EventQueue(const String& name);
EventQueue(String name);
bool CanProcessEvent(const String& type) const;
void ProcessEvent(const Dictionary::Ptr& event);

View File

@ -31,8 +31,8 @@
using namespace icinga;
HttpClientConnection::HttpClientConnection(const String& host, const String& port, bool tls)
: m_Host(host), m_Port(port), m_Tls(tls)
HttpClientConnection::HttpClientConnection(String host, String port, bool tls)
: m_Host(std::move(host)), m_Port(std::move(port)), m_Tls(tls)
{ }
void HttpClientConnection::Start()

View File

@ -39,7 +39,7 @@ class HttpClientConnection final : public Object
public:
DECLARE_PTR_TYPEDEFS(HttpClientConnection);
HttpClientConnection(const String& host, const String& port, bool tls = true);
HttpClientConnection(String host, String port, bool tls = true);
void Start();

View File

@ -27,11 +27,11 @@
using namespace icinga;
HttpRequest::HttpRequest(const Stream::Ptr& stream)
HttpRequest::HttpRequest(Stream::Ptr stream)
: Complete(false),
ProtocolVersion(HttpVersion11),
Headers(new Dictionary()),
m_Stream(stream),
m_Stream(std::move(stream)),
m_State(HttpRequestStart)
{ }

View File

@ -60,7 +60,7 @@ public:
Dictionary::Ptr Headers;
HttpRequest(const Stream::Ptr& stream);
HttpRequest(Stream::Ptr stream);
bool Parse(StreamReadContext& src, bool may_wait);
size_t ReadBody(char *data, size_t count);

View File

@ -27,8 +27,8 @@
using namespace icinga;
HttpResponse::HttpResponse(const Stream::Ptr& stream, const HttpRequest& request)
: Complete(false), m_State(HttpResponseStart), m_Request(request), m_Stream(stream)
HttpResponse::HttpResponse(Stream::Ptr stream, const HttpRequest& request)
: Complete(false), m_State(HttpResponseStart), m_Request(request), m_Stream(std::move(stream))
{ }
void HttpResponse::SetStatus(int code, const String& message)

View File

@ -52,7 +52,7 @@ public:
Dictionary::Ptr Headers;
HttpResponse(const Stream::Ptr& stream, const HttpRequest& request);
HttpResponse(Stream::Ptr stream, const HttpRequest& request);
bool Parse(StreamReadContext& src, bool may_wait);
size_t ReadBody(char *data, size_t count);

View File

@ -42,8 +42,8 @@ static int l_JsonRpcConnectionNextID;
static Timer::Ptr l_HeartbeatTimer;
JsonRpcConnection::JsonRpcConnection(const String& identity, bool authenticated,
const TlsStream::Ptr& stream, ConnectionRole role)
: m_ID(l_JsonRpcConnectionNextID++), m_Identity(identity), m_Authenticated(authenticated), m_Stream(stream),
TlsStream::Ptr stream, ConnectionRole role)
: m_ID(l_JsonRpcConnectionNextID++), m_Identity(identity), m_Authenticated(authenticated), m_Stream(std::move(stream)),
m_Role(role), m_Timestamp(Utility::GetTime()), m_Seen(Utility::GetTime()), m_NextHeartbeat(0), m_HeartbeatTimeout(0)
{
boost::call_once(l_JsonRpcConnectionOnceFlag, &JsonRpcConnection::StaticInitialize);

View File

@ -53,7 +53,7 @@ class JsonRpcConnection final : public Object
public:
DECLARE_PTR_TYPEDEFS(JsonRpcConnection);
JsonRpcConnection(const String& identity, bool authenticated, const TlsStream::Ptr& stream, ConnectionRole role);
JsonRpcConnection(const String& identity, bool authenticated, TlsStream::Ptr stream, ConnectionRole role);
void Start();

View File

@ -270,7 +270,7 @@ String Url::Format(bool onlyPathAndQuery, bool printCredentials) const
// Array
String temp;
for (const String s : kv.second) {
for (const String& s : kv.second) {
if (!temp.IsEmpty())
temp += "&";
@ -351,7 +351,7 @@ bool Url::ParsePort(const String& port)
bool Url::ParsePath(const String& path)
{
std::string pathStr = path;
const std::string& pathStr = path;
boost::char_separator<char> sep("/");
boost::tokenizer<boost::char_separator<char> > tokens(pathStr, sep);
@ -371,7 +371,7 @@ bool Url::ParsePath(const String& path)
bool Url::ParseQuery(const String& query)
{
/* Tokenizer does not like String AT ALL */
std::string queryStr = query;
const std::string& queryStr = query;
boost::char_separator<char> sep("&");
boost::tokenizer<boost::char_separator<char> > tokens(queryStr, sep);

View File

@ -24,6 +24,7 @@
#include <stdexcept>
#include <map>
#include <set>
#include <utility>
#include <vector>
#include <cstring>
#include <locale>
@ -35,9 +36,9 @@
using namespace icinga;
ClassCompiler::ClassCompiler(const std::string& path, std::istream& input,
ClassCompiler::ClassCompiler(std::string path, std::istream& input,
std::ostream& oimpl, std::ostream& oheader)
: m_Path(path), m_Input(input), m_Impl(oimpl), m_Header(oheader)
: m_Path(std::move(path)), m_Input(input), m_Impl(oimpl), m_Header(oheader)
{
InitializeScanner();
}

Some files were not shown because too many files have changed in this diff Show More