ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 54dcab1 was
4e5e6cc,
checked in by Thierry Delisle <tdelisle@…>, 5 years ago
|
Fixed indentation and remove too strict abort
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | // |
---|
2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo |
---|
3 | // |
---|
4 | // The contents of this file are covered under the licence agreement in the |
---|
5 | // file "LICENCE" distributed with Cforall. |
---|
6 | // |
---|
7 | // Indenter.h -- |
---|
8 | // |
---|
9 | // Author : Rob Schluntz |
---|
10 | // Created On : Fri Jun 30 16:55:23 2017 |
---|
11 | // Last Modified By : Andrew Beach |
---|
12 | // Last Modified On : Fri Aug 11 11:15:00 2017 |
---|
13 | // Update Count : 1 |
---|
14 | // |
---|
15 | |
---|
16 | #ifndef INDENTER_H |
---|
17 | #define INDENTER_H |
---|
18 | |
---|
19 | struct Indenter { |
---|
20 | static unsigned tabsize; ///< default number of spaces in one level of indentation |
---|
21 | |
---|
22 | unsigned int indent; ///< number of spaces to indent |
---|
23 | unsigned int amt; ///< spaces in one level of indentation |
---|
24 | |
---|
25 | Indenter( unsigned int indent = 0, unsigned int amt = tabsize ) |
---|
26 | : indent( indent ), amt( amt ) {} |
---|
27 | |
---|
28 | Indenter & operator+=(int nlevels) { indent += nlevels; return *this; } |
---|
29 | Indenter & operator-=(int nlevels) { indent -= nlevels; return *this; } |
---|
30 | Indenter operator+(int nlevels) { Indenter indenter = *this; return indenter += nlevels; } |
---|
31 | Indenter operator-(int nlevels) { Indenter indenter = *this; return indenter -= nlevels; } |
---|
32 | Indenter & operator++() { return *this += 1; } |
---|
33 | Indenter & operator--() { return *this -= 1; } |
---|
34 | }; |
---|
35 | |
---|
36 | inline std::ostream & operator<<( std::ostream & out, const Indenter & indent ) { |
---|
37 | return out << std::string(indent.indent * indent.amt, ' '); |
---|
38 | } |
---|
39 | |
---|
40 | #endif // INDENTER_H |
---|
Note: See
TracBrowser
for help on using the repository browser.