From 3ad431df9af959fd9add5e4d16d3f4d46132cfb7 Mon Sep 17 00:00:00 2001
From: Michele Calgaro
Date: Thu, 13 Mar 2025 16:04:37 +0900
Subject: Move TQChar code to standalone files tqchar.{h,cpp}
Signed-off-by: Michele Calgaro
---
doc/html/headerfilesynonyms | 1 -
doc/html/headers.html | 1 +
doc/html/qt.dcf | 2 +-
doc/html/titleindex | 1 +
doc/html/tqchar-h.html | 425 +++++++++++++++++++++++
doc/html/tqchar.html | 2 +-
doc/html/tqstring-h.html | 410 ++++-------------------
doc/man/man3/tqchar.3qt | 2 +-
include/tqchar.h | 1 +
qmake/Makefile.unix | 8 +-
qmake/Makefile.win32-g++ | 5 +-
src/tools/qt_tools.pri | 4 +-
src/tools/tqchar.cpp | 792 +++++++++++++++++++++++++++++++++++++++++++
src/tools/tqchar.h | 381 +++++++++++++++++++++
src/tools/tqstring.cpp | 795 ++------------------------------------------
src/tools/tqstring.h | 339 +------------------
src/tqmoc/tqmoc.pro | 1 +
17 files changed, 1705 insertions(+), 1465 deletions(-)
create mode 100644 doc/html/tqchar-h.html
create mode 120000 include/tqchar.h
create mode 100644 src/tools/tqchar.cpp
create mode 100644 src/tools/tqchar.h
diff --git a/doc/html/headerfilesynonyms b/doc/html/headerfilesynonyms
index 0779e83e1..77972e97c 100644
--- a/doc/html/headerfilesynonyms
+++ b/doc/html/headerfilesynonyms
@@ -123,7 +123,6 @@ tqptrdictiterator.h tqptrdict.h
tqptrlistiterator.h tqptrlist.h
tqsqlfieldinfo.h tqsqlfield.h
tqsqlrecordinfo.h tqsqlrecord.h
-tqchar.h tqstring.h
tqcharref.h tqstring.h
tqconststring.h tqstring.h
tqstrlistiterator.h tqstrlist.h
diff --git a/doc/html/headers.html b/doc/html/headers.html
index cc8c59e29..29ad7e498 100644
--- a/doc/html/headers.html
+++ b/doc/html/headers.html
@@ -53,6 +53,7 @@ body { background: #ffffff; color: black; }
tqcache.h
tqcanvas.h
tqcdestyle.h
+tqchar.h
tqcheckbox.h
tqclipboard.h
tqcolor.h
diff --git a/doc/html/qt.dcf b/doc/html/qt.dcf
index eda8cf1cc..79d3be956 100644
--- a/doc/html/qt.dcf
+++ b/doc/html/qt.dcf
@@ -865,7 +865,7 @@
operator>
operator>=
-
+
TQCharRef
diff --git a/doc/html/titleindex b/doc/html/titleindex
index a8eec621b..6f2b3091e 100644
--- a/doc/html/titleindex
+++ b/doc/html/titleindex
@@ -1055,6 +1055,7 @@ tqbuttongroup.h Include File | tqbuttongroup-h.html
tqcache.h Include File | tqcache-h.html
tqcanvas.h Include File | tqcanvas-h.html
tqcdestyle.h Include File | tqcdestyle-h.html
+tqchar.h Include File | tqchar-h.html
tqcheckbox.h Include File | tqcheckbox-h.html
tqclipboard.h Include File | tqclipboard-h.html
tqcolor.h Include File | tqcolor-h.html
diff --git a/doc/html/tqchar-h.html b/doc/html/tqchar-h.html
new file mode 100644
index 000000000..db1fc6fdd
--- /dev/null
+++ b/doc/html/tqchar-h.html
@@ -0,0 +1,425 @@
+
+
+
+
+tqchar.h Include File
+
+
+
+
+tqchar.h
+
+This is the verbatim text of the tqchar.h include file. It is provided only for illustration; the copyright remains with Trolltech.
+
+
+/****************************************************************************
+**
+** Definition of the TQChar class, and related Unicode functions.
+**
+** Created : 920609
+**
+** Copyright (C) 2015 Timothy Pearson. All rights reserved.
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of the tools module of the TQt GUI Toolkit.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free TQt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** This file may be used under the terms of the Q Public License as
+** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
+** included in the packaging of this file. Licensees holding valid TQt
+** Commercial licenses may use this file in accordance with the TQt
+** Commercial License Agreement provided with the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#ifndef TQCHAR_H
+#define TQCHAR_H
+
+#ifndef QT_H
+#include "tqglobal.h"
+#endif // QT_H
+
+class TQString;
+
+class TQ_EXPORT TQChar
+{
+public:
+ TQChar();
+ TQChar( char c );
+ TQChar( uchar c );
+ TQChar( uchar c, uchar r );
+ TQChar( const TQChar& c ); // ### remove in 4.0 to allow compiler optimization
+ TQChar( ushort rc );
+ TQChar( short rc );
+ TQChar( uint rc );
+ TQChar( int rc );
+
+ static const TQChar null; // 0000
+ static const TQChar replacement; // FFFD
+ static const TQChar byteOrderMark; // FEFF
+ static const TQChar byteOrderSwapped; // FFFE
+ static const TQChar nbsp; // 00A0
+
+ // Unicode information
+
+ enum Category
+ {
+ NoCategory,
+
+ Mark_NonSpacing, // Mn
+ Mark_SpacingCombining, // Mc
+ Mark_Enclosing, // Me
+
+ Number_DecimalDigit, // Nd
+ Number_Letter, // Nl
+ Number_Other, // No
+
+ Separator_Space, // Zs
+ Separator_Line, // Zl
+ Separator_Paragraph, // Zp
+
+ Other_Control, // Cc
+ Other_Format, // Cf
+ Other_Surrogate, // Cs
+ Other_PrivateUse, // Co
+ Other_NotAssigned, // Cn
+
+ Letter_Uppercase, // Lu
+ Letter_Lowercase, // Ll
+ Letter_Titlecase, // Lt
+ Letter_Modifier, // Lm
+ Letter_Other, // Lo
+
+ Punctuation_Connector, // Pc
+ Punctuation_Dash, // Pd
+ Punctuation_Dask = Punctuation_Dash, // oops
+ Punctuation_Open, // Ps
+ Punctuation_Close, // Pe
+ Punctuation_InitialQuote, // Pi
+ Punctuation_FinalQuote, // Pf
+ Punctuation_Other, // Po
+
+ Symbol_Math, // Sm
+ Symbol_Currency, // Sc
+ Symbol_Modifier, // Sk
+ Symbol_Other // So
+ };
+
+ enum Direction
+ {
+ DirL, DirR, DirEN, DirES, DirET, DirAN, DirCS, DirB, DirS, DirWS, DirON,
+ DirLRE, DirLRO, DirAL, DirRLE, DirRLO, DirPDF, DirNSM, DirBN
+ };
+
+ enum Decomposition
+ {
+ Single, Canonical, Font, NoBreak, Initial, Medial,
+ Final, Isolated, Circle, Super, Sub, Vertical,
+ Wide, Narrow, Small, Square, Compat, Fraction
+ };
+
+ enum Joining
+ {
+ OtherJoining, Dual, Right, Center
+ };
+
+ enum CombiningClass
+ {
+ Combining_BelowLeftAttached = 200,
+ Combining_BelowAttached = 202,
+ Combining_BelowRightAttached = 204,
+ Combining_LeftAttached = 208,
+ Combining_RightAttached = 210,
+ Combining_AboveLeftAttached = 212,
+ Combining_AboveAttached = 214,
+ Combining_AboveRightAttached = 216,
+
+ Combining_BelowLeft = 218,
+ Combining_Below = 220,
+ Combining_BelowRight = 222,
+ Combining_Left = 224,
+ Combining_Right = 226,
+ Combining_AboveLeft = 228,
+ Combining_Above = 230,
+ Combining_AboveRight = 232,
+
+ Combining_DoubleBelow = 233,
+ Combining_DoubleAbove = 234,
+ Combining_IotaSubscript = 240
+ };
+
+ // ****** WHEN ADDING FUNCTIONS, CONSIDER ADDING TO TQCharRef TOO
+
+ int digitValue() const;
+ TQChar lower() const;
+ TQChar upper() const;
+
+ Category category() const;
+ Direction direction() const;
+ Joining joining() const;
+ bool mirrored() const;
+ TQChar mirroredChar() const;
+ const TQString &decomposition() const; // ### return just TQString in 4.0
+ Decomposition decompositionTag() const;
+ unsigned char combiningClass() const;
+
+ char latin1() const { return ucs > 0xff ? 0 : (char) ucs; }
+ ushort unicode() const { return ucs; }
+#ifdef Q_NO_PACKED_REFERENCE
+ ushort &unicode() { return *((ushort*)&ucs); }
+#else
+ ushort &unicode() { return ucs; }
+#endif
+#ifndef TQT_NO_CAST_ASCII
+ // like all ifdef'd code this is undocumented
+ operator char() const { return latin1(); }
+#endif
+
+ bool isNull() const { return unicode()==0; }
+ bool isPrint() const;
+ bool isPunct() const;
+ bool isSpace() const;
+ bool isMark() const;
+ bool isLetter() const;
+ bool isNumber() const;
+ bool isLetterOrNumber() const;
+ bool isDigit() const;
+ bool isSymbol() const;
+
+ // Surrogate pairs support
+ bool isHighSurrogate() const;
+ bool isLowSurrogate() const;
+ static bool requiresSurrogates(uint ucs4);
+ static ushort highSurrogate(uint ucs4);
+ static ushort lowSurrogate(uint ucs4);
+ static uint surrogateToUcs4(const TQChar &high, const TQChar &low);
+
+ uchar cell() const { return ((uchar) ucs & 0xff); }
+ uchar row() const { return ((uchar) (ucs>>8)&0xff); }
+ void setCell( uchar cell ) { ucs = (ucs & 0xff00) + cell; }
+ void setRow( uchar row ) { ucs = (((ushort) row)<<8) + (ucs&0xff); }
+
+ static bool networkOrdered() {
+ int wordSize;
+ bool bigEndian = FALSE;
+ tqSysInfo( &wordSize, &bigEndian );
+ return bigEndian;
+ }
+
+ friend inline bool operator==( char ch, TQChar c );
+ friend inline bool operator==( TQChar c, char ch );
+ friend inline bool operator==( TQChar c1, TQChar c2 );
+ friend inline bool operator!=( TQChar c1, TQChar c2 );
+ friend inline bool operator!=( char ch, TQChar c );
+ friend inline bool operator!=( TQChar c, char ch );
+ friend inline bool operator<=( TQChar c, char ch );
+ friend inline bool operator<=( char ch, TQChar c );
+ friend inline bool operator<=( TQChar c1, TQChar c2 );
+
+#if defined(__cplusplus) && __cplusplus >= 201103L
+ // Explicit declarations to suppress warnings
+ // This could be removed when TQChar( const TQChar& c ) is removed
+ TQChar& operator=(const TQChar& other) = default;
+ ~TQChar() = default;
+#endif
+private:
+ ushort ucs;
+#if defined(QT_QSTRING_UCS_4)
+ ushort grp;
+#endif
+} TQ_PACKED;
+
+
+inline TQChar::TQChar() : ucs( 0 )
+#ifdef QT_QSTRING_UCS_4
+ , grp( 0 )
+#endif
+{
+}
+inline TQChar::TQChar( char c ) : ucs( (uchar)c )
+#ifdef QT_QSTRING_UCS_4
+ , grp( 0 )
+#endif
+{
+}
+inline TQChar::TQChar( uchar c ) : ucs( c )
+#ifdef QT_QSTRING_UCS_4
+ , grp( 0 )
+#endif
+{
+}
+inline TQChar::TQChar( uchar c, uchar r ) : ucs( (r << 8) | c )
+#ifdef QT_QSTRING_UCS_4
+ , grp( 0 )
+#endif
+{
+}
+inline TQChar::TQChar( const TQChar& c ) : ucs( c.ucs )
+#ifdef QT_QSTRING_UCS_4
+ , grp( c.grp )
+#endif
+{
+}
+
+inline TQChar::TQChar( ushort rc ) : ucs( rc )
+#ifdef QT_QSTRING_UCS_4
+ , grp( 0 )
+#endif
+{
+}
+inline TQChar::TQChar( short rc ) : ucs( (ushort) rc )
+#ifdef QT_QSTRING_UCS_4
+ , grp( 0 )
+#endif
+{
+}
+inline TQChar::TQChar( uint rc ) : ucs( (ushort ) (rc & 0xffff) )
+#ifdef QT_QSTRING_UCS_4
+ , grp( (ushort) ((rc >> 16) & 0xffff) )
+#endif
+{
+}
+inline TQChar::TQChar( int rc ) : ucs( (ushort) (rc & 0xffff) )
+#ifdef QT_QSTRING_UCS_4
+ , grp( (ushort) ((rc >> 16) & 0xffff) )
+#endif
+{
+}
+
+inline bool TQChar::isHighSurrogate() const
+{
+ return ((ucs & 0xfc00) == 0xd800);
+}
+
+inline bool TQChar::isLowSurrogate() const
+{
+ return ((ucs & 0xfc00) == 0xdc00);
+}
+
+inline bool TQChar::requiresSurrogates(uint ucs4)
+{
+ return (ucs4 >= 0x10000);
+}
+
+inline ushort TQChar::highSurrogate(uint ucs4)
+{
+ return ushort(((ucs4 - 0x10000) >> 10)) | 0xd800;
+}
+
+inline ushort TQChar::lowSurrogate(uint ucs4)
+{
+ return ushort(ucs4 & 0x03FF) | 0xdc00;
+}
+
+inline uint TQChar::surrogateToUcs4(const TQChar &high, const TQChar &low)
+{
+ return (uint(high.ucs & 0x03FF) << 10) | (low.ucs & 0x03FF) | 0x10000;
+}
+
+inline bool operator==( char ch, TQChar c )
+{
+ return ((uchar) ch) == c.ucs;
+}
+
+inline bool operator==( TQChar c, char ch )
+{
+ return ((uchar) ch) == c.ucs;
+}
+
+inline bool operator==( TQChar c1, TQChar c2 )
+{
+ return c1.ucs == c2.ucs;
+}
+
+inline bool operator!=( TQChar c1, TQChar c2 )
+{
+ return c1.ucs != c2.ucs;
+}
+
+inline bool operator!=( char ch, TQChar c )
+{
+ return ((uchar)ch) != c.ucs;
+}
+
+inline bool operator!=( TQChar c, char ch )
+{
+ return ((uchar) ch) != c.ucs;
+}
+
+inline bool operator<=( TQChar c, char ch )
+{
+ return c.ucs <= ((uchar) ch);
+}
+
+inline bool operator<=( char ch, TQChar c )
+{
+ return ((uchar) ch) <= c.ucs;
+}
+
+inline bool operator<=( TQChar c1, TQChar c2 )
+{
+ return c1.ucs <= c2.ucs;
+}
+
+inline bool operator>=( TQChar c, char ch ) { return ch <= c; }
+inline bool operator>=( char ch, TQChar c ) { return c <= ch; }
+inline bool operator>=( TQChar c1, TQChar c2 ) { return c2 <= c1; }
+inline bool operator<( TQChar c, char ch ) { return !(ch<=c); }
+inline bool operator<( char ch, TQChar c ) { return !(c<=ch); }
+inline bool operator<( TQChar c1, TQChar c2 ) { return !(c2<=c1); }
+inline bool operator>( TQChar c, char ch ) { return !(ch>=c); }
+inline bool operator>( char ch, TQChar c ) { return !(c>=ch); }
+inline bool operator>( TQChar c1, TQChar c2 ) { return !(c2>=c1); }
+
+#endif // TQCHAR_H
+
+
+
+
diff --git a/doc/html/tqchar.html b/doc/html/tqchar.html
index 038003227..3b990d622 100644
--- a/doc/html/tqchar.html
+++ b/doc/html/tqchar.html
@@ -33,7 +33,7 @@ body { background: #ffffff; color: black; }
The TQChar class provides a lightweight Unicode character.
More...
Almost all the functions in this class are reentrant when TQt is built with thread support. The exception is decomposition().
-
#include <tqstring.h>
+
#include <tqchar.h>
List of all member functions.
Public Members
diff --git a/doc/html/tqstring-h.html b/doc/html/tqstring-h.html
index 5387fbc3b..7ff338d13 100644
--- a/doc/html/tqstring-h.html
+++ b/doc/html/tqstring-h.html
@@ -34,22 +34,23 @@ body { background: #ffffff; color: black; }
/****************************************************************************
-** $Id: qt/tqstring.h 3.3.8 edited Jan 11 14:38 $
**
** Definition of the TQString class, and related Unicode functions.
**
** Created : 920609
**
-** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
+** Copyright (C) 2015 Timothy Pearson. All rights reserved.
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
**
** This file is part of the tools module of the TQt GUI Toolkit.
**
-** This file may be used under the terms of the GNU General Public
-** License versions 2.0 or 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Alternatively you may (at your option) use any
-** later version of the GNU General Public License if such license has
-** been publicly approved by Trolltech ASA (or its successors, if any)
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
** and the KDE Free TQt Foundation.
**
** Please review the following information to ensure GNU General
@@ -66,7 +67,7 @@ body { background: #ffffff; color: black; }
** Commercial licenses may use this file in accordance with the TQt
** Commercial License Agreement provided with the Software.
**
-** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
** herein.
@@ -77,7 +78,7 @@ body { background: #ffffff; color: black; }
#define TQSTRING_H
#ifndef QT_H
-#include "tqcstring.h"
+#include "tqcstring.h"
#endif // QT_H
#ifndef TQT_NO_CAST_ASCII
@@ -98,319 +99,29 @@ body { background: #ffffff; color: black; }
#endif
#endif
+#ifndef TQT_NO_SPRINTF
+#include <stdarg.h>
+#endif
-/*****************************************************************************
- TQString class
- *****************************************************************************/
+#include "tqchar.h"
class TQRegExp;
class TQString;
class TQCharRef;
+class TQMutex;
template <class T> class TQDeepCopy;
-class TQ_EXPORT TQChar {
-public:
- TQChar();
- TQChar( char c );
- TQChar( uchar c );
- TQChar( uchar c, uchar r );
- TQChar( const TQChar& c ); // ### remove in 4.0 to allow compiler optimization
- TQChar( ushort rc );
- TQChar( short rc );
- TQChar( uint rc );
- TQChar( int rc );
-
- static const TQChar null; // 0000
- static const TQChar replacement; // FFFD
- static const TQChar byteOrderMark; // FEFF
- static const TQChar byteOrderSwapped; // FFFE
- static const TQChar nbsp; // 00A0
-
- // Unicode information
-
- enum Category
- {
- NoCategory,
-
- Mark_NonSpacing, // Mn
- Mark_SpacingCombining, // Mc
- Mark_Enclosing, // Me
-
- Number_DecimalDigit, // Nd
- Number_Letter, // Nl
- Number_Other, // No
-
- Separator_Space, // Zs
- Separator_Line, // Zl
- Separator_Paragraph, // Zp
-
- Other_Control, // Cc
- Other_Format, // Cf
- Other_Surrogate, // Cs
- Other_PrivateUse, // Co
- Other_NotAssigned, // Cn
-
- Letter_Uppercase, // Lu
- Letter_Lowercase, // Ll
- Letter_Titlecase, // Lt
- Letter_Modifier, // Lm
- Letter_Other, // Lo
-
- Punctuation_Connector, // Pc
- Punctuation_Dash, // Pd
- Punctuation_Dask = Punctuation_Dash, // oops
- Punctuation_Open, // Ps
- Punctuation_Close, // Pe
- Punctuation_InitialQuote, // Pi
- Punctuation_FinalQuote, // Pf
- Punctuation_Other, // Po
-
- Symbol_Math, // Sm
- Symbol_Currency, // Sc
- Symbol_Modifier, // Sk
- Symbol_Other // So
- };
-
- enum Direction
- {
- DirL, DirR, DirEN, DirES, DirET, DirAN, DirCS, DirB, DirS, DirWS, DirON,
- DirLRE, DirLRO, DirAL, DirRLE, DirRLO, DirPDF, DirNSM, DirBN
- };
-
- enum Decomposition
- {
- Single, Canonical, Font, NoBreak, Initial, Medial,
- Final, Isolated, Circle, Super, Sub, Vertical,
- Wide, Narrow, Small, Square, Compat, Fraction
- };
-
- enum Joining
- {
- OtherJoining, Dual, Right, Center
- };
-
- enum CombiningClass
- {
- Combining_BelowLeftAttached = 200,
- Combining_BelowAttached = 202,
- Combining_BelowRightAttached = 204,
- Combining_LeftAttached = 208,
- Combining_RightAttached = 210,
- Combining_AboveLeftAttached = 212,
- Combining_AboveAttached = 214,
- Combining_AboveRightAttached = 216,
-
- Combining_BelowLeft = 218,
- Combining_Below = 220,
- Combining_BelowRight = 222,
- Combining_Left = 224,
- Combining_Right = 226,
- Combining_AboveLeft = 228,
- Combining_Above = 230,
- Combining_AboveRight = 232,
-
- Combining_DoubleBelow = 233,
- Combining_DoubleAbove = 234,
- Combining_IotaSubscript = 240
- };
-
- // ****** WHEN ADDING FUNCTIONS, CONSIDER ADDING TO TQCharRef TOO
-
- int digitValue() const;
- TQChar lower() const;
- TQChar upper() const;
-
- Category category() const;
- Direction direction() const;
- Joining joining() const;
- bool mirrored() const;
- TQChar mirroredChar() const;
- const TQString &decomposition() const; // ### return just TQString in 4.0
- Decomposition decompositionTag() const;
- unsigned char combiningClass() const;
-
- char latin1() const { return ucs > 0xff ? 0 : (char) ucs; }
- ushort unicode() const { return ucs; }
-#ifdef Q_NO_PACKED_REFERENCE
- ushort &unicode() { return *(&ucs); }
-#else
- ushort &unicode() { return ucs; }
-#endif
-#ifndef TQT_NO_CAST_ASCII
- // like all ifdef'd code this is undocumented
- operator char() const { return latin1(); }
-#endif
-
- bool isNull() const { return unicode()==0; }
- bool isPrint() const;
- bool isPunct() const;
- bool isSpace() const;
- bool isMark() const;
- bool isLetter() const;
- bool isNumber() const;
- bool isLetterOrNumber() const;
- bool isDigit() const;
- bool isSymbol() const;
-
- uchar cell() const { return ((uchar) ucs & 0xff); }
- uchar row() const { return ((uchar) (ucs>>8)&0xff); }
- void setCell( uchar cell ) { ucs = (ucs & 0xff00) + cell; }
- void setRow( uchar row ) { ucs = (((ushort) row)<<8) + (ucs&0xff); }
-
- static bool networkOrdered() {
- int wordSize;
- bool bigEndian = FALSE;
- tqSysInfo( &wordSize, &bigEndian );
- return bigEndian;
- }
-
- friend inline bool operator==( char ch, TQChar c );
- friend inline bool operator==( TQChar c, char ch );
- friend inline bool operator==( TQChar c1, TQChar c2 );
- friend inline bool operator!=( TQChar c1, TQChar c2 );
- friend inline bool operator!=( char ch, TQChar c );
- friend inline bool operator!=( TQChar c, char ch );
- friend inline bool operator<=( TQChar c, char ch );
- friend inline bool operator<=( char ch, TQChar c );
- friend inline bool operator<=( TQChar c1, TQChar c2 );
-
-private:
- ushort ucs;
-#if defined(QT_QSTRING_UCS_4)
- ushort grp;
-#endif
-} TQ_PACKED;
-
-inline TQChar::TQChar() : ucs( 0 )
-#ifdef QT_QSTRING_UCS_4
- , grp( 0 )
-#endif
-{
-}
-inline TQChar::TQChar( char c ) : ucs( (uchar)c )
-#ifdef QT_QSTRING_UCS_4
- , grp( 0 )
-#endif
-{
-}
-inline TQChar::TQChar( uchar c ) : ucs( c )
-#ifdef QT_QSTRING_UCS_4
- , grp( 0 )
-#endif
-{
-}
-inline TQChar::TQChar( uchar c, uchar r ) : ucs( (r << 8) | c )
-#ifdef QT_QSTRING_UCS_4
- , grp( 0 )
-#endif
-{
-}
-inline TQChar::TQChar( const TQChar& c ) : ucs( c.ucs )
-#ifdef QT_QSTRING_UCS_4
- , grp( c.grp )
-#endif
-{
-}
-
-inline TQChar::TQChar( ushort rc ) : ucs( rc )
-#ifdef QT_QSTRING_UCS_4
- , grp( 0 )
-#endif
-{
-}
-inline TQChar::TQChar( short rc ) : ucs( (ushort) rc )
-#ifdef QT_QSTRING_UCS_4
- , grp( 0 )
-#endif
-{
-}
-inline TQChar::TQChar( uint rc ) : ucs( (ushort ) (rc & 0xffff) )
-#ifdef QT_QSTRING_UCS_4
- , grp( (ushort) ((rc >> 16) & 0xffff) )
-#endif
-{
-}
-inline TQChar::TQChar( int rc ) : ucs( (ushort) (rc & 0xffff) )
-#ifdef QT_QSTRING_UCS_4
- , grp( (ushort) ((rc >> 16) & 0xffff) )
-#endif
-{
-}
-
-inline bool operator==( char ch, TQChar c )
-{
- return ((uchar) ch) == c.ucs;
-}
-
-inline bool operator==( TQChar c, char ch )
-{
- return ((uchar) ch) == c.ucs;
-}
-
-inline bool operator==( TQChar c1, TQChar c2 )
-{
- return c1.ucs == c2.ucs;
-}
-
-inline bool operator!=( TQChar c1, TQChar c2 )
-{
- return c1.ucs != c2.ucs;
-}
-
-inline bool operator!=( char ch, TQChar c )
-{
- return ((uchar)ch) != c.ucs;
-}
-
-inline bool operator!=( TQChar c, char ch )
-{
- return ((uchar) ch) != c.ucs;
-}
-
-inline bool operator<=( TQChar c, char ch )
-{
- return c.ucs <= ((uchar) ch);
-}
-
-inline bool operator<=( char ch, TQChar c )
-{
- return ((uchar) ch) <= c.ucs;
-}
-
-inline bool operator<=( TQChar c1, TQChar c2 )
-{
- return c1.ucs <= c2.ucs;
-}
-
-inline bool operator>=( TQChar c, char ch ) { return ch <= c; }
-inline bool operator>=( char ch, TQChar c ) { return c <= ch; }
-inline bool operator>=( TQChar c1, TQChar c2 ) { return c2 <= c1; }
-inline bool operator<( TQChar c, char ch ) { return !(ch<=c); }
-inline bool operator<( char ch, TQChar c ) { return !(c<=ch); }
-inline bool operator<( TQChar c1, TQChar c2 ) { return !(c2<=c1); }
-inline bool operator>( TQChar c, char ch ) { return !(ch>=c); }
-inline bool operator>( char ch, TQChar c ) { return !(c>=ch); }
-inline bool operator>( TQChar c1, TQChar c2 ) { return !(c2>=c1); }
-
// internal
-struct TQ_EXPORT TQStringData : public TQShared {
- TQStringData() :
- TQShared(), unicode(0), ascii(0), len(0), issimpletext(TRUE), maxl(0), islatin1(FALSE) { ref(); }
- TQStringData(TQChar *u, uint l, uint m) :
- TQShared(), unicode(u), ascii(0), len(l), issimpletext(FALSE), maxl(m), islatin1(FALSE) { }
- ~TQStringData() { if ( unicode ) delete[] ((char*)unicode);
- if ( ascii ) delete[] ascii; }
+struct TQ_EXPORT TQStringData : public TQShared
+{
+ TQStringData();
+ TQStringData(TQChar *u, uint l, uint m);
+ ~TQStringData();
void deleteSelf();
TQChar *unicode;
char *ascii;
- void setDirty() {
- if ( ascii ) {
- delete [] ascii;
- ascii = 0;
- }
- issimpletext = FALSE;
- }
+ void setDirty();
#ifdef Q_OS_MAC9
uint len;
#else
@@ -424,6 +135,11 @@ struct TQ_EXPORT TQStringData : public TQShared {
#endif
uint islatin1 : 1;
+ bool security_unpaged : 1;
+
+ TQMutex* mutex;
+ TQCString *cString;
+
private:
#if defined(TQ_DISABLE_COPY)
TQStringData( const TQStringData& );
@@ -476,7 +192,7 @@ public:
TQString arg( uint a, int fieldWidth = 0, int base = 10 ) const;
TQString arg( short a, int fieldWidth = 0, int base = 10 ) const;
TQString arg( ushort a, int fieldWidth = 0, int base = 10 ) const;
- TQString arg( double a, int fieldWidth = 0, char fmt = 'g',
+ TQString arg( double a, int fieldWidth = 0, char fmt = 'g',
int prec = -1 ) const;
TQString arg( char a, int fieldWidth = 0 ) const;
TQString arg( TQChar a, int fieldWidth = 0 ) const;
@@ -491,6 +207,11 @@ public:
TQString &sprintf( const char* format, ... )
#if defined(Q_CC_GNU) && !defined(__INSURE__)
__attribute__ ((format (printf, 2, 3)))
+#endif
+ ;
+ TQString &vsprintf(const char *format, va_list ap)
+#if defined(Q_CC_GNU) && !defined(__INSURE__)
+ __attribute__ ((format (printf, 2, 0)))
#endif
;
#endif
@@ -545,8 +266,8 @@ public:
TQString right( uint len ) const;
TQString mid( uint index, uint len=0xffffffff) const;
- TQString leftJustify( uint width, TQChar fill=' ', bool trunc=FALSE)const;
- TQString rightJustify( uint width, TQChar fill=' ',bool trunc=FALSE)const;
+ TQString leftJustify( uint width, TQChar fill=' ', bool trunc=FALSE)const;
+ TQString rightJustify( uint width, TQChar fill=' ',bool trunc=FALSE)const;
TQString lower() const;
TQString upper() const;
@@ -648,8 +369,8 @@ public:
TQString &setNum( ulong, int base=10 );
TQString &setNum( TQ_LLONG, int base=10 );
TQString &setNum( TQ_ULLONG, int base=10 );
- TQString &setNum( float, char f='g', int prec=6 );
- TQString &setNum( double, char f='g', int prec=6 );
+ TQString &setNum( float, char f='g', int prec=6 );
+ TQString &setNum( double, char f='g', int prec=6 );
static TQString number( long, int base=10 );
static TQString number( ulong, int base=10);
@@ -657,7 +378,7 @@ public:
static TQString number( TQ_ULLONG, int base=10);
static TQString number( int, int base=10 );
static TQString number( uint, int base=10);
- static TQString number( double, char f='g', int prec=6 );
+ static TQString number( double, char f='g', int prec=6 );
void setExpand( uint index, TQChar c );
@@ -680,13 +401,7 @@ public:
TQChar constref(uint i) const
{ return at(i); }
- TQChar& ref(uint i)
- { // Optimized for easy-inlining by simple compilers.
- if ( d->count != 1 || i >= d->len )
- subat( i );
- d->setDirty();
- return d->unicode[i];
- }
+ TQChar& ref(uint i);
const TQChar* unicode() const { return d->unicode; }
const char* ascii() const;
@@ -702,7 +417,7 @@ public:
operator const char *() const { return ascii(); }
#endif
#ifndef TQT_NO_STL
- operator std::string() const { return ascii() ? ascii() : ""; }
+ operator std::string() const { return ascii() ? ascii() : ""; }
#endif
static TQString fromUcs2( const unsigned short *ucs2 );
@@ -781,14 +496,21 @@ private:
friend class TQConstString;
friend class TQTextStream;
- TQString( TQStringData* dd, bool /* dummy */ ) : d(dd) { }
+ TQString( TQStringData* dd, bool /* dummy */ );
// needed for TQDeepCopy
void detach();
+
+ void setSecurityUnPaged(bool lock);
+ static char* unicodeToLatin1( const TQChar*, uint len, bool unpaged );
+
friend class TQDeepCopy<TQString>;
+ friend class TQLineEdit;
};
-class TQ_EXPORT TQCharRef {
+
+class TQ_EXPORT TQCharRef
+{
friend class TQString;
TQString& s;
uint p;
@@ -797,8 +519,14 @@ class TQ_EXPORT TQCharRef {
public:
// most TQChar operations repeated here
- // all this is not documented: We just say "like TQChar" and let it be.
+ // all this is not documented: We just say "like TQChar" and let it be.
#ifndef Q_QDOC
+#if defined(__cplusplus) && __cplusplus >= 201103L
+ // tells compiler that we know what we are doing and suppresses -Wdeprecated-copy warnings
+ TQCharRef(const TQCharRef&) = default;
+ ~TQCharRef() = default;
+#endif
+
ushort unicode() const { return s.constref(p).unicode(); }
char latin1() const { return s.constref(p).latin1(); }
@@ -824,6 +552,11 @@ public:
bool isNumber() const { return s.constref(p).isNumber(); }
bool isLetterOrNumber() { return s.constref(p).isLetterOrNumber(); }
bool isDigit() const { return s.constref(p).isDigit(); }
+ bool isSymbol() const { return s.constref(p).isSymbol(); }
+
+ // Surrogate pairs support
+ bool isHighSurrogate() const { return s.constref(p).isHighSurrogate(); }
+ bool isLowSurrogate() const { return s.constref(p).isLowSurrogate(); }
int digitValue() const { return s.constref(p).digitValue(); }
TQChar lower() const { return s.constref(p).lower(); }
@@ -868,25 +601,6 @@ TQ_EXPORT TQDataStream &operator>>( TQDataStream &, TQString &
TQString inline functions
*****************************************************************************/
-// These two move code into makeSharedNull() and deletesData()
-// to improve cache-coherence (and reduce code bloat), while
-// keeping the common cases fast.
-//
-// No safe way to pre-init shared_null on ALL compilers/linkers.
-inline TQString::TQString() :
- d(shared_null ? shared_null : makeSharedNull())
-{
- d->ref();
-}
-//
-inline TQString::~TQString()
-{
- if ( d->deref() ) {
- if ( d != shared_null )
- d->deleteSelf();
- }
-}
-
// needed for TQDeepCopy
inline void TQString::detach()
{ real_detach(); }
@@ -1146,7 +860,7 @@ extern TQ_EXPORT TQString qt_winMB2TQString( const char* mb, int len=-1 );
#endif
#define Q_DEFINED_QSTRING
-#include "tqwinexport.h"
+#include "tqwinexport.h"
#endif // TQSTRING_H
diff --git a/doc/man/man3/tqchar.3qt b/doc/man/man3/tqchar.3qt
index 86e001d7c..032b30141 100644
--- a/doc/man/man3/tqchar.3qt
+++ b/doc/man/man3/tqchar.3qt
@@ -11,7 +11,7 @@ TQChar \- Lightweight Unicode character
.SH SYNOPSIS
Almost all the functions in this class are reentrant when TQt is built with thread support. The exception is \fBdecomposition\fR().
.PP
-\fC#include \fR
+\fC#include \fR
.PP
.SS "Public Members"
.in +1c
diff --git a/include/tqchar.h b/include/tqchar.h
new file mode 120000
index 000000000..4d6adf7c0
--- /dev/null
+++ b/include/tqchar.h
@@ -0,0 +1 @@
+../src/tools/tqchar.h
\ No newline at end of file
diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix
index 0eb2661da..c1081994d 100644
--- a/qmake/Makefile.unix
+++ b/qmake/Makefile.unix
@@ -9,7 +9,7 @@ QOBJS=tqstring.o tqtextstream.o tqiodevice.o tqglobal.o tqgdict.o tqcstring.o \
tqdatastream.o tqgarray.o tqbuffer.o tqglist.o tqptrcollection.o tqfile.o \
tqfile_unix.o tqregexp.o tqgvector.o tqgcache.o tqbitarray.o tqdir.o tquuid.o \
tqfileinfo_unix.o tqdir_unix.o tqfileinfo.o tqdatetime.o tqstringlist.o tqmap.o \
- tqconfig.o tqunicodetables.o tqsettings.o tqlocale.o @QMAKE_QTOBJS@
+ tqconfig.o tqunicodetables.o tqsettings.o tqlocale.o tqchar.o @QMAKE_QTOBJS@
#all sources, used for the depend target
DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp qtmd5.cpp generators/makefile.cpp generators/unix/unixmake2.cpp \
@@ -30,7 +30,8 @@ DEPEND_SRC=project.cpp property.cpp meta.cpp main.cpp qtmd5.cpp generators/makef
@SOURCE_PATH@/src/tools/tqdatetime.cpp @SOURCE_PATH@/src/tools/tqstringlist.cpp \
@SOURCE_PATH@/src/tools/tqmap.cpp @SOURCE_PATH@/src/tools/tqconfig.cpp \
@SOURCE_PATH@/src/tools/tqsettings.cpp @SOURCE_PATH@/src/tools/tqurl.cpp \
- @SOURCE_PATH@/src/tools/tqsettings_mac.cpp @SOURCE_PATH@/src/tools/tqlocale.cpp
+ @SOURCE_PATH@/src/tools/tqsettings_mac.cpp @SOURCE_PATH@/src/tools/tqlocale.cpp \
+ @SOURCE_PATH@/src/tools/tqchar.cpp
CXXFLAGS= @QMAKE_CXXFLAGS@ \
-I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac \
@@ -84,6 +85,9 @@ tqsettings_mac.o: @SOURCE_PATH@/src/tools/tqsettings_mac.cpp
tqurl.o: @SOURCE_PATH@/src/kernel/tqurl.cpp
$(CXX) -c -o $@ $(CXXFLAGS) @SOURCE_PATH@/src/kernel/tqurl.cpp
+tqchar.o: @SOURCE_PATH@/src/tools/tqchar.cpp
+ $(CXX) -c -o $@ $(CXXFLAGS) @SOURCE_PATH@/src/tools/tqchar.cpp
+
tqstring.o: @SOURCE_PATH@/src/tools/tqstring.cpp
$(CXX) -c -o $@ $(CXXFLAGS) @SOURCE_PATH@/src/tools/tqstring.cpp
diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++
index 515cfc458..94d8452d2 100644
--- a/qmake/Makefile.win32-g++
+++ b/qmake/Makefile.win32-g++
@@ -23,7 +23,7 @@ QTOBJS=tqstring.o tquuid.o tqtextstream.o tqiodevice.o tqglobal.o tqgdict.o tqcs
tqgarray.o tqbuffer.o tqglist.o tqptrcollection.o tqfile.o tqfile_win.o tqregexp.o tqgvector.o \
tqgcache.o tqbitarray.o tqdir.o tqfileinfo_win.o tqdir_win.o tqfileinfo.o tqdatetime.o \
tqstringlist.o tqmap.o tqlibrary.o tqlibrary_win.o tqconfig.o tqsettings.o tqsettings_win.o tqunicodetables.o \
- tqlocale.o
+ tqlocale.o tqchar.o
@@ -67,6 +67,9 @@ tqgdict.o: ..\src\tools\tqgdict.cpp
tqcstring.o: ..\src\tools\tqcstring.cpp
$(CXX) $(CXXFLAGS) ..\src\tools\tqcstring.cpp
+tqchar.o: ..\src\tools\tqchar.cpp
+ $(CXX) $(CXXFLAGS) ..\src\tools\tqchar.cpp
+
tqstring.o: ..\src\tools\tqstring.cpp
$(CXX) $(CXXFLAGS) ..\src\tools\tqstring.cpp
diff --git a/src/tools/qt_tools.pri b/src/tools/qt_tools.pri
index 23ada8035..702e575f7 100644
--- a/src/tools/qt_tools.pri
+++ b/src/tools/qt_tools.pri
@@ -8,6 +8,7 @@ tools {
$$TOOLS_H/tqbitarray.h \
$$TOOLS_H/tqbuffer.h \
$$TOOLS_H/tqcache.h \
+ $$TOOLS_H/tqchar.h \
$$TOOLS_H/tqcleanuphandler.h \
$$TOOLS_P/tqcomponentfactory_p.h \
$$TOOLS_P/tqcomlibrary_p.h \
@@ -59,7 +60,7 @@ tools {
$$TOOLS_H/tqthreadstorage.h\
$$TOOLS_P/tqunicodetables_p.h \
$$TOOLS_H/tqptrvector.h \
- $$TOOLS_H/tqvaluelist.h \
+ $$TOOLS_H/tqvaluelist.h \
$$TOOLS_H/tqvaluestack.h \
$$TOOLS_H/tqvaluevector.h \
$$TOOLS_H/tqwaitcondition.h \
@@ -105,6 +106,7 @@ tools {
SOURCES += $$TOOLS_CPP/tqbitarray.cpp \
$$TOOLS_CPP/tqbuffer.cpp \
+ $$TOOLS_CPP/tqchar.cpp \
$$TOOLS_CPP/tqcomponentfactory.cpp \
$$TOOLS_CPP/tqcomlibrary.cpp \
$$TOOLS_CPP/tqcstring.cpp \
diff --git a/src/tools/tqchar.cpp b/src/tools/tqchar.cpp
new file mode 100644
index 000000000..ab83b7cc4
--- /dev/null
+++ b/src/tools/tqchar.cpp
@@ -0,0 +1,792 @@
+/****************************************************************************
+**
+** Implementation of the TQChar class and related Unicode functions
+**
+** Created : 920722
+**
+** Copyright (C) 2015 Timothy Pearson. All rights reserved.
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of the tools module of the TQt GUI Toolkit.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free TQt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** This file may be used under the terms of the Q Public License as
+** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
+** included in the packaging of this file. Licensees holding valid TQt
+** Commercial licenses may use this file in accordance with the TQt
+** Commercial License Agreement provided with the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#include "tqchar.h"
+#include "tqunicodetables_p.h"
+
+/*!
+ \class TQChar tqchar.h
+ \reentrant
+ \brief The TQChar class provides a lightweight Unicode character.
+
+ \ingroup text
+
+ Unicode characters are (so far) 16-bit entities without any markup
+ or structure. This class represents such an entity. It is
+ lightweight, so it can be used everywhere. Most compilers treat it
+ like a "short int". (In a few years it may be necessary to make
+ TQChar 32-bit when more than 65536 Unicode code points have been
+ defined and come into use.)
+
+ TQChar provides a full complement of testing/classification
+ functions, converting to and from other formats, converting from
+ composed to decomposed Unicode, and trying to compare and
+ case-convert if you ask it to.
+
+ The classification functions include functions like those in
+ ctype.h, but operating on the full range of Unicode characters.
+ They all return TRUE if the character is a certain type of
+ character; otherwise they return FALSE. These classification
+ functions are isNull() (returns TRUE if the character is U+0000),
+ isPrint() (TRUE if the character is any sort of printable
+ character, including whitespace), isPunct() (any sort of
+ punctation), isMark() (Unicode Mark), isLetter (a letter),
+ isNumber() (any sort of numeric character), isLetterOrNumber(),
+ and isDigit() (decimal digits). All of these are wrappers around
+ category() which return the Unicode-defined category of each
+ character.
+
+ TQChar further provides direction(), which indicates the "natural"
+ writing direction of this character. The joining() function
+ indicates how the character joins with its neighbors (needed
+ mostly for Arabic) and finally mirrored(), which indicates whether
+ the character needs to be mirrored when it is printed in its
+ "unnatural" writing direction.
+
+ Composed Unicode characters (like å) can be converted to
+ decomposed Unicode ("a" followed by "ring above") by using
+ decomposition().
+
+ In Unicode, comparison is not necessarily possible and case
+ conversion is very difficult at best. Unicode, covering the
+ "entire" world, also includes most of the world's case and sorting
+ problems. TQt tries, but not very hard: operator==() and friends
+ will do comparison based purely on the numeric Unicode value (code
+ point) of the characters, and upper() and lower() will do case
+ changes when the character has a well-defined upper/lower-case
+ equivalent. There is no provision for locale-dependent case
+ folding rules or comparison; these functions are meant to be fast
+ so they can be used unambiguously in data structures. (See
+ TQString::localeAwareCompare() though.)
+
+ The conversion functions include unicode() (to a scalar), latin1()
+ (to scalar, but converts all non-Latin-1 characters to 0), row()
+ (gives the Unicode row), cell() (gives the Unicode cell),
+ digitValue() (gives the integer value of any of the numerous digit
+ characters), and a host of constructors.
+
+ More information can be found in the document \link unicode.html
+ About Unicode. \endlink
+
+ \sa TQString TQCharRef
+*/
+
+/*!
+ \enum TQChar::Category
+
+ This enum maps the Unicode character categories.
+
+ The following characters are normative in Unicode:
+
+ \value Mark_NonSpacing Unicode class name Mn
+
+ \value Mark_SpacingCombining Unicode class name Mc
+
+ \value Mark_Enclosing Unicode class name Me
+
+ \value Number_DecimalDigit Unicode class name Nd
+
+ \value Number_Letter Unicode class name Nl
+
+ \value Number_Other Unicode class name No
+
+ \value Separator_Space Unicode class name Zs
+
+ \value Separator_Line Unicode class name Zl
+
+ \value Separator_Paragraph Unicode class name Zp
+
+ \value Other_Control Unicode class name Cc
+
+ \value Other_Format Unicode class name Cf
+
+ \value Other_Surrogate Unicode class name Cs
+
+ \value Other_PrivateUse Unicode class name Co
+
+ \value Other_NotAssigned Unicode class name Cn
+
+
+ The following categories are informative in Unicode:
+
+ \value Letter_Uppercase Unicode class name Lu
+
+ \value Letter_Lowercase Unicode class name Ll
+
+ \value Letter_Titlecase Unicode class name Lt
+
+ \value Letter_Modifier Unicode class name Lm
+
+ \value Letter_Other Unicode class name Lo
+
+ \value Punctuation_Connector Unicode class name Pc
+
+ \value Punctuation_Dash Unicode class name Pd
+
+ \value Punctuation_Open Unicode class name Ps
+
+ \value Punctuation_Close Unicode class name Pe
+
+ \value Punctuation_InitialQuote Unicode class name Pi
+
+ \value Punctuation_FinalQuote Unicode class name Pf
+
+ \value Punctuation_Other Unicode class name Po
+
+ \value Symbol_Math Unicode class name Sm
+
+ \value Symbol_Currency Unicode class name Sc
+
+ \value Symbol_Modifier Unicode class name Sk
+
+ \value Symbol_Other Unicode class name So
+
+
+ There are two categories that are specific to TQt:
+
+ \value NoCategory used when TQt is dazed and confused and cannot
+ make sense of anything.
+
+ \value Punctuation_Dask old typo alias for Punctuation_Dash
+
+*/
+
+/*!
+ \enum TQChar::Direction
+
+ This enum type defines the Unicode direction attributes. See \link
+ http://www.unicode.org/ the Unicode Standard\endlink for a
+ description of the values.
+
+ In order to conform to C/C++ naming conventions "Dir" is prepended
+ to the codes used in the Unicode Standard.
+*/
+
+/*!
+ \enum TQChar::Decomposition
+
+ This enum type defines the Unicode decomposition attributes. See
+ \link http://www.unicode.org/ the Unicode Standard\endlink for a
+ description of the values.
+*/
+
+/*!
+ \enum TQChar::Joining
+
+ This enum type defines the Unicode joining attributes. See \link
+ http://www.unicode.org/ the Unicode Standard\endlink for a
+ description of the values.
+*/
+
+/*!
+ \enum TQChar::CombiningClass
+
+ This enum type defines names for some of the Unicode combining
+ classes. See \link http://www.unicode.org/ the Unicode
+ Standard\endlink for a description of the values.
+*/
+
+/*!
+ \fn void TQChar::setCell( uchar cell )
+ \internal
+*/
+
+/*!
+ \fn void TQChar::setRow( uchar row )
+ \internal
+*/
+
+/*!
+ \fn TQChar::TQChar()
+
+ Constructs a null TQChar (one that isNull()).
+*/
+
+/*!
+ \fn TQChar::TQChar( char c )
+
+ Constructs a TQChar corresponding to ASCII/Latin-1 character \a c.
+*/
+
+/*!
+ \fn TQChar::TQChar( uchar c )
+
+ Constructs a TQChar corresponding to ASCII/Latin-1 character \a c.
+*/
+
+/*!
+ \fn TQChar::TQChar( uchar c, uchar r )
+
+ Constructs a TQChar for Unicode cell \a c in row \a r.
+*/
+
+/*!
+ \fn TQChar::TQChar( const TQChar& c )
+
+ Constructs a copy of \a c. This is a deep copy, if such a
+ lightweight object can be said to have deep copies.
+*/
+
+/*!
+ \fn TQChar::TQChar( ushort rc )
+
+ Constructs a TQChar for the character with Unicode code point \a rc.
+*/
+
+/*!
+ \fn TQChar::TQChar( short rc )
+
+ Constructs a TQChar for the character with Unicode code point \a rc.
+*/
+
+/*!
+ \fn TQChar::TQChar( uint rc )
+
+ Constructs a TQChar for the character with Unicode code point \a rc.
+*/
+
+/*!
+ \fn TQChar::TQChar( int rc )
+
+ Constructs a TQChar for the character with Unicode code point \a rc.
+*/
+
+/*!
+ \fn bool TQChar::networkOrdered ()
+
+ \obsolete
+
+ Returns TRUE if this character is in network byte order (MSB
+ first); otherwise returns FALSE. This is platform dependent.
+*/
+
+/*!
+ \fn bool TQChar::isNull() const
+
+ Returns TRUE if the character is the Unicode character 0x0000
+ (ASCII NUL); otherwise returns FALSE.
+*/
+
+/*!
+ \fn uchar TQChar::cell () const
+
+ Returns the cell (least significant byte) of the Unicode
+ character.
+*/
+
+/*!
+ \fn uchar TQChar::row () const
+
+ Returns the row (most significant byte) of the Unicode character.
+*/
+
+/*!
+ \fn TQChar::operator char() const
+
+ Returns the Latin-1 character equivalent to the TQChar, or 0. This
+ is mainly useful for non-internationalized software.
+
+ \sa unicode()
+*/
+
+/*!
+ \fn ushort TQChar::unicode() const
+
+ Returns the numeric Unicode value equal to the TQChar. Normally,
+ you should use TQChar objects as they are equivalent, but for some
+ low-level tasks (e.g. indexing into an array of Unicode
+ information), this function is useful.
+*/
+
+/*!
+ \fn ushort & TQChar::unicode()
+
+ \overload
+
+ Returns a reference to the numeric Unicode value equal to the
+ TQChar.
+*/
+
+/*****************************************************************************
+ Documentation of TQChar related functions
+ *****************************************************************************/
+
+/*!
+ \fn bool operator==( TQChar c1, TQChar c2 )
+
+ \relates TQChar
+
+ Returns TRUE if \a c1 and \a c2 are the same Unicode character;
+ otherwise returns FALSE.
+*/
+
+/*!
+ \fn bool operator==( char ch, TQChar c )
+
+ \overload
+ \relates TQChar
+
+ Returns TRUE if \a c is the ASCII/Latin-1 character \a ch;
+ otherwise returns FALSE.
+*/
+
+/*!
+ \fn bool operator==( TQChar c, char ch )
+
+ \overload
+ \relates TQChar
+
+ Returns TRUE if \a c is the ASCII/Latin-1 character \a ch;
+ otherwise returns FALSE.
+*/
+
+/*!
+ \fn int operator!=( TQChar c1, TQChar c2 )
+
+ \relates TQChar
+
+ Returns TRUE if \a c1 and \a c2 are not the same Unicode
+ character; otherwise returns FALSE.
+*/
+
+/*!
+ \fn int operator!=( char ch, TQChar c )
+
+ \overload
+ \relates TQChar
+
+ Returns TRUE if \a c is not the ASCII/Latin-1 character \a ch;
+ otherwise returns FALSE.
+*/
+
+/*!
+ \fn int operator!=( TQChar c, char ch )
+
+ \overload
+ \relates TQChar
+
+ Returns TRUE if \a c is not the ASCII/Latin-1 character \a ch;
+ otherwise returns FALSE.
+*/
+
+/*!
+ \fn int operator<=( TQChar c1, TQChar c2 )
+
+ \relates TQChar
+
+ Returns TRUE if the numeric Unicode value of \a c1 is less than
+ that of \a c2, or they are the same Unicode character; otherwise
+ returns FALSE.
+*/
+
+/*!
+ \fn int operator<=( TQChar c, char ch )
+
+ \overload
+ \relates TQChar
+
+ Returns TRUE if the numeric Unicode value of \a c is less than or
+ equal to that of the ASCII/Latin-1 character \a ch; otherwise
+ returns FALSE.
+*/
+
+/*!
+ \fn int operator<=( char ch, TQChar c )
+
+ \overload
+ \relates TQChar
+
+ Returns TRUE if the numeric Unicode value of the ASCII/Latin-1
+ character \a ch is less than or equal to that of \a c; otherwise
+ returns FALSE.
+*/
+
+/*!
+ \fn int operator>=( TQChar c1, TQChar c2 )
+
+ \relates TQChar
+
+ Returns TRUE if the numeric Unicode value of \a c1 is greater than
+ that of \a c2, or they are the same Unicode character; otherwise
+ returns FALSE.
+*/
+
+/*!
+ \fn int operator>=( TQChar c, char ch )
+
+ \overload
+ \relates TQChar
+
+ Returns TRUE if the numeric Unicode value of \a c is greater than
+ or equal to that of the ASCII/Latin-1 character \a ch; otherwise
+ returns FALSE.
+*/
+
+/*!
+ \fn int operator>=( char ch, TQChar c )
+
+ \overload
+ \relates TQChar
+
+ Returns TRUE if the numeric Unicode value of the ASCII/Latin-1
+ character \a ch is greater than or equal to that of \a c;
+ otherwise returns FALSE.
+*/
+
+/*!
+ \fn int operator<( TQChar c1, TQChar c2 )
+
+ \relates TQChar
+
+ Returns TRUE if the numeric Unicode value of \a c1 is less than
+ that of \a c2; otherwise returns FALSE.
+*/
+
+/*!
+ \fn int operator<( TQChar c, char ch )
+
+ \overload
+ \relates TQChar
+
+ Returns TRUE if the numeric Unicode value of \a c is less than that
+ of the ASCII/Latin-1 character \a ch; otherwise returns FALSE.
+*/
+
+/*!
+ \fn int operator<( char ch, TQChar c )
+
+ \overload
+ \relates TQChar
+
+ Returns TRUE if the numeric Unicode value of the ASCII/Latin-1
+ character \a ch is less than that of \a c; otherwise returns
+ FALSE.
+*/
+
+/*!
+ \fn int operator>( TQChar c1, TQChar c2 )
+
+ \relates TQChar
+
+ Returns TRUE if the numeric Unicode value of \a c1 is greater than
+ that of \a c2; otherwise returns FALSE.
+*/
+
+/*!
+ \fn int operator>( TQChar c, char ch )
+
+ \overload
+ \relates TQChar
+
+ Returns TRUE if the numeric Unicode value of \a c is greater than
+ that of the ASCII/Latin-1 character \a ch; otherwise returns FALSE.
+*/
+
+/*!
+ \fn int operator>( char ch, TQChar c )
+
+ \overload
+ \relates TQChar
+
+ Returns TRUE if the numeric Unicode value of the ASCII/Latin-1
+ character \a ch is greater than that of \a c; otherwise returns
+ FALSE.
+*/
+
+
+const TQChar TQChar::null;
+const TQChar TQChar::replacement((ushort)0xfffd);
+const TQChar TQChar::byteOrderMark((ushort)0xfeff);
+const TQChar TQChar::byteOrderSwapped((ushort)0xfffe);
+const TQChar TQChar::nbsp((ushort)0x00a0);
+
+
+/*!
+ Returns TRUE if the character is a printable character; otherwise
+ returns FALSE. This is any character not of category Cc or Cn.
+
+ Note that this gives no indication of whether the character is
+ available in a particular \link TQFont font\endlink.
+*/
+bool TQChar::isPrint() const
+{
+ Category c = ::category( *this );
+ return !(c == Other_Control || c == Other_NotAssigned);
+}
+
+/*!
+ Returns TRUE if the character is a separator character
+ (Separator_* categories); otherwise returns FALSE.
+*/
+bool TQChar::isSpace() const
+{
+ return ::isSpace( *this );
+}
+
+/*!
+ Returns TRUE if the character is a mark (Mark_* categories);
+ otherwise returns FALSE.
+*/
+bool TQChar::isMark() const
+{
+ Category c = ::category( *this );
+ return c >= Mark_NonSpacing && c <= Mark_Enclosing;
+}
+
+/*!
+ Returns TRUE if the character is a punctuation mark (Punctuation_*
+ categories); otherwise returns FALSE.
+*/
+bool TQChar::isPunct() const
+{
+ Category c = ::category( *this );
+ return (c >= Punctuation_Connector && c <= Punctuation_Other);
+}
+
+/*!
+ Returns TRUE if the character is a letter (Letter_* categories);
+ otherwise returns FALSE.
+*/
+bool TQChar::isLetter() const
+{
+ Category c = ::category( *this );
+ return (c >= Letter_Uppercase && c <= Letter_Other);
+}
+
+/*!
+ Returns TRUE if the character is a number (of any sort - Number_*
+ categories); otherwise returns FALSE.
+
+ \sa isDigit()
+*/
+bool TQChar::isNumber() const
+{
+ Category c = ::category( *this );
+ return c >= Number_DecimalDigit && c <= Number_Other;
+}
+
+/*!
+ Returns TRUE if the character is a letter or number (Letter_* or
+ Number_* categories); otherwise returns FALSE.
+*/
+bool TQChar::isLetterOrNumber() const
+{
+ Category c = ::category( *this );
+ return (c >= Letter_Uppercase && c <= Letter_Other)
+ || (c >= Number_DecimalDigit && c <= Number_Other);
+}
+
+
+/*!
+ Returns TRUE if the character is a decimal digit
+ (Number_DecimalDigit); otherwise returns FALSE.
+*/
+bool TQChar::isDigit() const
+{
+ return (::category( *this ) == Number_DecimalDigit);
+}
+
+
+/*!
+ Returns TRUE if the character is a symbol (Symbol_* categories);
+ otherwise returns FALSE.
+*/
+bool TQChar::isSymbol() const
+{
+ Category c = ::category( *this );
+ return c >= Symbol_Math && c <= Symbol_Other;
+}
+
+/*!
+ Returns the numeric value of the digit, or -1 if the character is
+ not a digit.
+*/
+int TQChar::digitValue() const
+{
+#ifndef TQT_NO_UNICODETABLES
+ int pos = TQUnicodeTables::decimal_info[row()];
+ if( !pos )
+ return -1;
+ return TQUnicodeTables::decimal_info[(pos<<8) + cell()];
+#else
+ // ##### just latin1
+ if ( ucs < '0' || ucs > '9' )
+ return -1;
+ else
+ return ucs - '0';
+#endif
+}
+
+/*!
+ Returns the character category.
+
+ \sa Category
+*/
+TQChar::Category TQChar::category() const
+{
+ return ::category( *this );
+}
+
+/*!
+ Returns the character's direction.
+
+ \sa Direction
+*/
+TQChar::Direction TQChar::direction() const
+{
+ return ::direction( *this );
+}
+
+/*!
+ \warning This function is not supported (it may change to use
+ Unicode character classes).
+
+ Returns information about the joining properties of the character
+ (needed for example, for Arabic).
+*/
+TQChar::Joining TQChar::joining() const
+{
+ return ::joining( *this );
+}
+
+
+/*!
+ Returns TRUE if the character is a mirrored character (one that
+ should be reversed if the text direction is reversed); otherwise
+ returns FALSE.
+*/
+bool TQChar::mirrored() const
+{
+ return ::mirrored( *this );
+}
+
+/*!
+ Returns the mirrored character if this character is a mirrored
+ character, otherwise returns the character itself.
+*/
+TQChar TQChar::mirroredChar() const
+{
+ return ::mirroredChar( *this );
+}
+
+#ifndef TQT_NO_UNICODETABLES
+// ### REMOVE ME 4.0
+static TQString shared_decomp;
+#endif
+/*!
+ \nonreentrant
+
+ Decomposes a character into its parts. Returns TQString::null if no
+ decomposition exists.
+*/
+const TQString &TQChar::decomposition() const
+{
+#ifndef TQT_NO_UNICODETABLES
+ int pos = TQUnicodeTables::decomposition_info[row()];
+ if(!pos) return TQString::null;
+
+ pos = TQUnicodeTables::decomposition_info[(pos<<8)+cell()];
+ if(!pos) return TQString::null;
+ pos+=2;
+
+ TQString s;
+ TQ_UINT16 c;
+ while ( (c = TQUnicodeTables::decomposition_map[pos++]) != 0 )
+ s += TQChar( c );
+ // ### In 4.0, return s, and not shared_decomp. shared_decomp
+ // prevents this function from being reentrant.
+ shared_decomp = s;
+ return shared_decomp;
+#else
+ return TQString::null;
+#endif
+}
+
+/*!
+ Returns the tag defining the composition of the character. Returns
+ TQChar::Single if no decomposition exists.
+*/
+TQChar::Decomposition TQChar::decompositionTag() const
+{
+#ifndef TQT_NO_UNICODETABLES
+ int pos = TQUnicodeTables::decomposition_info[row()];
+ if(!pos) return TQChar::Single;
+
+ pos = TQUnicodeTables::decomposition_info[(pos<<8)+cell()];
+ if(!pos) return TQChar::Single;
+
+ return (TQChar::Decomposition) TQUnicodeTables::decomposition_map[pos];
+#else
+ return Single; // ########### FIX eg. just latin1
+#endif
+}
+
+/*!
+ Returns the combining class for the character as defined in the
+ Unicode standard. This is mainly useful as a positioning hint for
+ marks attached to a base character.
+
+ The TQt text rendering engine uses this information to correctly
+ position non spacing marks around a base character.
+*/
+unsigned char TQChar::combiningClass() const
+{
+ return ::combiningClass( *this );
+}
+
+
+/*!
+ Returns the lowercase equivalent if the character is uppercase;
+ otherwise returns the character itself.
+*/
+TQChar TQChar::lower() const
+{
+ return ::lower( *this );
+}
+
+/*!
+ Returns the uppercase equivalent if the character is lowercase;
+ otherwise returns the character itself.
+*/
+TQChar TQChar::upper() const
+{
+ return ::upper( *this );
+}
diff --git a/src/tools/tqchar.h b/src/tools/tqchar.h
new file mode 100644
index 000000000..fdf111079
--- /dev/null
+++ b/src/tools/tqchar.h
@@ -0,0 +1,381 @@
+/****************************************************************************
+**
+** Definition of the TQChar class, and related Unicode functions.
+**
+** Created : 920609
+**
+** Copyright (C) 2015 Timothy Pearson. All rights reserved.
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of the tools module of the TQt GUI Toolkit.
+**
+** This file may be used under the terms of the GNU General
+** Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the files LICENSE.GPL2
+** and LICENSE.GPL3 included in the packaging of this file.
+** Alternatively you may (at your option) use any later version
+** of the GNU General Public License if such license has been
+** publicly approved by Trolltech ASA (or its successors, if any)
+** and the KDE Free TQt Foundation.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/.
+** If you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** This file may be used under the terms of the Q Public License as
+** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
+** included in the packaging of this file. Licensees holding valid TQt
+** Commercial licenses may use this file in accordance with the TQt
+** Commercial License Agreement provided with the Software.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
+** herein.
+**
+**********************************************************************/
+
+#ifndef TQCHAR_H
+#define TQCHAR_H
+
+#ifndef QT_H
+#include "tqglobal.h"
+#endif // QT_H
+
+class TQString;
+
+class TQ_EXPORT TQChar
+{
+public:
+ TQChar();
+ TQChar( char c );
+ TQChar( uchar c );
+ TQChar( uchar c, uchar r );
+ TQChar( const TQChar& c ); // ### remove in 4.0 to allow compiler optimization
+ TQChar( ushort rc );
+ TQChar( short rc );
+ TQChar( uint rc );
+ TQChar( int rc );
+
+ static const TQChar null; // 0000
+ static const TQChar replacement; // FFFD
+ static const TQChar byteOrderMark; // FEFF
+ static const TQChar byteOrderSwapped; // FFFE
+ static const TQChar nbsp; // 00A0
+
+ // Unicode information
+
+ enum Category
+ {
+ NoCategory,
+
+ Mark_NonSpacing, // Mn
+ Mark_SpacingCombining, // Mc
+ Mark_Enclosing, // Me
+
+ Number_DecimalDigit, // Nd
+ Number_Letter, // Nl
+ Number_Other, // No
+
+ Separator_Space, // Zs
+ Separator_Line, // Zl
+ Separator_Paragraph, // Zp
+
+ Other_Control, // Cc
+ Other_Format, // Cf
+ Other_Surrogate, // Cs
+ Other_PrivateUse, // Co
+ Other_NotAssigned, // Cn
+
+ Letter_Uppercase, // Lu
+ Letter_Lowercase, // Ll
+ Letter_Titlecase, // Lt
+ Letter_Modifier, // Lm
+ Letter_Other, // Lo
+
+ Punctuation_Connector, // Pc
+ Punctuation_Dash, // Pd
+ Punctuation_Dask = Punctuation_Dash, // oops
+ Punctuation_Open, // Ps
+ Punctuation_Close, // Pe
+ Punctuation_InitialQuote, // Pi
+ Punctuation_FinalQuote, // Pf
+ Punctuation_Other, // Po
+
+ Symbol_Math, // Sm
+ Symbol_Currency, // Sc
+ Symbol_Modifier, // Sk
+ Symbol_Other // So
+ };
+
+ enum Direction
+ {
+ DirL, DirR, DirEN, DirES, DirET, DirAN, DirCS, DirB, DirS, DirWS, DirON,
+ DirLRE, DirLRO, DirAL, DirRLE, DirRLO, DirPDF, DirNSM, DirBN
+ };
+
+ enum Decomposition
+ {
+ Single, Canonical, Font, NoBreak, Initial, Medial,
+ Final, Isolated, Circle, Super, Sub, Vertical,
+ Wide, Narrow, Small, Square, Compat, Fraction
+ };
+
+ enum Joining
+ {
+ OtherJoining, Dual, Right, Center
+ };
+
+ enum CombiningClass
+ {
+ Combining_BelowLeftAttached = 200,
+ Combining_BelowAttached = 202,
+ Combining_BelowRightAttached = 204,
+ Combining_LeftAttached = 208,
+ Combining_RightAttached = 210,
+ Combining_AboveLeftAttached = 212,
+ Combining_AboveAttached = 214,
+ Combining_AboveRightAttached = 216,
+
+ Combining_BelowLeft = 218,
+ Combining_Below = 220,
+ Combining_BelowRight = 222,
+ Combining_Left = 224,
+ Combining_Right = 226,
+ Combining_AboveLeft = 228,
+ Combining_Above = 230,
+ Combining_AboveRight = 232,
+
+ Combining_DoubleBelow = 233,
+ Combining_DoubleAbove = 234,
+ Combining_IotaSubscript = 240
+ };
+
+ // ****** WHEN ADDING FUNCTIONS, CONSIDER ADDING TO TQCharRef TOO
+
+ int digitValue() const;
+ TQChar lower() const;
+ TQChar upper() const;
+
+ Category category() const;
+ Direction direction() const;
+ Joining joining() const;
+ bool mirrored() const;
+ TQChar mirroredChar() const;
+ const TQString &decomposition() const; // ### return just TQString in 4.0
+ Decomposition decompositionTag() const;
+ unsigned char combiningClass() const;
+
+ char latin1() const { return ucs > 0xff ? 0 : (char) ucs; }
+ ushort unicode() const { return ucs; }
+#ifdef Q_NO_PACKED_REFERENCE
+ ushort &unicode() { return *((ushort*)&ucs); }
+#else
+ ushort &unicode() { return ucs; }
+#endif
+#ifndef TQT_NO_CAST_ASCII
+ // like all ifdef'd code this is undocumented
+ operator char() const { return latin1(); }
+#endif
+
+ bool isNull() const { return unicode()==0; }
+ bool isPrint() const;
+ bool isPunct() const;
+ bool isSpace() const;
+ bool isMark() const;
+ bool isLetter() const;
+ bool isNumber() const;
+ bool isLetterOrNumber() const;
+ bool isDigit() const;
+ bool isSymbol() const;
+
+ // Surrogate pairs support
+ bool isHighSurrogate() const;
+ bool isLowSurrogate() const;
+ static bool requiresSurrogates(uint ucs4);
+ static ushort highSurrogate(uint ucs4);
+ static ushort lowSurrogate(uint ucs4);
+ static uint surrogateToUcs4(const TQChar &high, const TQChar &low);
+
+ uchar cell() const { return ((uchar) ucs & 0xff); }
+ uchar row() const { return ((uchar) (ucs>>8)&0xff); }
+ void setCell( uchar cell ) { ucs = (ucs & 0xff00) + cell; }
+ void setRow( uchar row ) { ucs = (((ushort) row)<<8) + (ucs&0xff); }
+
+ static bool networkOrdered() {
+ int wordSize;
+ bool bigEndian = FALSE;
+ tqSysInfo( &wordSize, &bigEndian );
+ return bigEndian;
+ }
+
+ friend inline bool operator==( char ch, TQChar c );
+ friend inline bool operator==( TQChar c, char ch );
+ friend inline bool operator==( TQChar c1, TQChar c2 );
+ friend inline bool operator!=( TQChar c1, TQChar c2 );
+ friend inline bool operator!=( char ch, TQChar c );
+ friend inline bool operator!=( TQChar c, char ch );
+ friend inline bool operator<=( TQChar c, char ch );
+ friend inline bool operator<=( char ch, TQChar c );
+ friend inline bool operator<=( TQChar c1, TQChar c2 );
+
+#if defined(__cplusplus) && __cplusplus >= 201103L
+ // Explicit declarations to suppress warnings
+ // This could be removed when TQChar( const TQChar& c ) is removed
+ TQChar& operator=(const TQChar& other) = default;
+ ~TQChar() = default;
+#endif
+private:
+ ushort ucs;
+#if defined(QT_QSTRING_UCS_4)
+ ushort grp;
+#endif
+} TQ_PACKED;
+
+
+inline TQChar::TQChar() : ucs( 0 )
+#ifdef QT_QSTRING_UCS_4
+ , grp( 0 )
+#endif
+{
+}
+inline TQChar::TQChar( char c ) : ucs( (uchar)c )
+#ifdef QT_QSTRING_UCS_4
+ , grp( 0 )
+#endif
+{
+}
+inline TQChar::TQChar( uchar c ) : ucs( c )
+#ifdef QT_QSTRING_UCS_4
+ , grp( 0 )
+#endif
+{
+}
+inline TQChar::TQChar( uchar c, uchar r ) : ucs( (r << 8) | c )
+#ifdef QT_QSTRING_UCS_4
+ , grp( 0 )
+#endif
+{
+}
+inline TQChar::TQChar( const TQChar& c ) : ucs( c.ucs )
+#ifdef QT_QSTRING_UCS_4
+ , grp( c.grp )
+#endif
+{
+}
+
+inline TQChar::TQChar( ushort rc ) : ucs( rc )
+#ifdef QT_QSTRING_UCS_4
+ , grp( 0 )
+#endif
+{
+}
+inline TQChar::TQChar( short rc ) : ucs( (ushort) rc )
+#ifdef QT_QSTRING_UCS_4
+ , grp( 0 )
+#endif
+{
+}
+inline TQChar::TQChar( uint rc ) : ucs( (ushort ) (rc & 0xffff) )
+#ifdef QT_QSTRING_UCS_4
+ , grp( (ushort) ((rc >> 16) & 0xffff) )
+#endif
+{
+}
+inline TQChar::TQChar( int rc ) : ucs( (ushort) (rc & 0xffff) )
+#ifdef QT_QSTRING_UCS_4
+ , grp( (ushort) ((rc >> 16) & 0xffff) )
+#endif
+{
+}
+
+inline bool TQChar::isHighSurrogate() const
+{
+ return ((ucs & 0xfc00) == 0xd800);
+}
+
+inline bool TQChar::isLowSurrogate() const
+{
+ return ((ucs & 0xfc00) == 0xdc00);
+}
+
+inline bool TQChar::requiresSurrogates(uint ucs4)
+{
+ return (ucs4 >= 0x10000);
+}
+
+inline ushort TQChar::highSurrogate(uint ucs4)
+{
+ return ushort(((ucs4 - 0x10000) >> 10)) | 0xd800;
+}
+
+inline ushort TQChar::lowSurrogate(uint ucs4)
+{
+ return ushort(ucs4 & 0x03FF) | 0xdc00;
+}
+
+inline uint TQChar::surrogateToUcs4(const TQChar &high, const TQChar &low)
+{
+ return (uint(high.ucs & 0x03FF) << 10) | (low.ucs & 0x03FF) | 0x10000;
+}
+
+inline bool operator==( char ch, TQChar c )
+{
+ return ((uchar) ch) == c.ucs;
+}
+
+inline bool operator==( TQChar c, char ch )
+{
+ return ((uchar) ch) == c.ucs;
+}
+
+inline bool operator==( TQChar c1, TQChar c2 )
+{
+ return c1.ucs == c2.ucs;
+}
+
+inline bool operator!=( TQChar c1, TQChar c2 )
+{
+ return c1.ucs != c2.ucs;
+}
+
+inline bool operator!=( char ch, TQChar c )
+{
+ return ((uchar)ch) != c.ucs;
+}
+
+inline bool operator!=( TQChar c, char ch )
+{
+ return ((uchar) ch) != c.ucs;
+}
+
+inline bool operator<=( TQChar c, char ch )
+{
+ return c.ucs <= ((uchar) ch);
+}
+
+inline bool operator<=( char ch, TQChar c )
+{
+ return ((uchar) ch) <= c.ucs;
+}
+
+inline bool operator<=( TQChar c1, TQChar c2 )
+{
+ return c1.ucs <= c2.ucs;
+}
+
+inline bool operator>=( TQChar c, char ch ) { return ch <= c; }
+inline bool operator>=( char ch, TQChar c ) { return c <= ch; }
+inline bool operator>=( TQChar c1, TQChar c2 ) { return c2 <= c1; }
+inline bool operator<( TQChar c, char ch ) { return !(ch<=c); }
+inline bool operator<( char ch, TQChar c ) { return !(c<=ch); }
+inline bool operator<( TQChar c1, TQChar c2 ) { return !(c2<=c1); }
+inline bool operator>( TQChar c, char ch ) { return !(ch>=c); }
+inline bool operator>( char ch, TQChar c ) { return !(c>=ch); }
+inline bool operator>( TQChar c1, TQChar c2 ) { return !(c2>=c1); }
+
+#endif // TQCHAR_H
diff --git a/src/tools/tqstring.cpp b/src/tools/tqstring.cpp
index 8db00f1cc..ae95bcaf0 100644
--- a/src/tools/tqstring.cpp
+++ b/src/tools/tqstring.cpp
@@ -167,777 +167,6 @@ static char qToLower(char c)
return c;
}
-/*!
- \class TQCharRef tqstring.h
- \reentrant
- \brief The TQCharRef class is a helper class for TQString.
-
- \ingroup text
-
- When you get an object of type TQCharRef, if you can assign to it,
- the assignment will apply to the character in the string from
- which you got the reference. That is its whole purpose in life.
- The TQCharRef becomes invalid once modifications are made to the
- string: if you want to keep the character, copy it into a TQChar.
-
- Most of the TQChar member functions also exist in TQCharRef.
- However, they are not explicitly documented here.
-
- \sa TQString::operator[]() TQString::at() TQChar
-*/
-
-/*!
- \class TQChar tqstring.h
- \reentrant
- \brief The TQChar class provides a lightweight Unicode character.
-
- \ingroup text
-
- Unicode characters are (so far) 16-bit entities without any markup
- or structure. This class represents such an entity. It is
- lightweight, so it can be used everywhere. Most compilers treat it
- like a "short int". (In a few years it may be necessary to make
- TQChar 32-bit when more than 65536 Unicode code points have been
- defined and come into use.)
-
- TQChar provides a full complement of testing/classification
- functions, converting to and from other formats, converting from
- composed to decomposed Unicode, and trying to compare and
- case-convert if you ask it to.
-
- The classification functions include functions like those in
- ctype.h, but operating on the full range of Unicode characters.
- They all return TRUE if the character is a certain type of
- character; otherwise they return FALSE. These classification
- functions are isNull() (returns TRUE if the character is U+0000),
- isPrint() (TRUE if the character is any sort of printable
- character, including whitespace), isPunct() (any sort of
- punctation), isMark() (Unicode Mark), isLetter (a letter),
- isNumber() (any sort of numeric character), isLetterOrNumber(),
- and isDigit() (decimal digits). All of these are wrappers around
- category() which return the Unicode-defined category of each
- character.
-
- TQChar further provides direction(), which indicates the "natural"
- writing direction of this character. The joining() function
- indicates how the character joins with its neighbors (needed
- mostly for Arabic) and finally mirrored(), which indicates whether
- the character needs to be mirrored when it is printed in its
- "unnatural" writing direction.
-
- Composed Unicode characters (like å) can be converted to
- decomposed Unicode ("a" followed by "ring above") by using
- decomposition().
-
- In Unicode, comparison is not necessarily possible and case
- conversion is very difficult at best. Unicode, covering the
- "entire" world, also includes most of the world's case and sorting
- problems. TQt tries, but not very hard: operator==() and friends
- will do comparison based purely on the numeric Unicode value (code
- point) of the characters, and upper() and lower() will do case
- changes when the character has a well-defined upper/lower-case
- equivalent. There is no provision for locale-dependent case
- folding rules or comparison; these functions are meant to be fast
- so they can be used unambiguously in data structures. (See
- TQString::localeAwareCompare() though.)
-
- The conversion functions include unicode() (to a scalar), latin1()
- (to scalar, but converts all non-Latin-1 characters to 0), row()
- (gives the Unicode row), cell() (gives the Unicode cell),
- digitValue() (gives the integer value of any of the numerous digit
- characters), and a host of constructors.
-
- More information can be found in the document \link unicode.html
- About Unicode. \endlink
-
- \sa TQString TQCharRef
-*/
-
-/*!
- \enum TQChar::Category
-
- This enum maps the Unicode character categories.
-
- The following characters are normative in Unicode:
-
- \value Mark_NonSpacing Unicode class name Mn
-
- \value Mark_SpacingCombining Unicode class name Mc
-
- \value Mark_Enclosing Unicode class name Me
-
- \value Number_DecimalDigit Unicode class name Nd
-
- \value Number_Letter Unicode class name Nl
-
- \value Number_Other Unicode class name No
-
- \value Separator_Space Unicode class name Zs
-
- \value Separator_Line Unicode class name Zl
-
- \value Separator_Paragraph Unicode class name Zp
-
- \value Other_Control Unicode class name Cc
-
- \value Other_Format Unicode class name Cf
-
- \value Other_Surrogate Unicode class name Cs
-
- \value Other_PrivateUse Unicode class name Co
-
- \value Other_NotAssigned Unicode class name Cn
-
-
- The following categories are informative in Unicode:
-
- \value Letter_Uppercase Unicode class name Lu
-
- \value Letter_Lowercase Unicode class name Ll
-
- \value Letter_Titlecase Unicode class name Lt
-
- \value Letter_Modifier Unicode class name Lm
-
- \value Letter_Other Unicode class name Lo
-
- \value Punctuation_Connector Unicode class name Pc
-
- \value Punctuation_Dash Unicode class name Pd
-
- \value Punctuation_Open Unicode class name Ps
-
- \value Punctuation_Close Unicode class name Pe
-
- \value Punctuation_InitialQuote Unicode class name Pi
-
- \value Punctuation_FinalQuote Unicode class name Pf
-
- \value Punctuation_Other Unicode class name Po
-
- \value Symbol_Math Unicode class name Sm
-
- \value Symbol_Currency Unicode class name Sc
-
- \value Symbol_Modifier Unicode class name Sk
-
- \value Symbol_Other Unicode class name So
-
-
- There are two categories that are specific to TQt:
-
- \value NoCategory used when TQt is dazed and confused and cannot
- make sense of anything.
-
- \value Punctuation_Dask old typo alias for Punctuation_Dash
-
-*/
-
-/*!
- \enum TQChar::Direction
-
- This enum type defines the Unicode direction attributes. See \link
- http://www.unicode.org/ the Unicode Standard\endlink for a
- description of the values.
-
- In order to conform to C/C++ naming conventions "Dir" is prepended
- to the codes used in the Unicode Standard.
-*/
-
-/*!
- \enum TQChar::Decomposition
-
- This enum type defines the Unicode decomposition attributes. See
- \link http://www.unicode.org/ the Unicode Standard\endlink for a
- description of the values.
-*/
-
-/*!
- \enum TQChar::Joining
-
- This enum type defines the Unicode joining attributes. See \link
- http://www.unicode.org/ the Unicode Standard\endlink for a
- description of the values.
-*/
-
-/*!
- \enum TQChar::CombiningClass
-
- This enum type defines names for some of the Unicode combining
- classes. See \link http://www.unicode.org/ the Unicode
- Standard\endlink for a description of the values.
-*/
-
-/*!
- \fn void TQChar::setCell( uchar cell )
- \internal
-*/
-
-/*!
- \fn void TQChar::setRow( uchar row )
- \internal
-*/
-
-
-/*!
- \fn TQChar::TQChar()
-
- Constructs a null TQChar (one that isNull()).
-*/
-
-
-/*!
- \fn TQChar::TQChar( char c )
-
- Constructs a TQChar corresponding to ASCII/Latin-1 character \a c.
-*/
-
-
-/*!
- \fn TQChar::TQChar( uchar c )
-
- Constructs a TQChar corresponding to ASCII/Latin-1 character \a c.
-*/
-
-
-/*!
- \fn TQChar::TQChar( uchar c, uchar r )
-
- Constructs a TQChar for Unicode cell \a c in row \a r.
-*/
-
-
-/*!
- \fn TQChar::TQChar( const TQChar& c )
-
- Constructs a copy of \a c. This is a deep copy, if such a
- lightweight object can be said to have deep copies.
-*/
-
-
-/*!
- \fn TQChar::TQChar( ushort rc )
-
- Constructs a TQChar for the character with Unicode code point \a rc.
-*/
-
-
-/*!
- \fn TQChar::TQChar( short rc )
-
- Constructs a TQChar for the character with Unicode code point \a rc.
-*/
-
-
-/*!
- \fn TQChar::TQChar( uint rc )
-
- Constructs a TQChar for the character with Unicode code point \a rc.
-*/
-
-
-/*!
- \fn TQChar::TQChar( int rc )
-
- Constructs a TQChar for the character with Unicode code point \a rc.
-*/
-
-
-/*!
- \fn bool TQChar::networkOrdered ()
-
- \obsolete
-
- Returns TRUE if this character is in network byte order (MSB
- first); otherwise returns FALSE. This is platform dependent.
-*/
-
-
-/*!
- \fn bool TQChar::isNull() const
-
- Returns TRUE if the character is the Unicode character 0x0000
- (ASCII NUL); otherwise returns FALSE.
-*/
-
-/*!
- \fn uchar TQChar::cell () const
-
- Returns the cell (least significant byte) of the Unicode
- character.
-*/
-
-/*!
- \fn uchar TQChar::row () const
-
- Returns the row (most significant byte) of the Unicode character.
-*/
-
-/*!
- Returns TRUE if the character is a printable character; otherwise
- returns FALSE. This is any character not of category Cc or Cn.
-
- Note that this gives no indication of whether the character is
- available in a particular \link TQFont font\endlink.
-*/
-bool TQChar::isPrint() const
-{
- Category c = ::category( *this );
- return !(c == Other_Control || c == Other_NotAssigned);
-}
-
-/*!
- Returns TRUE if the character is a separator character
- (Separator_* categories); otherwise returns FALSE.
-*/
-bool TQChar::isSpace() const
-{
- return ::isSpace( *this );
-}
-
-/*!
- Returns TRUE if the character is a mark (Mark_* categories);
- otherwise returns FALSE.
-*/
-bool TQChar::isMark() const
-{
- Category c = ::category( *this );
- return c >= Mark_NonSpacing && c <= Mark_Enclosing;
-}
-
-/*!
- Returns TRUE if the character is a punctuation mark (Punctuation_*
- categories); otherwise returns FALSE.
-*/
-bool TQChar::isPunct() const
-{
- Category c = ::category( *this );
- return (c >= Punctuation_Connector && c <= Punctuation_Other);
-}
-
-/*!
- Returns TRUE if the character is a letter (Letter_* categories);
- otherwise returns FALSE.
-*/
-bool TQChar::isLetter() const
-{
- Category c = ::category( *this );
- return (c >= Letter_Uppercase && c <= Letter_Other);
-}
-
-/*!
- Returns TRUE if the character is a number (of any sort - Number_*
- categories); otherwise returns FALSE.
-
- \sa isDigit()
-*/
-bool TQChar::isNumber() const
-{
- Category c = ::category( *this );
- return c >= Number_DecimalDigit && c <= Number_Other;
-}
-
-/*!
- Returns TRUE if the character is a letter or number (Letter_* or
- Number_* categories); otherwise returns FALSE.
-*/
-bool TQChar::isLetterOrNumber() const
-{
- Category c = ::category( *this );
- return (c >= Letter_Uppercase && c <= Letter_Other)
- || (c >= Number_DecimalDigit && c <= Number_Other);
-}
-
-
-/*!
- Returns TRUE if the character is a decimal digit
- (Number_DecimalDigit); otherwise returns FALSE.
-*/
-bool TQChar::isDigit() const
-{
- return (::category( *this ) == Number_DecimalDigit);
-}
-
-
-/*!
- Returns TRUE if the character is a symbol (Symbol_* categories);
- otherwise returns FALSE.
-*/
-bool TQChar::isSymbol() const
-{
- Category c = ::category( *this );
- return c >= Symbol_Math && c <= Symbol_Other;
-}
-
-/*!
- Returns the numeric value of the digit, or -1 if the character is
- not a digit.
-*/
-int TQChar::digitValue() const
-{
-#ifndef TQT_NO_UNICODETABLES
- int pos = TQUnicodeTables::decimal_info[row()];
- if( !pos )
- return -1;
- return TQUnicodeTables::decimal_info[(pos<<8) + cell()];
-#else
- // ##### just latin1
- if ( ucs < '0' || ucs > '9' )
- return -1;
- else
- return ucs - '0';
-#endif
-}
-
-/*!
- Returns the character category.
-
- \sa Category
-*/
-TQChar::Category TQChar::category() const
-{
- return ::category( *this );
-}
-
-/*!
- Returns the character's direction.
-
- \sa Direction
-*/
-TQChar::Direction TQChar::direction() const
-{
- return ::direction( *this );
-}
-
-/*!
- \warning This function is not supported (it may change to use
- Unicode character classes).
-
- Returns information about the joining properties of the character
- (needed for example, for Arabic).
-*/
-TQChar::Joining TQChar::joining() const
-{
- return ::joining( *this );
-}
-
-
-/*!
- Returns TRUE if the character is a mirrored character (one that
- should be reversed if the text direction is reversed); otherwise
- returns FALSE.
-*/
-bool TQChar::mirrored() const
-{
- return ::mirrored( *this );
-}
-
-/*!
- Returns the mirrored character if this character is a mirrored
- character, otherwise returns the character itself.
-*/
-TQChar TQChar::mirroredChar() const
-{
- return ::mirroredChar( *this );
-}
-
-#ifndef TQT_NO_UNICODETABLES
-// ### REMOVE ME 4.0
-static TQString shared_decomp;
-#endif
-/*!
- \nonreentrant
-
- Decomposes a character into its parts. Returns TQString::null if no
- decomposition exists.
-*/
-const TQString &TQChar::decomposition() const
-{
-#ifndef TQT_NO_UNICODETABLES
- int pos = TQUnicodeTables::decomposition_info[row()];
- if(!pos) return TQString::null;
-
- pos = TQUnicodeTables::decomposition_info[(pos<<8)+cell()];
- if(!pos) return TQString::null;
- pos+=2;
-
- TQString s;
- TQ_UINT16 c;
- while ( (c = TQUnicodeTables::decomposition_map[pos++]) != 0 )
- s += TQChar( c );
- // ### In 4.0, return s, and not shared_decomp. shared_decomp
- // prevents this function from being reentrant.
- shared_decomp = s;
- return shared_decomp;
-#else
- return TQString::null;
-#endif
-}
-
-/*!
- Returns the tag defining the composition of the character. Returns
- TQChar::Single if no decomposition exists.
-*/
-TQChar::Decomposition TQChar::decompositionTag() const
-{
-#ifndef TQT_NO_UNICODETABLES
- int pos = TQUnicodeTables::decomposition_info[row()];
- if(!pos) return TQChar::Single;
-
- pos = TQUnicodeTables::decomposition_info[(pos<<8)+cell()];
- if(!pos) return TQChar::Single;
-
- return (TQChar::Decomposition) TQUnicodeTables::decomposition_map[pos];
-#else
- return Single; // ########### FIX eg. just latin1
-#endif
-}
-
-/*!
- Returns the combining class for the character as defined in the
- Unicode standard. This is mainly useful as a positioning hint for
- marks attached to a base character.
-
- The TQt text rendering engine uses this information to correctly
- position non spacing marks around a base character.
-*/
-unsigned char TQChar::combiningClass() const
-{
- return ::combiningClass( *this );
-}
-
-
-/*!
- Returns the lowercase equivalent if the character is uppercase;
- otherwise returns the character itself.
-*/
-TQChar TQChar::lower() const
-{
- return ::lower( *this );
-}
-
-/*!
- Returns the uppercase equivalent if the character is lowercase;
- otherwise returns the character itself.
-*/
-TQChar TQChar::upper() const
-{
- return ::upper( *this );
-}
-
-/*!
- \fn TQChar::operator char() const
-
- Returns the Latin-1 character equivalent to the TQChar, or 0. This
- is mainly useful for non-internationalized software.
-
- \sa unicode()
-*/
-
-/*!
- \fn ushort TQChar::unicode() const
-
- Returns the numeric Unicode value equal to the TQChar. Normally,
- you should use TQChar objects as they are equivalent, but for some
- low-level tasks (e.g. indexing into an array of Unicode
- information), this function is useful.
-*/
-
-/*!
- \fn ushort & TQChar::unicode()
-
- \overload
-
- Returns a reference to the numeric Unicode value equal to the
- TQChar.
-*/
-
-/*****************************************************************************
- Documentation of TQChar related functions
- *****************************************************************************/
-
-/*!
- \fn bool operator==( TQChar c1, TQChar c2 )
-
- \relates TQChar
-
- Returns TRUE if \a c1 and \a c2 are the same Unicode character;
- otherwise returns FALSE.
-*/
-
-/*!
- \fn bool operator==( char ch, TQChar c )
-
- \overload
- \relates TQChar
-
- Returns TRUE if \a c is the ASCII/Latin-1 character \a ch;
- otherwise returns FALSE.
-*/
-
-/*!
- \fn bool operator==( TQChar c, char ch )
-
- \overload
- \relates TQChar
-
- Returns TRUE if \a c is the ASCII/Latin-1 character \a ch;
- otherwise returns FALSE.
-*/
-
-/*!
- \fn int operator!=( TQChar c1, TQChar c2 )
-
- \relates TQChar
-
- Returns TRUE if \a c1 and \a c2 are not the same Unicode
- character; otherwise returns FALSE.
-*/
-
-/*!
- \fn int operator!=( char ch, TQChar c )
-
- \overload
- \relates TQChar
-
- Returns TRUE if \a c is not the ASCII/Latin-1 character \a ch;
- otherwise returns FALSE.
-*/
-
-/*!
- \fn int operator!=( TQChar c, char ch )
-
- \overload
- \relates TQChar
-
- Returns TRUE if \a c is not the ASCII/Latin-1 character \a ch;
- otherwise returns FALSE.
-*/
-
-/*!
- \fn int operator<=( TQChar c1, TQChar c2 )
-
- \relates TQChar
-
- Returns TRUE if the numeric Unicode value of \a c1 is less than
- that of \a c2, or they are the same Unicode character; otherwise
- returns FALSE.
-*/
-
-/*!
- \fn int operator<=( TQChar c, char ch )
-
- \overload
- \relates TQChar
-
- Returns TRUE if the numeric Unicode value of \a c is less than or
- equal to that of the ASCII/Latin-1 character \a ch; otherwise
- returns FALSE.
-*/
-
-/*!
- \fn int operator<=( char ch, TQChar c )
-
- \overload
- \relates TQChar
-
- Returns TRUE if the numeric Unicode value of the ASCII/Latin-1
- character \a ch is less than or equal to that of \a c; otherwise
- returns FALSE.
-*/
-
-/*!
- \fn int operator>=( TQChar c1, TQChar c2 )
-
- \relates TQChar
-
- Returns TRUE if the numeric Unicode value of \a c1 is greater than
- that of \a c2, or they are the same Unicode character; otherwise
- returns FALSE.
-*/
-
-/*!
- \fn int operator>=( TQChar c, char ch )
-
- \overload
- \relates TQChar
-
- Returns TRUE if the numeric Unicode value of \a c is greater than
- or equal to that of the ASCII/Latin-1 character \a ch; otherwise
- returns FALSE.
-*/
-
-/*!
- \fn int operator>=( char ch, TQChar c )
-
- \overload
- \relates TQChar
-
- Returns TRUE if the numeric Unicode value of the ASCII/Latin-1
- character \a ch is greater than or equal to that of \a c;
- otherwise returns FALSE.
-*/
-
-/*!
- \fn int operator<( TQChar c1, TQChar c2 )
-
- \relates TQChar
-
- Returns TRUE if the numeric Unicode value of \a c1 is less than
- that of \a c2; otherwise returns FALSE.
-*/
-
-/*!
- \fn int operator<( TQChar c, char ch )
-
- \overload
- \relates TQChar
-
- Returns TRUE if the numeric Unicode value of \a c is less than that
- of the ASCII/Latin-1 character \a ch; otherwise returns FALSE.
-*/
-
-/*!
- \fn int operator<( char ch, TQChar c )
-
- \overload
- \relates TQChar
-
- Returns TRUE if the numeric Unicode value of the ASCII/Latin-1
- character \a ch is less than that of \a c; otherwise returns
- FALSE.
-*/
-
-/*!
- \fn int operator>( TQChar c1, TQChar c2 )
-
- \relates TQChar
-
- Returns TRUE if the numeric Unicode value of \a c1 is greater than
- that of \a c2; otherwise returns FALSE.
-*/
-
-/*!
- \fn int operator>( TQChar c, char ch )
-
- \overload
- \relates TQChar
-
- Returns TRUE if the numeric Unicode value of \a c is greater than
- that of the ASCII/Latin-1 character \a ch; otherwise returns FALSE.
-*/
-
-/*!
- \fn int operator>( char ch, TQChar c )
-
- \overload
- \relates TQChar
-
- Returns TRUE if the numeric Unicode value of the ASCII/Latin-1
- character \a ch is greater than that of \a c; otherwise returns
- FALSE.
-*/
-
#ifndef TQT_NO_UNICODETABLES
// small class used internally in TQString::Compose()
@@ -1458,11 +687,6 @@ char* TQString::unicodeToLatin1(const TQChar *uc, uint l, bool unpaged)
*/
TQ_EXPORT TQStringData *TQString::shared_null = 0;
const TQString TQString::null;
-const TQChar TQChar::null;
-const TQChar TQChar::replacement((ushort)0xfffd);
-const TQChar TQChar::byteOrderMark((ushort)0xfeff);
-const TQChar TQChar::byteOrderSwapped((ushort)0xfffe);
-const TQChar TQChar::nbsp((ushort)0x00a0);
TQStringData* TQString::makeSharedNull()
{
@@ -6463,6 +5687,25 @@ TQChar& TQString::ref(uint i) {
will be used instead.
*/
+/*!
+ \class TQCharRef tqstring.h
+ \reentrant
+ \brief The TQCharRef class is a helper class for TQString.
+
+ \ingroup text
+
+ When you get an object of type TQCharRef, if you can assign to it,
+ the assignment will apply to the character in the string from
+ which you got the reference. That is its whole purpose in life.
+ The TQCharRef becomes invalid once modifications are made to the
+ string: if you want to keep the character, copy it into a TQChar.
+
+ Most of the TQChar member functions also exist in TQCharRef.
+ However, they are not explicitly documented here.
+
+ \sa TQString::operator[]() TQString::at() TQChar
+*/
+
/*!
\fn TQCharRef TQString::operator[]( int )
diff --git a/src/tools/tqstring.h b/src/tools/tqstring.h
index c29a9c392..12914075e 100644
--- a/src/tools/tqstring.h
+++ b/src/tools/tqstring.h
@@ -68,9 +68,7 @@
#include
#endif
-/*****************************************************************************
- TQString class
- *****************************************************************************/
+#include "tqchar.h"
class TQRegExp;
class TQString;
@@ -78,336 +76,9 @@ class TQCharRef;
class TQMutex;
template class TQDeepCopy;
-class TQ_EXPORT TQChar {
-public:
- TQChar();
- TQChar( char c );
- TQChar( uchar c );
- TQChar( uchar c, uchar r );
- TQChar( const TQChar& c ); // ### remove in 4.0 to allow compiler optimization
- TQChar( ushort rc );
- TQChar( short rc );
- TQChar( uint rc );
- TQChar( int rc );
-
- static const TQChar null; // 0000
- static const TQChar replacement; // FFFD
- static const TQChar byteOrderMark; // FEFF
- static const TQChar byteOrderSwapped; // FFFE
- static const TQChar nbsp; // 00A0
-
- // Unicode information
-
- enum Category
- {
- NoCategory,
-
- Mark_NonSpacing, // Mn
- Mark_SpacingCombining, // Mc
- Mark_Enclosing, // Me
-
- Number_DecimalDigit, // Nd
- Number_Letter, // Nl
- Number_Other, // No
-
- Separator_Space, // Zs
- Separator_Line, // Zl
- Separator_Paragraph, // Zp
-
- Other_Control, // Cc
- Other_Format, // Cf
- Other_Surrogate, // Cs
- Other_PrivateUse, // Co
- Other_NotAssigned, // Cn
-
- Letter_Uppercase, // Lu
- Letter_Lowercase, // Ll
- Letter_Titlecase, // Lt
- Letter_Modifier, // Lm
- Letter_Other, // Lo
-
- Punctuation_Connector, // Pc
- Punctuation_Dash, // Pd
- Punctuation_Dask = Punctuation_Dash, // oops
- Punctuation_Open, // Ps
- Punctuation_Close, // Pe
- Punctuation_InitialQuote, // Pi
- Punctuation_FinalQuote, // Pf
- Punctuation_Other, // Po
-
- Symbol_Math, // Sm
- Symbol_Currency, // Sc
- Symbol_Modifier, // Sk
- Symbol_Other // So
- };
-
- enum Direction
- {
- DirL, DirR, DirEN, DirES, DirET, DirAN, DirCS, DirB, DirS, DirWS, DirON,
- DirLRE, DirLRO, DirAL, DirRLE, DirRLO, DirPDF, DirNSM, DirBN
- };
-
- enum Decomposition
- {
- Single, Canonical, Font, NoBreak, Initial, Medial,
- Final, Isolated, Circle, Super, Sub, Vertical,
- Wide, Narrow, Small, Square, Compat, Fraction
- };
-
- enum Joining
- {
- OtherJoining, Dual, Right, Center
- };
-
- enum CombiningClass
- {
- Combining_BelowLeftAttached = 200,
- Combining_BelowAttached = 202,
- Combining_BelowRightAttached = 204,
- Combining_LeftAttached = 208,
- Combining_RightAttached = 210,
- Combining_AboveLeftAttached = 212,
- Combining_AboveAttached = 214,
- Combining_AboveRightAttached = 216,
-
- Combining_BelowLeft = 218,
- Combining_Below = 220,
- Combining_BelowRight = 222,
- Combining_Left = 224,
- Combining_Right = 226,
- Combining_AboveLeft = 228,
- Combining_Above = 230,
- Combining_AboveRight = 232,
-
- Combining_DoubleBelow = 233,
- Combining_DoubleAbove = 234,
- Combining_IotaSubscript = 240
- };
-
- // ****** WHEN ADDING FUNCTIONS, CONSIDER ADDING TO TQCharRef TOO
-
- int digitValue() const;
- TQChar lower() const;
- TQChar upper() const;
-
- Category category() const;
- Direction direction() const;
- Joining joining() const;
- bool mirrored() const;
- TQChar mirroredChar() const;
- const TQString &decomposition() const; // ### return just TQString in 4.0
- Decomposition decompositionTag() const;
- unsigned char combiningClass() const;
-
- char latin1() const { return ucs > 0xff ? 0 : (char) ucs; }
- ushort unicode() const { return ucs; }
-#ifdef Q_NO_PACKED_REFERENCE
- ushort &unicode() { return *((ushort*)&ucs); }
-#else
- ushort &unicode() { return ucs; }
-#endif
-#ifndef TQT_NO_CAST_ASCII
- // like all ifdef'd code this is undocumented
- operator char() const { return latin1(); }
-#endif
-
- bool isNull() const { return unicode()==0; }
- bool isPrint() const;
- bool isPunct() const;
- bool isSpace() const;
- bool isMark() const;
- bool isLetter() const;
- bool isNumber() const;
- bool isLetterOrNumber() const;
- bool isDigit() const;
- bool isSymbol() const;
-
- // Surrogate pairs support
- bool isHighSurrogate() const;
- bool isLowSurrogate() const;
- static bool requiresSurrogates(uint ucs4);
- static ushort highSurrogate(uint ucs4);
- static ushort lowSurrogate(uint ucs4);
- static uint surrogateToUcs4(const TQChar &high, const TQChar &low);
-
- uchar cell() const { return ((uchar) ucs & 0xff); }
- uchar row() const { return ((uchar) (ucs>>8)&0xff); }
- void setCell( uchar cell ) { ucs = (ucs & 0xff00) + cell; }
- void setRow( uchar row ) { ucs = (((ushort) row)<<8) + (ucs&0xff); }
-
- static bool networkOrdered() {
- int wordSize;
- bool bigEndian = FALSE;
- tqSysInfo( &wordSize, &bigEndian );
- return bigEndian;
- }
-
- friend inline bool operator==( char ch, TQChar c );
- friend inline bool operator==( TQChar c, char ch );
- friend inline bool operator==( TQChar c1, TQChar c2 );
- friend inline bool operator!=( TQChar c1, TQChar c2 );
- friend inline bool operator!=( char ch, TQChar c );
- friend inline bool operator!=( TQChar c, char ch );
- friend inline bool operator<=( TQChar c, char ch );
- friend inline bool operator<=( char ch, TQChar c );
- friend inline bool operator<=( TQChar c1, TQChar c2 );
-
-#if defined(__cplusplus) && __cplusplus >= 201103L
- // Explicit declarations to suppress warnings
- // This could be removed when TQChar( const TQChar& c ) is removed
- TQChar& operator=(const TQChar& other) = default;
- ~TQChar() = default;
-#endif
-private:
- ushort ucs;
-#if defined(QT_QSTRING_UCS_4)
- ushort grp;
-#endif
-} TQ_PACKED;
-
-inline TQChar::TQChar() : ucs( 0 )
-#ifdef QT_QSTRING_UCS_4
- , grp( 0 )
-#endif
-{
-}
-inline TQChar::TQChar( char c ) : ucs( (uchar)c )
-#ifdef QT_QSTRING_UCS_4
- , grp( 0 )
-#endif
-{
-}
-inline TQChar::TQChar( uchar c ) : ucs( c )
-#ifdef QT_QSTRING_UCS_4
- , grp( 0 )
-#endif
-{
-}
-inline TQChar::TQChar( uchar c, uchar r ) : ucs( (r << 8) | c )
-#ifdef QT_QSTRING_UCS_4
- , grp( 0 )
-#endif
-{
-}
-inline TQChar::TQChar( const TQChar& c ) : ucs( c.ucs )
-#ifdef QT_QSTRING_UCS_4
- , grp( c.grp )
-#endif
-{
-}
-
-inline TQChar::TQChar( ushort rc ) : ucs( rc )
-#ifdef QT_QSTRING_UCS_4
- , grp( 0 )
-#endif
-{
-}
-inline TQChar::TQChar( short rc ) : ucs( (ushort) rc )
-#ifdef QT_QSTRING_UCS_4
- , grp( 0 )
-#endif
-{
-}
-inline TQChar::TQChar( uint rc ) : ucs( (ushort ) (rc & 0xffff) )
-#ifdef QT_QSTRING_UCS_4
- , grp( (ushort) ((rc >> 16) & 0xffff) )
-#endif
-{
-}
-inline TQChar::TQChar( int rc ) : ucs( (ushort) (rc & 0xffff) )
-#ifdef QT_QSTRING_UCS_4
- , grp( (ushort) ((rc >> 16) & 0xffff) )
-#endif
-{
-}
-
-inline bool TQChar::isHighSurrogate() const
-{
- return ((ucs & 0xfc00) == 0xd800);
-}
-
-inline bool TQChar::isLowSurrogate() const
-{
- return ((ucs & 0xfc00) == 0xdc00);
-}
-
-inline bool TQChar::requiresSurrogates(uint ucs4)
-{
- return (ucs4 >= 0x10000);
-}
-
-inline ushort TQChar::highSurrogate(uint ucs4)
-{
- return ushort(((ucs4 - 0x10000) >> 10)) | 0xd800;
-}
-
-inline ushort TQChar::lowSurrogate(uint ucs4)
-{
- return ushort(ucs4 & 0x03FF) | 0xdc00;
-}
-
-inline uint TQChar::surrogateToUcs4(const TQChar &high, const TQChar &low)
-{
- return (uint(high.ucs & 0x03FF) << 10) | (low.ucs & 0x03FF) | 0x10000;
-}
-
-inline bool operator==( char ch, TQChar c )
-{
- return ((uchar) ch) == c.ucs;
-}
-
-inline bool operator==( TQChar c, char ch )
-{
- return ((uchar) ch) == c.ucs;
-}
-
-inline bool operator==( TQChar c1, TQChar c2 )
-{
- return c1.ucs == c2.ucs;
-}
-
-inline bool operator!=( TQChar c1, TQChar c2 )
-{
- return c1.ucs != c2.ucs;
-}
-
-inline bool operator!=( char ch, TQChar c )
-{
- return ((uchar)ch) != c.ucs;
-}
-
-inline bool operator!=( TQChar c, char ch )
-{
- return ((uchar) ch) != c.ucs;
-}
-
-inline bool operator<=( TQChar c, char ch )
-{
- return c.ucs <= ((uchar) ch);
-}
-
-inline bool operator<=( char ch, TQChar c )
-{
- return ((uchar) ch) <= c.ucs;
-}
-
-inline bool operator<=( TQChar c1, TQChar c2 )
-{
- return c1.ucs <= c2.ucs;
-}
-
-inline bool operator>=( TQChar c, char ch ) { return ch <= c; }
-inline bool operator>=( char ch, TQChar c ) { return c <= ch; }
-inline bool operator>=( TQChar c1, TQChar c2 ) { return c2 <= c1; }
-inline bool operator<( TQChar c, char ch ) { return !(ch<=c); }
-inline bool operator<( char ch, TQChar c ) { return !(c<=ch); }
-inline bool operator<( TQChar c1, TQChar c2 ) { return !(c2<=c1); }
-inline bool operator>( TQChar c, char ch ) { return !(ch>=c); }
-inline bool operator>( char ch, TQChar c ) { return !(c>=ch); }
-inline bool operator>( TQChar c1, TQChar c2 ) { return !(c2>=c1); }
-
// internal
-struct TQ_EXPORT TQStringData : public TQShared {
+struct TQ_EXPORT TQStringData : public TQShared
+{
TQStringData();
TQStringData(TQChar *u, uint l, uint m);
~TQStringData();
@@ -802,7 +473,9 @@ private:
friend class TQLineEdit;
};
-class TQ_EXPORT TQCharRef {
+
+class TQ_EXPORT TQCharRef
+{
friend class TQString;
TQString& s;
uint p;
diff --git a/src/tqmoc/tqmoc.pro b/src/tqmoc/tqmoc.pro
index bcb942e6e..24aa3c7f2 100644
--- a/src/tqmoc/tqmoc.pro
+++ b/src/tqmoc/tqmoc.pro
@@ -14,6 +14,7 @@ LIBS =
OBJECTS_DIR = .
SOURCES = ../tools/tqbuffer.cpp \
../tools/tqptrcollection.cpp \
+ ../tools/tqchar.cpp \
../tools/tqcstring.cpp \
../tools/tqdatastream.cpp \
../tools/tqdatetime.cpp \
--
cgit v1.2.1