Free cookie consent management tool by TermsFeed Policy Generator

source: branches/CodeEditor/HeuristicLab.ExtLibs/HeuristicLab.NRefactory/5.5.0/NRefactory.CSharp-5.5.0/IndentEngine/NullIStateMachineIndentEngine.cs @ 11700

Last change on this file since 11700 was 11700, checked in by jkarder, 9 years ago

#2077: created branch and added first version

File size: 4.4 KB
Line 
1//
2// NullIStateMachineIndentEngine.cs
3//
4// Author:
5//       Mike KrÃŒger <mkrueger@xamarin.com>
6//
7// Copyright (c) 2013 Xamarin Inc. (http://xamarin.com)
8//
9// Permission is hereby granted, free of charge, to any person obtaining a copy
10// of this software and associated documentation files (the "Software"), to deal
11// in the Software without restriction, including without limitation the rights
12// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13// copies of the Software, and to permit persons to whom the Software is
14// furnished to do so, subject to the following conditions:
15//
16// The above copyright notice and this permission notice shall be included in
17// all copies or substantial portions of the Software.
18//
19// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25// THE SOFTWARE.
26using System;
27
28namespace ICSharpCode.NRefactory.CSharp
29{
30  /// <summary>
31  /// An empty IStateMachineIndentEngine implementation that does nothing.
32  /// </summary>
33  public sealed class NullIStateMachineIndentEngine : IStateMachineIndentEngine
34  {
35    readonly ICSharpCode.NRefactory.Editor.IDocument document;
36    int offset;
37
38    public NullIStateMachineIndentEngine(ICSharpCode.NRefactory.Editor.IDocument document)
39    {
40      if (document == null)
41        throw new ArgumentNullException("document");
42      this.document = document;
43    }
44
45    #region IStateMachineIndentEngine implementation
46    public IStateMachineIndentEngine Clone()
47    {
48      return new NullIStateMachineIndentEngine(document) { offset = this.offset };
49    }
50
51    bool IStateMachineIndentEngine.IsInsidePreprocessorDirective {
52      get {
53        return false;
54      }
55    }
56
57    bool IStateMachineIndentEngine.IsInsidePreprocessorComment {
58      get {
59        return false;
60      }
61    }
62
63    bool IStateMachineIndentEngine.IsInsideStringLiteral {
64      get {
65        return false;
66      }
67    }
68
69    bool IStateMachineIndentEngine.IsInsideVerbatimString {
70      get {
71        return false;
72      }
73    }
74
75    bool IStateMachineIndentEngine.IsInsideCharacter {
76      get {
77        return false;
78      }
79    }
80
81    bool IStateMachineIndentEngine.IsInsideString {
82      get {
83        return false;
84      }
85    }
86
87    bool IStateMachineIndentEngine.IsInsideLineComment {
88      get {
89        return false;
90      }
91    }
92
93    bool IStateMachineIndentEngine.IsInsideMultiLineComment {
94      get {
95        return false;
96      }
97    }
98
99    bool IStateMachineIndentEngine.IsInsideDocLineComment {
100      get {
101        return false;
102      }
103    }
104
105    bool IStateMachineIndentEngine.IsInsideComment {
106      get {
107        return false;
108      }
109    }
110
111    bool IStateMachineIndentEngine.IsInsideOrdinaryComment {
112      get {
113        return false;
114      }
115    }
116
117    bool IStateMachineIndentEngine.IsInsideOrdinaryCommentOrString {
118      get {
119        return false;
120      }
121    }
122
123    bool IStateMachineIndentEngine.LineBeganInsideVerbatimString {
124      get {
125        return false;
126      }
127    }
128
129    bool IStateMachineIndentEngine.LineBeganInsideMultiLineComment {
130      get {
131        return false;
132      }
133    }
134    #endregion
135
136    #region IDocumentIndentEngine implementation
137    void IDocumentIndentEngine.Push(char ch)
138    {
139      offset++;
140    }
141
142    void IDocumentIndentEngine.Reset()
143    {
144      this.offset = 0;
145    }
146
147    void IDocumentIndentEngine.Update(int offset)
148    {
149      this.offset = offset;
150    }
151
152    IDocumentIndentEngine IDocumentIndentEngine.Clone()
153    {
154      return Clone();
155    }
156
157    ICSharpCode.NRefactory.Editor.IDocument IDocumentIndentEngine.Document {
158      get {
159        return document;
160      }
161    }
162
163    string IDocumentIndentEngine.ThisLineIndent {
164      get {
165        return "";
166      }
167    }
168
169    string IDocumentIndentEngine.NextLineIndent {
170      get {
171        return "";
172      }
173    }
174
175    string IDocumentIndentEngine.CurrentIndent {
176      get {
177        return "";
178      }
179    }
180
181    bool IDocumentIndentEngine.NeedsReindent {
182      get {
183        return false;
184      }
185    }
186
187    int IDocumentIndentEngine.Offset {
188      get {
189        return offset;
190      }
191    }
192    TextLocation IDocumentIndentEngine.Location {
193      get {
194        return TextLocation.Empty;
195      }
196    }
197
198    /// <inheritdoc />
199    public bool EnableCustomIndentLevels
200    {
201      get { return false; }
202      set { }
203    }
204
205    #endregion
206
207    #region ICloneable implementation
208    object ICloneable.Clone()
209    {
210      return Clone();
211    }
212    #endregion
213  }
214}
215
Note: See TracBrowser for help on using the repository browser.