Clean up the DebugInfo class

refs #7709
This commit is contained in:
Gunnar Beutner 2014-12-18 12:58:46 +01:00
parent 82a9a8f0cf
commit c3cf7682b9
3 changed files with 8 additions and 6 deletions

View File

@ -23,6 +23,10 @@
using namespace icinga; using namespace icinga;
DebugInfo::DebugInfo(void)
: FirstLine(0), FirstColumn(0), LastLine(0), LastColumn(0)
{ }
/** /**
* Outputs a DebugInfo struct to a stream. * Outputs a DebugInfo struct to a stream.
* *

View File

@ -31,7 +31,7 @@ namespace icinga
* *
* @ingroup config * @ingroup config
*/ */
struct DebugInfo struct I2_BASE_API DebugInfo
{ {
String Path; String Path;
@ -41,16 +41,14 @@ struct DebugInfo
int LastLine; int LastLine;
int LastColumn; int LastColumn;
DebugInfo(void) DebugInfo(void);
: FirstLine(0), FirstColumn(0), LastLine(0), LastColumn(0)
{ }
}; };
I2_BASE_API std::ostream& operator<<(std::ostream& out, const DebugInfo& val); I2_BASE_API std::ostream& operator<<(std::ostream& out, const DebugInfo& val);
I2_BASE_API DebugInfo DebugInfoRange(const DebugInfo& start, const DebugInfo& end); I2_BASE_API DebugInfo DebugInfoRange(const DebugInfo& start, const DebugInfo& end);
I2_BASE_API void ShowCodeFragment(std::ostream& out, const DebugInfo& di, bool verbose); I2_BASE_API void ShowCodeFragment(std::ostream& out, const DebugInfo& di, bool verbose = true);
} }

View File

@ -144,7 +144,7 @@ static bool LoadConfigFiles(const boost::program_options::variables_map& vm, con
BOOST_FOREACH(const ConfigCompilerMessage& message, ConfigCompilerContext::GetInstance()->GetMessages()) { BOOST_FOREACH(const ConfigCompilerMessage& message, ConfigCompilerContext::GetInstance()->GetMessages()) {
std::ostringstream locbuf; std::ostringstream locbuf;
ShowCodeFragment(locbuf, message.Location, true); ShowCodeFragment(locbuf, message.Location);
String location = locbuf.str(); String location = locbuf.str();
String logmsg; String logmsg;