// // IDocumentIndentEngine.cs // // Author: // Matej Miklečić // // Copyright (c) 2013 Matej Miklečić (matej.miklecic@gmail.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using ICSharpCode.NRefactory.Editor; using System; namespace ICSharpCode.NRefactory.CSharp { /// /// The base interface for all indent engines. /// public interface IDocumentIndentEngine : ICloneable { /// /// A reference to the document that's parsed by the engine. /// IDocument Document { get; } /// /// The indentation string of the current line. /// string ThisLineIndent { get; } /// /// The indentation string of the next line. /// string NextLineIndent { get; } /// /// The indent string on the beginning of the current line. /// string CurrentIndent { get; } /// /// True if the current line needs to be reindented. /// bool NeedsReindent { get; } /// /// The current offset of the engine. /// int Offset { get; } /// /// The current location of the engine. /// TextLocation Location { get; } /// /// If this is true, the engine should try to adjust its indent /// levels to manual user's corrections, even if they are wrong. /// bool EnableCustomIndentLevels { get; set; } /// /// Pushes a new char into the engine which calculates the new /// indentation levels. /// /// /// A new character. /// void Push(char ch); /// /// Resets the engine. /// void Reset(); /// /// Updates the engine to the given offset. /// /// /// Valid offset in . /// void Update(int offset); /// /// Clones the engine and preserves the current state. /// /// /// An indentical clone which can operate without interference /// with this engine. /// new IDocumentIndentEngine Clone(); } }