| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2017 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the examples of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:BSD$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** BSD License Usage |
| 18 | ** Alternatively, you may use this file under the terms of the BSD license |
| 19 | ** as follows: |
| 20 | ** |
| 21 | ** "Redistribution and use in source and binary forms, with or without |
| 22 | ** modification, are permitted provided that the following conditions are |
| 23 | ** met: |
| 24 | ** * Redistributions of source code must retain the above copyright |
| 25 | ** notice, this list of conditions and the following disclaimer. |
| 26 | ** * Redistributions in binary form must reproduce the above copyright |
| 27 | ** notice, this list of conditions and the following disclaimer in |
| 28 | ** the documentation and/or other materials provided with the |
| 29 | ** distribution. |
| 30 | ** * Neither the name of The Qt Company Ltd nor the names of its |
| 31 | ** contributors may be used to endorse or promote products derived |
| 32 | ** from this software without specific prior written permission. |
| 33 | ** |
| 34 | ** |
| 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." |
| 46 | ** |
| 47 | ** $QT_END_LICENSE$ |
| 48 | ** |
| 49 | ****************************************************************************/ |
| 50 | |
| 51 | #include "scriptbreakpointmanager.h"cxx . . $ `<file>/examples/script/qsdbg/scriptbreakpointmanager.h`/ |
| 52 | |
| 53 | ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#ScriptBreakpointManager(49f6e7a06ebc5aa8).() |
| 54 | { |
| 55 | } |
| 56 | |
| 57 | ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::~cxx . . $ ScriptBreakpointManager#`~ScriptBreakpointManager`(ced63f7c635d850d).ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#() |
| 58 | { |
| 59 | } |
| 60 | |
| 61 | bool ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::hasBreakpointscxx . . $ ScriptBreakpointManager#hasBreakpoints(50ce9a9e25b4a850).() const |
| 62 | { |
| 63 | return !breakpointscxx . . $ ScriptBreakpointManager#breakpoints..isEmptycxx . . $ QList#isEmpty(3482b152b9333168).(); |
| 64 | } |
| 65 | |
| 66 | int ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::setBreakpointcxx . . $ ScriptBreakpointManager#setBreakpoint(a664fe1f05d5cb93).(const QStringcxx . . $ QString# &fileName, int lineNumber) |
| 67 | { |
| 68 | breakpointscxx . . $ ScriptBreakpointManager#breakpoints..appendcxx . . $ QList#append(77d9f17553126ecb).(ScriptBreakpointInfocxx . . $ ScriptBreakpointInfo#ScriptBreakpointInfo(29ed8fcd127906b1).(fileName, lineNumber)); |
| 69 | return breakpointscxx . . $ ScriptBreakpointManager#breakpoints..sizecxx . . $ QList#size(ea6fe5115c70a13f).() - 1; |
| 70 | } |
| 71 | |
| 72 | int ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::setBreakpointcxx . . $ ScriptBreakpointManager#setBreakpoint(c6f4e55073dadb56).(const QStringcxx . . $ QString# &functionName, const QStringcxx . . $ QString# &fileName) |
| 73 | { |
| 74 | breakpointscxx . . $ ScriptBreakpointManager#breakpoints..appendcxx . . $ QList#append(77d9f17553126ecb).(ScriptBreakpointInfocxx . . $ ScriptBreakpointInfo#ScriptBreakpointInfo(c1427772cd1877b0).(functionName, fileName)); |
| 75 | return breakpointscxx . . $ ScriptBreakpointManager#breakpoints..sizecxx . . $ QList#size(ea6fe5115c70a13f).() - 1; |
| 76 | } |
| 77 | |
| 78 | int ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::setBreakpointcxx . . $ ScriptBreakpointManager#setBreakpoint(1ba93f8a114f47f4).(const QScriptValuecxx . . $ QScriptValue# &function) |
| 79 | { |
| 80 | breakpointscxx . . $ ScriptBreakpointManager#breakpoints..appendcxx . . $ QList#append(77d9f17553126ecb).(ScriptBreakpointInfocxx . . $ ScriptBreakpointInfo#(function)); |
| 81 | return breakpointscxx . . $ ScriptBreakpointManager#breakpoints..sizecxx . . $ QList#size(ea6fe5115c70a13f).() - 1; |
| 82 | } |
| 83 | |
| 84 | void ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::removeBreakpointcxx . . $ ScriptBreakpointManager#removeBreakpoint(d4f767463ce0a6b3).(int id) |
| 85 | { |
| 86 | if (id >= 0 && id < breakpointscxx . . $ ScriptBreakpointManager#breakpoints..sizecxx . . $ QList#size(ea6fe5115c70a13f).()) |
| 87 | breakpointscxx . . $ ScriptBreakpointManager#breakpoints.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).id] =cxx . . $ ScriptBreakpointInfo#`operator=`(96c804fa3369480). ScriptBreakpointInfocxx . . $ ScriptBreakpointInfo#ScriptBreakpointInfo(49f6e7a06ebc5aa8).(); |
| 88 | } |
| 89 | |
| 90 | int ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::findBreakpointcxx . . $ ScriptBreakpointManager#findBreakpoint(91f46685ef4c12b5).(const QStringcxx . . $ QString# &fileName, int lineNumber) const |
| 91 | { |
| 92 | for (int i = 0; i < breakpointscxx . . $ ScriptBreakpointManager#breakpoints..sizecxx . . $ QList#size(ea6fe5115c70a13f).(); ++i) { |
| 93 | const ScriptBreakpointInfocxx . . $ ScriptBreakpointInfo# &brk = breakpointscxx . . $ ScriptBreakpointManager#breakpoints..atcxx . . $ QList#at(e2681f9bb6b2f357).(i); |
| 94 | if (brk.typecxx . . $ ScriptBreakpointInfo#type. != ScriptBreakpointInfocxx . . $ ScriptBreakpointInfo#::Filecxx . . $ ScriptBreakpointInfo#File.) |
| 95 | continue; |
| 96 | if (brk.fileNamecxx . . $ ScriptBreakpointInfo#fileName. ==cxx . . $ `operator==`(5bc2975d2d751687). fileName && brk.lineNumbercxx . . $ ScriptBreakpointInfo#lineNumber. == lineNumber) |
| 97 | return i; |
| 98 | } |
| 99 | return -1; |
| 100 | } |
| 101 | |
| 102 | int ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::findBreakpointcxx . . $ ScriptBreakpointManager#findBreakpoint(45fb196bbb245bf5).(const QStringcxx . . $ QString# &functionName, const QStringcxx . . $ QString# &fileName) const |
| 103 | { |
| 104 | for (int i = 0; i < breakpointscxx . . $ ScriptBreakpointManager#breakpoints..sizecxx . . $ QList#size(ea6fe5115c70a13f).(); ++i) { |
| 105 | const ScriptBreakpointInfocxx . . $ ScriptBreakpointInfo# &brk = breakpointscxx . . $ ScriptBreakpointManager#breakpoints..atcxx . . $ QList#at(e2681f9bb6b2f357).(i); |
| 106 | if (brk.typecxx . . $ ScriptBreakpointInfo#type. != ScriptBreakpointInfocxx . . $ ScriptBreakpointInfo#::FunctionNamecxx . . $ ScriptBreakpointInfo#FunctionName.) |
| 107 | continue; |
| 108 | if (brk.functionNamecxx . . $ ScriptBreakpointInfo#functionName. ==cxx . . $ `operator==`(5bc2975d2d751687). functionName && brk.fileNamecxx . . $ ScriptBreakpointInfo#fileName. ==cxx . . $ `operator==`(5bc2975d2d751687). fileName) |
| 109 | return i; |
| 110 | } |
| 111 | return -1; |
| 112 | } |
| 113 | |
| 114 | int ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::findBreakpointcxx . . $ ScriptBreakpointManager#findBreakpoint(7777895d9151fbe4).(const QScriptValuecxx . . $ QScriptValue# &function) const |
| 115 | { |
| 116 | for (int i = 0; i < breakpointscxx . . $ ScriptBreakpointManager#breakpoints..sizecxx . . $ QList#size(ea6fe5115c70a13f).(); ++i) { |
| 117 | const ScriptBreakpointInfocxx . . $ ScriptBreakpointInfo# &brk = breakpointscxx . . $ ScriptBreakpointManager#breakpoints..atcxx . . $ QList#at(e2681f9bb6b2f357).(i); |
| 118 | if (brk.typecxx . . $ ScriptBreakpointInfo#type. != ScriptBreakpointInfocxx . . $ ScriptBreakpointInfo#::Functioncxx . . $ ScriptBreakpointInfo#Function.) |
| 119 | continue; |
| 120 | if (brk.functioncxx . . $ ScriptBreakpointInfo#function..strictlyEqualscxx . . $ QScriptValue#strictlyEquals(f1859bb82f79d140).(function)) |
| 121 | return i; |
| 122 | } |
| 123 | return -1; |
| 124 | } |
| 125 | |
| 126 | bool ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::isBreakpointEnabledcxx . . $ ScriptBreakpointManager#isBreakpointEnabled(4a668f6de69bf818).(int id) const |
| 127 | { |
| 128 | return breakpointscxx . . $ ScriptBreakpointManager#breakpoints..valuecxx . . $ QList#value(b4be2ec6940d8d62).(id).enabledcxx . . $ ScriptBreakpointInfo#enabled.; |
| 129 | } |
| 130 | |
| 131 | void ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::setBreakpointEnabledcxx . . $ ScriptBreakpointManager#setBreakpointEnabled(918ebd27a9ddbad3).(int id, bool enabled) |
| 132 | { |
| 133 | if (id >= 0 && id < breakpointscxx . . $ ScriptBreakpointManager#breakpoints..sizecxx . . $ QList#size(ea6fe5115c70a13f).()) |
| 134 | breakpointscxx . . $ ScriptBreakpointManager#breakpoints.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).id].enabledcxx . . $ ScriptBreakpointInfo#enabled. = enabled; |
| 135 | } |
| 136 | |
| 137 | QStringcxx . . $ QString# ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::breakpointConditioncxx . . $ ScriptBreakpointManager#breakpointCondition(3f3c3d0e9c0eb37f).(int id) const |
| 138 | { |
| 139 | return breakpointscxx . . $ QString#QString(28715ad661ad3cec)..valuecxx . . $ QList#value(b4be2ec6940d8d62).(id).conditioncxx . . $ ScriptBreakpointInfo#condition.; |
| 140 | } |
| 141 | |
| 142 | void ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::setBreakpointConditioncxx . . $ ScriptBreakpointManager#setBreakpointCondition(4b11a7293b4ed91c).(int id, const QStringcxx . . $ QString# &expression) |
| 143 | { |
| 144 | if (id >= 0 && id < breakpointscxx . . $ ScriptBreakpointManager#breakpoints..sizecxx . . $ QList#size(ea6fe5115c70a13f).()) |
| 145 | breakpointscxx . . $ ScriptBreakpointManager#breakpoints.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).id].conditioncxx . . $ ScriptBreakpointInfo#condition. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). expression; |
| 146 | } |
| 147 | |
| 148 | int ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::breakpointIgnoreCountcxx . . $ ScriptBreakpointManager#breakpointIgnoreCount(7ccb52b1bfe01045).(int id) const |
| 149 | { |
| 150 | return breakpointscxx . . $ ScriptBreakpointManager#breakpoints..valuecxx . . $ QList#value(b4be2ec6940d8d62).(id).ignoreCountcxx . . $ ScriptBreakpointInfo#ignoreCount.; |
| 151 | } |
| 152 | |
| 153 | void ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::setBreakpointIgnoreCountcxx . . $ ScriptBreakpointManager#setBreakpointIgnoreCount(3e454b8ccf442868).(int id, int ignoreCount) |
| 154 | { |
| 155 | if (id >= 0 && id < breakpointscxx . . $ ScriptBreakpointManager#breakpoints..sizecxx . . $ QList#size(ea6fe5115c70a13f).()) |
| 156 | breakpointscxx . . $ ScriptBreakpointManager#breakpoints.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).id].ignoreCountcxx . . $ ScriptBreakpointInfo#ignoreCount. = ignoreCount; |
| 157 | } |
| 158 | |
| 159 | bool ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::isBreakpointSingleShotcxx . . $ ScriptBreakpointManager#isBreakpointSingleShot(4a668f6de69bf818).(int id) const |
| 160 | { |
| 161 | return breakpointscxx . . $ ScriptBreakpointManager#breakpoints..valuecxx . . $ QList#value(b4be2ec6940d8d62).(id).singleShotcxx . . $ ScriptBreakpointInfo#singleShot.; |
| 162 | } |
| 163 | |
| 164 | void ScriptBreakpointManagercxx . . $ ScriptBreakpointManager#::setBreakpointSingleShotcxx . . $ ScriptBreakpointManager#setBreakpointSingleShot(918ebd27a9ddbad3).(int id, bool singleShot) |
| 165 | { |
| 166 | if (id >= 0 && id < breakpointscxx . . $ ScriptBreakpointManager#breakpoints..sizecxx . . $ QList#size(ea6fe5115c70a13f).()) |
| 167 | breakpointscxx . . $ ScriptBreakpointManager#breakpoints.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).id].singleShotcxx . . $ ScriptBreakpointInfo#singleShot. = singleShot; |
| 168 | } |