mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-21 20:54:35 +02:00
Implement shift operator for the Value class.
This commit is contained in:
parent
ba92ab9460
commit
cab2b41e56
@ -300,7 +300,7 @@ void Query::PrintResultSet(std::ostream& fp, const std::vector<String>& columns,
|
|||||||
if (value.IsObjectType<Array>())
|
if (value.IsObjectType<Array>())
|
||||||
PrintCsvArray(fp, value, 0);
|
PrintCsvArray(fp, value, 0);
|
||||||
else
|
else
|
||||||
fp << Convert::ToString(value);
|
fp << value;
|
||||||
}
|
}
|
||||||
|
|
||||||
fp << "\n";
|
fp << "\n";
|
||||||
@ -324,7 +324,7 @@ void Query::PrintCsvArray(std::ostream& fp, const Array::Ptr& array, int level)
|
|||||||
if (value.IsObjectType<Array>())
|
if (value.IsObjectType<Array>())
|
||||||
PrintCsvArray(fp, value, level + 1);
|
PrintCsvArray(fp, value, level + 1);
|
||||||
else
|
else
|
||||||
fp << Convert::ToString(value);
|
fp << value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,3 +237,17 @@ ValueType Value::GetType(void) const
|
|||||||
{
|
{
|
||||||
return static_cast<ValueType>(m_Value.which());
|
return static_cast<ValueType>(m_Value.which());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ostream& icinga::operator<<(std::ostream& stream, const Value& value)
|
||||||
|
{
|
||||||
|
stream << static_cast<String>(value);
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::istream& icinga::operator>>(std::istream& stream, Value& value)
|
||||||
|
{
|
||||||
|
String tstr;
|
||||||
|
stream >> tstr;
|
||||||
|
value = tstr;
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
@ -114,6 +114,9 @@ private:
|
|||||||
|
|
||||||
static Value Empty;
|
static Value Empty;
|
||||||
|
|
||||||
|
I2_BASE_API std::ostream& operator<<(std::ostream& stream, const Value& value);
|
||||||
|
I2_BASE_API std::istream& operator>>(std::istream& stream, Value& value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* VALUE_H */
|
#endif /* VALUE_H */
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "base/scriptfunction.h"
|
#include "base/scriptfunction.h"
|
||||||
#include "base/logger_fwd.h"
|
#include "base/logger_fwd.h"
|
||||||
#include "base/utility.h"
|
#include "base/utility.h"
|
||||||
#include "base/convert.h"
|
|
||||||
#include "base/process.h"
|
#include "base/process.h"
|
||||||
#include <boost/smart_ptr/make_shared.hpp>
|
#include <boost/smart_ptr/make_shared.hpp>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
@ -87,7 +86,7 @@ void PluginNotificationTask::ScriptFunc(const Notification::Ptr& notification, c
|
|||||||
|
|
||||||
if (pr.ExitStatus != 0) {
|
if (pr.ExitStatus != 0) {
|
||||||
std::ostringstream msgbuf;
|
std::ostringstream msgbuf;
|
||||||
msgbuf << "Notification command '" << Convert::ToString(command) << "' for service '"
|
msgbuf << "Notification command '" << command << "' for service '"
|
||||||
<< service->GetName() << "' failed; exit status: "
|
<< service->GetName() << "' failed; exit status: "
|
||||||
<< pr.ExitStatus << ", output: " << pr.Output;
|
<< pr.ExitStatus << ", output: " << pr.Output;
|
||||||
Log(LogWarning, "icinga", msgbuf.str());
|
Log(LogWarning, "icinga", msgbuf.str());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user