Added comments, not entirely correct

This commit is contained in:
Jesse Beder
2012-05-22 12:29:36 -05:00
parent 0f3f1e26a7
commit 0814813302
5 changed files with 18 additions and 4 deletions

View File

@@ -333,15 +333,18 @@ namespace YAML
{
const unsigned curIndent = out.col();
out << "#" << Indentation(postCommentIndent);
out.set_comment();
int codePoint;
for(std::string::const_iterator i = str.begin();
GetNextCodePointAndAdvance(codePoint, i, str.end());
)
{
if(codePoint == '\n')
if(codePoint == '\n') {
out << "\n" << IndentTo(curIndent) << "#" << Indentation(postCommentIndent);
else
out.set_comment();
} else {
WriteCodePoint(out, codePoint);
}
}
return true;
}