Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

quuid.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000-2002 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of the Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 
00021 #ifndef QUUID_H
00022 #define QUUID_H
00023 
00024 #ifndef QT_H
00025 #include <qstring.h>
00026 #endif // QT_H
00027 
00028 struct Q_EXPORT QUuid
00029 {
00030     enum Variant {
00031         VarUnknown  =-1,
00032         NCS     = 0, // 0 - -
00033         DCE     = 2, // 1 0 -
00034         Microsoft   = 6, // 1 1 0
00035         Reserved    = 7  // 1 1 1
00036     };
00037 
00038     QUuid()
00039     {
00040         memset( this, 0, sizeof(QUuid) );
00041     }
00042     QUuid( uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8 )
00043     {
00044         data1 = l;
00045         data2 = w1;
00046         data3 = w2;
00047         data4[0] = b1;
00048         data4[1] = b2;
00049         data4[2] = b3;
00050         data4[3] = b4;
00051         data4[4] = b5;
00052         data4[5] = b6;
00053         data4[6] = b7;
00054         data4[7] = b8;
00055     }
00056     QUuid( const QUuid &uuid )
00057     {
00058         uint i;
00059 
00060         data1 = uuid.data1;
00061         data2 = uuid.data2;
00062         data3 = uuid.data3;
00063         for( i = 0; i < 8; i++ )
00064             data4[ i ] = uuid.data4[ i ];
00065     }
00066 
00067 #ifndef QT_NO_QUUID_STRING
00068     QUuid( const QString & );
00069     QString toString() const;
00070 #endif
00071     bool isNull() const;
00072 
00073     QUuid &operator=(const QUuid &orig )
00074     {
00075         uint i;
00076 
00077         data1 = orig.data1;
00078         data2 = orig.data2;
00079         data3 = orig.data3;
00080         for( i = 0; i < 8; i++ )
00081             data4[ i ] = orig.data4[ i ];
00082 
00083         return *this;
00084     }
00085 
00086     bool operator==(const QUuid &orig ) const
00087     {
00088         uint i;
00089         if ( data1 != orig.data1 || data2 != orig.data2 ||
00090                 data3 != orig.data3 )
00091             return FALSE;
00092 
00093         for( i = 0; i < 8; i++ )
00094             if ( data4[i] != orig.data4[i] )
00095                 return FALSE;
00096 
00097         return TRUE;
00098     }
00099 
00100     bool operator!=(const QUuid &orig ) const
00101     {
00102         return !( *this == orig );
00103     }
00104 
00105     bool operator<(const QUuid &other ) const;
00106     bool operator>(const QUuid &other ) const;
00107 
00108     QUuid::Variant variant() const;
00109 
00110     ulong   data1;
00111     ushort  data2;
00112     ushort  data3;
00113     uchar   data4[ 8 ];
00114 };
00115 
00116 #endif //QUUID_H

Generated on Sat Nov 5 16:16:41 2005 for OPIE by  doxygen 1.4.2