Qt 4.8
Namespaces | Macros | Typedefs | Functions
qxmltestlogger.cpp File Reference
#include <stdio.h>
#include <string.h>
#include <QtCore/qglobal.h>
#include "QtTest/private/qxmltestlogger_p.h"
#include "QtTest/private/qtestresult_p.h"
#include "QtTest/private/qbenchmark_p.h"
#include "QtTest/private/qbenchmarkmetric_p.h"
#include "QtTest/qtestcase.h"

Go to the source code of this file.

Namespaces

 QTest
 The QTest namespace contains all the functions and declarations that are related to the QTestLib tool.
 

Macros

#define MAP_ENTITY(chr, ent)
 

Typedefs

typedef int(* StringFormatFunction) (QTestCharBuffer *, char const *, size_t)
 

Functions

int allocateStringFn (QTestCharBuffer *str, char const *src, StringFormatFunction func)
 
static const char * QTest::benchmarkResultFormatString ()
 
static const char * QTest::incidentFormatString (bool noDescription, bool noTag)
 
static bool QTest::isEmpty (const char *str)
 
static const char * QTest::messageFormatString (bool noDescription, bool noTag)
 
static const char * QTest::xmlIncidentType2String (QAbstractTestLogger::IncidentTypes type)
 
static const char * QTest::xmlMessageType2String (QAbstractTestLogger::MessageTypes type)
 

Macro Definition Documentation

◆ MAP_ENTITY

#define MAP_ENTITY (   chr,
  ent 
)
Value:
case chr: \
if (dest + sizeof(ent) < end) { \
strcpy(dest, ent); \
dest += sizeof(ent) - 1; \
} \
else { \
*dest = 0; \
return (dest+sizeof(ent)-begin); \
} \
++src; \
break;
static const KeyPair *const end

Referenced by QXmlTestLogger::xmlQuote().

Typedef Documentation

◆ StringFormatFunction

typedef int(* StringFormatFunction) (QTestCharBuffer *, char const *, size_t)

Definition at line 410 of file qxmltestlogger.cpp.

Function Documentation

◆ allocateStringFn()

int allocateStringFn ( QTestCharBuffer str,
char const *  src,
StringFormatFunction  func 
)

Definition at line 416 of file qxmltestlogger.cpp.

Referenced by QXmlTestLogger::xmlCdata(), and QXmlTestLogger::xmlQuote().

417 {
418  static const int MAXSIZE = 1024*1024*2;
419 
420  int size = str->size();
421 
422  int res = 0;
423 
424  for (;;) {
425  res = func(str, src, size);
426  str->data()[size - 1] = '\0';
427  if (res < size) {
428  // We succeeded or fatally failed
429  break;
430  }
431  // buffer wasn't big enough, try again
432  size *= 2;
433  if (size > MAXSIZE) {
434  break;
435  }
436  if (!str->reset(size))
437  break; // ran out of memory - bye
438  }
439 
440  return res;
441 }
bool reset(int newSize)