MCPcopy Create free account
hub / github.com/analogdevicesinc/scopy / hasText

Method hasText

pluginbase/src/scopyjs.cpp:184–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184void ScopyJS::hasText()
185{
186 QTextStream in(stdin);
187 QTextStream out(stdout);
188
189 QString str = in.readLine();
190 js_cmd.append(str);
191
192 qWarning() << str;
193 unsigned int nb_open_braces = js_cmd.count(QChar('{'));
194 unsigned int nb_closing_braces = js_cmd.count(QChar('}'));
195
196 if(nb_open_braces == nb_closing_braces) {
197 QJSValue val = m_engine.evaluate(js_cmd);
198
199 if(val.isError()) {
200 out << "Exception:" << val.toString() << Qt::endl;
201 } else if(!val.isUndefined()) {
202 out << val.toString() << Qt::endl;
203 }
204
205 js_cmd.clear();
206 out << "scopy > ";
207 } else {
208 js_cmd.append(QChar('\n'));
209
210 out << "> ";
211 }
212
213 out.flush();
214}
215
216void ScopyJS::jsCategoryFilter(QLoggingCategory *category)
217{

Callers

nothing calls this directly

Calls 5

readLineMethod · 0.80
appendMethod · 0.80
countMethod · 0.45
toStringMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected