indentation.h
Go to the documentation of this file.
00001 #ifndef INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
00002 #define INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
00003 
00004 #if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
00005 #pragma once
00006 #endif
00007 
00008 
00009 #include "yaml-cpp-pm/ostream.h"
00010 #include <iostream>
00011 
00012 namespace YAML_PM
00013 {
00014         struct Indentation {
00015                 Indentation(unsigned n_): n(n_) {}
00016                 unsigned n;
00017         };
00018         
00019         inline ostream& operator << (ostream& out, const Indentation& indent) {
00020                 for(unsigned i=0;i<indent.n;i++)
00021                         out << ' ';
00022                 return out;
00023         }
00024 
00025         struct IndentTo {
00026                 IndentTo(unsigned n_): n(n_) {}
00027                 unsigned n;
00028         };
00029         
00030         inline ostream& operator << (ostream& out, const IndentTo& indent) {
00031                 while(out.col() < indent.n)
00032                         out << ' ';
00033                 return out;
00034         }
00035 }
00036 
00037 
00038 #endif // INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66


upstream_src
Author(s):
autogenerated on Mon Oct 6 2014 10:27:41