Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/ParsingConfiguration.cs @ 14419

Last change on this file since 14419 was 12074, checked in by sraggl, 10 years ago

#2341: Added EPPlus-4.0.3 to ExtLibs

File size: 2.3 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
6using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
7using OfficeOpenXml.FormulaParsing.ExpressionGraph;
8using OfficeOpenXml.FormulaParsing.Excel.Functions;
9using OfficeOpenXml.FormulaParsing.Logging;
10using OfficeOpenXml.FormulaParsing.Utilities;
11
12namespace OfficeOpenXml.FormulaParsing
13{
14    public class ParsingConfiguration
15    {
16        public virtual ILexer Lexer { get; private set; }
17
18        public IFormulaParserLogger Logger { get; private set; }
19
20        public IExpressionGraphBuilder GraphBuilder { get; private set; }
21
22        public IExpressionCompiler ExpressionCompiler{ get; private set; }
23
24        public FunctionRepository FunctionRepository{ get; private set; }
25
26        private ParsingConfiguration()
27        {
28            FunctionRepository = FunctionRepository.Create();
29        }
30
31        internal static ParsingConfiguration Create()
32        {
33            return new ParsingConfiguration();
34        }
35
36        public ParsingConfiguration SetLexer(ILexer lexer)
37        {
38            Lexer = lexer;
39            return this;
40        }
41
42        public ParsingConfiguration SetGraphBuilder(IExpressionGraphBuilder graphBuilder)
43        {
44            GraphBuilder = graphBuilder;
45            return this;
46        }
47
48        public ParsingConfiguration SetExpresionCompiler(IExpressionCompiler expressionCompiler)
49        {
50            ExpressionCompiler = expressionCompiler;
51            return this;
52        }
53
54        /// <summary>
55        /// Attaches a logger, errors and log entries will be written to the logger during the parsing process.
56        /// </summary>
57        /// <param name="logger"></param>
58        /// <returns></returns>
59        public ParsingConfiguration AttachLogger(IFormulaParserLogger logger)
60        {
61            Require.That(logger).Named("logger").IsNotNull();
62            Logger = logger;
63            return this;
64        }
65
66        /// <summary>
67        /// if a logger is attached it will be removed.
68        /// </summary>
69        /// <returns></returns>
70        public ParsingConfiguration DetachLogger()
71        {
72            Logger = null;
73            return this;
74        }
75    }
76}
Note: See TracBrowser for help on using the repository browser.