⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qglobal.h

📁 奇趣公司比较新的qt/emd版本
💻 H
📖 第 1 页 / 共 5 页
字号:
#endif#ifndef qPrintable#  define qPrintable(string) (string).toLocal8Bit().constData()#endifQ_CORE_EXPORT void qDebug(const char *, ...) /* print debug message */#if defined(Q_CC_GNU) && !defined(__INSURE__)    __attribute__ ((format (printf, 1, 2)))#endif;Q_CORE_EXPORT void qWarning(const char *, ...) /* print warning message */#if defined(Q_CC_GNU) && !defined(__INSURE__)    __attribute__ ((format (printf, 1, 2)))#endif;class QString;Q_CORE_EXPORT QString qt_error_string(int errorCode = -1);Q_CORE_EXPORT void qCritical(const char *, ...) /* print critical message */#if defined(Q_CC_GNU) && !defined(__INSURE__)    __attribute__ ((format (printf, 1, 2)))#endif;Q_CORE_EXPORT void qFatal(const char *, ...) /* print fatal message and exit */#if defined(Q_CC_GNU) && !defined(__INSURE__)    __attribute__ ((format (printf, 1, 2)))#endif;#ifdef QT3_SUPPORTQ_CORE_EXPORT QT3_SUPPORT void qSystemWarning(const char *msg, int code = -1);#endif /* QT3_SUPPORT */Q_CORE_EXPORT void qErrnoWarning(int code, const char *msg, ...);Q_CORE_EXPORT void qErrnoWarning(const char *msg, ...);#if (defined(QT_NO_DEBUG_OUTPUT) || defined(QT_NO_TEXTSTREAM)) && !defined(QT_NO_DEBUG_STREAM)#define QT_NO_DEBUG_STREAM#endif/*  Forward declarations only.  In order to use the qDebug() stream, you must #include<QDebug>*/class QDebug;class QNoDebug;#ifndef QT_NO_DEBUG_STREAMQ_CORE_EXPORT_INLINE QDebug qDebug();Q_CORE_EXPORT_INLINE QDebug qWarning();Q_CORE_EXPORT_INLINE QDebug qCritical();#elseinline QNoDebug qDebug();#endif#define QT_NO_QDEBUG_MACRO if(1); else qDebug#ifdef QT_NO_DEBUG_OUTPUT#  define qDebug QT_NO_QDEBUG_MACRO#endif#ifdef QT_NO_WARNING_OUTPUT#  define qWarning if(1); else qWarning#endifinline void qt_noop() {}Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line);#if !defined(Q_ASSERT)#  ifndef QT_NO_DEBUG#    define Q_ASSERT(cond) do {if(!(cond))qt_assert(#cond,__FILE__,__LINE__);} while (0)#  else#    define Q_ASSERT(cond) do{}while(0)#  endif#endif#if defined(QT_NO_DEBUG) && !defined(QT_PAINT_DEBUG)#define QT_NO_PAINT_DEBUG#endifQ_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line);#if !defined(Q_ASSERT_X)#  ifndef QT_NO_DEBUG#    define Q_ASSERT_X(cond, where, what) do {if(!(cond))qt_assert_x(where, what,__FILE__,__LINE__);} while (0)#  else#    define Q_ASSERT_X(cond, where, what) do{}while(0)#  endif#endifQ_CORE_EXPORT void qt_check_pointer(const char *, int);#ifndef QT_NO_DEBUG#  define Q_CHECK_PTR(p) do {if(!(p))qt_check_pointer(__FILE__,__LINE__);} while (0)#else#  define Q_CHECK_PTR(p)#endif#if (defined(Q_CC_GNU) && !defined(Q_OS_SOLARIS)) || defined(Q_CC_HPACC)#  define Q_FUNC_INFO __PRETTY_FUNCTION__#elif defined(_MSC_VER)    /* MSVC 2002 doesn't have __FUNCSIG__ nor can it handle QT_STRINGIFY. */#  if _MSC_VER <= 1300#      define Q_FUNC_INFO __FILE__ "(line number unavailable)"#  else#      define Q_FUNC_INFO __FUNCSIG__#  endif#else#   if defined(Q_OS_SOLARIS) || defined(Q_CC_XLC)#      define Q_FUNC_INFO __FILE__ "(line number unavailable)"#   else        /* These two macros makes it possible to turn the builtin line expander into a         * string literal. */#       define QT_STRINGIFY2(x) #x#       define QT_STRINGIFY(x) QT_STRINGIFY2(x)#       define Q_FUNC_INFO __FILE__ ":" QT_STRINGIFY(__LINE__)#   endif    /* The MIPSpro compiler postpones macro expansion, and therefore macros must be in scope     * when being used. */#   if !defined(Q_CC_MIPS)#       undef QT_STRINGIFY2#       undef QT_STRINGIFY#   endif#endifenum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg = QtCriticalMsg };Q_CORE_EXPORT void qt_message_output(QtMsgType, const char *buf);typedef void (*QtMsgHandler)(QtMsgType, const char *);Q_CORE_EXPORT QtMsgHandler qInstallMsgHandler(QtMsgHandler);#ifdef QT3_SUPPORTinline QT3_SUPPORT void qSuppressObsoleteWarnings(bool = true) {}inline QT3_SUPPORT void qObsolete(const char *, const char * = 0, const char * = 0) {}#endif#if defined(QT_NO_THREAD)template <typename T>class QGlobalStatic{public:    T *pointer;    inline QGlobalStatic(T *p) : pointer(p) { }    inline ~QGlobalStatic() { pointer = 0; }};#define Q_GLOBAL_STATIC(TYPE, NAME)                              \    static TYPE *NAME()                                          \    {                                                            \        static TYPE this_##NAME;                                 \        static QGlobalStatic<TYPE > global_##NAME(&this_##NAME); \        return global_##NAME.pointer;                            \    }#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS)              \    static TYPE *NAME()                                          \    {                                                            \        static TYPE this_##NAME ARGS;                            \        static QGlobalStatic<TYPE > global_##NAME(&this_##NAME); \        return global_##NAME.pointer;                            \    }#else// forward declaration, since qatomic.h needs qglobal.htemplate <typename T> struct QBasicAtomicPointer;// POD for Q_GLOBAL_STATICtemplate <typename T>class QGlobalStatic{public:    T *pointer;    bool destroyed;};// Created as a function-local static to delete a QGlobalStatic<T>template <typename T>class QGlobalStaticDeleter{public:    QGlobalStatic<T> &globalStatic;    QGlobalStaticDeleter(QGlobalStatic<T> &_globalStatic)        : globalStatic(_globalStatic)    { }    inline ~QGlobalStaticDeleter()    {        delete globalStatic.pointer;        globalStatic.pointer = 0;        globalStatic.destroyed = true;    }};#if (defined Q_OS_HPUX && defined Q_CC_HPACC && !defined __ia64)// aCC 3.x bug#  define Q_GLOBAL_STATIC_INIT(TYPE, NAME)                              \    static QGlobalStatic<TYPE > this_##NAME#else#  define Q_GLOBAL_STATIC_INIT(TYPE, NAME)                              \    static QGlobalStatic<TYPE > this_##NAME = { 0, false }#endif#define Q_GLOBAL_STATIC(TYPE, NAME)                                     \    Q_GLOBAL_STATIC_INIT(TYPE, NAME);                                   \    static TYPE *NAME()                                                 \    {                                                                   \        if (!this_##NAME.pointer && !this_##NAME.destroyed) {           \            TYPE *x = new TYPE;                                         \            if (!q_atomic_test_and_set_ptr(&this_##NAME.pointer, 0, x)) \                delete x;                                               \            else                                                        \                static QGlobalStaticDeleter<TYPE > cleanup(this_##NAME); \        }                                                               \        return this_##NAME.pointer;                                     \    }#define Q_GLOBAL_STATIC_WITH_ARGS(TYPE, NAME, ARGS)                     \    Q_GLOBAL_STATIC_INIT(TYPE, NAME);                                   \    static TYPE *NAME()                                                 \    {                                                                   \        if (!this_##NAME.pointer && !this_##NAME.destroyed) {           \            TYPE *x = new TYPE ARGS;                                    \            if (!q_atomic_test_and_set_ptr(&this_##NAME.pointer, 0, x)) \                delete x;                                               \            else                                                        \                static QGlobalStaticDeleter<TYPE > cleanup(this_##NAME); \        }                                                               \        return this_##NAME.pointer;                                     \    }#endifclass QBool{    bool b;public:    inline explicit QBool(bool B) : b(B) {}    inline operator const void *() const    { return b ? static_cast<const void *>(this) : static_cast<const void *>(0); }};inline bool operator==(QBool b1, bool b2) { return !b1 == !b2; }inline bool operator==(bool b1, QBool b2) { return !b1 == !b2; }inline bool operator==(QBool b1, QBool b2) { return !b1 == !b2; }inline bool operator!=(QBool b1, bool b2) { return !b1 != !b2; }inline bool operator!=(bool b1, QBool b2) { return !b1 != !b2; }inline bool operator!=(QBool b1, QBool b2) { return !b1 != !b2; }static inline bool qFuzzyCompare(double p1, double p2){    return qAbs(p1 - p2) < 0.00000000001;}static inline bool qFuzzyCompare(float p1, float p2){    return qAbs(p1 - p2) < 0.000001;}/*   This function tests a double for a null value. It doesn't   check whether the actual value is 0 or close to 0, but whether   it is binary 0.*/static inline bool qIsNull(double d){    union U {        double d;        quint64 u;    };    U val;    val.d = d;    return val.u == quint64(0);}/*   This function tests a float for a null value. It doesn't   check whether the actual value is 0 or close to 0, but whether   it is binary 0.*/static inline bool qIsNull(float f){    union U {        float f;        quint32 u;    };    U val;    val.f = f;    return val.u == 0u;}/*   Compilers which follow outdated template instantiation rules   require a class to have a comparison operator to exist when   a QList of this type is instantiated. It's not actually   used in the list, though. Hence the dummy implementation.   Just in case other code relies on it we better trigger a warning   mandating a real implementation.*/#ifdef Q_FULL_TEMPLATE_INSTANTIATION#  define Q_DUMMY_COMPARISON_OPERATOR(C) \    bool operator==(const C&) const { \        qWarning(#C"::operator==(const "#C"&) was called"); \        return false; \    }#else#  define Q_DUMMY_COMPARISON_OPERATOR(C)#endif/*   QTypeInfo     - type trait functionality   qIsDetached   - data sharing functionality*/#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION/*  The catch-all template.*/template <typename T> inline bool qIsDetached(T &) { return true; }template <typename T>class QTypeInfo{public:    enum {        isPointer = false,        isComplex = true,        isStatic = true,        isLarge = (sizeof(T)>sizeof(void*)),        isDummy = false    };};template <typename T>class QTypeInfo<T*>{public:    enum {        isPointer = true,        isComplex = false,        isStatic = false,        isLarge = false,        isDummy = false    };};#elsetemplate <typename T> char QTypeInfoHelper(T*(*)());void* QTypeInfoHelper(...);template <typename T> inline bool qIsDetached(T &) { return true; }template <typename T>class QTypeInfo{public:    enum {        isPointer = (1 == sizeof(QTypeInfoHelper((T(*)())0))),        isComplex = !isPointer,        isStatic = !isPointer,        isLarge = (sizeof(T)>sizeof(void*)),        isDummy = false    };};#endif /* QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION *//*   Specialize a specific type with:     Q_DECLARE_TYPEINFO(type, flags);   where 'type' is the name of the type to specialize and 'flags' is   logically-OR'ed combination of the flags below.*/enum { /* TYPEINFO flags */    Q_COMPLEX_TYPE = 0,    Q_PRIMITIVE_TYPE = 0x1,    Q_STATIC_TYPE = 0,    Q_MOVABLE_TYPE = 0x2,    Q_DUMMY_TYPE = 0x4};#define Q_DECLARE_TYPEINFO(TYPE, FLAGS) \template <> \class QTypeInfo<TYPE> \{ \public: \    enum { \        isComplex = (((FLAGS) & Q_PRIMITIVE_TYPE) == 0), \        isStatic = (((FLAGS) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), \        isLarge = (sizeof(TYPE)>sizeof(void*)), \        isPointer = false, \        isDummy = (((FLAGS) & Q_DUMMY_TYPE) != 0) \    }; \    static inline const char *name() { return #TYPE; } \}/*   Specialize a shared type with:     Q_DECLARE_SHARED(type);   where 'type' is the name of the type to specialize.  NOTE: shared   types must declare a 'bool isDetached(void) const;' member for this

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -