Functions | Variables
qglobal.cpp File Reference
#include "qglobal.h"
#include "qasciidict.h"
#include "qstring.h"
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

void qDebug (const char *msg,...)
 
void debug (const char *msg,...)
 
void qWarning (const char *msg,...)
 
void warning (const char *msg,...)
 
void qFatal (const char *msg,...)
 
void fatal (const char *msg,...)
 
bool qt_check_pointer (bool c, const char *n, int l)
 
static bool firstObsoleteWarning (const char *obj, const char *oldfunc)
 
void qSuppressObsoleteWarnings (bool suppress)
 
void qObsolete (const char *obj, const char *oldfunc, const char *newfunc)
 
void qObsolete (const char *obj, const char *oldfunc)
 
void qObsolete (const char *message)
 

Variables

static bool si_alreadyDone = FALSE
 
static int si_wordSize
 
static bool si_bigEndian
 
static msg_handler handler = 0
 
static bool suppressObsolete = FALSE
 

Function Documentation

void debug ( const char *  msg,
  ... 
)

Definition at line 393 of file qglobal.cpp.

394 {
395  char buf[8196];
396  va_list ap;
397  va_start( ap, msg ); // use variable arg list
398  if ( handler ) {
399  vsprintf( buf, msg, ap );
400  va_end( ap );
401  (*handler)( QtDebugMsg, buf );
402  } else {
403  vfprintf( stderr, msg, ap );
404  va_end( ap );
405  fprintf( stderr, "\n" ); // add newline
406  }
407 }
void msg(const char *fmt,...)
Definition: message.cpp:107
static msg_handler handler
Definition: qglobal.cpp:234
UWORD32 buf[4]
Definition: md5.h:42
void fatal ( const char *  msg,
  ... 
)

Definition at line 465 of file qglobal.cpp.

466 {
467  char buf[8196];
468  va_list ap;
469  va_start( ap, msg ); // use variable arg list
470  if ( handler ) {
471  vsprintf( buf, msg, ap );
472  va_end( ap );
473  (*handler)( QtFatalMsg, buf );
474  } else {
475  vfprintf( stderr, msg, ap );
476  va_end( ap );
477  fprintf( stderr, "\n" ); // add newline
478 #if defined(_OS_UNIX_) && defined(DEBUG)
479  abort(); // trap; generates core dump
480 #else
481  exit( 1 ); // goodbye cruel world
482 #endif
483  }
484 }
void msg(const char *fmt,...)
Definition: message.cpp:107
static msg_handler handler
Definition: qglobal.cpp:234
UWORD32 buf[4]
Definition: md5.h:42
static bool firstObsoleteWarning ( const char *  obj,
const char *  oldfunc 
)
static

Definition at line 557 of file qglobal.cpp.

558 {
559  static QAsciiDict<int> *obsoleteDict = 0;
560  if ( !obsoleteDict ) { // first time func is called
561  obsoleteDict = new QAsciiDict<int>;
562 #if defined(DEBUG)
563  qDebug(
564  "You are using obsolete functions in the Qt library. Call the function\n"
565  "qSuppressObsoleteWarnings() to suppress obsolete warnings.\n"
566  );
567 #endif
568  }
569  QCString s( obj );
570  s += "::";
571  s += oldfunc;
572  if ( obsoleteDict->find(s.data()) == 0 ) {
573  obsoleteDict->insert( s.data(), (int*)1 ); // anything different from 0
574  return TRUE;
575  }
576  return FALSE;
577 }
void qDebug(const char *msg,...)
Definition: qglobal.cpp:376
type * find(const char *k) const
Definition: qasciidict.h:65
void insert(const char *k, const type *d)
Definition: qasciidict.h:59
const bool FALSE
Definition: qglobal.h:370
const char * data() const
Definition: qcstring.h:207
static QCString * s
Definition: config.cpp:1042
const bool TRUE
Definition: qglobal.h:371
void qDebug ( const char *  msg,
  ... 
)

Definition at line 376 of file qglobal.cpp.

377 {
378  char buf[8196];
379  va_list ap;
380  va_start( ap, msg ); // use variable arg list
381  if ( handler ) {
382  vsprintf( buf, msg, ap ); // ### vsnprintf would be great here
383  va_end( ap );
384  (*handler)( QtDebugMsg, buf );
385  } else {
386  vfprintf( stderr, msg, ap );
387  va_end( ap );
388  fprintf( stderr, "\n" ); // add newline
389  }
390 }
void msg(const char *fmt,...)
Definition: message.cpp:107
static msg_handler handler
Definition: qglobal.cpp:234
UWORD32 buf[4]
Definition: md5.h:42
void qFatal ( const char *  msg,
  ... 
)

Definition at line 443 of file qglobal.cpp.

444 {
445  char buf[8196];
446  va_list ap;
447  va_start( ap, msg ); // use variable arg list
448  if ( handler ) {
449  vsprintf( buf, msg, ap );
450  va_end( ap );
451  (*handler)( QtFatalMsg, buf );
452  } else {
453  vfprintf( stderr, msg, ap );
454  va_end( ap );
455  fprintf( stderr, "\n" ); // add newline
456 #if defined(_OS_UNIX_) && defined(DEBUG)
457  abort(); // trap; generates core dump
458 #else
459  exit( 1 ); // goodbye cruel world
460 #endif
461  }
462 }
void msg(const char *fmt,...)
Definition: message.cpp:107
static msg_handler handler
Definition: qglobal.cpp:234
UWORD32 buf[4]
Definition: md5.h:42
void qObsolete ( const char *  obj,
const char *  oldfunc,
const char *  newfunc 
)

Definition at line 586 of file qglobal.cpp.

587 {
588  if ( suppressObsolete )
589  return;
590  if ( !firstObsoleteWarning(obj, oldfunc) )
591  return;
592  if ( obj )
593  qDebug( "%s::%s: This function is obsolete, use %s instead.",
594  obj, oldfunc, newfunc );
595  else
596  qDebug( "%s: This function is obsolete, use %s instead.",
597  oldfunc, newfunc );
598 }
void qDebug(const char *msg,...)
Definition: qglobal.cpp:376
static bool firstObsoleteWarning(const char *obj, const char *oldfunc)
Definition: qglobal.cpp:557
static bool suppressObsolete
Definition: qglobal.cpp:579
void qObsolete ( const char *  obj,
const char *  oldfunc 
)

Definition at line 600 of file qglobal.cpp.

601 {
602  if ( suppressObsolete )
603  return;
604  if ( !firstObsoleteWarning(obj, oldfunc) )
605  return;
606  if ( obj )
607  qDebug( "%s::%s: This function is obsolete.", obj, oldfunc );
608  else
609  qDebug( "%s: This function is obsolete.", oldfunc );
610 }
void qDebug(const char *msg,...)
Definition: qglobal.cpp:376
static bool firstObsoleteWarning(const char *obj, const char *oldfunc)
Definition: qglobal.cpp:557
static bool suppressObsolete
Definition: qglobal.cpp:579
void qObsolete ( const char *  message)

Definition at line 612 of file qglobal.cpp.

613 {
614  if ( suppressObsolete )
615  return;
616  if ( !firstObsoleteWarning( "Qt", message) )
617  return;
618  qDebug( "%s", message );
619 }
void qDebug(const char *msg,...)
Definition: qglobal.cpp:376
static bool firstObsoleteWarning(const char *obj, const char *oldfunc)
Definition: qglobal.cpp:557
static bool suppressObsolete
Definition: qglobal.cpp:579
void qSuppressObsoleteWarnings ( bool  suppress)

Definition at line 581 of file qglobal.cpp.

582 {
583  suppressObsolete = suppress;
584 }
static bool suppressObsolete
Definition: qglobal.cpp:579
bool qt_check_pointer ( bool  c,
const char *  n,
int  l 
)

Definition at line 549 of file qglobal.cpp.

550 {
551  if ( c )
552  qFatal( "In file %s, line %d: Out of memory", n, l );
553  return TRUE;
554 }
static QStrList * l
Definition: config.cpp:1044
std::void_t< T > n
void qFatal(const char *msg,...)
Definition: qglobal.cpp:443
const bool TRUE
Definition: qglobal.h:371
void qWarning ( const char *  msg,
  ... 
)

Definition at line 409 of file qglobal.cpp.

410 {
411  char buf[8196];
412  va_list ap;
413  va_start( ap, msg ); // use variable arg list
414  if ( handler ) {
415  vsprintf( buf, msg, ap );
416  va_end( ap );
417  (*handler)( QtWarningMsg, buf );
418  } else {
419  vfprintf( stderr, msg, ap );
420  va_end( ap );
421  fprintf( stderr, "\n" ); // add newline
422  }
423 }
void msg(const char *fmt,...)
Definition: message.cpp:107
static msg_handler handler
Definition: qglobal.cpp:234
UWORD32 buf[4]
Definition: md5.h:42
void warning ( const char *  msg,
  ... 
)

Definition at line 427 of file qglobal.cpp.

428 {
429  char buf[8196];
430  va_list ap;
431  va_start( ap, msg ); // use variable arg list
432  if ( handler ) {
433  vsprintf( buf, msg, ap );
434  va_end( ap );
435  (*handler)( QtWarningMsg, buf );
436  } else {
437  vfprintf( stderr, msg, ap );
438  va_end( ap );
439  fprintf( stderr, "\n" ); // add newline
440  }
441 }
void msg(const char *fmt,...)
Definition: message.cpp:107
static msg_handler handler
Definition: qglobal.cpp:234
UWORD32 buf[4]
Definition: md5.h:42

Variable Documentation

msg_handler handler = 0
static

Definition at line 234 of file qglobal.cpp.

bool si_alreadyDone = FALSE
static

Definition at line 63 of file qglobal.cpp.

bool si_bigEndian
static

Definition at line 65 of file qglobal.cpp.

int si_wordSize
static

Definition at line 64 of file qglobal.cpp.

bool suppressObsolete = FALSE
static

Definition at line 579 of file qglobal.cpp.