Changeset b067d9b for src/Common/Indenter.h
- Timestamp:
- Oct 29, 2019, 4:01:24 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 773db65, 9421f3d8
- Parents:
- 7951100 (diff), 8364209 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/Indenter.h
r7951100 rb067d9b 18 18 19 19 struct Indenter { 20 static unsigned tabsize; 20 static unsigned tabsize; ///< default number of spaces in one level of indentation 21 21 22 Indenter( unsigned int amt = tabsize, unsigned int indent = 0 ) : amt( amt ), indent( indent ) {} 23 unsigned int amt; // amount 1 level increases indent by (i.e. how much to increase by in operator++) 24 unsigned int indent; 22 unsigned int indent; ///< number of spaces to indent 23 unsigned int amt; ///< spaces in one level of indentation 25 24 26 Indenter & operator+=(int nlevels) { indent += amt*nlevels; return *this; } 27 Indenter & operator-=(int nlevels) { indent -= amt*nlevels; return *this; } 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; } 28 30 Indenter operator+(int nlevels) { Indenter indenter = *this; return indenter += nlevels; } 29 31 Indenter operator-(int nlevels) { Indenter indenter = *this; return indenter -= nlevels; } … … 33 35 34 36 inline std::ostream & operator<<( std::ostream & out, const Indenter & indent ) { 35 return out << std::string(indent.indent , ' ');37 return out << std::string(indent.indent * indent.amt, ' '); 36 38 } 37 39
Note:
See TracChangeset
for help on using the changeset viewer.