File indexing completed on 2025-05-12 09:08:10
0001 #ifndef INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
0002 #define INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
0003
0004 #if defined(_MSC_VER) || \
0005 (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
0006 (__GNUC__ >= 4))
0007 #pragma once
0008 #endif
0009
0010 #include <iostream>
0011 #include <cstddef>
0012
0013 #include "ATOOLS/YAML/yaml-cpp/ostream_wrapper.h"
0014
0015 namespace SHERPA_YAML {
0016 struct Indentation {
0017 Indentation(std::size_t n_) : n(n_) {}
0018 std::size_t n;
0019 };
0020
0021 inline ostream_wrapper& operator<<(ostream_wrapper& out,
0022 const Indentation& indent) {
0023 for (std::size_t i = 0; i < indent.n; i++)
0024 out << ' ';
0025 return out;
0026 }
0027
0028 struct IndentTo {
0029 IndentTo(std::size_t n_) : n(n_) {}
0030 std::size_t n;
0031 };
0032
0033 inline ostream_wrapper& operator<<(ostream_wrapper& out,
0034 const IndentTo& indent) {
0035 while (out.col() < indent.n)
0036 out << ' ';
0037 return out;
0038 }
0039 }
0040
0041 #endif