Scine::Sparrow  5.0.0
Library for fast and agile quantum chemical calculations with semiempirical methods.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Indent.h
Go to the documentation of this file.
1 
7 #ifndef INCLUDE_SPARROW_EMBED_INDENT_H
8 #define INCLUDE_SPARROW_EMBED_INDENT_H
9 
10 #include <string>
11 
12 template<typename T>
13 struct Indented {
14  constexpr static unsigned width = 2;
15 
16  unsigned startLevel;
17  const T& bound;
18 
19  std::string operator()(const unsigned level) const {
20  return std::string(width * (startLevel + level), ' ');
21  }
22 
23  Indented<T> increment() const {
24  return Indented<T>{startLevel + 1, bound};
25  }
26 };
27 
28 struct Indent {
29  constexpr static unsigned width = 2;
30 
31  static std::string level(const unsigned a) {
32  return std::string(width * a, ' ');
33  }
34 
35  template<typename T>
36  static auto bind(unsigned level, const T& t) {
37  return Indented<T>{level, t};
38  }
39 };
40 
41 #endif
Definition: Indent.h:28
Definition: Indent.h:13