Qt 4.8
Public Functions | Properties | List of all members
QScriptDebuggerConsole Class Reference

The QScriptDebuggerConsole class provides the core functionality of a debugger console. More...

#include <qscriptdebuggerconsole_p.h>

Inheritance diagram for QScriptDebuggerConsole:
QScriptDebuggerConsoleHistorianInterface

Public Functions

void bumpSessionId ()
 
void changeHistoryAt (int index, const QString &newHistory)
 Reimplemented Function More...
 
QScriptDebuggerConsoleCommandManagercommandManager () const
 
QString commandPrefix () const
 
QScriptDebuggerConsoleCommandJobconsumeInput (const QString &input, QScriptMessageHandlerInterface *messageHandler, QScriptDebuggerCommandSchedulerInterface *commandScheduler)
 Consumes the given line of input. More...
 
int currentFrameIndex () const
 
int currentLineNumber () const
 
qint64 currentScriptId () const
 
int evaluateAction () const
 
bool hasIncompleteInput () const
 
QString historyAt (int index) const
 Reimplemented Function More...
 
int historyCount () const
 Reimplemented Function More...
 
QString incompleteInput () const
 
void loadScriptedCommands (const QString &scriptsPath, QScriptMessageHandlerInterface *messageHandler)
 
 QScriptDebuggerConsole ()
 
qint64 sessionId () const
 
void setCurrentFrameIndex (int index)
 
void setCurrentLineNumber (int lineNumber)
 
void setCurrentScriptId (qint64 id)
 
void setEvaluateAction (int action)
 
void setIncompleteInput (const QString &input)
 
void showDebuggerInfoMessage (QScriptMessageHandlerInterface *messageHandler)
 
 ~QScriptDebuggerConsole ()
 
- Public Functions inherited from QScriptDebuggerConsoleHistorianInterface
virtual ~QScriptDebuggerConsoleHistorianInterface ()
 

Properties

QScopedPointer< QScriptDebuggerConsolePrivated_ptr
 

Detailed Description

The QScriptDebuggerConsole class provides the core functionality of a debugger console.

Since
4.5
Warning
This function is not part of the public interface.

Definition at line 70 of file qscriptdebuggerconsole_p.h.

Constructors and Destructors

◆ QScriptDebuggerConsole()

QScriptDebuggerConsole::QScriptDebuggerConsole ( )

Definition at line 417 of file qscriptdebuggerconsole.cpp.

419 {
420 }
QScopedPointer< QScriptDebuggerConsolePrivate > d_ptr

◆ ~QScriptDebuggerConsole()

QScriptDebuggerConsole::~QScriptDebuggerConsole ( )

Definition at line 422 of file qscriptdebuggerconsole.cpp.

423 {
424 }

Functions

◆ bumpSessionId()

void QScriptDebuggerConsole::bumpSessionId ( )

Definition at line 563 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerPrivate::startInteraction().

564 {
566  ++d->sessionId;
567 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.

◆ changeHistoryAt()

void QScriptDebuggerConsole::changeHistoryAt ( int  index,
const QString newHistory 
)
virtual

Reimplemented Function

Implements QScriptDebuggerConsoleHistorianInterface.

Definition at line 602 of file qscriptdebuggerconsole.cpp.

603 {
605  d->commandHistory[index] = newHistory;
606 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.
quint16 index

◆ commandManager()

QScriptDebuggerConsoleCommandManager * QScriptDebuggerConsole::commandManager ( ) const

Definition at line 433 of file qscriptdebuggerconsole.cpp.

434 {
436  return d->commandManager;
437 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.

◆ commandPrefix()

QString QScriptDebuggerConsole::commandPrefix ( ) const

Definition at line 457 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerPrivate::executeConsoleCommand().

458 {
460  return d->commandPrefix;
461 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.

◆ consumeInput()

QScriptDebuggerConsoleCommandJob * QScriptDebuggerConsole::consumeInput ( const QString input,
QScriptMessageHandlerInterface messageHandler,
QScriptDebuggerCommandSchedulerInterface commandScheduler 
)

Consumes the given line of input.

If the input starts with the command prefix, it is regarded as a debugger command; otherwise the input is evaluated as a plain script.

Definition at line 468 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerPrivate::_q_onLineEntered(), and QScriptDebuggerPrivate::executeConsoleCommand().

471 {
473  static const int maximumHistoryCount = 100;
474  QString cmd;
475  if (d->input.isEmpty() && input.isEmpty()) {
476  if (d->commandHistory.isEmpty())
477  return 0;
478  cmd = d->commandHistory.first();
479  } else {
480  cmd = input;
481  }
482  if (d->input.isEmpty() && cmd.startsWith(d->commandPrefix)) {
483  if (!input.isEmpty()) {
484  d->commandHistory.prepend(cmd);
485  if (d->commandHistory.size() > maximumHistoryCount)
486  d->commandHistory.removeLast();
487  }
488  cmd.remove(0, d->commandPrefix.length());
489  return d->createJob(cmd, messageHandler, commandScheduler);
490  }
491  d->input += cmd;
492  d->input += QLatin1Char('\n');
495  return false;
496  d->input.chop(1); // remove the last \n
497  cmd = QString();
498  cmd.append(d->commandPrefix);
499  cmd.append(QString::fromLatin1("eval "));
500  cmd.append(d->input);
501  d->commandHistory.prepend(cmd);
502  if (d->commandHistory.size() > maximumHistoryCount)
503  d->commandHistory.removeLast();
504  d->input.clear();
505  cmd.remove(0, d->commandPrefix.length());
506  return d->createJob(cmd, messageHandler, commandScheduler);
507 }
double d
Definition: qnumeric_p.h:62
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition: qstring.cpp:3734
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
The QScriptSyntaxCheckResult class provides the result of a script syntax check.
Definition: qscriptengine.h:75
QString & append(QChar c)
Definition: qstring.cpp:1777
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
static QScriptSyntaxCheckResult checkSyntax(const QString &program)
Checks the syntax of the given program.
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
Definition: qstring.cpp:1867
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
State state() const
Returns the state of this QScriptSyntaxCheckResult.

◆ currentFrameIndex()

int QScriptDebuggerConsole::currentFrameIndex ( ) const

Definition at line 509 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerPrivate::debuggerEvent(), QScriptCompletionTask::QScriptCompletionTask(), QScriptDebuggerPrivate::showToolTip(), and QScriptDebuggerPrivate::sync().

510 {
512  return d->currentFrameIndex;
513 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.

◆ currentLineNumber()

int QScriptDebuggerConsole::currentLineNumber ( ) const

Definition at line 533 of file qscriptdebuggerconsole.cpp.

534 {
536  return d->currentLineNumber;
537 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.

◆ currentScriptId()

qint64 QScriptDebuggerConsole::currentScriptId ( ) const

Definition at line 521 of file qscriptdebuggerconsole.cpp.

522 {
524  return d->currentScriptId;
525 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.

◆ evaluateAction()

int QScriptDebuggerConsole::evaluateAction ( ) const

Definition at line 545 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerPrivate::debuggerEvent().

546 {
548  return d->evaluateAction;
549 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.

◆ hasIncompleteInput()

bool QScriptDebuggerConsole::hasIncompleteInput ( ) const

Definition at line 439 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerPrivate::_q_onLineEntered().

440 {
442  return !d->input.isEmpty();
443 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.

◆ historyAt()

QString QScriptDebuggerConsole::historyAt ( int  index) const
virtual

Reimplemented Function

Implements QScriptDebuggerConsoleHistorianInterface.

Definition at line 593 of file qscriptdebuggerconsole.cpp.

594 {
596  return d->commandHistory.value(index);
597 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.
quint16 index

◆ historyCount()

int QScriptDebuggerConsole::historyCount ( ) const
virtual

Reimplemented Function

Implements QScriptDebuggerConsoleHistorianInterface.

Definition at line 584 of file qscriptdebuggerconsole.cpp.

585 {
587  return d->commandHistory.size();
588 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.

◆ incompleteInput()

QString QScriptDebuggerConsole::incompleteInput ( ) const

Definition at line 445 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerPrivate::executeConsoleCommand().

446 {
448  return d->input;
449 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.

◆ loadScriptedCommands()

void QScriptDebuggerConsole::loadScriptedCommands ( const QString scriptsPath,
QScriptMessageHandlerInterface messageHandler 
)

Definition at line 426 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerPrivate::QScriptDebuggerPrivate().

428 {
430  d->loadScriptedCommands(scriptsPath, messageHandler);
431 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.

◆ sessionId()

qint64 QScriptDebuggerConsole::sessionId ( ) const

Definition at line 557 of file qscriptdebuggerconsole.cpp.

558 {
560  return d->sessionId;
561 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.

◆ setCurrentFrameIndex()

void QScriptDebuggerConsole::setCurrentFrameIndex ( int  index)

Definition at line 515 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerPrivate::startInteraction().

516 {
518  d->currentFrameIndex = index;
519 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.
quint16 index

◆ setCurrentLineNumber()

void QScriptDebuggerConsole::setCurrentLineNumber ( int  lineNumber)

Definition at line 539 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerPrivate::startInteraction().

540 {
542  d->currentLineNumber = lineNumber;
543 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.

◆ setCurrentScriptId()

void QScriptDebuggerConsole::setCurrentScriptId ( qint64  id)

Definition at line 527 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerPrivate::startInteraction().

528 {
530  d->currentScriptId = id;
531 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.

◆ setEvaluateAction()

void QScriptDebuggerConsole::setEvaluateAction ( int  action)

Definition at line 551 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerPrivate::debuggerEvent().

552 {
554  d->evaluateAction = action;
555 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.

◆ setIncompleteInput()

void QScriptDebuggerConsole::setIncompleteInput ( const QString input)

Definition at line 451 of file qscriptdebuggerconsole.cpp.

Referenced by QScriptDebuggerPrivate::executeConsoleCommand().

452 {
454  d->input = input;
455 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QScriptDebuggerConsole class provides the core functionality of a debugger console.

◆ showDebuggerInfoMessage()

void QScriptDebuggerConsole::showDebuggerInfoMessage ( QScriptMessageHandlerInterface messageHandler)

Definition at line 569 of file qscriptdebuggerconsole.cpp.

571 {
572  messageHandler->message(
573  QtDebugMsg,
575  "Welcome to the Qt Script debugger.\n"
576  "Debugger commands start with a . (period).\n"
577  "Any other input will be evaluated by the script interpreter.\n"
578  "Type \".help\" for help.\n"));
579 }
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
virtual void message(QtMsgType type, const QString &text, const QString &fileName=QString(), int lineNumber=-1, int columnNumber=-1, const QVariant &data=QVariant())=0

Properties

◆ d_ptr

QScopedPointer<QScriptDebuggerConsolePrivate> QScriptDebuggerConsole::d_ptr
private

Definition at line 113 of file qscriptdebuggerconsole_p.h.


The documentation for this class was generated from the following files: