File indexing completed on 2024-04-28 15:54:06

0001 /*
0002     SPDX-FileCopyrightText: 2007 Piyush verma <piyush.verma@gmail.com>
0003     SPDX-FileCopyrightText: 2011-2012 Sven Brauch <svenbrauch@googlemail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef PYTHONEDITORINTEGRATOR_H
0009 #define PYTHONEDITORINTEGRATOR_H
0010 
0011 #include "pythonduchainexport.h"
0012 #include <language/editor/documentrange.h>
0013 #include "parsesession.h"
0014 #include <codehelpers.h>
0015 
0016 namespace Python
0017 {
0018 
0019 class Ast;
0020 
0021 class KDEVPYTHONDUCHAIN_EXPORT PythonEditorIntegrator
0022 {
0023 
0024 public:
0025     PythonEditorIntegrator(ParseSession* session);
0026     ~PythonEditorIntegrator();
0027     
0028     ParseSession* parseSession() const;
0029 
0030     enum Edge {
0031         FrontEdge,
0032         BackEdge
0033     };
0034 
0035     enum RangeEdge {
0036         InnerEdge,
0037         OuterEdge
0038     };
0039 
0040     CursorInRevision findPosition( const Python::Ast* node, Python::PythonEditorIntegrator::Edge edge = BackEdge ) const;
0041 
0042     RangeInRevision findRange(const Python::Ast* node, Python::PythonEditorIntegrator::RangeEdge edge = OuterEdge) const;
0043     RangeInRevision findRange(const Python::Ast* from, const Python::Ast* to) const;
0044     inline FileIndentInformation* indent() const {
0045         return m_indentInformationCache;
0046     }
0047 private:
0048     ParseSession* m_session;
0049     FileIndentInformation* m_indentInformationCache;
0050 };
0051 
0052 }
0053 
0054 #endif
0055 // kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on; auto-insert-doxygen on