1 module dhtags.utils.prettyprint; 2 3 mixin template PrettyPrintFuncs() { 4 @property int depth(); 5 @property typeof(this) depth(int); 6 7 @property bool isInline(); 8 @property typeof(this) isInline(bool); 9 10 @property bool isOnlyChild(); 11 @property void isOnlyChild(bool); 12 13 @property bool hasNextSibling(); 14 @property typeof(this) hasNextSibling(bool); 15 } 16 17 mixin template PrettyPrintImpl() { 18 bool _isOnlyChild = false; 19 @property bool isOnlyChild() { return _isOnlyChild; } 20 @property void isOnlyChild(bool b) { _isOnlyChild = b; } 21 22 int _depth = 0; 23 @property int depth() { return _depth; } 24 @property typeof(this) depth(int d) { 25 _depth = d; 26 return this; 27 } 28 29 bool _isInline = false; 30 @property bool isInline() { return _isInline; } 31 @property typeof(this) isInline(bool b) { 32 _isInline = b; 33 return this; 34 } 35 36 bool _hasNextSibling = false; 37 @property bool hasNextSibling() { return _hasNextSibling; } 38 @property typeof(this) hasNextSibling(bool b) { 39 _hasNextSibling = b; 40 return this; 41 } 42 43 protected { 44 auto createIndent() { 45 string[] indent = new string[_depth]; 46 indent[] = HtmlProperties.Indent; 47 return indent; 48 } 49 } 50 }