Qt 4.8
Public Functions | Private Functions | Properties | Friends | List of all members
QDeclarativeInfo Class Reference

#include <qdeclarativeinfo.h>

Inheritance diagram for QDeclarativeInfo:
QDebug

Public Functions

QDeclarativeInfooperator<< (QChar t)
 
QDeclarativeInfooperator<< (QBool t)
 
QDeclarativeInfooperator<< (bool t)
 
QDeclarativeInfooperator<< (char t)
 
QDeclarativeInfooperator<< (signed short t)
 
QDeclarativeInfooperator<< (unsigned short t)
 
QDeclarativeInfooperator<< (signed int t)
 
QDeclarativeInfooperator<< (unsigned int t)
 
QDeclarativeInfooperator<< (signed long t)
 
QDeclarativeInfooperator<< (unsigned long t)
 
QDeclarativeInfooperator<< (qint64 t)
 
QDeclarativeInfooperator<< (quint64 t)
 
QDeclarativeInfooperator<< (float t)
 
QDeclarativeInfooperator<< (double t)
 
QDeclarativeInfooperator<< (const char *t)
 
QDeclarativeInfooperator<< (const QString &t)
 
QDeclarativeInfooperator<< (const QStringRef &t)
 
QDeclarativeInfooperator<< (const QLatin1String &t)
 
QDeclarativeInfooperator<< (const QByteArray &t)
 
QDeclarativeInfooperator<< (const void *t)
 
QDeclarativeInfooperator<< (QTextStreamFunction f)
 
QDeclarativeInfooperator<< (QTextStreamManipulator m)
 
QDeclarativeInfooperator<< (const QUrl &t)
 
 QDeclarativeInfo (const QDeclarativeInfo &)
 
 ~QDeclarativeInfo ()
 
- Public Functions inherited from QDebug
QDebugmaybeSpace ()
 Writes a space character to the debug stream, depending on the last character sent to the stream, and returns a reference to the stream. More...
 
QDebugnospace ()
 Clears the stream's internal flag that records whether the last character was a space and returns a reference to the stream. More...
 
QDebugoperator<< (QChar t)
 Writes the character, t, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (QBool t)
 Writes the boolean value, t, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (bool t)
 Writes the boolean value, t, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (char t)
 Writes the character, t, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (signed short t)
 Writes the signed short integer, i, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (unsigned short t)
 Writes then unsigned short integer, i, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (signed int t)
 Writes the signed integer, i, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (unsigned int t)
 Writes then unsigned integer, i, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (signed long t)
 Writes the signed long integer, l, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (unsigned long t)
 Writes then unsigned long integer, l, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (qint64 t)
 Writes the signed 64-bit integer, i, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (quint64 t)
 Writes then unsigned 64-bit integer, i, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (float t)
 Writes the 32-bit floating point number, f, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (double t)
 Writes the 64-bit floating point number, f, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (const char *t)
 Writes the '\0'-terminated string, s, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (const QString &t)
 Writes the string, s, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (const QStringRef &t)
 Writes the string reference, s, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (const QLatin1String &t)
 Writes the Latin1-encoded string, s, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (const QByteArray &t)
 Writes the byte array, b, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (const void *t)
 Writes a pointer, p, to the stream and returns a reference to the stream. More...
 
QDebugoperator<< (QTextStreamFunction f)
 
QDebugoperator<< (QTextStreamManipulator m)
 
QDebugoperator= (const QDebug &other)
 Assigns the other debug stream to this stream and returns a reference to this stream. More...
 
 QDebug (QIODevice *device)
 Constructs a debug stream that writes to the given device. More...
 
 QDebug (QString *string)
 Constructs a debug stream that writes to the given string. More...
 
 QDebug (QtMsgType t)
 Constructs a debug stream that writes to the handler for the message type specified by type. More...
 
 QDebug (const QDebug &o)
 Constructs a copy of the other debug stream. More...
 
QDebugspace ()
 Writes a space character to the debug stream and returns a reference to the stream. More...
 
 ~QDebug ()
 Flushes any pending data to be written and destroys the debug stream. More...
 

Private Functions

 QDeclarativeInfo (QDeclarativeInfoPrivate *)
 

Properties

QDeclarativeInfoPrivated
 

Friends

Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo (const QObject *me)
 
Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo (const QObject *me, const QDeclarativeError &error)
 
Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo (const QObject *me, const QList< QDeclarativeError > &errors)
 

Detailed Description

Definition at line 56 of file qdeclarativeinfo.h.

Constructors and Destructors

◆ QDeclarativeInfo() [1/2]

QDeclarativeInfo::QDeclarativeInfo ( const QDeclarativeInfo other)

Definition at line 100 of file qdeclarativeinfo.cpp.

Referenced by qmlInfo().

101 : QDebug(other), d(other.d)
102 {
103  d->ref++;
104 }
QDebug(QIODevice *device)
Constructs a debug stream that writes to the given device.
Definition: qdebug.h:76
QDeclarativeInfoPrivate * d

◆ ~QDeclarativeInfo()

QDeclarativeInfo::~QDeclarativeInfo ( )

Definition at line 106 of file qdeclarativeinfo.cpp.

107 {
108  if (0 == --d->ref) {
110 
111  QDeclarativeEngine *engine = 0;
112 
113  if (!d->buffer.isEmpty()) {
115 
116  QObject *object = const_cast<QObject *>(d->object);
117 
118  if (object) {
119  engine = qmlEngine(d->object);
122  if (type) {
123  typeName = QLatin1String(type->qmlTypeName());
124  int lastSlash = typeName.lastIndexOf(QLatin1Char('/'));
125  if (lastSlash != -1)
126  typeName = typeName.mid(lastSlash+1);
127  } else {
128  typeName = QString::fromUtf8(object->metaObject()->className());
129  int marker = typeName.indexOf(QLatin1String("_QMLTYPE_"));
130  if (marker != -1)
131  typeName = typeName.left(marker);
132  }
133 
134  d->buffer.prepend(QLatin1String("QML ") + typeName + QLatin1String(": "));
135 
136  QDeclarativeData *ddata = QDeclarativeData::get(object, false);
137  if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty()) {
138  error.setUrl(ddata->outerContext->url);
139  error.setLine(ddata->lineNumber);
140  error.setColumn(ddata->columnNumber);
141  }
142  }
143 
144  error.setDescription(d->buffer);
145 
146  errors.prepend(error);
147  }
148 
149  QDeclarativeEnginePrivate::warning(engine, errors);
150 
151  delete d;
152  }
153 }
QDeclarativeContextData * outerContext
static QDeclarativeData * get(const QObject *object, bool create=false)
int type
Definition: qmetatype.cpp:239
void setDescription(const QString &)
Sets the error description.
#define error(msg)
bool isEmpty() const
Returns true if the URL has no data; otherwise returns false.
Definition: qurl.cpp:4317
QString & prepend(QChar c)
Definition: qstring.h:261
void setColumn(int)
Sets the error column number.
static QDeclarativeType * qmlType(const QByteArray &, int, int)
Returns the type (if any) of URI-qualified named name in version specified by version_major and versi...
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
const char * typeName
Definition: qmetatype.cpp:239
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
void prepend(const T &t)
Inserts value at the beginning of the list.
Definition: qlist.h:541
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
Definition: qstring.cpp:4302
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
QByteArray qmlTypeName() const
The QDeclarativeError class encapsulates a QML error.
void setLine(int)
Sets the error line number.
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Definition: qstring.cpp:3706
QList< QDeclarativeError > errors
Q_DECLARATIVE_EXPORT QDeclarativeEngine * qmlEngine(const QObject *)
void setUrl(const QUrl &)
Sets the url for the file that caused this error.
The QDeclarativeEngine class provides an environment for instantiating QML components.
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:3000
const char * className() const
Returns the class name.
Definition: qobjectdefs.h:491
void warning(const QDeclarativeError &)
QDeclarativeInfoPrivate * d
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.

◆ QDeclarativeInfo() [2/2]

QDeclarativeInfo::QDeclarativeInfo ( QDeclarativeInfoPrivate p)
private

Definition at line 94 of file qdeclarativeinfo.cpp.

95 : QDebug(&p->buffer), d(p)
96 {
97  nospace();
98 }
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
QDebug(QIODevice *device)
Constructs a debug stream that writes to the given device.
Definition: qdebug.h:76
QDeclarativeInfoPrivate * d

Functions

◆ operator<<() [1/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( QChar  t)
inline

Definition at line 62 of file qdeclarativeinfo.h.

62 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [2/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( QBool  t)
inline

Definition at line 63 of file qdeclarativeinfo.h.

63 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [3/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( bool  t)
inline

Definition at line 64 of file qdeclarativeinfo.h.

64 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [4/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( char  t)
inline

Definition at line 65 of file qdeclarativeinfo.h.

65 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [5/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( signed short  t)
inline

Definition at line 66 of file qdeclarativeinfo.h.

66 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [6/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( unsigned short  t)
inline

Definition at line 67 of file qdeclarativeinfo.h.

67 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [7/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( signed int  t)
inline

Definition at line 68 of file qdeclarativeinfo.h.

68 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [8/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( unsigned int  t)
inline

Definition at line 69 of file qdeclarativeinfo.h.

69 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [9/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( signed long  t)
inline

Definition at line 70 of file qdeclarativeinfo.h.

70 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [10/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( unsigned long  t)
inline

Definition at line 71 of file qdeclarativeinfo.h.

71 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [11/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( qint64  t)
inline

Definition at line 72 of file qdeclarativeinfo.h.

72 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [12/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( quint64  t)
inline

Definition at line 73 of file qdeclarativeinfo.h.

73 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [13/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( float  t)
inline

Definition at line 74 of file qdeclarativeinfo.h.

74 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [14/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( double  t)
inline

Definition at line 75 of file qdeclarativeinfo.h.

75 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [15/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( const char *  t)
inline

Definition at line 76 of file qdeclarativeinfo.h.

76 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [16/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( const QString t)
inline

Definition at line 77 of file qdeclarativeinfo.h.

77 { QDebug::operator<<(t.toLocal8Bit().constData()); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
Definition: qstring.cpp:4049
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433

◆ operator<<() [17/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( const QStringRef t)
inline

Definition at line 78 of file qdeclarativeinfo.h.

Referenced by operator<<().

78 { return operator<<(t.toString()); }
QString toString() const
Returns a copy of the string reference as a QString object.
Definition: qstring.cpp:8653
QDeclarativeInfo & operator<<(QChar t)

◆ operator<<() [18/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( const QLatin1String t)
inline

Definition at line 79 of file qdeclarativeinfo.h.

79 { QDebug::operator<<(t.latin1()); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95
const char * latin1() const
Returns the Latin-1 string stored in this object.
Definition: qstring.h:661

◆ operator<<() [19/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( const QByteArray t)
inline

Definition at line 80 of file qdeclarativeinfo.h.

80 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [20/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( const void *  t)
inline

Definition at line 81 of file qdeclarativeinfo.h.

81 { QDebug::operator<<(t); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [21/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( QTextStreamFunction  f)
inline

Definition at line 82 of file qdeclarativeinfo.h.

82 { QDebug::operator<<(f); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [22/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( QTextStreamManipulator  m)
inline

Definition at line 83 of file qdeclarativeinfo.h.

83 { QDebug::operator<<(m); return *this; }
QDebug & operator<<(QChar t)
Writes the character, t, to the stream and returns a reference to the stream.
Definition: qdebug.h:95

◆ operator<<() [23/23]

QDeclarativeInfo& QDeclarativeInfo::operator<< ( const QUrl t)
inline

Definition at line 85 of file qdeclarativeinfo.h.

85 { static_cast<QDebug &>(*this) << t; return *this; }
The QDebug class provides an output stream for debugging information.
Definition: qdebug.h:62

Friends and Related Functions

◆ qmlInfo [1/3]

Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo ( const QObject me)
friend

Definition at line 155 of file qdeclarativeinfo.cpp.

156 {
158  d->object = me;
159  return QDeclarativeInfo(d);
160 }
QDeclarativeInfo(const QDeclarativeInfo &)
QDeclarativeInfoPrivate * d

◆ qmlInfo [2/3]

Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo ( const QObject me,
const QDeclarativeError error 
)
friend

Definition at line 162 of file qdeclarativeinfo.cpp.

163 {
165  d->object = me;
166  d->errors << error;
167  return QDeclarativeInfo(d);
168 }
#define error(msg)
QDeclarativeInfo(const QDeclarativeInfo &)
QList< QDeclarativeError > errors
QDeclarativeInfoPrivate * d

◆ qmlInfo [3/3]

Q_DECLARATIVE_EXPORT QDeclarativeInfo qmlInfo ( const QObject me,
const QList< QDeclarativeError > &  errors 
)
friend

Definition at line 170 of file qdeclarativeinfo.cpp.

171 {
173  d->object = me;
174  d->errors = errors;
175  return QDeclarativeInfo(d);
176 }
QDeclarativeInfo(const QDeclarativeInfo &)
QList< QDeclarativeError > errors
QDeclarativeInfoPrivate * d

Properties

◆ d

QDeclarativeInfoPrivate* QDeclarativeInfo::d
private

Definition at line 94 of file qdeclarativeinfo.h.

Referenced by QDeclarativeInfo(), qmlInfo(), and ~QDeclarativeInfo().


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