Free cookie consent management tool by TermsFeed Policy Generator

source: branches/ALPS/HeuristicLab.ExtLibs/HeuristicLab.NRefactory/5.5.0/NRefactory.CSharp-5.5.0/IndentEngine/IDocumentIndentEngine.cs @ 12062

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

#2077: created branch and added first version

File size: 3.2 KB
Line 
1//
2// IDocumentIndentEngine.cs
3//
4// Author:
5//       Matej Miklečić <matej.miklecic@gmail.com>
6//
7// Copyright (c) 2013 Matej Miklečić (matej.miklecic@gmail.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 ICSharpCode.NRefactory.Editor;
27using System;
28
29namespace ICSharpCode.NRefactory.CSharp
30{
31  /// <summary>
32  ///     The base interface for all indent engines.
33  /// </summary>
34  public interface IDocumentIndentEngine : ICloneable
35  {
36    /// <summary>
37    ///     A reference to the document that's parsed by the engine.
38    /// </summary>
39    IDocument Document { get; }
40
41    /// <summary>
42    ///     The indentation string of the current line.
43    /// </summary>
44    string ThisLineIndent { get; }
45
46    /// <summary>
47    ///     The indentation string of the next line.
48    /// </summary>
49    string NextLineIndent { get; }
50
51    /// <summary>
52    ///     The indent string on the beginning of the current line.
53    /// </summary>
54    string CurrentIndent { get; }
55
56    /// <summary>
57    ///     True if the current line needs to be reindented.
58    /// </summary>
59    bool NeedsReindent { get; }
60
61    /// <summary>
62    ///     The current offset of the engine.
63    /// </summary>
64    int Offset { get; }
65
66    /// <summary>
67    ///     The current location of the engine.
68    /// </summary>
69    TextLocation Location { get; }
70
71    /// <summary>
72    ///     If this is true, the engine should try to adjust its indent
73    ///     levels to manual user's corrections, even if they are wrong.
74    /// </summary>
75    bool EnableCustomIndentLevels { get; set; }
76
77    /// <summary>
78    ///     Pushes a new char into the engine which calculates the new
79    ///     indentation levels.
80    /// </summary>
81    /// <param name="ch">
82    ///     A new character.
83    /// </param>
84    void Push(char ch);
85
86    /// <summary>
87    ///     Resets the engine.
88    /// </summary>
89    void Reset();
90
91    /// <summary>
92    ///     Updates the engine to the given offset.
93    /// </summary>
94    /// <param name="offset">
95    ///     Valid offset in <see cref="Document"/>.
96    /// </param>
97    void Update(int offset);
98
99    /// <summary>
100    ///     Clones the engine and preserves the current state.
101    /// </summary>
102    /// <returns>
103    ///     An indentical clone which can operate without interference
104    ///     with this engine.
105    /// </returns>
106    new IDocumentIndentEngine Clone();
107  }
108}
Note: See TracBrowser for help on using the repository browser.