Qt 4.8
Macros | Functions | Variables
qtsciicodec.cpp File Reference
#include "qtsciicodec_p.h"
#include "qlist.h"

Go to the source code of this file.

Macros

#define IsTSCIIChar(c)   (((c) >= 0x80) && ((c) <= 0xfd))
 

Functions

static int cmp (const ushort *s1, const ushort *s2, size_t len)
 
static unsigned int qt_TSCIIToUnicode (unsigned int code, uint *s)
 
static unsigned char qt_UnicodeToTSCII (ushort u1, ushort u2, ushort u3)
 

Variables

static const ushort TsToUn [][3]
 
static const ushort UnToTs [][4]
 
static const int UnToTsLast = 124
 

Macro Definition Documentation

◆ IsTSCIIChar

#define IsTSCIIChar (   c)    (((c) >= 0x80) && ((c) <= 0xfd))

Definition at line 56 of file qtsciicodec.cpp.

Referenced by QTsciiCodec::convertToUnicode().

Function Documentation

◆ cmp()

static int cmp ( const ushort s1,
const ushort s2,
size_t  len 
)
static

Definition at line 446 of file qtsciicodec.cpp.

Referenced by detectProcessorFeatures(), QTriangulator< T >::SimpleToMonotone::fillPriorityQueue(), QSortedModelEngine::filter(), QVariant::operator!=(), QTriangulator< T >::ComplexToSimple::CompareEdges::operator()(), QVariant::operator==(), qt_UnicodeToTSCII(), ucstrcmp(), and winLangCodeToIsoName().

447 {
448  int diff = 0;
449 
450  while (len-- && (diff = *s1++ - *s2++) == 0)
451  ;
452 
453  return diff;
454 }
static Bigint * diff(Bigint *a, Bigint *b)

◆ qt_TSCIIToUnicode()

static unsigned int qt_TSCIIToUnicode ( unsigned int  code,
uint s 
)
static

Definition at line 484 of file qtsciicodec.cpp.

Referenced by QTsciiCodec::convertToUnicode().

485 {
486  int len = 0;
487  for (int i = 0; i < 3; i++) {
488  uint u = TsToUn[code & 0x7f][i];
489  s[i] = u;
490  if (s[i]) len = i + 1;
491  }
492 
493  return len;
494 }
static const ushort TsToUn[][3]
quint16 u
unsigned int uint
Definition: qglobal.h:996

◆ qt_UnicodeToTSCII()

static unsigned char qt_UnicodeToTSCII ( ushort  u1,
ushort  u2,
ushort  u3 
)
static

Definition at line 456 of file qtsciicodec.cpp.

Referenced by QTsciiCodec::convertFromUnicode().

457 {
458  ushort s[3];
459  s[0] = u1;
460  s[1] = u2;
461  s[2] = u3;
462 
463  int a = 0; // start pos
464  int b = UnToTsLast; // end pos
465 
466  // do a binary search for the composed unicode in the list
467  while (a <= b) {
468  int w = (a + b) / 2;
469  int j = cmp(UnToTs[w], s, 3);
470 
471  if (j == 0)
472  // found it
473  return UnToTs[w][3];
474 
475  if (j < 0)
476  a = w + 1;
477  else
478  b = w - 1;
479  }
480 
481  return 0;
482 }
long ASN1_INTEGER_get ASN1_INTEGER * a
static const ushort UnToTs[][4]
static int cmp(const ushort *s1, const ushort *s2, size_t len)
static const int UnToTsLast
unsigned short ushort
Definition: qglobal.h:995

Variable Documentation

◆ TsToUn

const ushort TsToUn[][3]
static

Definition at line 316 of file qtsciicodec.cpp.

Referenced by qt_TSCIIToUnicode().

◆ UnToTs

const ushort UnToTs[][4]
static

Definition at line 186 of file qtsciicodec.cpp.

Referenced by qt_UnicodeToTSCII().

◆ UnToTsLast

const int UnToTsLast = 124
static

Definition at line 185 of file qtsciicodec.cpp.

Referenced by qt_UnicodeToTSCII().