mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 04:41:16 +00:00
Merged emitter branch into trunk, changes r105:r151
This commit is contained in:
30
src/indentation.h
Normal file
30
src/indentation.h
Normal 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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user