Merged emitter branch into trunk, changes r105:r151

This commit is contained in:
Jesse Beder
2009-05-22 21:52:31 +00:00
parent b3a5a519f2
commit 9245f9253a
20 changed files with 2478 additions and 37 deletions

30
src/indentation.h Normal file
View File

@@ -0,0 +1,30 @@
#pragma once
#include "ostream.h"
#include <iostream>
namespace YAML
{
struct Indentation {
Indentation(unsigned n_): n(n_) {}
unsigned n;
};
inline ostream& operator << (ostream& out, const Indentation& indent) {
for(unsigned i=0;i<indent.n;i++)
out << ' ';
return out;
}
struct IndentTo {
IndentTo(unsigned n_): n(n_) {}
unsigned n;
};
inline ostream& operator << (ostream& out, const IndentTo& indent) {
while(out.col() < indent.n)
out << ' ';
return out;
}
}