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

The QScriptStdMessageHandler class implements a message handler that writes to standard output. More...

#include <qscriptstdmessagehandler_p.h>

Inheritance diagram for QScriptStdMessageHandler:
QScriptMessageHandlerInterface

Public Functions

void message (QtMsgType type, const QString &text, const QString &fileName=QString(), int lineNumber=-1, int columnNumber=-1, const QVariant &data=QVariant())
 
 QScriptStdMessageHandler ()
 
 ~QScriptStdMessageHandler ()
 
- Public Functions inherited from QScriptMessageHandlerInterface
virtual ~QScriptMessageHandlerInterface ()
 

Properties

QScopedPointer< QScriptStdMessageHandlerPrivated_ptr
 

Detailed Description

The QScriptStdMessageHandler class implements a message handler that writes to standard output.

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

Definition at line 63 of file qscriptstdmessagehandler_p.h.

Constructors and Destructors

◆ QScriptStdMessageHandler()

QScriptStdMessageHandler::QScriptStdMessageHandler ( )

Definition at line 65 of file qscriptstdmessagehandler.cpp.

67 {
68 }
QScopedPointer< QScriptStdMessageHandlerPrivate > d_ptr

◆ ~QScriptStdMessageHandler()

QScriptStdMessageHandler::~QScriptStdMessageHandler ( )

Definition at line 70 of file qscriptstdmessagehandler.cpp.

71 {
72 }

Functions

◆ message()

void QScriptStdMessageHandler::message ( QtMsgType  type,
const QString text,
const QString fileName = QString(),
int  lineNumber = -1,
int  columnNumber = -1,
const QVariant data = QVariant() 
)
virtual

Implements QScriptMessageHandlerInterface.

Definition at line 74 of file qscriptstdmessagehandler.cpp.

78 {
79  QString msg;
80  if (!fileName.isEmpty() || (lineNumber != -1)) {
81  if (!fileName.isEmpty())
82  msg.append(fileName);
83  else
84  msg.append(QLatin1String("<noname>"));
85  if (lineNumber != -1) {
86  msg.append(QLatin1Char(':'));
87  msg.append(QString::number(lineNumber));
88  if (columnNumber != -1) {
89  msg.append(QLatin1Char(':'));
90  msg.append(QString::number(columnNumber));
91  }
92  }
93  msg.append(QLatin1String(": "));
94  }
95  msg.append(text);
96 
97  FILE *fp = (type == QtDebugMsg) ? stdout : stderr;
98  fprintf(fp, "%s\n", msg.toLatin1().constData());
99  fflush(fp);
100 }
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.cpp:6448
int type
Definition: qmetatype.cpp:239
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
QString & append(QChar c)
Definition: qstring.cpp:1777
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

Properties

◆ d_ptr

QScopedPointer<QScriptStdMessageHandlerPrivate> QScriptStdMessageHandler::d_ptr
private

Definition at line 76 of file qscriptstdmessagehandler_p.h.


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