mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-10 04:51:17 +00:00
Added emitting for a YAML::Node (instead of the ad-hoc std::ostream overload) so it'll actually emit valid YAML always
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#include "node.h"
|
||||
#include "scanner.h"
|
||||
#include "token.h"
|
||||
#include <iostream>
|
||||
#include "emitter.h"
|
||||
|
||||
namespace YAML
|
||||
{
|
||||
@@ -133,23 +133,12 @@ namespace YAML
|
||||
}
|
||||
}
|
||||
|
||||
void Sequence::Write(std::ostream& out, int indent, bool startedLine, bool onlyOneCharOnLine)
|
||||
void Sequence::Write(Emitter& out) const
|
||||
{
|
||||
if(startedLine && !onlyOneCharOnLine)
|
||||
out << "\n";
|
||||
|
||||
for(unsigned i=0;i<m_data.size();i++) {
|
||||
if((startedLine && !onlyOneCharOnLine) || i > 0) {
|
||||
for(int j=0;j<indent;j++)
|
||||
out << " ";
|
||||
}
|
||||
|
||||
out << "- ";
|
||||
m_data[i]->Write(out, indent + 1, true, i > 0 || !startedLine || onlyOneCharOnLine);
|
||||
}
|
||||
|
||||
if(m_data.empty())
|
||||
out << "\n";
|
||||
out << BeginSeq;
|
||||
for(unsigned i=0;i<m_data.size();i++)
|
||||
out << *m_data[i];
|
||||
out << EndSeq;
|
||||
}
|
||||
|
||||
int Sequence::Compare(Content *pContent)
|
||||
|
Reference in New Issue
Block a user