00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024
00025 #ifndef QVDEFINES_H
00026 #define QVDEFINES_H
00027
00028
00029 #include <QMetaType>
00030 #include <QList>
00031 #include <QVector>
00032 #include <QPoint>
00033 #include <QPointF>
00034 #include <QRect>
00035 #include <QPair>
00036 #include <limits>
00037 #include <iso646.h>
00038 #include <iostream>
00039
00040 #if !defined(Q_WARNING)
00041 # ifndef QT_NO_DEBUG
00042 # define Q_WARNING(cond) { if (not (cond)) std::cerr << "WARNING: condition \"" << #cond << "\" in file \"" << __FILE__ << "\", line " << __LINE__ << " does not hold" << std::endl; }
00043 # else
00044 # define Q_WARNING(cond) qt_noop()
00045 # endif
00046 #endif
00047
00048 #if !defined(Q_WARNING_X)
00049 # ifndef QT_NO_DEBUG
00050 # define Q_WARNING_X(cond,where,what) { if (not (cond)) std::cerr << "WARNING: in file \"" << __FILE__ << "\", line " << __LINE__ << ": " << what << std::endl; }
00051 # else
00052 # define Q_WARNING_X(cond) qt_noop()
00053 # endif
00054 #endif
00055
00056 #if !defined(Q_CHECKPOINT)
00057 # ifndef QT_NO_DEBUG
00058 # define Q_CHECKPOINT { std::cout << " (CHKPT@" << __FILE__ << ":" << __LINE__ << ") "; }
00059 # else
00060 # define Q_CHECKPOINT qt_noop()
00061 # endif
00062 #endif
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 typedef unsigned char uChar;
00075 typedef unsigned short uShort;
00076 typedef unsigned int uInt;
00077 typedef signed char sChar;
00078 typedef signed short sShort;
00079 typedef signed int sInt;
00080
00081
00082 typedef float sFloat;
00083 typedef double sDouble;
00084
00085
00086
00091 typedef QPair<QPointF, QPointF> QPointFMatching;
00092
00093
00094
00095 Q_DECLARE_METATYPE(sChar);
00096 Q_DECLARE_METATYPE(QVector<sFloat>);
00097 Q_DECLARE_METATYPE(QVector<sDouble>);
00098 Q_DECLARE_METATYPE(QList<sInt>);
00099 Q_DECLARE_METATYPE(QList<sFloat>);
00100 Q_DECLARE_METATYPE(QList<sDouble>);
00101 Q_DECLARE_METATYPE(QList<QPoint>);
00102 Q_DECLARE_METATYPE(QList<QPointF>);
00103 Q_DECLARE_METATYPE(QList<QRect>);
00104 Q_DECLARE_METATYPE(QList< QList< QPoint > >);
00105 Q_DECLARE_METATYPE(QList< QList< QPointF > >);
00106
00107 Q_DECLARE_METATYPE(QPointFMatching);
00108 Q_DECLARE_METATYPE(QList<QPointFMatching>);
00109
00110 #include <QColor>
00111 const QColor qvColors[] = {
00112 Qt::red,
00113 Qt::green,
00114 Qt::blue,
00115 Qt::cyan,
00116 Qt::magenta,
00117 Qt::darkRed,
00118 Qt::darkGreen,
00119 Qt::darkBlue,
00120 Qt::darkCyan,
00121 Qt::darkMagenta
00122 };
00123
00124 std::ostream& operator << (std::ostream &os, const QPointF &point);
00125 std::ostream& operator << (std::ostream &os, const QPoint &point);
00126 std::ostream& operator << (std::ostream &os, const QPointFMatching &matching);
00127
00128 uint qHash(const double &value);
00129 uint qHash(const QPointF &point);
00130 uint qHash(const QPoint &point);
00131
00132 long long getMicroseconds();
00133
00134 #ifdef QVOCTAVE
00135
00136 #include <QLocale>
00137 inline bool operator==(const QLocale::NumberOptions & a,const QLocale::NumberOptions & b) {
00138 return static_cast<int>(a) == static_cast<int>(b);
00139 }
00140 #endif // QVOCTAVE
00141
00142 #ifdef QVIPP
00143 #include <ipp.h>
00144 Q_DECLARE_METATYPE(IppiMaskSize);
00145 Q_DECLARE_METATYPE(IppCmpOp);
00146 Q_DECLARE_METATYPE(IppRoundMode);
00147 #endif // QVIPP
00148
00149 #ifndef DOXYGEN_IGNORE_THIS
00150
00151
00152
00153
00154
00155
00156 template < template<typename T> class TypeContainer, typename TypeElement, typename TypeIndex>
00157 QVector< QPair<TypeElement, TypeElement> > compose( const TypeContainer< QPair<TypeIndex, TypeIndex> > &pairIndexes,
00158 const TypeContainer<TypeElement> &containerA,
00159 const TypeContainer<TypeElement> &containerB)
00160 {
00161 QVector< QPair<TypeElement, TypeElement> > result(pairIndexes.count());
00162
00163 TypeIndex i = 0;
00164 QPair<TypeIndex, TypeIndex> element;
00165 foreach(element, pairIndexes)
00166 {
00167 result[i].first = containerA[element.first];
00168 result[i].second = containerB[element.second];
00169 i++;
00170 }
00171
00172 return result;
00173 }
00174
00175
00176
00177
00178
00179
00180
00181 template< template< typename T> class ContainerA, typename Element, typename ContainerB> ContainerB compose(const ContainerA<Element> &containerA)
00182 {
00183 ContainerB containerB;
00184 foreach(Element e, containerA)
00185 containerB << e;
00186 return containerB;
00187 }
00188
00189 #endif // DOXYGEN_IGNORE_THIS
00190
00191 #define GLUPERSPECTIVE_SUBSTITUTE
00192
00193 #ifdef GLUPERSPECTIVE_SUBSTITUTE
00194 #include <GL/glu.h>
00195 void qvGluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
00196 #else // GLUPERSPECTIVE_SUBSTITUTE
00197 #define qvGluPerspective gluPerspective
00198 #endif // GLUPERSPECTIVE_SUBSTITUTE
00199
00200 #endif
00201
00202