mirror of https://github.com/Icinga/icinga2.git
parent
5d46f661ea
commit
7378964f31
|
@ -216,6 +216,6 @@ Array::Ptr Array::Reverse(void) const
|
||||||
String Array::ToString(void) const
|
String Array::ToString(void) const
|
||||||
{
|
{
|
||||||
std::ostringstream msgbuf;
|
std::ostringstream msgbuf;
|
||||||
ConfigWriter::EmitArray(msgbuf, const_cast<Array *>(this));
|
ConfigWriter::EmitArray(msgbuf, 1, const_cast<Array *>(this));
|
||||||
return msgbuf.str();
|
return msgbuf.str();
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,14 +50,14 @@ void ConfigWriter::EmitEmpty(std::ostream& fp)
|
||||||
fp << "null";
|
fp << "null";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigWriter::EmitArray(std::ostream& fp, const Array::Ptr& val)
|
void ConfigWriter::EmitArray(std::ostream& fp, int indentLevel, const Array::Ptr& val)
|
||||||
{
|
{
|
||||||
fp << "[ ";
|
fp << "[ ";
|
||||||
EmitArrayItems(fp, val);
|
EmitArrayItems(fp, indentLevel, val);
|
||||||
fp << " ]";
|
fp << " ]";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigWriter::EmitArrayItems(std::ostream& fp, const Array::Ptr& val)
|
void ConfigWriter::EmitArrayItems(std::ostream& fp, int indentLevel, const Array::Ptr& val)
|
||||||
{
|
{
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ void ConfigWriter::EmitArrayItems(std::ostream& fp, const Array::Ptr& val)
|
||||||
else
|
else
|
||||||
fp << ", ";
|
fp << ", ";
|
||||||
|
|
||||||
EmitValue(fp, 0, item);
|
EmitValue(fp, indentLevel, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ void ConfigWriter::EmitScope(std::ostream& fp, int indentLevel, const Dictionary
|
||||||
void ConfigWriter::EmitValue(std::ostream& fp, int indentLevel, const Value& val)
|
void ConfigWriter::EmitValue(std::ostream& fp, int indentLevel, const Value& val)
|
||||||
{
|
{
|
||||||
if (val.IsObjectType<Array>())
|
if (val.IsObjectType<Array>())
|
||||||
EmitArray(fp, val);
|
EmitArray(fp, indentLevel, val);
|
||||||
else if (val.IsObjectType<Dictionary>())
|
else if (val.IsObjectType<Dictionary>())
|
||||||
EmitScope(fp, indentLevel, val);
|
EmitScope(fp, indentLevel, val);
|
||||||
else if (val.IsString())
|
else if (val.IsString())
|
||||||
|
@ -192,7 +192,7 @@ void ConfigWriter::EmitFunctionCall(std::ostream& fp, const String& name, const
|
||||||
{
|
{
|
||||||
EmitIdentifier(fp, name, false);
|
EmitIdentifier(fp, name, false);
|
||||||
fp << "(";
|
fp << "(";
|
||||||
EmitArrayItems(fp, arguments);
|
EmitArrayItems(fp, 0, arguments);
|
||||||
fp << ")";
|
fp << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,8 @@ public:
|
||||||
static void EmitNumber(std::ostream& fp, double val);
|
static void EmitNumber(std::ostream& fp, double val);
|
||||||
static void EmitString(std::ostream& fp, const String& val);
|
static void EmitString(std::ostream& fp, const String& val);
|
||||||
static void EmitEmpty(std::ostream& fp);
|
static void EmitEmpty(std::ostream& fp);
|
||||||
static void EmitArray(std::ostream& fp, const Array::Ptr& val);
|
static void EmitArray(std::ostream& fp, int indentLevel, const Array::Ptr& val);
|
||||||
static void EmitArrayItems(std::ostream& fp, const Array::Ptr& val);
|
static void EmitArrayItems(std::ostream& fp, int indentLevel, const Array::Ptr& val);
|
||||||
static void EmitDictionary(std::ostream& fp, const Dictionary::Ptr& val);
|
|
||||||
static void EmitScope(std::ostream& fp, int indentLevel, const Dictionary::Ptr& val, const Array::Ptr& imports = Array::Ptr());
|
static void EmitScope(std::ostream& fp, int indentLevel, const Dictionary::Ptr& val, const Array::Ptr& imports = Array::Ptr());
|
||||||
static void EmitValue(std::ostream& fp, int indentLevel, const Value& val);
|
static void EmitValue(std::ostream& fp, int indentLevel, const Value& val);
|
||||||
static void EmitRaw(std::ostream& fp, const String& val);
|
static void EmitRaw(std::ostream& fp, const String& val);
|
||||||
|
|
Loading…
Reference in New Issue