[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qvariant.h:1 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>qvariant.h Include File</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qvariant.h</h1>
|
---|
| 33 |
|
---|
| 34 | <p>This is the verbatim text of the qvariant.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
---|
| 35 | <hr>
|
---|
| 36 | <pre>
|
---|
| 37 | /****************************************************************************
|
---|
| 38 | ** $Id: qvariant-h.html 2051 2007-02-21 10:04:20Z chehrlic $
|
---|
| 39 | **
|
---|
| 40 | ** Definition of QVariant class
|
---|
| 41 | **
|
---|
| 42 | ** Created : 990414
|
---|
| 43 | **
|
---|
| 44 | ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
---|
| 45 | **
|
---|
| 46 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
---|
| 47 | **
|
---|
| 48 | ** This file may be distributed under the terms of the Q Public License
|
---|
| 49 | ** as defined by Trolltech ASA of Norway and appearing in the file
|
---|
| 50 | ** LICENSE.QPL included in the packaging of this file.
|
---|
| 51 | **
|
---|
| 52 | ** This file may be distributed and/or modified under the terms of the
|
---|
| 53 | ** GNU General Public License version 2 as published by the Free Software
|
---|
| 54 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 55 | ** packaging of this file.
|
---|
| 56 | **
|
---|
| 57 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
| 58 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
| 59 | ** Agreement provided with the Software.
|
---|
| 60 | **
|
---|
| 61 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
| 62 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 63 | **
|
---|
| 64 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
| 65 | ** information about Qt Commercial License Agreements.
|
---|
| 66 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
| 67 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
| 68 | **
|
---|
| 69 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
| 70 | ** not clear to you.
|
---|
| 71 | **
|
---|
| 72 | **********************************************************************/
|
---|
| 73 |
|
---|
| 74 | #ifndef QVARIANT_H
|
---|
| 75 | #define QVARIANT_H
|
---|
| 76 |
|
---|
| 77 | #ifndef QT_H
|
---|
| 78 | #include "qstring.h"
|
---|
| 79 | #endif // QT_H
|
---|
| 80 |
|
---|
| 81 | #ifndef QT_NO_VARIANT
|
---|
| 82 | class QString;
|
---|
| 83 | class QCString;
|
---|
| 84 | class QFont;
|
---|
| 85 | class QPixmap;
|
---|
| 86 | class QBrush;
|
---|
| 87 | class QRect;
|
---|
| 88 | class QPoint;
|
---|
| 89 | class QImage;
|
---|
| 90 | class QSize;
|
---|
| 91 | class QColor;
|
---|
| 92 | class QPalette;
|
---|
| 93 | class QColorGroup;
|
---|
| 94 | class QIconSet;
|
---|
| 95 | class QDataStream;
|
---|
| 96 | class QPointArray;
|
---|
| 97 | class QRegion;
|
---|
| 98 | class QBitmap;
|
---|
| 99 | class QCursor;
|
---|
| 100 | class QStringList;
|
---|
| 101 | class QSizePolicy;
|
---|
| 102 | class QDate;
|
---|
| 103 | class QTime;
|
---|
| 104 | class QDateTime;
|
---|
| 105 | class QBitArray;
|
---|
| 106 | class QKeySequence;
|
---|
| 107 | class QPen;
|
---|
| 108 | // Some headers rejected after QVariant declaration for GCC 2.7.* compatibility
|
---|
| 109 | class QVariant;
|
---|
| 110 | #ifndef QT_NO_TEMPLATE_VARIANT
|
---|
| 111 | template <class T> class QValueList;
|
---|
| 112 | template <class T> class QValueListConstIterator;
|
---|
| 113 | template <class T> class QValueListNode;
|
---|
| 114 | template <class Key, class T> class QMap;
|
---|
| 115 | template <class Key, class T> class QMapConstIterator;
|
---|
| 116 | #endif
|
---|
| 117 |
|
---|
| 118 | class Q_EXPORT QVariant
|
---|
| 119 | {
|
---|
| 120 | public:
|
---|
| 121 | enum Type {
|
---|
| 122 | Invalid,
|
---|
| 123 | Map,
|
---|
| 124 | List,
|
---|
| 125 | String,
|
---|
| 126 | StringList,
|
---|
| 127 | Font,
|
---|
| 128 | Pixmap,
|
---|
| 129 | Brush,
|
---|
| 130 | Rect,
|
---|
| 131 | Size,
|
---|
| 132 | Color,
|
---|
| 133 | Palette,
|
---|
| 134 | ColorGroup,
|
---|
| 135 | IconSet,
|
---|
| 136 | Point,
|
---|
| 137 | Image,
|
---|
| 138 | Int,
|
---|
| 139 | UInt,
|
---|
| 140 | Bool,
|
---|
| 141 | Double,
|
---|
| 142 | CString,
|
---|
| 143 | PointArray,
|
---|
| 144 | Region,
|
---|
| 145 | Bitmap,
|
---|
| 146 | Cursor,
|
---|
| 147 | SizePolicy,
|
---|
| 148 | Date,
|
---|
| 149 | Time,
|
---|
| 150 | DateTime,
|
---|
| 151 | ByteArray,
|
---|
| 152 | BitArray,
|
---|
| 153 | KeySequence,
|
---|
| 154 | Pen,
|
---|
| 155 | LongLong,
|
---|
| 156 | ULongLong
|
---|
| 157 | };
|
---|
| 158 |
|
---|
| 159 | QVariant();
|
---|
| 160 | ~QVariant();
|
---|
| 161 | QVariant( const QVariant& );
|
---|
| 162 | #ifndef QT_NO_DATASTREAM
|
---|
| 163 | QVariant( QDataStream& s );
|
---|
| 164 | #endif
|
---|
| 165 | QVariant( const QString& );
|
---|
| 166 | QVariant( const QCString& );
|
---|
| 167 | QVariant( const char* );
|
---|
| 168 | #ifndef QT_NO_STRINGLIST
|
---|
| 169 | QVariant( const QStringList& );
|
---|
| 170 | #endif
|
---|
| 171 | QVariant( const QFont& );
|
---|
| 172 | QVariant( const QPixmap& );
|
---|
| 173 | QVariant( const QImage& );
|
---|
| 174 | QVariant( const QBrush& );
|
---|
| 175 | QVariant( const QPoint& );
|
---|
| 176 | QVariant( const QRect& );
|
---|
| 177 | QVariant( const QSize& );
|
---|
| 178 | QVariant( const QColor& );
|
---|
| 179 | QVariant( const QPalette& );
|
---|
| 180 | QVariant( const QColorGroup& );
|
---|
| 181 | QVariant( const QIconSet& );
|
---|
| 182 | QVariant( const QPointArray& );
|
---|
| 183 | QVariant( const QRegion& );
|
---|
| 184 | QVariant( const QBitmap& );
|
---|
| 185 | QVariant( const QCursor& );
|
---|
| 186 | QVariant( const QDate& );
|
---|
| 187 | QVariant( const QTime& );
|
---|
| 188 | QVariant( const QDateTime& );
|
---|
| 189 | QVariant( const QByteArray& );
|
---|
| 190 | QVariant( const QBitArray& );
|
---|
| 191 | #ifndef QT_NO_ACCEL
|
---|
| 192 | QVariant( const QKeySequence& );
|
---|
| 193 | #endif
|
---|
| 194 | QVariant( const QPen& );
|
---|
| 195 | #ifndef QT_NO_TEMPLATE_VARIANT
|
---|
| 196 | QVariant( const QValueList<QVariant>& );
|
---|
| 197 | QVariant( const QMap<QString,QVariant>& );
|
---|
| 198 | #endif
|
---|
| 199 | QVariant( int );
|
---|
| 200 | QVariant( uint );
|
---|
| 201 | QVariant( Q_LLONG );
|
---|
| 202 | QVariant( Q_ULLONG );
|
---|
| 203 | // ### Problems on some compilers ?
|
---|
| 204 | QVariant( bool, int );
|
---|
| 205 | QVariant( double );
|
---|
| 206 | QVariant( QSizePolicy );
|
---|
| 207 |
|
---|
| 208 | QVariant& operator= ( const QVariant& );
|
---|
| 209 | bool operator==( const QVariant& ) const;
|
---|
| 210 | bool operator!=( const QVariant& ) const;
|
---|
| 211 |
|
---|
| 212 | Type type() const;
|
---|
| 213 | const char* typeName() const;
|
---|
| 214 |
|
---|
| 215 | bool canCast( Type ) const;
|
---|
| 216 | bool cast( Type );
|
---|
| 217 |
|
---|
| 218 | bool isValid() const;
|
---|
| 219 | bool isNull() const;
|
---|
| 220 |
|
---|
| 221 | void clear();
|
---|
| 222 |
|
---|
| 223 | const QString toString() const;
|
---|
| 224 | const QCString toCString() const;
|
---|
| 225 | #ifndef QT_NO_STRINGLIST
|
---|
| 226 | const QStringList toStringList() const;
|
---|
| 227 | #endif
|
---|
| 228 | const QFont toFont() const;
|
---|
| 229 | const QPixmap toPixmap() const;
|
---|
| 230 | const QImage toImage() const;
|
---|
| 231 | const QBrush toBrush() const;
|
---|
| 232 | const QPoint toPoint() const;
|
---|
| 233 | const QRect toRect() const;
|
---|
| 234 | const QSize toSize() const;
|
---|
| 235 | const QColor toColor() const;
|
---|
| 236 | const QPalette toPalette() const;
|
---|
| 237 | const QColorGroup toColorGroup() const;
|
---|
| 238 | const QIconSet toIconSet() const;
|
---|
| 239 | const QPointArray toPointArray() const;
|
---|
| 240 | const QBitmap toBitmap() const;
|
---|
| 241 | const QRegion toRegion() const;
|
---|
| 242 | const QCursor toCursor() const;
|
---|
| 243 | const QDate toDate() const;
|
---|
| 244 | const QTime toTime() const;
|
---|
| 245 | const QDateTime toDateTime() const;
|
---|
| 246 | const QByteArray toByteArray() const;
|
---|
| 247 | const QBitArray toBitArray() const;
|
---|
| 248 | #ifndef QT_NO_ACCEL
|
---|
| 249 | const QKeySequence toKeySequence() const;
|
---|
| 250 | #endif
|
---|
| 251 | const QPen toPen() const;
|
---|
| 252 | int toInt( bool * ok=0 ) const;
|
---|
| 253 | uint toUInt( bool * ok=0 ) const;
|
---|
| 254 | Q_LLONG toLongLong( bool * ok=0 ) const;
|
---|
| 255 | Q_ULLONG toULongLong( bool * ok=0 ) const;
|
---|
| 256 | bool toBool() const;
|
---|
| 257 | double toDouble( bool * ok=0 ) const;
|
---|
| 258 | #ifndef QT_NO_TEMPLATE_VARIANT
|
---|
| 259 | const QValueList<QVariant> toList() const;
|
---|
| 260 | const QMap<QString,QVariant> toMap() const;
|
---|
| 261 | #endif
|
---|
| 262 | QSizePolicy toSizePolicy() const;
|
---|
| 263 |
|
---|
| 264 | #ifndef QT_NO_TEMPLATE_VARIANT
|
---|
| 265 | QValueListConstIterator<QString> stringListBegin() const;
|
---|
| 266 | QValueListConstIterator<QString> stringListEnd() const;
|
---|
| 267 | QValueListConstIterator<QVariant> listBegin() const;
|
---|
| 268 | QValueListConstIterator<QVariant> listEnd() const;
|
---|
| 269 | QMapConstIterator<QString,QVariant> mapBegin() const;
|
---|
| 270 | QMapConstIterator<QString,QVariant> mapEnd() const;
|
---|
| 271 | QMapConstIterator<QString,QVariant> mapFind( const QString& ) const;
|
---|
| 272 | #endif
|
---|
| 273 | QString& asString();
|
---|
| 274 | QCString& asCString();
|
---|
| 275 | #ifndef QT_NO_STRINGLIST
|
---|
| 276 | QStringList& asStringList();
|
---|
| 277 | #endif
|
---|
| 278 | QFont& asFont();
|
---|
| 279 | QPixmap& asPixmap();
|
---|
| 280 | QImage& asImage();
|
---|
| 281 | QBrush& asBrush();
|
---|
| 282 | QPoint& asPoint();
|
---|
| 283 | QRect& asRect();
|
---|
| 284 | QSize& asSize();
|
---|
| 285 | QColor& asColor();
|
---|
| 286 | QPalette& asPalette();
|
---|
| 287 | QColorGroup& asColorGroup();
|
---|
| 288 | QIconSet& asIconSet();
|
---|
| 289 | QPointArray& asPointArray();
|
---|
| 290 | QBitmap& asBitmap();
|
---|
| 291 | QRegion& asRegion();
|
---|
| 292 | QCursor& asCursor();
|
---|
| 293 | QDate& asDate();
|
---|
| 294 | QTime& asTime();
|
---|
| 295 | QDateTime& asDateTime();
|
---|
| 296 | QByteArray& asByteArray();
|
---|
| 297 | QBitArray& asBitArray();
|
---|
| 298 | #ifndef QT_NO_ACCEL
|
---|
| 299 | QKeySequence& asKeySequence();
|
---|
| 300 | #endif
|
---|
| 301 | QPen& asPen();
|
---|
| 302 | int& asInt();
|
---|
| 303 | uint& asUInt();
|
---|
| 304 | Q_LLONG& asLongLong();
|
---|
| 305 | Q_ULLONG& asULongLong();
|
---|
| 306 | bool& asBool();
|
---|
| 307 | double& asDouble();
|
---|
| 308 | #ifndef QT_NO_TEMPLATE_VARIANT
|
---|
| 309 | QValueList<QVariant>& asList();
|
---|
| 310 | QMap<QString,QVariant>& asMap();
|
---|
| 311 | #endif
|
---|
| 312 | QSizePolicy& asSizePolicy();
|
---|
| 313 |
|
---|
| 314 | #ifndef QT_NO_DATASTREAM
|
---|
| 315 | void load( QDataStream& );
|
---|
| 316 | void save( QDataStream& ) const;
|
---|
| 317 | #endif
|
---|
| 318 | static const char* typeToName( Type typ );
|
---|
| 319 | static Type nameToType( const char* name );
|
---|
| 320 |
|
---|
| 321 | private:
|
---|
| 322 | void detach();
|
---|
| 323 |
|
---|
| 324 | class Private : public QShared
|
---|
| 325 | {
|
---|
| 326 | public:
|
---|
| 327 | Private();
|
---|
| 328 | Private( Private* );
|
---|
| 329 | ~Private();
|
---|
| 330 |
|
---|
| 331 | void clear();
|
---|
| 332 |
|
---|
| 333 | Type typ;
|
---|
| 334 | union
|
---|
| 335 | {
|
---|
| 336 | uint u;
|
---|
| 337 | int i;
|
---|
| 338 | Q_LLONG ll;
|
---|
| 339 | Q_ULLONG ull;
|
---|
| 340 | bool b;
|
---|
| 341 | double d;
|
---|
| 342 | void *ptr;
|
---|
| 343 | } value;
|
---|
| 344 | uint is_null : 1; // ## 4.0 merge with typ
|
---|
| 345 | };
|
---|
| 346 |
|
---|
| 347 | Private* d;
|
---|
| 348 |
|
---|
| 349 | public:
|
---|
| 350 | void* rawAccess( void* ptr = 0, Type typ = Invalid, bool deepCopy = FALSE );
|
---|
| 351 | };
|
---|
| 352 |
|
---|
| 353 | // down here for GCC 2.7.* compatibility
|
---|
| 354 | #ifndef QT_H
|
---|
| 355 | #include "qvaluelist.h"
|
---|
| 356 | #include "qstringlist.h"
|
---|
| 357 | #include "qmap.h"
|
---|
| 358 | #endif // QT_H
|
---|
| 359 |
|
---|
| 360 | inline QVariant::Type QVariant::type() const
|
---|
| 361 | {
|
---|
| 362 | return d->typ;
|
---|
| 363 | }
|
---|
| 364 |
|
---|
| 365 | inline bool QVariant::isValid() const
|
---|
| 366 | {
|
---|
| 367 | return (d->typ != Invalid);
|
---|
| 368 | }
|
---|
| 369 |
|
---|
| 370 | #ifndef QT_NO_TEMPLATE_VARIANT
|
---|
| 371 | inline QValueListConstIterator<QString> QVariant::stringListBegin() const
|
---|
| 372 | {
|
---|
| 373 | if ( d->typ != StringList )
|
---|
| 374 | return QValueListConstIterator<QString>();
|
---|
| 375 | return ((const QStringList*)d->value.ptr)->begin();
|
---|
| 376 | }
|
---|
| 377 |
|
---|
| 378 | inline QValueListConstIterator<QString> QVariant::stringListEnd() const
|
---|
| 379 | {
|
---|
| 380 | if ( d->typ != StringList )
|
---|
| 381 | return QValueListConstIterator<QString>();
|
---|
| 382 | return ((const QStringList*)d->value.ptr)->end();
|
---|
| 383 | }
|
---|
| 384 |
|
---|
| 385 | inline QValueListConstIterator<QVariant> QVariant::listBegin() const
|
---|
| 386 | {
|
---|
| 387 | if ( d->typ != List )
|
---|
| 388 | return QValueListConstIterator<QVariant>();
|
---|
| 389 | return ((const QValueList<QVariant>*)d->value.ptr)->begin();
|
---|
| 390 | }
|
---|
| 391 |
|
---|
| 392 | inline QValueListConstIterator<QVariant> QVariant::listEnd() const
|
---|
| 393 | {
|
---|
| 394 | if ( d->typ != List )
|
---|
| 395 | return QValueListConstIterator<QVariant>();
|
---|
| 396 | return ((const QValueList<QVariant>*)d->value.ptr)->end();
|
---|
| 397 | }
|
---|
| 398 |
|
---|
| 399 | inline QMapConstIterator<QString,QVariant> QVariant::mapBegin() const
|
---|
| 400 | {
|
---|
| 401 | if ( d->typ != Map )
|
---|
| 402 | return QMapConstIterator<QString,QVariant>();
|
---|
| 403 | return ((const QMap<QString,QVariant>*)d->value.ptr)->begin();
|
---|
| 404 | }
|
---|
| 405 |
|
---|
| 406 | inline QMapConstIterator<QString,QVariant> QVariant::mapEnd() const
|
---|
| 407 | {
|
---|
| 408 | if ( d->typ != Map )
|
---|
| 409 | return QMapConstIterator<QString,QVariant>();
|
---|
| 410 | return ((const QMap<QString,QVariant>*)d->value.ptr)->end();
|
---|
| 411 | }
|
---|
| 412 |
|
---|
| 413 | inline QMapConstIterator<QString,QVariant> QVariant::mapFind( const QString& key ) const
|
---|
| 414 | {
|
---|
| 415 | if ( d->typ != Map )
|
---|
| 416 | return QMapConstIterator<QString,QVariant>();
|
---|
| 417 | return ((const QMap<QString,QVariant>*)d->value.ptr)->find( key );
|
---|
| 418 | }
|
---|
| 419 | #endif
|
---|
| 420 |
|
---|
| 421 | #ifndef QT_NO_DATASTREAM
|
---|
| 422 | Q_EXPORT QDataStream& operator>> ( QDataStream& s, QVariant& p );
|
---|
| 423 | Q_EXPORT QDataStream& operator<< ( QDataStream& s, const QVariant& p );
|
---|
| 424 | Q_EXPORT QDataStream& operator>> ( QDataStream& s, QVariant::Type& p );
|
---|
| 425 | Q_EXPORT QDataStream& operator<< ( QDataStream& s, const QVariant::Type p );
|
---|
| 426 | #endif
|
---|
| 427 |
|
---|
| 428 | #endif //QT_NO_VARIANT
|
---|
| 429 | #endif // QVARIANT_H
|
---|
| 430 | </pre>
|
---|
| 431 | <!-- eof -->
|
---|
| 432 | <p><address><hr><div align=center>
|
---|
| 433 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 434 | <td>Copyright © 2007
|
---|
| 435 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 436 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 437 | </table></div></address></body>
|
---|
| 438 | </html>
|
---|