icinga2/lib/base/debuginfo.cpp
2025-04-29 11:05:00 +02:00

34 lines
776 B
C++

/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
#include "base/debuginfo.hpp"
using namespace icinga;
/**
* Outputs a DebugInfo struct to a stream.
*
* @param out The output stream.
* @param val The DebugInfo struct.
* @returns The output stream.
*/
std::ostream& icinga::operator<<(std::ostream& out, const DebugInfo& val)
{
out << "in " << val.Path << ": "
<< val.FirstLine << ":" << val.FirstColumn
<< "-"
<< val.LastLine << ":" << val.LastColumn;
return out;
}
DebugInfo icinga::DebugInfoRange(const DebugInfo& start, const DebugInfo& end)
{
DebugInfo result;
result.Path = start.Path;
result.FirstLine = start.FirstLine;
result.FirstColumn = start.FirstColumn;
result.LastLine = end.LastLine;
result.LastColumn = end.LastColumn;
return result;
}