1 /*
2  *Copyright (C) 2018 Laurent Tréguier
3  *
4  *This file is part of DLS.
5  *
6  *DLS is free software: you can redistribute it and/or modify
7  *it under the terms of the GNU General Public License as published by
8  *the Free Software Foundation, either version 3 of the License, or
9  *(at your option) any later version.
10  *
11  *DLS is distributed in the hope that it will be useful,
12  *but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *GNU General Public License for more details.
15  *
16  *You should have received a copy of the GNU General Public License
17  *along with DLS.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 module dls.tools.configuration;
22 
23 class Configuration
24 {
25     static class SymbolConfiguration
26     {
27         string[] importPaths;
28     }
29 
30     static class AnalysisConfiguration
31     {
32         string configFile = "dscanner.ini";
33     }
34 
35     static class FormatConfiguration
36     {
37         static enum BraceStyle : string
38         {
39             allman = "allman",
40             otbs = "otbs",
41             stroustrup = "stroustrup"
42         }
43 
44         static enum EndOfLine : string
45         {
46             lf = "lf",
47             cr = "cr",
48             crlf = "crlf"
49         }
50 
51         static enum TemplateConstraintStyle : string
52         {
53             conditionalNewlineIndent = "conditionalNewlineIndent",
54             conditionalNewline = "conditionalNewline",
55             alwaysNewline = "alwaysNewline",
56             alwaysNewlineIndent = "alwaysNewlineIndent"
57         }
58 
59         EndOfLine endOfLine = EndOfLine.lf;
60         int maxLineLength = 120;
61         bool dfmtAlignSwitchStatements = true;
62         BraceStyle dfmtBraceStyle = BraceStyle.allman;
63         bool dfmtOutdentAttributes = true;
64         int dfmtSoftMaxLineLength = 80;
65         bool dfmtSpaceAfterCast = true;
66         bool dfmtSpaceAfterKeywords = true;
67         bool dfmtSpaceBeforeFunctionParameters = false;
68         bool dfmtSplitOperatorAtLineEnd = false;
69         bool dfmtSelectiveImportSpace = true;
70         bool dfmtCompactLabeledStatements = true;
71         TemplateConstraintStyle dfmtTemplateConstraintStyle = TemplateConstraintStyle
72             .conditionalNewlineIndent;
73         bool dfmtSingleTemplateConstraintIndent = false;
74     }
75 
76     SymbolConfiguration symbol;
77     AnalysisConfiguration analysis;
78     FormatConfiguration format;
79 
80     this()
81     {
82         symbol = new SymbolConfiguration();
83         analysis = new AnalysisConfiguration();
84         format = new FormatConfiguration();
85     }
86 }