Warning, file /kdevelop/kdev-python/debugger/variablecontroller.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2012 Sven Brauch <svenbrauch@googlemail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef VARIABLECONTROLLER_H
0008 #define VARIABLECONTROLLER_H
0009 #include <debugger/interfaces/ivariablecontroller.h>
0010 #include <debugger/interfaces/idebugsession.h>
0011 #include "variable.h"
0012 
0013 #include <QTimer>
0014 
0015 using namespace KDevelop;
0016 
0017 namespace Python {
0018 
0019 class VariableController : public KDevelop::IVariableController
0020 {
0021 Q_OBJECT
0022 public:
0023     VariableController(IDebugSession* parent);
0024     void addWatch(KDevelop::Variable* variable) override;
0025     void addWatchpoint(KDevelop::Variable* variable) override;
0026     
0027     /**
0028      * @brief This just calls the Variable constructor and returns a new, empty \a Variable object.
0029      **/
0030     KDevelop::Variable* createVariable(KDevelop::TreeModel* model, KDevelop::TreeItem* parent,
0031                                                const QString& expression, const QString& display = "") override;
0032     
0033     /**
0034      * @brief Mini-parser which gives the expression under the cursor.
0035      * Example: _I_ = cursor
0036      * self.fo_I_obar(something) # should return "self.foobar"
0037      * self.foobar(some_I_thing) # should return "something"
0038      * The expressions returned by this are "print"ed by the debugger, and then displayed in the tooltip.
0039      * @param doc The document to operate on
0040      * @param cursor the cursor position
0041      * @return The expression to print. Should be an (at least syntactically) valid python expression
0042      **/
0043     KTextEditor::Range expressionRangeUnderCursor(KTextEditor::Document* doc, const KTextEditor::Cursor& cursor) override;
0044 
0045     /**
0046      * @brief Update locals and/or watches, as indicated by autoUpdate().
0047      **/
0048     void update() override;
0049 protected:
0050     /**
0051      * @brief Overridden to handle frame change events (when the user clicks the frame list).
0052      * This then enqueues many "up" or "down" commands to react to the frame change.
0053      **/
0054     void handleEvent(IDebugSession::event_t event) override;
0055 
0056 private:
0057     QTimer m_updateTimer;
0058     QList<Variable*> m_watchVariables;
0059 
0060 private slots:
0061     /**
0062      * @brief Parse the debugger output, and perform an update of the local variables.
0063      **/
0064     void localsUpdateReady(QByteArray rawData);
0065 
0066     void _update();
0067 };
0068 
0069 }
0070 
0071 #endif // VARIABLECONTROLLER_H