Merge pull request #944 from KLayout/qt6

Qt6
This commit is contained in:
Matthias Köfferlein 2022-01-21 22:30:28 +01:00 committed by GitHub
commit 1f2e59c192
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2346 changed files with 760001 additions and 59461 deletions

View File

@ -1,4 +1,6 @@
0.28 (2022-xx-xx):
0.27.6 (2022-01-04):
* Enhancement: %GITHUB%/issues/963 Display snapped position in main window
* Bugfix: %GITHUB%/issues/960 Cap values range now shown in netlist browser

View File

@ -256,7 +256,6 @@ if not exist "%option-build%" (
echo on
"%option-qmake%" ^
HAVE_QT5=1 ^
HAVE_QT_UITOOLS=1 ^
HAVE_QT_NETWORK=1 ^
HAVE_QT_SQL=1 ^

View File

@ -36,7 +36,6 @@ HAVE_QT_DESIGNER=1
HAVE_QT_XML=1
HAVE_64BIT_COORD=0
HAVE_QT=1
HAVE_QT5="" # not set
HAVE_CURL=0
HAVE_EXPAT=0
@ -197,12 +196,6 @@ while [ "$*" != "" ]; do
RPATH="$1"
shift
;;
-qt4)
HAVE_QT5=0
;;
-qt5)
HAVE_QT5=1
;;
-dry-run)
RUN_MAKE=0
;;
@ -302,19 +295,6 @@ if [ "$QMAKE" = "" ]; then
exit 1
fi
# if not given, try to detect the qt major version to use
if [ "$HAVE_QT5" = "" ]; then
qt_major=`$QMAKE -v | grep 'Using Qt version' | sed 's/.*version *\([0-9][0-9]*\).*/\1/'`
if [ "$qt_major" = "4" ]; then
HAVE_QT5=0
elif [ "$qt_major" = "5" ]; then
HAVE_QT5=1
else
echo "*** ERROR: could not determine Qt version from '$QMAKE -v'"
exit 1
fi
fi
echo "Using qmake: $QMAKE"
echo ""
@ -492,11 +472,7 @@ if [ $HAVE_QT = 0 ]; then
echo " Qt not used at all"
fi
if [ $HAVE_QTBINDINGS != 0 ]; then
if [ "$HAVE_QT5" != "0" ]; then
echo " Qt bindings enabled (Qt 5 API)"
else
echo " Qt bindings enabled (Qt 4 API)"
fi
echo " Qt bindings enabled"
fi
if [ $HAVE_64BIT_COORD != 0 ]; then
echo " 64 bit coordinates enabled"
@ -613,13 +589,6 @@ echo ""
echo "Running $QMAKE .."
cd $BUILD
# chose the right qmake
if [ $HAVE_QT5 = 0 ]; then
export QT_SELECT=4
else
export QT_SELECT=5
fi
$QMAKE -v
# Force a minimum rebuild because of version info
@ -647,7 +616,6 @@ qmake_options=(
HAVE_QT_XML="$HAVE_QT_XML"
HAVE_64BIT_COORD="$HAVE_64BIT_COORD"
HAVE_QT="$HAVE_QT"
HAVE_QT5="$HAVE_QT5"
HAVE_CURL="$HAVE_CURL"
HAVE_EXPAT="$HAVE_EXPAT"
PREFIX="$BIN"

View File

@ -1,9 +1,9 @@
Relevant KLayout version: 0.27.4<br>
Relevant KLayout version: 0.27.5<br>
Author: Kazzz-S<br>
Last modified: 2021-11-07<br>
Last modified: 2021-11-27<br>
# 1. Introduction
This directory **`macbuild`** contains different files required for building KLayout (http://www.klayout.de/) version 0.27.4 or later for different 64-bit macOS, including:
This directory **`macbuild`** contains different files required for building KLayout (http://www.klayout.de/) version 0.27.5 or later for different 64-bit macOS, including:
* Catalina (10.15.7) : the primary development environment
* Big Sur (11.x) : experimental; Apple M1 chip is not tested since the author does not own an M1 Mac
* Monterey (12.x) : -- ditto --
@ -18,15 +18,26 @@ However, they are not actively supported, and DMG packages for them are not prov
Throughout this document, the primary target machine is **Intel x86_64** with **macOS Catalina**.<br>
A **((Notes))** marker indicates special notes for specific operating systems.
# 2. Qt5 Frameworks
By default, the Qt framework is "Qt5" from MacPorts (https://www.macports.org/), which is usually located under:
# 2. Qt6/Qt5 Frameworks
By default, the Qt framework is "Qt6" from Homebrew (https://brew.sh/), which is usually located under:
```
/opt/local/libexec/qt5/
/usr/local/opt/qt@6/
```
Alternatively, you can use "Qt5" from Homebrew (https://brew.sh/), which is usually located under:
"Qt5" is usually located under:
```
/usr/local/opt/qt@5/
```
Alternatively, you can use "Qt6" from MacPorts (https://www.macports.org/), which is usually located under:
```
/opt/local/libexec/qt6/
```
**((Notes))** As of 2021-11-27, MacPorts' Qt6 does not provide `qt6-qtmultimedia`, which causes a build error!!!
"Qt5" is usually located under:
```
/opt/local/libexec/qt5/
```
OR
@ -40,7 +51,6 @@ If you have installed Anaconda3 under $HOME/opt/anaconda3/, make a symbolic link
```
/Applications/anaconda3/ ---> $HOME/opt/anaconda3/
```
**((Notes))** "Qt5" from Homebrew is chosen as the default for **Big Sur** and **Monterey**.
# 3. Script language support: Ruby and Python
Earlier, by default, supported script languages, i.e., Ruby and Python, were those standard ones bundled with the OS.<br>
@ -57,14 +67,14 @@ Big Sur (11.x) and Monterey (12.x) still provide the Python 2.7 binaries to run
However, the latest Xcode 13.1 does not allow us to link the legacy Python 2.7 library with the newly compiled KLayout binaries.<br>
Therefore, Homebrew is adopted as the default environment for Big Sur and Monterey.
The build script **`build4mac.py`** provides several possible combinations of Qt5, Ruy, and Python modules to accommodate such a slightly complex environment.<br>
The build script **`build4mac.py`** provides several possible combinations of Qt[6|5], Ruy, and Python modules to accommodate such a slightly complex environment.<br>
Some typical use cases are described in Section 6.
# 4. Prerequisites
You need to have:
* the latest Xcode and command-line tool kit compliant with each OS
* Qt5 package from MacPorts, Homebrew, or Anaconda3
* optionally Ruby and Python packages from MacPorts, Homebrew, or Anaconda3
* Qt[6|5] package from Homebrew or MacPorts; Qt5 from Anaconda3
* optionally Ruby and Python packages from Homebrew, MacPorts, or Anaconda3
#### For matching versions of Ruby and Python, please also refer to `build4mac_env.py`.
# 5. Command-line options of **`build4mac.py`** are as shown below.
@ -72,12 +82,15 @@ You need to have:
```
---------------------------------------------------------------------------------------------------------
<< Usage of 'build4mac.py' >>
for building KLayout 0.27.4 or later on different Apple macOS / Mac OSX platforms.
for building KLayout 0.27.5 or later on different Apple macOS / Mac OSX platforms.
$ [python] ./build4mac.py
$ [python] ./build4mac.py
option & argument : descriptions (refer to 'macbuild/build4mac_env.py' for details)| default value
--------------------------------------------------------------------------------------+---------------
[-q|--qt <type>] : case-insensitive type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3'] | qt5macports
[-q|--qt <type>] : case-insensitive type=['Qt6MacPorts', 'Qt6Brew', | qt6brew
: 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3'] |
: Qt6MacPorts: use Qt6 from MacPorts |
: Qt6Brew: use Qt6 from Homebrew |
: Qt5MacPorts: use Qt5 from MacPorts |
: Qt5Brew: use Qt5 from Homebrew |
: Qt5Ana3: use Qt5 from Anaconda3 |
@ -88,30 +101,31 @@ $ [python] ./build4mac.py
: HB27: use Ruby 2.7 from Homebrew |
: Ana3: use Ruby 2.5 from Anaconda3 |
[-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | sys
: 'HBAuto'] |
: 'HB39', HBAuto'] |
: nil: don't bind Python |
: Sys: use OS-bundled Python 2.7 [ElCapitan -- Catalina] |
: MP38: use Python 3.8 from MacPorts |
: HB38: use Python 3.8 from Homebrew |
: Ana3: use Python 3.8 from Anaconda3 |
: HB39: use Python 3.9 from Homebrew |
: HBAuto: use the latest Python 3.x auto-detected from Homebrew |
[-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled
[-u|--noqtuitools] : don't include uitools in Qt binding | disabled
[-m|--make <option>] : option passed to 'make' | '--jobs=4'
[-d|--debug] : enable debug mode build | disabled
[-c|--checkcom] : check command-line and exit without building | disabled
[-y|--deploy] : deploy executables and dylibs including Qt's Frameworks | disabled
[-Y|--DEPLOY] : deploy executables and dylibs for those who built KLayout | disabled
[-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled
[-u|--noqtuitools] : don't include uitools in Qt binding | disabled
[-m|--make <option>] : option passed to 'make' | '--jobs=4'
[-d|--debug] : enable debug mode build | disabled
[-c|--checkcom] : check command-line and exit without building | disabled
[-y|--deploy] : deploy executables and dylibs including Qt's Frameworks | disabled
[-Y|--DEPLOY] : deploy executables and dylibs for those who built KLayout | disabled
: from the source code and use the tools in the same machine |
: ! After confirmation of successful build of 'klayout.app', |
: rerun this script with BOTH: |
: 1) the same options used for building AND |
: 2) <-y|--deploy> OR <-Y|--DEPLOY> |
: optionally with [-v|--verbose <0-3>] |
[-v|--verbose <0-3>] : verbose level of `macdeployqt' (effective with -y only) | 1
[-v|--verbose <0-3>] : verbose level of `macdeployqt' (effective with -y only) | 1
: 0 = no output, 1 = error/warning (default), |
: 2 = normal, 3 = debug |
[-?|--?] : print this usage and exit | disabled
[-?|--?] : print this usage and exit | disabled
-----------------------------------------------------------------------------------------+---------------
```
@ -119,12 +133,15 @@ $ [python] ./build4mac.py
```
---------------------------------------------------------------------------------------------------------
<< Usage of 'build4mac.py' >>
for building KLayout 0.27.4 or later on different Apple macOS / Mac OSX platforms.
for building KLayout 0.27.5 or later on different Apple macOS / Mac OSX platforms.
$ [python] ./build4mac.py
$ [python] ./build4mac.py
option & argument : descriptions (refer to 'macbuild/build4mac_env.py' for details)| default value
--------------------------------------------------------------------------------------+---------------
[-q|--qt <type>] : case-insensitive type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3'] | qt5brew
[-q|--qt <type>] : case-insensitive type=['Qt6MacPorts', 'Qt6Brew', | qt6brew
: 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3'] |
: Qt6MacPorts: use Qt6 from MacPorts |
: Qt6Brew: use Qt6 from Homebrew |
: Qt5MacPorts: use Qt5 from MacPorts |
: Qt5Brew: use Qt5 from Homebrew |
: Qt5Ana3: use Qt5 from Anaconda3 |
@ -135,30 +152,31 @@ $ [python] ./build4mac.py
: HB27: use Ruby 2.7 from Homebrew |
: Ana3: use Ruby 2.5 from Anaconda3 |
[-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | hb38
: 'HBAuto'] |
: 'HB39', HBAuto'] |
: nil: don't bind Python |
: Sys: use OS-bundled Python 2.7 [ElCapitan -- Catalina] |
: MP38: use Python 3.8 from MacPorts |
: HB38: use Python 3.8 from Homebrew |
: Ana3: use Python 3.8 from Anaconda3 |
: HB39: use Python 3.9 from Homebrew |
: HBAuto: use the latest Python 3.x auto-detected from Homebrew |
[-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled
[-u|--noqtuitools] : don't include uitools in Qt binding | disabled
[-m|--make <option>] : option passed to 'make' | '--jobs=4'
[-d|--debug] : enable debug mode build | disabled
[-c|--checkcom] : check command-line and exit without building | disabled
[-y|--deploy] : deploy executables and dylibs including Qt's Frameworks | disabled
[-Y|--DEPLOY] : deploy executables and dylibs for those who built KLayout | disabled
[-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled
[-u|--noqtuitools] : don't include uitools in Qt binding | disabled
[-m|--make <option>] : option passed to 'make' | '--jobs=4'
[-d|--debug] : enable debug mode build | disabled
[-c|--checkcom] : check command-line and exit without building | disabled
[-y|--deploy] : deploy executables and dylibs including Qt's Frameworks | disabled
[-Y|--DEPLOY] : deploy executables and dylibs for those who built KLayout | disabled
: from the source code and use the tools in the same machine |
: ! After confirmation of successful build of 'klayout.app', |
: rerun this script with BOTH: |
: 1) the same options used for building AND |
: 2) <-y|--deploy> OR <-Y|--DEPLOY> |
: optionally with [-v|--verbose <0-3>] |
[-v|--verbose <0-3>] : verbose level of `macdeployqt' (effective with -y only) | 1
[-v|--verbose <0-3>] : verbose level of `macdeployqt' (effective with -y only) | 1
: 0 = no output, 1 = error/warning (default), |
: 2 = normal, 3 = debug |
[-?|--?] : print this usage and exit | disabled
[-?|--?] : print this usage and exit | disabled
-----------------------------------------------------------------------------------------+---------------
```
@ -167,11 +185,9 @@ In this section, the actual file names and directory names are those obtained on
On different OS, those names differ accordingly.
### 6A. Standard build using the OS-bundled Ruby and Python
0. Install MacPorts, then install Qt5 by
0. Install Homebrew, then install Qt6 by
```
$ sudo port install coreutils
$ sudo port install findutils
$ sudo port install qt5
$ brew install qt6
```
1. Invoke **`build4mac.py`** with the default options: **((Notes))** only for Catalina
```
@ -185,24 +201,25 @@ $ ./build4mac.py
$ ./build4mac.py -y
```
The application bundle **`klayout.app`** is located under:<br>
**`ST-qt5MP.pkg.macos-Catalina-release-RsysPsys`** directory, where the three name parts below are important.
**`ST-qt6Brew.pkg.macos-Catalina-release-RsysPsys`** directory, where the three name parts below are important.
* "ST-" means that this is a standard package (LW-, HW-, and EX- are other possibilities explained below).
* "qt5MP" means that Qt5 from MacPorts is used.
* "qt6Brew" means that Qt6 from Homebrew is used.
* "RsysPsys" means that Ruby is OS-bundled; Python is OS-bundled.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
If you use the "-Y" option instead of the "-y" in Step-3, the Qt5 framework is NOT deployed in the application bundle.<br>
Then the directory name will be **`LW-qt5MP.pkg.macos-Catalina-release-RsysPsys`**, where
If you use the "-Y" option instead of the "-y" in Step-3, the Qt6 framework is NOT deployed in the application bundle.<br>
Then the directory name will be **`LW-qt6Brew.pkg.macos-Catalina-release-RsysPsys`**, where
* "LW-" means that this is a lightweight package.
#### If you build KLayout from the source code AND run it on the same machine, the "-Y" option is highly recommended.
### 6B. Fully MacPorts-flavored build with MacPorts Ruby 2.7 and MacPorts Python 3.8
0. Install MacPorts, then install Qt5, Ruby 2.7, and Python 3.8 by
0. Install MacPorts, then install Qt6, Ruby 2.7, and Python 3.8 by
```
$ sudo port install coreutils
$ sudo port install findutils
$ sudo port install qt5
$ sudo port install qt6
$ sudo port install qt6-qttools
$ sudo port install ruby27
$ sudo port install python38
$ sudo port install py38-pip
@ -210,67 +227,67 @@ $ sudo port install py38-pip
1. Invoke **`build4mac.py`** with the following options:
```
$ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5macports -r mp27 -p mp38
$ ./build4mac.py -q qt6macports -r mp27 -p mp38
```
2. Confirm successful build (it will take about one hour depending on your machine spec).
3. Run **`build4mac.py`** again with the same options used in 1. PLUS "-Y" to deploy executables and libraries under **`klayout.app`** bundle.<br>
The buddy command-line tools (strm*) will also be deployed in this step.
```
$ ./build4mac.py -q qt5macports -r mp27 -p mp38 -Y
$ ./build4mac.py -q qt6macports -r mp27 -p mp38 -Y
```
The application bundle **`klayout.app`** is located under:<br>
**`LW-qt5MP.pkg.macos-Catalina-release-Rmp27Pmp38`** directory, where
**`LW-qt6MP.pkg.macos-Catalina-release-Rmp27Pmp38`** directory, where
* "LW-" means that this is a lightweight package.
* "qt5MP" means that Qt5 from MacPorts is used.
* "qt6MP" means that Qt6 from MacPorts is used.
* "Rmp27Pmp38" means that Ruby is 2.7 from MacPorts; Python is 3.8 from MacPorts.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### 6C. Fully Homebrew-flavored build with Homebrew Ruby 2.7 and Homebrew Python 3.8
0. Install Homebrew, then install Qt5, Ruby 2.7, and Python 3.8 by
0. Install Homebrew, then install Qt6, Ruby 2.7, and Python 3.8 by
```
$ brew install qt@5
$ brew install qt6
$ brew install ruby@2.7
$ brew install python@3.8
```
1. Invoke **`build4mac.py`** with the following options: **((Notes))** These options are the default for Big Sur and Monterey.
```
$ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5brew -r hb27 -p hb38
$ ./build4mac.py -q qt6brew -r hb27 -p hb38
```
2. Confirm successful build (it will take about one hour depending on your machine spec).
3. Run **`build4mac.py`** again with the same options used in 1. PLUS "-Y" to deploy executables and libraries under **`klayout.app`** bundle.<br>
The buddy command-line tools (strm*) will also be deployed in this step.
```
$ ./build4mac.py -q qt5brew -r hb27 -p hb38 -Y
$ ./build4mac.py -q qt6brew -r hb27 -p hb38 -Y
```
The application bundle **`klayout.app`** is located under:<br>
**`LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phb38`** directory, where
**`LW-qt6Brew.pkg.macos-Catalina-release-Rhb27Phb38`** directory, where
* "LW-" means that this is a lightweight package.
* "qt5Brew" means that Qt5 from Homebrew is used.
* "qt6Brew" means that Qt6 from Homebrew is used.
* "Rhb27Phb38" means that Ruby is 2.7 from Homebrew; Python is 3.8 from Homebrew.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### 6D. Partially Homebrew-flavored build with System Ruby and Homebrew Python 3.8
0. Install Homebrew, then install Qt5 and Python 3.8 by
0. Install Homebrew, then install Qt6 and Python 3.8 by
```
$ brew install qt@5
$ brew install qt6
$ brew install python@3.8
```
1. Invoke **`build4mac.py`** with the following options:
```
$ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5brew -r sys -p hb38
$ ./build4mac.py -q qt6brew -r sys -p hb38
```
2. Confirm successful build (it will take about one hour depending on your machine spec).
3. Run **`build4mac.py`** again with the same options used in 1. PLUS "-y" to deploy executables and libraries (including Qt's framework and Python framework) under **`klayout.app`** bundle.<br>
The buddy command-line tools (strm*) will also be deployed in this step.
```
$ ./build4mac.py -q qt5brew -r sys -p hb38 -y
$ ./build4mac.py -q qt6brew -r sys -p hb38 -y
```
The application bundle **`klayout.app`** is located under:<br>
**`HW-qt5Brew.pkg.macos-Catalina-release-RsysPhb38`** directory, where
* "HW-" means that this is a heavyweight package because both Qt5 and Python Frameworks are deployed.
* "qt5Brew" means that Qt5 from Homebrew is used.
**`HW-qt6Brew.pkg.macos-Catalina-release-RsysPhb38`** directory, where
* "HW-" means that this is a heavyweight package because both Qt6 and Python Frameworks are deployed.
* "qt6Brew" means that Qt6 from Homebrew is used.
* "RsysPhb38" means that Ruby is OS-bundled; Python is 3.8 from Homebrew.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### Important
@ -321,14 +338,14 @@ makeDMG4mac.py -> macbuild/makeDMG4mac.py
2. Invoke **`makeDMG4mac.py`** with -p and -m options, for example,
```
$ cd /where/'build.sh'/exists
$ ./makeDMG4mac.py -p ST-qt5MP.pkg.macos-Catalina-release-RsysPsys -m
$ ./makeDMG4mac.py -p ST-qt6Brew.pkg.macos-Catalina-release-RsysPsys -m
```
This command will generate the two files below:<br>
* **`ST-klayout-0.27.4-macOS-Catalina-1-qt5MP-RsysPsys.dmg`** ---(1) the main DMG file
* **`ST-klayout-0.27.4-macOS-Catalina-1-qt5MP-RsysPsys.dmg.md5`** ---(2) MD5-value text file
* **`ST-klayout-0.27.5-macOS-Catalina-1-qt6Brew-RsysPsys.dmg`** ---(1) the main DMG file
* **`ST-klayout-0.27.5-macOS-Catalina-1-qt6Brew-RsysPsys.dmg.md5`** ---(2) MD5-value text file
# Known issues
Because we assume some specific versions of non-OS-standard Ruby and Python, updating MacPorts, Homebrew, or Anaconda3 may cause build- and link errors.<br>
Because we assume some specific versions of non-OS-standard Ruby and Python, updating Homebrew, MacPorts, or Anaconda3 may cause build- and link errors.<br>
In such cases, you need to update the dictionary contents of **`build4mac_env.py`**.
# Final comments

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

After

Width:  |  Height:  |  Size: 205 KiB

View File

@ -34,25 +34,28 @@ from build4mac_util import *
#-------------------------------------------------------------------------------
def GenerateUsage(platform):
if platform.upper() in [ "MONTEREY", "BIGSUR" ]: # with Xcode [13.1 .. ]
myQt5 = "qt5brew"
myQt65 = "qt6brew"
myRuby = "hb27"
myPython = "hb38"
moduleset = ('qt5Brew', 'HB27', 'HB38')
moduleset = ('qt6Brew', 'HB27', 'HB38')
else: # with Xcode [ .. 12.4]
myQt5 = "qt5macports"
myQt65 = "qt6brew"
myRuby = "sys"
myPython = "sys"
moduleset = ('qt5MP', 'Sys', 'Sys')
moduleset = ('qt6Brew', 'Sys', 'Sys')
usage = "\n"
usage += "---------------------------------------------------------------------------------------------------------\n"
usage += "<< Usage of 'build4mac.py' >>\n"
usage += " for building KLayout 0.27.4 or later on different Apple macOS / Mac OSX platforms.\n"
usage += " for building KLayout 0.27.5 or later on different Apple macOS / Mac OSX platforms.\n"
usage += "\n"
usage += "$ [python] ./build4mac.py\n"
usage += " option & argument : descriptions (refer to 'macbuild/build4mac_env.py' for details)| default value\n"
usage += " --------------------------------------------------------------------------------------+---------------\n"
usage += " [-q|--qt <type>] : case-insensitive type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3'] | %s \n" % myQt5
usage += " [-q|--qt <type>] : case-insensitive type=['Qt6MacPorts', 'Qt6Brew', | %s \n" % myQt65
usage += " : 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3'] | \n"
usage += " : Qt6MacPorts: use Qt6 from MacPorts | \n"
usage += " : Qt6Brew: use Qt6 from Homebrew | \n"
usage += " : Qt5MacPorts: use Qt5 from MacPorts | \n"
usage += " : Qt5Brew: use Qt5 from Homebrew | \n"
usage += " : Qt5Ana3: use Qt5 from Anaconda3 | \n"
@ -63,12 +66,13 @@ def GenerateUsage(platform):
usage += " : HB27: use Ruby 2.7 from Homebrew | \n"
usage += " : Ana3: use Ruby 2.5 from Anaconda3 | \n"
usage += " [-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | %s \n" % myPython
usage += " : 'HBAuto'] | \n"
usage += " : 'HB39', HBAuto'] | \n"
usage += " : nil: don't bind Python | \n"
usage += " : Sys: use OS-bundled Python 2.7 [ElCapitan -- Catalina] | \n"
usage += " : MP38: use Python 3.8 from MacPorts | \n"
usage += " : HB38: use Python 3.8 from Homebrew | \n"
usage += " : Ana3: use Python 3.8 from Anaconda3 | \n"
usage += " : HB39: use Python 3.9 from Homebrew | \n"
usage += " : HBAuto: use the latest Python 3.x auto-detected from Homebrew | \n"
usage += " [-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled\n"
usage += " [-u|--noqtuitools] : don't include uitools in Qt binding | disabled\n"
@ -129,7 +133,7 @@ def Get_Default_Config():
sys.exit(1)
if not Machine == "x86_64":
if Machine == "arm64" and (Platform == "Monterey" or Platform == "BigSur"): # with an Apple Silicon Chip
if Machine == "arm64" and Platform in ["Monterey", "BigSur"]: # with an Apple Silicon Chip
print("")
print( "### Your Mac equips an Apple Silicon Chip ###" )
print("")
@ -144,35 +148,35 @@ def Get_Default_Config():
# Set the default modules
if Platform == "Monterey":
ModuleQt = "Qt5Brew"
ModuleQt = "Qt6Brew"
ModuleRuby = "RubyMonterey"
ModulePython = "PythonMonterey"
elif Platform == "BigSur":
ModuleQt = "Qt5Brew"
ModuleQt = "Qt6Brew"
ModuleRuby = "RubyBigSur"
ModulePython = "PythonBigSur"
elif Platform == "Catalina":
ModuleQt = "Qt5MacPorts"
ModuleQt = "Qt6Brew"
ModuleRuby = "RubyCatalina"
ModulePython = "PythonCatalina"
elif Platform == "Mojave":
ModuleQt = "Qt5MacPorts"
ModuleQt = "Qt6Brew"
ModuleRuby = "RubyMojave"
ModulePython = "PythonMojave"
elif Platform == "HighSierra":
ModuleQt = "Qt5MacPorts"
ModuleQt = "Qt6Brew"
ModuleRuby = "RubyHighSierra"
ModulePython = "PythonHighSierra"
elif Platform == "Sierra":
ModuleQt = "Qt5MacPorts"
ModuleQt = "Qt6Brew"
ModuleRuby = "RubySierra"
ModulePython = "PythonSierra"
elif Platform == "ElCapitan":
ModuleQt = "Qt5MacPorts"
ModuleQt = "Qt6Brew"
ModuleRuby = "RubyElCapitan"
ModulePython = "PythonElCapitan"
else:
ModuleQt = "Qt5MacPorts"
ModuleQt = "Qt6Brew"
ModuleRuby = "nil"
ModulePython = "nil"
@ -253,7 +257,7 @@ def Parse_CLI_Args(config):
p = optparse.OptionParser(usage=Usage)
p.add_option( '-q', '--qt',
dest='type_qt',
help="Qt type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3']" )
help="Qt type=['Qt6MacPorts', 'Qt6Brew', 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3']" )
p.add_option( '-r', '--ruby',
dest='type_ruby',
@ -261,7 +265,7 @@ def Parse_CLI_Args(config):
p.add_option( '-p', '--python',
dest='type_python',
help="Python type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', 'HBAuto']" )
help="Python type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', 'HB39', 'HBAuto']" )
p.add_option( '-n', '--noqtbinding',
action='store_true',
@ -314,7 +318,7 @@ def Parse_CLI_Args(config):
help='check usage' )
if Platform.upper() in [ "MONTEREY", "BIGSUR" ]: # with Xcode [13.1 .. ]
p.set_defaults( type_qt = "qt5brew",
p.set_defaults( type_qt = "qt6brew",
type_ruby = "hb27",
type_python = "hb38",
no_qt_binding = False,
@ -327,7 +331,7 @@ def Parse_CLI_Args(config):
deploy_verbose = "1",
checkusage = False )
else: # with Xcode [ .. 12.4]
p.set_defaults( type_qt = "qt5macports",
p.set_defaults( type_qt = "qt6brew",
type_ruby = "sys",
type_python = "sys",
no_qt_binding = False,
@ -347,6 +351,8 @@ def Parse_CLI_Args(config):
# (A) Determine the Qt type
candidates = dict()
candidates['QT6MACPORTS'] = 'Qt6MacPorts'
candidates['QT6BREW'] = 'Qt6Brew'
candidates['QT5MACPORTS'] = 'Qt5MacPorts'
candidates['QT5BREW'] = 'Qt5Brew'
candidates['QT5ANA3'] = 'Qt5Ana3'
@ -361,12 +367,16 @@ def Parse_CLI_Args(config):
(opt.type_qt, list(candidates.keys())), file=sys.stderr )
print(Usage)
sys.exit(1)
elif ModuleQt == "Qt6MacPorts":
choiceQt65 = 'qt6MP'
elif ModuleQt == "Qt6Brew":
choiceQt65 = 'qt6Brew'
elif ModuleQt == "Qt5MacPorts":
choiceQt5 = 'qt5MP'
choiceQt65 = 'qt5MP'
elif ModuleQt == "Qt5Brew":
choiceQt5 = 'qt5Brew'
choiceQt65 = 'qt5Brew'
elif ModuleQt == "Qt5Ana3":
choiceQt5 = 'qt5Ana3'
choiceQt65 = 'qt5Ana3'
# By default, OS-standard (-bundled) script languages (Ruby and Python) are used
NonOSStdLang = False
@ -426,6 +436,7 @@ def Parse_CLI_Args(config):
candidates['MP38'] = 'MP38'
candidates['HB38'] = 'HB38'
candidates['ANA3'] = 'Ana3'
candidates['HB39'] = 'HB39'
candidates['HBAUTO'] = 'HBAuto'
try:
choicePython = candidates[ opt.type_python.upper() ]
@ -460,6 +471,9 @@ def Parse_CLI_Args(config):
elif choicePython == "Ana3":
ModulePython = 'PythonAnaconda3'
NonOSStdLang = True
elif choicePython == "HB39":
ModulePython = 'Python39Brew'
NonOSStdLang = True
elif choicePython == "HBAuto":
ModulePython = 'PythonAutoBrew'
NonOSStdLang = True
@ -471,7 +485,7 @@ def Parse_CLI_Args(config):
sys.exit(1)
# (D) Set of modules chosen
ModuleSet = ( choiceQt5, choiceRuby, choicePython )
ModuleSet = ( choiceQt65, choiceRuby, choicePython )
NoQtBindings = opt.no_qt_binding
NoQtUiTools = opt.no_qt_uitools
@ -504,14 +518,14 @@ def Parse_CLI_Args(config):
message = "### You are going to make "
if DeploymentP:
PackagePrefix = "LW-"
message += "a lightweight (LW-) package excluding Qt5, Ruby, and Python..."
message += "a lightweight (LW-) package excluding Qt[6|5], Ruby, and Python..."
elif DeploymentF:
if (ModuleRuby in RubySys) and (ModulePython in PythonSys):
PackagePrefix = "ST-"
message += "a standard (ST-) package including Qt5 and using OS-bundled Ruby and Python..."
elif ModulePython == 'Python38Brew' or ModulePython == 'PythonAutoBrew':
message += "a standard (ST-) package including Qt[6|5] and using OS-bundled Ruby and Python..."
elif ModulePython in ['Python38Brew', 'Python39Brew', 'PythonAutoBrew']:
PackagePrefix = "HW-"
message += "a heavyweight (HW-) package including Qt5 and Python3.8~ from Homebrew..."
message += "a heavyweight (HW-) package including Qt[6|5] and Python3.8~ from Homebrew..."
else:
PackagePrefix = "EX-"
message += "a package with exceptional (EX-) combinations of different modules..."
@ -584,7 +598,7 @@ def Get_Build_Parameters(config):
mode = "release"
# (B) Modules
(qt, ruby, python) = ModuleSet # ( 'qt5MP', 'Sys', 'Sys' )
(qt, ruby, python) = ModuleSet # ( 'qt6Brew', 'Sys', 'Sys' )
ruby_python = "R%sP%s" % ( ruby.lower(), python.lower() )
# (C) Target directories and files
@ -595,8 +609,14 @@ def Get_Build_Parameters(config):
MacBuildDirQAT = MacBuildDir + ".macQAT"
parameters['logfile'] = MacBuildLog
# (D) Qt5
if ModuleQt == 'Qt5MacPorts':
# (D) Qt6|5
if ModuleQt == 'Qt6MacPorts':
parameters['qmake'] = Qt6MacPorts['qmake']
parameters['deploy_tool'] = Qt6MacPorts['deploy']
elif ModuleQt == 'Qt6Brew':
parameters['qmake'] = Qt6Brew['qmake']
parameters['deploy_tool'] = Qt6Brew['deploy']
elif ModuleQt == 'Qt5MacPorts':
parameters['qmake'] = Qt5MacPorts['qmake']
parameters['deploy_tool'] = Qt5MacPorts['deploy']
elif ModuleQt == 'Qt5Brew':
@ -606,6 +626,7 @@ def Get_Build_Parameters(config):
parameters['qmake'] = Qt5Ana3['qmake']
parameters['deploy_tool'] = Qt5Ana3['deploy']
parameters['bin'] = MacBinDir
parameters['build'] = MacBuildDir
parameters['rpath'] = "@executable_path/../Frameworks"
@ -668,8 +689,10 @@ def Run_Build_Command(parameters):
# (C) Target directories and files
MacBuildDirQAT = parameters['build'] + ".macQAT"
# (D) Qt5
cmd_args += " \\\n -qt5"
# (D) Qt[6|5]
# '-qt6' is not yet supported as of 2021-11-27
# Passing '-qt5' with the Qt6 environments looks conflict
#cmd_args += " \\\n -qt5"
cmd_args += " \\\n -qmake %s" % parameters['qmake']
cmd_args += " \\\n -bin %s" % parameters['bin']
cmd_args += " \\\n -build %s" % parameters['build']
@ -1228,18 +1251,15 @@ def Deploy_Binaries_For_Bundle(config, parameters):
#----------------------------------------------------------------------------------
# Typical usage of 'pip' after installation of the DMG package
#
# $ /Applications/klayout.app/Contents/MacOS/start-console.py
# Warning: Populating font family aliases took 195 ms. Replace uses of missing font\
# family "Monospace" with one that exists to avoid this cost.
# Python 3.7.8 (default, Jul 4 2020, 10:17:17)
# [Clang 11.0.3 (clang-1103.0.32.62)] on darwin
# $ cd /Applications/klayout.app/Contents/MacOS/
# $ ./start-console.py
#
# Python 3.8.12 (default, Oct 13 2021, 06:42:19)
# [Clang 12.0.0 (clang-1200.0.32.29)] on darwin
# Type "help", "copyright", "credits" or "license" for more information.
# (KLayout Python Console)
# >>> import pip
# >>> pip.main( ['install', 'numpy'] )
# >>> pip.main( ['install', 'scipy'] )
# >>> pip.main( ['install', 'pandas'] )
# >>> pip.main( ['install', 'matplotlib'] )
# >>> pip.main( ['install', 'numpy', 'scipy', 'pandas', 'matplotlib'] )
#----------------------------------------------------------------------------------
pip_module = "%s/Versions/%s/lib/python%s/site-packages/pip/__init__.py" % \
(pythonFrameworkPath, pythonHBVer, pythonHBVer)
@ -1276,7 +1296,7 @@ def Deploy_Binaries_For_Bundle(config, parameters):
print( " Ruby2.7 from Homebrew is not yet supported." )
print( " Since you have Homebrew development environment, there two options:" )
print( " (1) Retry to make a package with '-Y|--DEPLOY' option." )
print( " This will not deploy any of Qt5, Python, and Ruby from Homebrew." )
print( " This will not deploy any of Qt[6|5], Python, and Ruby from Homebrew." )
print( " Instead, the package will directly use those Frameworks and libraries" )
print( " in your Homebrew environment." )
print( " (2) Rebuild KLayout with '-r|--ruby <nil|Sys>' option depending on your preference." )

View File

@ -32,22 +32,40 @@ else:
del System, Node, Release, MacVersion, Machine, Processor
#-----------------------------------------------------
# [1] Qt
# [1] Qt6 or Qt5
#-----------------------------------------------------
Qts = [ 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3' ]
Qts = [ 'Qt6MacPorts', 'Qt6Brew' ]
Qts += [ 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3' ]
#-----------------------------------------------------
# Whereabout of different components of Qt6
#-----------------------------------------------------
# Qt6 from MacPorts (https://www.macports.org/)
# install with 'sudo port install [qt6|qt6-qttools]'
# [Key Type Name] = 'Qt6MacPorts'
Qt6MacPorts = { 'qmake' : '/opt/local/libexec/qt6/bin/qmake',
'deploy': '/opt/local/libexec/qt6/bin/macdeployqt'
}
# Qt6 from Homebrew (https://brew.sh/)
# install with 'brew install qt6'
# [Key Type Name] = 'Qt6Brew'
Qt6Brew = { 'qmake' : '%s/opt/qt@6/bin/qmake' % DefaultHomebrewRoot,
'deploy': '%s/opt/qt@6/bin/macdeployqt' % DefaultHomebrewRoot
}
#-----------------------------------------------------
# Whereabout of different components of Qt5
#-----------------------------------------------------
# Qt5 from MacPorts (https://www.macports.org/)
# install with 'sudo port install qt5'
# install with 'sudo port install [qt5|qt5-qttools]'
# [Key Type Name] = 'Qt5MacPorts'
Qt5MacPorts = { 'qmake' : '/opt/local/libexec/qt5/bin/qmake',
'deploy': '/opt/local/libexec/qt5/bin/macdeployqt'
}
# Qt5 from Homebrew (https://brew.sh/)
# install with 'brew install qt'
# install with 'brew install qt5'
# [Key Type Name] = 'Qt5Brew'
Qt5Brew = { 'qmake' : '%s/opt/qt@5/bin/qmake' % DefaultHomebrewRoot,
'deploy': '%s/opt/qt@5/bin/macdeployqt' % DefaultHomebrewRoot
@ -203,7 +221,7 @@ RubyDictionary = { 'nil' : None,
PythonNil = [ 'nil' ]
PythonSys = [ 'PythonElCapitan', 'PythonSierra', 'PythonHighSierra', 'PythonMojave' ]
PythonSys += [ 'PythonCatalina', 'PythonBigSur', 'PythonMonterey' ]
PythonExt = [ 'Python38MacPorts', 'Python38Brew', 'PythonAnaconda3', 'PythonAutoBrew' ]
PythonExt = [ 'Python38MacPorts', 'Python38Brew', 'Python39Brew', 'PythonAnaconda3', 'PythonAutoBrew' ]
Pythons = PythonNil + PythonSys + PythonExt
#-----------------------------------------------------
@ -282,7 +300,7 @@ Python38MacPorts= { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versi
}
# Python 3.8 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
# install with 'brew install python'
# install with 'brew install python@3.8'
# [Key Type Name] = 'HB38'
HBPython38FrameworkPath = '%s/opt/python@3.8/Frameworks/Python.framework' % DefaultHomebrewRoot
Python38Brew = { 'exe': '%s/Versions/3.8/bin/python3.8' % HBPython38FrameworkPath,
@ -290,6 +308,15 @@ Python38Brew = { 'exe': '%s/Versions/3.8/bin/python3.8' % HBPython38Framework
'lib': '%s/Versions/3.8/lib/libpython3.8.dylib' % HBPython38FrameworkPath
}
# Python 3.9 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
# install with 'brew install python@3.9'
# [Key Type Name] = 'HB39'
HBPython39FrameworkPath = '%s/opt/python@3.9/Frameworks/Python.framework' % DefaultHomebrewRoot
Python39Brew = { 'exe': '%s/Versions/3.9/bin/python3.9' % HBPython39FrameworkPath,
'inc': '%s/Versions/3.9/include/python3.9' % HBPython39FrameworkPath,
'lib': '%s/Versions/3.9/lib/libpython3.9.dylib' % HBPython39FrameworkPath
}
# Python 3.8 bundled with anaconda3 installed under /Applications/anaconda3/ *+*+*+ EXPERIMENTAL *+*+*+
# The standard installation deploys the tool under $HOME/opt/anaconda3/.
# If so, you need to make a symbolic link: /Applications/anaconda3 ---> $HOME/opt/anaconda3/
@ -332,6 +359,7 @@ PythonDictionary = { 'nil' : None,
'PythonMonterey' : PythonMonterey,
'Python38MacPorts': Python38MacPorts,
'Python38Brew' : Python38Brew,
'Python39Brew' : Python39Brew,
'PythonAnaconda3' : PythonAnaconda3
}
if _have_Homebrew_Python:

View File

@ -77,13 +77,13 @@ def SetGlobals():
Usage = "\n"
Usage += "---------------------------------------------------------------------------------------------------------\n"
Usage += "<< Usage of 'makeDMG4mac.py' >>\n"
Usage += " for making a DMG file of KLayout 0.27.4 or later on different Apple macOS / Mac OSX platforms.\n"
Usage += " for making a DMG file of KLayout 0.27.5 or later on different Apple macOS / Mac OSX platforms.\n"
Usage += "\n"
Usage += "$ [python] ./makeDMG4mac.py\n"
Usage += " option & argument : descriptions | default value\n"
Usage += " ----------------------------------------------------------------------------------+-----------------\n"
Usage += " <-p|--pkg <dir>> : package directory created by `build4mac.py` with [-y|-Y] | ``\n"
Usage += " : like 'ST-qt5MP.pkg.macos-Catalina-release-RsysPsys' | \n"
Usage += " : like 'ST-qt6MP.pkg.macos-Catalina-release-RsysPsys' | \n"
Usage += " <-c|--clean> : clean the work directory | disabled\n"
Usage += " <-m|--make> : make a compressed DMG file | disabled\n"
Usage += " : <-c|--clean> and <-m|--make> are mutually exclusive | \n"
@ -137,7 +137,7 @@ def SetGlobals():
sys.exit(1)
if not Machine == "x86_64":
if Machine == "arm64" and (Platform == "Monterey" or Platform == "BigSur"): # with an Apple Silicon Chip
if Machine == "arm64" and Platform in ["Monterey", "BigSur"]: # with an Apple Silicon Chip
print("")
print( "### Your Mac equips an Apple Silicon Chip ###" )
print("")
@ -195,13 +195,17 @@ def SetGlobals():
## To check the contents of the package directory
#
# The package directory name should look like:
# * ST-qt5MP.pkg.macos-Catalina-release-RsysPsys --- (1)
# * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3
# * LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phb38
# * ST-qt6MP.pkg.macos-Catalina-release-RsysPsys --- (1)
# * LW-qt6MP.pkg.macos-Catalina-release-Rmp27Pmp38
# * LW-qt6Brew.pkg.macos-Catalina-release-Rhb27Phb38
#
# * ST-qt5MP.pkg.macos-Catalina-release-RsysPsys
# * LW-qt5MP.pkg.macos-Catalina-release-Rmp27Pmp38
# * LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phb38
# * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3
#
# Generated DMG will be, for example,
# (1) ---> ST-klayout-0.26.1-macOS-Catalina-1-qt5MP-RsysPsys.dmg
# (1) ---> ST-klayout-0.27.5-macOS-Catalina-1-qt6MP-RsysPsys.dmg
#
# @return on success, positive integer in [MB] that tells approx. occupied disc space;
# on failure, -1
@ -238,14 +242,18 @@ def CheckPkgDirectory():
#-----------------------------------------------------------------------------
# [2] Identify (Qt, Ruby, Python) from PkgDir
# * ST-qt6MP.pkg.macos-Catalina-release-RsysPsys
# * LW-qt6MP.pkg.macos-Catalina-release-Rmp27Pmp38
# * LW-qt6Brew.pkg.macos-Catalina-release-Rhb27Phb38
#
# * ST-qt5MP.pkg.macos-Catalina-release-RsysPsys
# * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3
# * LW-qt5MP.pkg.macos-Catalina-release-Rmp27Pmp38
# * LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phb38
# * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3
# * HW-qt5Brew.pkg.macos-Catalina-release-RsysPhb38
# * EX-qt5MP.pkg.macos-Catalina-release-Rmp27Pmp38
#-----------------------------------------------------------------------------
patQRP = u'(ST|LW|HW|EX)([-])(qt5[0-9A-Za-z]+)([.]pkg[.])([A-Za-z]+[-][A-Za-z]+[-]release[-])([0-9A-Za-z]+)'
patQRP = u'(ST|LW|HW|EX)([-])([qt6|qt5][0-9A-Za-z]+)([.]pkg[.])([A-Za-z]+[-][A-Za-z]+[-]release[-])([0-9A-Za-z]+)'
regQRP = re.compile(patQRP)
if not regQRP.match(PkgDir):
print( "! Cannot identify (Qt, Ruby, Python) from the package directory name" )
@ -265,18 +273,18 @@ def CheckPkgDirectory():
#-----------------------------------------------------------------------------
LatestOSMacPorts = Platform == LatestOS
LatestOSMacPorts &= PackagePrefix == "LW"
LatestOSMacPorts &= QtIdentification == "qt5MP"
LatestOSMacPorts &= RubyPythonID == "Rmp27Pmp38"
LatestOSMacPorts &= QtIdentification in ["qt6MP", "qt5MP"]
LatestOSMacPorts &= RubyPythonID in ["Rmp27Pmp38"]
LatestOSHomebrew = Platform == LatestOS
LatestOSHomebrew &= PackagePrefix == "LW"
LatestOSHomebrew &= QtIdentification == "qt5Brew"
LatestOSHomebrew &= RubyPythonID == "Rhb27Phb38" or RubyPythonID == "Rhb27Phbauto"
LatestOSHomebrew &= QtIdentification in ["qt6Brew", "qt5Brew"]
LatestOSHomebrew &= RubyPythonID in ["Rhb27Phb38", "Rhb27Phb39", "Rhb27Phbauto"]
LatestOSAnaconda3 = Platform == LatestOS
LatestOSAnaconda3 &= PackagePrefix == "LW"
LatestOSAnaconda3 &= QtIdentification == "qt5Ana3"
LatestOSAnaconda3 &= RubyPythonID == "Rana3Pana3"
LatestOSAnaconda3 &= QtIdentification in ["qt5Ana3"]
LatestOSAnaconda3 &= RubyPythonID in ["Rana3Pana3"]
if LatestOSMacPorts:
mydic = DicLightWeight["ports"]

View File

@ -7,13 +7,14 @@
# framework is based on a C++ parser and a configuration file that specifies details
# about the translation.
#
# By default, the script will take the Qt headers from /opt/qt/4.6.3 and /opt/qt/5.5.1
# for Qt4 and Qt5 respectively.
# By default, the script will take the Qt headers from /opt/qt/4.6.3, /opt/qt/5.5.1
# and /opt/qt/6.2.1 for Qt4, Qt5 and Qt6 respectively.
#
# Call it from project level as
#
# ./scripts/mkqtdecl.sh -update # Qt4
# ./scripts/mkqtdecl.sh -update -qt5 # Qt5
# ./scripts/mkqtdecl.sh -update -qt6 # Qt6
#
# For more options see
#
@ -43,14 +44,18 @@ diff=0
reuse=0
qt="/opt/qt/4.6.3/include"
qt5="/opt/qt/5.5.1/include"
qt6="/opt/qt/6.2.1/include"
inst_dir_common=`pwd`/scripts/mkqtdecl_common
inst_dir4=`pwd`/scripts/mkqtdecl4
inst_dir5=`pwd`/scripts/mkqtdecl5
inst_dir6=`pwd`/scripts/mkqtdecl6
src_dir=`pwd`/src
src_name4=gsiqt/qt4
src_name5=gsiqt/qt5
src_name6=gsiqt/qt6
qt_mods4="QtCore QtGui QtDesigner QtNetwork QtSql QtXml QtUiTools"
qt_mods5="QtCore QtGui QtWidgets QtDesigner QtNetwork QtPrintSupport QtSql QtSvg QtXml QtXmlPatterns QtMultimedia QtUiTools"
qt_mods6="QtCore QtGui QtWidgets QtNetwork QtPrintSupport QtSql QtSvg QtXml QtMultimedia QtUiTools QtCore5Compat"
src_name=$src_name4
inst_dir=$inst_dir4
@ -73,6 +78,7 @@ while [ "$1" != "" ]; do
echo " mkqtdecl.sh -diff Show differences - don't produce and don't synchronize"
echo " mkqtdecl.sh -qt path_to_include Use the specified include path"
echo " mkqtdecl.sh -qt5 Use setup for Qt 5.x (use before -qt)"
echo " mkqtdecl.sh -qt6 Use setup for Qt 6.x (use before -qt)"
echo " mkqtdecl.sh -reuse Don't parse C++ container again"
exit 0
;;
@ -102,6 +108,13 @@ while [ "$1" != "" ]; do
qt_mods="$qt_mods5"
src_name="$src_name5"
;;
-qt6)
qt="$qt6"
work_dir="mkqtdecl6.tmp"
inst_dir="$inst_dir6"
qt_mods="$qt_mods6"
src_name="$src_name6"
;;
*)
echo "*** ERROR: unknown command option $a"
exit 1
@ -181,7 +194,7 @@ if [ $update != 0 ]; then
echo "Running gcc preprocessor .."
# By using -D_GCC_LIMITS_H_ we make the gcc not include constants such as ULONG_MAX which will
# remain as such. This way the generated code is more generic.
gcc -std=gnu++98 -I$qt -fPIC -D_GCC_LIMITS_H_ -E -o allofqt.x allofqt.cpp
gcc -std=c++17 -I$qt -fPIC -D_GCC_LIMITS_H_ -E -o allofqt.x allofqt.cpp
echo "Stripping hash lines .."
egrep -v '^#' <allofqt.x >allofqt.e

View File

@ -165,10 +165,30 @@ drop_class "QtGlobal"
drop_class "QThreadStorage"
drop_class "QThreadStorageData"
drop_class "QtMsgHandler"
drop_class "QtMsgType"
drop_class "QtPlugin"
drop_class "QtPluginInstanceFunction"
drop_class "QtPrivate"
drop_class "QtSharedPointer"
drop_class "QtValidLicenseForActiveQtModule"
drop_class "QtValidLicenseForCoreModule"
drop_class "QtValidLicenseForDBusModule"
drop_class "QtValidLicenseForDeclarativeModule"
drop_class "QtValidLicenseForGuiModule"
drop_class "QtValidLicenseForHelpModule"
drop_class "QtValidLicenseForMultimediaModule"
drop_class "QtValidLicenseForNetworkModule"
drop_class "QtValidLicenseForOpenGLModule"
drop_class "QtValidLicenseForOpenVGModule"
drop_class "QtValidLicenseForQt3SupportLightModule"
drop_class "QtValidLicenseForQt3SupportModule"
drop_class "QtValidLicenseForScriptModule"
drop_class "QtValidLicenseForScriptToolsModule"
drop_class "QtValidLicenseForSqlModule"
drop_class "QtValidLicenseForSvgModule"
drop_class "QtValidLicenseForTestModule"
drop_class "QtValidLicenseForXmlModule"
drop_class "QtValidLicenseForXmlPatternsModule"
drop_class "QTypeInfo"
drop_class "QUuid"
drop_class "QUpdateLaterEvent"
@ -229,7 +249,7 @@ drop_method "QObject", /QObject::userData/ # QObjectUserData not available
drop_method "QChildEvent", /QChildEvent::child/ # provided through a special implementation
drop_method "QFile", /QFile::setDecodingFunction/ # uses callbacks
drop_method "QFile", /QFile::setEncodingFunction/ # uses callbacks
drop_method "QFile", /QFile::open.*IO_FILE/ # uses internal struct
drop_method "QFile", /QFile::open.*FILE/ # uses internal struct
drop_method "QPrinter", /QPrinter::printerSelectionOption/ # not available on WIN
drop_method "QPrinter", /QPrinter::setPrinterSelectionOption/ # not available on WIN
drop_method "QSessionManager", /QSessionManager::handle/ # not available on WIN
@ -263,8 +283,8 @@ drop_method "QFile", /QFile::decodeName\(const\s+QByteArray/ # clashes with cons
drop_method "QTemporaryFile", /QTemporaryFile::open\(int/ # unsupported file descriptor
drop_method "QTextStream", /QTextStream::QTextStream\(QByteArray/ # clashes with QString variant
drop_method "QTextStream", /QTextStream::QTextStream\(const\s*QByteArray/ # clashes with QString variant
drop_method "QTextStream", /QTextStream::QTextStream\(.*_IO_FILE/ # unsupported IO_FILE
drop_method "QTextStream", /QTextStream::QTextStream\(.*_IO_FILE/ # unsupported IO_FILE
drop_method "QTextStream", /QTextStream::QTextStream\(.*FILE/ # unsupported FILE
drop_method "QTextStream", /QTextStream::QTextStream\(.*FILE/ # unsupported FILE
drop_method "", /::operator\s*>>\(QTextStream\s*&/ # implemented through read
drop_method "", /::operator\s*<<\(QTextStream\s*&/ # implemented through put
drop_method "QTextStream", /::operator\s*>>/ # implemented through read
@ -475,6 +495,8 @@ drop_class "QWSServer"
drop_class "QWSWindow"
# depedencies from operators are not derived automatically currently:
include "QPolygon", [ "<QTransform>", "<QMatrix>" ]
include "QPolygonF", [ "<QTransform>", "<QMatrix>" ]
include "QPoint", [ "<QPoint>", "<QMatrix>", "<QMatrix4x4>" ]
include "QPointF", [ "<QPointF>", "<QMatrix>", "<QMatrix4x4>" ]
include "QVector3D", [ "<QVector3D>", "<QVector2D>", "<QMatrix4x4>" ]

View File

@ -30,6 +30,9 @@ drop_method :all_classes, /::qt_check_for_QOBJECT_macro/ # don't include in API!
drop_method :all_classes, /::devType\(/ # not required
drop_method :all_classes, /::data_ptr/ # no private data
drop_method :all_classes, /::x11/ # no X11 stuff
drop_method :all_classes, /\(.*&&.*\)/ # no move semantics
drop_method :all_classes, /.*\s+&&$/ # no move semantics
drop_method :all_classes, /\(.*std::initializer_list.*\)/ # no brace initialization
rename :all_classes, /::create\(/, "qt_create" # clashes with GSI/Ruby
rename :all_classes, /::destroy\(/, "qt_destroy" # clashes with GSI/Ruby
@ -201,6 +204,7 @@ drop_class "QtGlobal"
drop_class "QThreadStorage"
drop_class "QThreadStorageData"
drop_class "QtMsgHandler"
drop_class "QtMsgType"
drop_class "QtPlugin"
drop_class "QtPluginInstanceFunction"
drop_class "QtPrivate"
@ -223,6 +227,9 @@ drop_class "QVectorIterator"
drop_class "QVectorTypedData"
drop_enum_const "QEvent", /CocoaRequestModal/ # not available on WIN
drop_method "QMetaType", /QMetaType::staticMetaObject/ # not available
drop_method "QMetaType", /QMetaType::registerNormalizedType/ # needs function ptrs.
drop_method "QCollator", /QCollator::compare\(.*QStringRef/ # clashes with QString version
drop_method "QLocale", /QLocale::(toDouble|toFloat|toInt|toLongLong|toShort|quoteString|toUInt|toULongLong|toUShort)\(.*QStringRef/ # clashes with QString version
drop_method "QRegularExpression", /QRegularExpression::(match|globalMatch)\(.*QStringRef/ # clashes with QString version
@ -289,7 +296,7 @@ drop_method "QObject", /QObject::setUserData/ # QObjectUserData not available
drop_method "QObject", /QObject::userData/ # QObjectUserData not available
drop_method "QFile", /QFile::setDecodingFunction/ # uses callbacks
drop_method "QFile", /QFile::setEncodingFunction/ # uses callbacks
drop_method "QFile", /QFile::open.*IO_FILE/ # uses internal struct
drop_method "QFile", /QFile::open.*FILE/ # uses internal struct
drop_method "QFileInfo", /QFileInfo::QFileInfo\(QFileInfoPrivate\s+\*/ # uses internal struct
drop_method "QPrinter", /QPrinter::printerSelectionOption/ # not available on WIN
drop_method "QPrinter", /QPrinter::setPrinterSelectionOption/ # not available on WIN
@ -330,8 +337,8 @@ drop_method "QFile", /QFile::decodeName\(const\s+QByteArray/ # clashes with cons
drop_method "QTemporaryFile", /QTemporaryFile::open\(int/ # unsupported file descriptor
drop_method "QTextStream", /QTextStream::QTextStream\(QByteArray/ # clashes with QString variant
drop_method "QTextStream", /QTextStream::QTextStream\(const\s*QByteArray/ # clashes with QString variant
drop_method "QTextStream", /QTextStream::QTextStream\(.*_IO_FILE/ # unsupported IO_FILE
drop_method "QTextStream", /QTextStream::QTextStream\(.*_IO_FILE/ # unsupported IO_FILE
drop_method "QTextStream", /QTextStream::QTextStream\(.*FILE/ # unsupported FILE
drop_method "QTextStream", /QTextStream::QTextStream\(.*FILE/ # unsupported FILE
drop_method "", /::operator\s*>>\(QTextStream\s*&/ # implemented through read
drop_method "", /::operator\s*<<\(QTextStream\s*&/ # implemented through put
drop_method "QTextStream", /::operator\s*>>/ # implemented through read
@ -637,11 +644,11 @@ include "QVector3D", [ "<QVector3D>", "<QVector2D>", "<QMatrix4x4>" ]
include "QVector4D", [ "<QVector4D>", "<QVector2D>", "<QMatrix4x4>" ]
include "QAction", [ "<QAction>", "<QGraphicsWidget>", "<QMenu>" ]
include "QCursor", [ "<QCursor>", "<QScreen>", "<QBitmap>" ]
include "QGraphicsItem", [ "<QGraphicsItem>", "<QGraphicsTransform>", "<QGraphicsScene>", "<QStyleOptionGraphicsItem>", "<QGraphicsEffect>", "<QGraphicsWidget>", "<QGraphicsSceneContextMenuEvent>", "<QGraphicsSceneDragDropEvent>", "<QGraphicsSceneHoverEvent>", "<QGraphicsSceneMouseEvent>", "<QGraphicsSceneWheelEvent>" ]
include "QGraphicsItem", [ "<QGraphicsItem>", "<QGraphicsTransform>", "<QGraphicsScene>", "<QStyleOptionGraphicsItem>", "<QGraphicsEffect>", "<QGraphicsWidget>", "<QGraphicsSceneContextMenuEvent>", "<QGraphicsSceneDragDropEvent>", "<QGraphicsSceneHoverEvent>", "<QGraphicsSceneMouseEvent>", "<QGraphicsSceneWheelEvent>", "<QPainter>" ]
include "QGraphicsScene", [ "<QGraphicsScene>", "<QGraphicsView>", "<QGraphicsItem>", "<QGraphicsWidget>", "<QGraphicsEllipseItem>", "<QGraphicsLineItem>", "<QGraphicsPathItem>", "<QGraphicsPixmapItem>", "<QGraphicsPolygonItem>", "<QGraphicsRectItem>", "<QGraphicsSimpleTextItem>", "<QGraphicsTextItem>", "<QGraphicsProxyWidget>", "<QGraphicsItemGroup>", "<QStyle>", "<QGraphicsSceneContextMenuEvent>", "<QGraphicsSceneDragDropEvent>", "<QGraphicsSceneHelpEvent>", "<QGraphicsSceneMouseEvent>", "<QGraphicsSceneWheelEvent>" ]
include "QGuiApplication", [ "<QGuiApplication>", "<QScreen>", "<QSessionManager>", "<QClipboard>", "<QWindow>", "<QStyleHints>" ]
include "QGuiApplication", [ "<QGuiApplication>", "<QScreen>", "<QSessionManager>", "<QClipboard>", "<QWindow>", "<QStyleHints>", "<QFont>", "<QPalette>" ]
include "QApplication", [ "<QApplication>", "<QSessionManager>", "<QDesktopWidget>", "<QStyle>", "<QWindow>", "<QScreen>" ]
include "QWindow", [ "<QWindow>", "<QScreen>" ]
include "QWindow", [ "<QWindow>", "<QScreen>", "<QAccessibleInterface>" ]
include "QOffscreenSurface", [ "<QOffscreenSurface>", "<QScreen>" ]
include "QScreenOrientationChangeEvent", [ "<QScreenOrientationChangeEvent>", "<QScreen>" ]
@ -861,7 +868,7 @@ no_copy_ctor "QIconEngine"
# QtXml
include "QXmlFormatter", [ "<QXmlFormatter>", "<QXmlQuery>" ]
include "QXmlSerializer", [ "<QXmlSerializer>", "<QXmlQuery>" ]
include "QXmlSerializer", [ "<QXmlSerializer>", "<QXmlQuery>", "<QTextCodec>" ]
no_imports "QXmlStreamAttributes" # base class is a template.
@ -994,7 +1001,7 @@ final_class "QFormBuilder" # requires a lot of Dom* classes
include "QCamera", [ "<QCamera>", "<QVideoWidget>", "<QGraphicsVideoItem>", "<QAbstractVideoSurface>", "<QCameraInfo>" ]
include "QAudioBuffer", [ "<QAudioBuffer>" ]
include "QBackingStore", [ "<QBackingStore>" ]
include "QMediaPlayer", [ "<QMediaPlayer>", "<QVideoWidget>", "<QGraphicsVideoItem>", "<QMediaPlaylist>", "<QAbstractVideoSurface>" ]
include "QMediaPlayer", [ "<QMediaPlayer>", "<QVideoWidget>", "<QGraphicsVideoItem>", "<QMediaPlaylist>", "<QAbstractVideoSurface>", "<QMediaService>" ]
drop_class "QAudioBuffer", /StereoFrameDefault/
drop_class "QAudioBuffer", /StereoFrame/

View File

@ -0,0 +1,357 @@
#include <QtCore/QAbstractAnimation>
#include <QtCore/QAbstractEventDispatcher>
#include <QtCore/QAbstractItemModel>
#include <QtCore/QAbstractListModel>
#include <QtCore/QAbstractNativeEventFilter>
#include <QtCore/QAbstractProxyModel>
#include <QtCore/QAbstractTableModel>
#include <QtCore/QAdoptSharedDataTag>
#include <QtCore/QAnimationDriver>
#include <QtCore/QAnimationGroup>
#include <QtCore/QAnyStringView>
#include <QtCore/QArgument>
#include <QtCore/QArrayData>
#include <QtCore/QArrayDataPointer>
#include <QtCore/QAssociativeConstIterator>
#include <QtCore/QAssociativeIterable>
#include <QtCore/QAssociativeIterator>
#include <QtCore/QAtomicInt>
#include <QtCore/QAtomicInteger>
#include <QtCore/QAtomicPointer>
#include <QtCore/QBaseIterator>
#include <QtCore/QBasicMutex>
#include <QtCore/QBasicTimer>
#include <QtCore/QBasicUtf8StringView>
#include <QtCore/QBEInteger>
#include <QtCore/QBigEndianStorageType>
#include <QtCore/QBindable>
#include <QtCore/QBindingStatus>
#include <QtCore/QBindingStorage>
#include <QtCore/QBitArray>
#include <QtCore/QBitRef>
#include <QtCore/QBuffer>
#include <QtCore/QByteArray>
#include <QtCore/QByteArrayAlgorithms>
#include <QtCore/QByteArrayList>
#include <QtCore/QByteArrayListIterator>
#include <QtCore/QByteArrayMatcher>
#include <QtCore/QByteArrayView>
#include <QtCore/QCache>
#include <QtCore/QCalendar>
#include <QtCore/QCborArray>
#include <QtCore/QCborError>
#include <QtCore/QCborMap>
#include <QtCore/QCborParserError>
#include <QtCore/QCborStreamReader>
#include <QtCore/QCborStreamWriter>
#include <QtCore/QCborValue>
#include <QtCore/QCborValueRef>
#include <QtCore/QChar>
#include <QtCore/QChildEvent>
#include <QtCore/QCollator>
#include <QtCore/QCollatorSortKey>
#include <QtCore/QCommandLineOption>
#include <QtCore/QCommandLineParser>
#include <QtCore/QConcatenateTablesProxyModel>
#include <QtCore/QConstIterator>
#include <QtCore/QConstOverload>
#include <QtCore/QContiguousCache>
#include <QtCore/QContiguousCacheData>
#include <QtCore/QContiguousCacheTypedData>
#include <QtCore/QCoreApplication>
#include <QtCore/QCryptographicHash>
#include <QtCore/QDataStream>
#include <QtCore/QDate>
#include <QtCore/QDateTime>
#include <QtCore/QDeadlineTimer>
#include <QtCore/QDebug>
#include <QtCore/QDebugStateSaver>
#include <QtCore/QDeferredDeleteEvent>
#include <QtCore/QDir>
#include <QtCore/QDirIterator>
#include <QtCore/QDynamicPropertyChangeEvent>
#include <QtCore/QEasingCurve>
#include <QtCore/QElapsedTimer>
#include <QtCore/QEnableSharedFromThis>
#include <QtCore/QEvent>
#include <QtCore/QEventLoop>
#include <QtCore/QEventLoopLocker>
#include <QtCore/QException>
#include <QtCore/QExplicitlySharedDataPointer>
#include <QtCore/QFactoryInterface>
#include <QtCore/QFile>
#include <QtCore/QFileDevice>
#include <QtCore/QFileInfo>
#include <QtCore/QFileInfoList>
#include <QtCore/QFileSelector>
#include <QtCore/QFileSystemWatcher>
#include <QtCore/QFlag>
#include <QtCore/QFlags>
#include <QtCore/QFloat16>
#include <QtCore/QFunctionPointer>
#include <QtCore/QFuture>
#include <QtCore/QFutureInterface>
#include <QtCore/QFutureInterfaceBase>
#include <QtCore/QFutureIterator>
#include <QtCore/QFutureSynchronizer>
#include <QtCore/QFutureWatcher>
#include <QtCore/QFutureWatcherBase>
#include <QtCore/QGenericArgument>
#include <QtCore/QGenericReturnArgument>
#include <QtCore/QGlobalStatic>
#include <QtCore/QHash>
#include <QtCore/QHashDummyValue>
#include <QtCore/QHashFunctions>
#include <QtCore/QHashIterator>
#include <QtCore/QHashSeed>
#include <QtCore/QIdentityProxyModel>
#include <QtCore/QIncompatibleFlag>
#include <QtCore/QIntegerForSize>
#include <QtCore/QInternal>
#include <QtCore/QIODevice>
#include <QtCore/QIODeviceBase>
#include <QtCore/QItemSelection>
#include <QtCore/QItemSelectionModel>
#include <QtCore/QItemSelectionRange>
#include <QtCore/QIterable>
#include <QtCore/QIterator>
#include <QtCore/QJniEnvironment>
#include <QtCore/QJniObject>
#include <QtCore/QJsonArray>
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
#include <QtCore/QJsonParseError>
#include <QtCore/QJsonValue>
#include <QtCore/QJsonValueRef>
#include <QtCore/QKeyCombination>
#include <QtCore/QKeyValueIterator>
#include <QtCore/QLatin1Char>
#include <QtCore/QLatin1String>
#include <QtCore/QLEInteger>
#include <QtCore/QLibrary>
#include <QtCore/QLibraryInfo>
#include <QtCore/QLine>
#include <QtCore/QLineF>
#include <QtCore/QList>
#include <QtCore/QListIterator>
#include <QtCore/QListSpecialMethodsBase>
#include <QtCore/QLittleEndianStorageType>
#include <QtCore/QLocale>
#include <QtCore/QLockFile>
#include <QtCore/QLoggingCategory>
#include <QtCore/QMap>
#include <QtCore/QMapData>
#include <QtCore/QMapIterator>
#include <QtCore/QMargins>
#include <QtCore/QMarginsF>
#include <QtCore/QMessageAuthenticationCode>
#include <QtCore/QMessageLogContext>
#include <QtCore/QMessageLogger>
#include <QtCore/QMetaAssociation>
#include <QtCore/QMetaClassInfo>
#include <QtCore/QMetaContainer>
#include <QtCore/QMetaEnum>
#include <QtCore/QMetaMethod>
#include <QtCore/QMetaObject>
#include <QtCore/QMetaProperty>
#include <QtCore/QMetaSequence>
#include <QtCore/QMetaType>
#include <QtCore/QMethodRawArguments>
#include <QtCore/QMimeData>
#include <QtCore/QMimeDatabase>
#include <QtCore/QMimeType>
#include <QtCore/QModelIndex>
#include <QtCore/QModelIndexList>
#include <QtCore/QModelRoleData>
#include <QtCore/QModelRoleDataSpan>
#include <QtCore/QMultiHash>
#include <QtCore/QMultiHashIterator>
#include <QtCore/QMultiMap>
#include <QtCore/QMultiMapIterator>
#include <QtCore/QMutableByteArrayListIterator>
#include <QtCore/QMutableFutureIterator>
#include <QtCore/QMutableHashIterator>
#include <QtCore/QMutableListIterator>
#include <QtCore/QMutableMapIterator>
#include <QtCore/QMutableMultiHashIterator>
#include <QtCore/QMutableMultiMapIterator>
#include <QtCore/QMutableSetIterator>
#include <QtCore/QMutex>
#include <QtCore/QMutexLocker>
#include <QtCore/QNoDebug>
#include <QtCore/QNonConstOverload>
#include <QtCore/QObject>
#include <QtCore/QObjectBindableProperty>
#include <QtCore/QObjectCleanupHandler>
#include <QtCore/QObjectData>
#include <QtCore/QObjectList>
#include <QtCore/QOperatingSystemVersion>
#include <QtCore/QPair>
#include <QtCore/QParallelAnimationGroup>
#include <QtCore/QPartialOrdering>
#include <QtCore/QPauseAnimation>
#include <QtCore/QPersistentModelIndex>
#include <QtCore/QPluginLoader>
#include <QtCore/QPluginMetaData>
#include <QtCore/QPoint>
#include <QtCore/QPointer>
#include <QtCore/QPointF>
#include <QtCore/QProcess>
#include <QtCore/QProcessEnvironment>
#include <QtCore/QPromise>
#include <QtCore/QProperty>
#include <QtCore/QPropertyAlias>
#include <QtCore/QPropertyAnimation>
#include <QtCore/QPropertyBinding>
#include <QtCore/QPropertyBindingError>
#include <QtCore/QPropertyBindingPrivatePtr>
#include <QtCore/QPropertyBindingSourceLocation>
#include <QtCore/QPropertyChangeHandler>
#include <QtCore/QPropertyData>
#include <QtCore/QPropertyNotifier>
#include <QtCore/QPropertyObserver>
#include <QtCore/QPropertyObserverBase>
#include <QtCore/QPropertyProxyBindingData>
#include <QtCore/QQueue>
#include <QtCore/QRandomGenerator>
#include <QtCore/QRandomGenerator64>
#include <QtCore/QReadLocker>
#include <QtCore/QReadWriteLock>
#include <QtCore/QRect>
#include <QtCore/QRectF>
#include <QtCore/QRecursiveMutex>
#include <QtCore/QRegularExpression>
#include <QtCore/QRegularExpressionMatch>
#include <QtCore/QRegularExpressionMatchIterator>
#include <QtCore/QResource>
#include <QtCore/QReturnArgument>
#include <QtCore/QRunnable>
#include <QtCore/QSaveFile>
#include <QtCore/QScopedArrayPointer>
#include <QtCore/QScopedPointer>
#include <QtCore/QScopedPointerArrayDeleter>
#include <QtCore/QScopedPointerDeleteLater>
#include <QtCore/QScopedPointerDeleter>
#include <QtCore/QScopedPointerObjectDeleteLater>
#include <QtCore/QScopedPointerPodDeleter>
#include <QtCore/QScopedValueRollback>
#include <QtCore/QScopeGuard>
#include <QtCore/QSemaphore>
#include <QtCore/QSemaphoreReleaser>
#include <QtCore/QSequentialAnimationGroup>
#include <QtCore/QSequentialConstIterator>
#include <QtCore/QSequentialIterable>
#include <QtCore/QSequentialIterator>
#include <QtCore/QSet>
#include <QtCore/QSetIterator>
#include <QtCore/QSettings>
#include <QtCore/QSharedData>
#include <QtCore/QSharedDataPointer>
#include <QtCore/QSharedMemory>
#include <QtCore/QSharedPointer>
#include <QtCore/QSignalBlocker>
#include <QtCore/QSignalMapper>
#include <QtCore/QSize>
#include <QtCore/QSizeF>
#include <QtCore/QSocketDescriptor>
#include <QtCore/QSocketNotifier>
#include <QtCore/QSortFilterProxyModel>
#include <QtCore/QSpecialInteger>
#include <QtCore/QStack>
#include <QtCore/QStandardPaths>
#include <QtCore/QStaticByteArrayMatcherBase>
#include <QtCore/QStaticPlugin>
#include <QtCore/QStorageInfo>
#include <QtCore/QString>
#include <QtCore/QStringAlgorithms>
#include <QtCore/QStringBuilder>
#include <QtCore/QStringConverter>
#include <QtCore/QStringConverterBase>
#include <QtCore/QStringDecoder>
#include <QtCore/QStringEncoder>
#include <QtCore/QStringList>
#include <QtCore/QStringListModel>
#include <QtCore/QStringLiteral>
#include <QtCore/QStringMatcher>
#include <QtCore/QStringTokenizer>
#include <QtCore/QStringTokenizerBase>
#include <QtCore/QStringTokenizerBaseBase>
#include <QtCore/QStringView>
#include <QtCore/QSysInfo>
#include <QtCore/QSystemSemaphore>
#include <QtCore/Qt>
#include <QtCore/QTaggedIterator>
#include <QtCore/QTaggedPointer>
#include <QtCore/QtAlgorithms>
#include <QtCore/QtCborCommon>
#include <QtCore/QtCleanUpFunction>
#include <QtCore/QtCompare>
#include <QtCore/QtConfig>
#include <QtCore/QtContainerFwd>
//#include <QtCore/QtCore>
//#include <QtCore/QtCoreDepends>
#include <QtCore/QtCoreVersion>
#include <QtCore/QtDebug>
#include <QtCore/QTemporaryDir>
#include <QtCore/QTemporaryFile>
#include <QtCore/QtEndian>
#include <QtCore/QTextBoundaryFinder>
#include <QtCore/QTextStream>
#include <QtCore/QTextStreamFunction>
#include <QtCore/QTextStreamManipulator>
#include <QtCore/QtGlobal>
#include <QtCore/QThread>
#include <QtCore/QThreadPool>
#include <QtCore/QThreadStorage>
#include <QtCore/QThreadStorageData>
#include <QtCore/QTime>
#include <QtCore/QTimeLine>
#include <QtCore/QTimer>
#include <QtCore/QTimerEvent>
#include <QtCore/QTimeZone>
#include <QtCore/QtMath>
#include <QtCore/QtMessageHandler>
#include <QtCore/QtNumeric>
#include <QtCore/QtPlugin>
#include <QtCore/QtPluginInstanceFunction>
#include <QtCore/QtPluginMetaDataFunction>
#include <QtCore/QTranslator>
#include <QtCore/QTransposeProxyModel>
#include <QtCore/QTypeInfo>
#include <QtCore/QTypeInfoMerger>
#include <QtCore/QTypeRevision>
#include <QtCore/QUnhandledException>
#include <QtCore/QUntypedBindable>
#include <QtCore/QUntypedPropertyBinding>
#include <QtCore/QUntypedPropertyData>
#include <QtCore/QUrl>
#include <QtCore/QUrlQuery>
#include <QtCore/QUrlTwoFlags>
#include <QtCore/QUtf8StringView>
#include <QtCore/QUuid>
#include <QtCore/QVariant>
#include <QtCore/QVariantAnimation>
#include <QtCore/QVariantConstPointer>
#include <QtCore/QVariantHash>
#include <QtCore/QVariantList>
#include <QtCore/QVariantMap>
#include <QtCore/QVariantPointer>
#include <QtCore/QVariantRef>
#include <QtCore/QVarLengthArray>
#include <QtCore/QVector>
#include <QtCore/QVersionNumber>
#include <QtCore/QWaitCondition>
#include <QtCore/QWeakPointer>
#include <QtCore/QWinEventNotifier>
#include <QtCore/QWriteLocker>
#include <QtCore/QXmlStreamAttribute>
#include <QtCore/QXmlStreamAttributes>
#include <QtCore/QXmlStreamEntityDeclaration>
#include <QtCore/QXmlStreamEntityDeclarations>
#include <QtCore/QXmlStreamEntityResolver>
#include <QtCore/QXmlStreamNamespaceDeclaration>
#include <QtCore/QXmlStreamNamespaceDeclarations>
#include <QtCore/QXmlStreamNotationDeclaration>
#include <QtCore/QXmlStreamNotationDeclarations>
#include <QtCore/QXmlStreamReader>
#include <QtCore/QXmlStreamWriter>

View File

@ -0,0 +1,29 @@
#include <QtCore5Compat/QBinaryJson>
#include <QtCore5Compat/QConcatenable>
#include <QtCore5Compat/QLinkedList>
#include <QtCore5Compat/QLinkedListData>
#include <QtCore5Compat/QLinkedListIterator>
#include <QtCore5Compat/QLinkedListNode>
#include <QtCore5Compat/QMutableLinkedListIterator>
#include <QtCore5Compat/QRegExp>
#include <QtCore5Compat/QStringRef>
//#include <QtCore5Compat/QtCore5Compat>
//#include <QtCore5Compat/QtCore5CompatDepends>
#include <QtCore5Compat/QtCore5CompatVersion>
#include <QtCore5Compat/QTextCodec>
#include <QtCore5Compat/QTextDecoder>
#include <QtCore5Compat/QTextEncoder>
#include <QtCore5Compat/QXmlAttributes>
#include <QtCore5Compat/QXmlContentHandler>
#include <QtCore5Compat/QXmlDeclHandler>
#include <QtCore5Compat/QXmlDefaultHandler>
#include <QtCore5Compat/QXmlDTDHandler>
#include <QtCore5Compat/QXmlEntityResolver>
#include <QtCore5Compat/QXmlErrorHandler>
#include <QtCore5Compat/QXmlInputSource>
#include <QtCore5Compat/QXmlLexicalHandler>
#include <QtCore5Compat/QXmlLocator>
#include <QtCore5Compat/QXmlNamespaceSupport>
#include <QtCore5Compat/QXmlParseException>
#include <QtCore5Compat/QXmlReader>
#include <QtCore5Compat/QXmlSimpleReader>

View File

@ -0,0 +1,44 @@
#include <QtDesigner/QAbstractExtensionFactory>
#include <QtDesigner/QAbstractExtensionManager>
#include <QtDesigner/QAbstractFormBuilder>
#include <QtDesigner/QDesignerActionEditorInterface>
#include <QtDesigner/QDesignerComponents>
#include <QtDesigner/QDesignerContainerExtension>
#include <QtDesigner/QDesignerCustomWidgetCollectionInterface>
#include <QtDesigner/QDesignerCustomWidgetInterface>
#include <QtDesigner/QDesignerDnDItemInterface>
#include <QtDesigner/QDesignerDynamicPropertySheetExtension>
#include <QtDesigner/QDesignerExportWidget>
#include <QtDesigner/QDesignerExtraInfoExtension>
#include <QtDesigner/QDesignerFormEditorInterface>
#include <QtDesigner/QDesignerFormEditorPluginInterface>
#include <QtDesigner/QDesignerFormWindowCursorInterface>
#include <QtDesigner/QDesignerFormWindowInterface>
#include <QtDesigner/QDesignerFormWindowManagerInterface>
#include <QtDesigner/QDesignerFormWindowToolInterface>
#include <QtDesigner/QDesignerIntegration>
#include <QtDesigner/QDesignerIntegrationInterface>
#include <QtDesigner/QDesignerLanguageExtension>
#include <QtDesigner/QDesignerLayoutDecorationExtension>
#include <QtDesigner/QDesignerMemberSheetExtension>
#include <QtDesigner/QDesignerMetaDataBaseInterface>
#include <QtDesigner/QDesignerMetaDataBaseItemInterface>
#include <QtDesigner/QDesignerNewFormWidgetInterface>
#include <QtDesigner/QDesignerObjectInspectorInterface>
#include <QtDesigner/QDesignerOptionsPageInterface>
#include <QtDesigner/QDesignerPromotionInterface>
#include <QtDesigner/QDesignerPropertyEditorInterface>
#include <QtDesigner/QDesignerPropertySheetExtension>
#include <QtDesigner/QDesignerResourceBrowserInterface>
#include <QtDesigner/QDesignerSettingsInterface>
#include <QtDesigner/QDesignerTaskMenuExtension>
#include <QtDesigner/QDesignerWidgetBoxInterface>
#include <QtDesigner/QDesignerWidgetDataBaseInterface>
#include <QtDesigner/QDesignerWidgetDataBaseItemInterface>
#include <QtDesigner/QDesignerWidgetFactoryInterface>
#include <QtDesigner/QExtensionFactory>
#include <QtDesigner/QExtensionManager>
#include <QtDesigner/QFormBuilder>
//#include <QtDesigner/QtDesigner>
//#include <QtDesigner/QtDesignerDepends>
#include <QtDesigner/QtDesignerVersion>

View File

@ -0,0 +1,225 @@
#include <QtGui/QAbstractFileIconProvider>
#include <QtGui/QAbstractTextDocumentLayout>
#include <QtGui/QAbstractUndoItem>
#include <QtGui/QAccessible>
#include <QtGui/QAccessibleActionInterface>
#include <QtGui/QAccessibleApplication>
#include <QtGui/QAccessibleBridge>
#include <QtGui/QAccessibleBridgePlugin>
#include <QtGui/QAccessibleEditableTextInterface>
#include <QtGui/QAccessibleEvent>
#include <QtGui/QAccessibleHyperlinkInterface>
#include <QtGui/QAccessibleImageInterface>
#include <QtGui/QAccessibleInterface>
#include <QtGui/QAccessibleObject>
#include <QtGui/QAccessiblePlugin>
#include <QtGui/QAccessibleStateChangeEvent>
#include <QtGui/QAccessibleTableCellInterface>
#include <QtGui/QAccessibleTableInterface>
#include <QtGui/QAccessibleTableModelChangeEvent>
#include <QtGui/QAccessibleTextCursorEvent>
#include <QtGui/QAccessibleTextInsertEvent>
#include <QtGui/QAccessibleTextInterface>
#include <QtGui/QAccessibleTextRemoveEvent>
#include <QtGui/QAccessibleTextSelectionEvent>
#include <QtGui/QAccessibleTextUpdateEvent>
#include <QtGui/QAccessibleValueChangeEvent>
#include <QtGui/QAccessibleValueInterface>
#include <QtGui/QAction>
#include <QtGui/QActionEvent>
#include <QtGui/QActionGroup>
#include <QtGui/QApplicationStateChangeEvent>
#include <QtGui/QBackingStore>
#include <QtGui/QBitmap>
#include <QtGui/QBrush>
#include <QtGui/QBrushData>
#include <QtGui/QBrushDataPointerDeleter>
#include <QtGui/QClipboard>
#include <QtGui/QCloseEvent>
#include <QtGui/QColor>
#include <QtGui/QColorSpace>
#include <QtGui/QColorTransform>
#include <QtGui/QConicalGradient>
#include <QtGui/QContextMenuEvent>
#include <QtGui/QCursor>
#include <QtGui/QDesktopServices>
#include <QtGui/QDoubleValidator>
#include <QtGui/QDrag>
#include <QtGui/QDragEnterEvent>
#include <QtGui/QDragLeaveEvent>
#include <QtGui/QDragMoveEvent>
#include <QtGui/QDropEvent>
#include <QtGui/QEnterEvent>
#include <QtGui/QEventPoint>
#include <QtGui/QExposeEvent>
#include <QtGui/QFileOpenEvent>
#include <QtGui/QFileSystemModel>
#include <QtGui/QFocusEvent>
#include <QtGui/QFont>
#include <QtGui/QFontDatabase>
#include <QtGui/QFontInfo>
#include <QtGui/QFontMetrics>
#include <QtGui/QFontMetricsF>
#include <QtGui/QGenericMatrix>
#include <QtGui/QGenericPlugin>
#include <QtGui/QGenericPluginFactory>
#include <QtGui/QGlyphRun>
#include <QtGui/QGradient>
#include <QtGui/QGradientStop>
#include <QtGui/QGradientStops>
#include <QtGui/QGuiApplication>
#include <QtGui/QHelpEvent>
#include <QtGui/QHideEvent>
#include <QtGui/QHoverEvent>
#include <QtGui/QIcon>
#include <QtGui/QIconDragEvent>
#include <QtGui/QIconEngine>
#include <QtGui/QIconEnginePlugin>
#include <QtGui/QImage>
#include <QtGui/QImageCleanupFunction>
#include <QtGui/QImageIOHandler>
#include <QtGui/QImageIOPlugin>
#include <QtGui/QImageReader>
#include <QtGui/QImageWriter>
#include <QtGui/QInputDevice>
#include <QtGui/QInputEvent>
#include <QtGui/QInputMethod>
#include <QtGui/QInputMethodEvent>
#include <QtGui/QInputMethodQueryEvent>
#include <QtGui/QIntValidator>
#include <QtGui/QKeyEvent>
#include <QtGui/QKeySequence>
#include <QtGui/QLinearGradient>
#include <QtGui/QMatrix2x2>
#include <QtGui/QMatrix2x3>
#include <QtGui/QMatrix2x4>
#include <QtGui/QMatrix3x2>
#include <QtGui/QMatrix3x3>
#include <QtGui/QMatrix3x4>
#include <QtGui/QMatrix4x2>
#include <QtGui/QMatrix4x3>
#include <QtGui/QMatrix4x4>
#include <QtGui/QMouseEvent>
#include <QtGui/QMoveEvent>
#include <QtGui/QMovie>
#include <QtGui/QNativeGestureEvent>
#include <QtGui/QOffscreenSurface>
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLContextGroup>
#include <QtGui/QOpenGLExtraFunctions>
#include <QtGui/QOpenGLExtraFunctionsPrivate>
#include <QtGui/QOpenGLFunctions>
#include <QtGui/QOpenGLFunctionsPrivate>
#include <QtGui/QPagedPaintDevice>
#include <QtGui/QPageLayout>
#include <QtGui/QPageRanges>
#include <QtGui/QPageSize>
#include <QtGui/QPaintDevice>
#include <QtGui/QPaintDeviceWindow>
#include <QtGui/QPaintEngine>
#include <QtGui/QPaintEngineState>
#include <QtGui/QPainter>
#include <QtGui/QPainterPath>
#include <QtGui/QPainterPathStroker>
#include <QtGui/QPaintEvent>
#include <QtGui/QPalette>
#include <QtGui/QPdfWriter>
#include <QtGui/QPen>
#include <QtGui/QPicture>
#include <QtGui/QPixelFormat>
#include <QtGui/QPixmap>
#include <QtGui/QPixmapCache>
#include <QtGui/QPlatformSurfaceEvent>
#include <QtGui/QPointerEvent>
#include <QtGui/QPointingDevice>
#include <QtGui/QPointingDeviceUniqueId>
#include <QtGui/QPolygon>
#include <QtGui/QPolygonF>
#include <QtGui/QQuaternion>
#include <QtGui/QRadialGradient>
#include <QtGui/QRasterWindow>
#include <QtGui/QRawFont>
#include <QtGui/QRegion>
#include <QtGui/QRegularExpressionValidator>
#include <QtGui/QResizeEvent>
#include <QtGui/QRgb>
#include <QtGui/QRgba64>
#include <QtGui/QRgbaFloat16>
#include <QtGui/QRgbaFloat32>
#include <QtGui/QScreen>
#include <QtGui/QScreenOrientationChangeEvent>
#include <QtGui/QScrollEvent>
#include <QtGui/QScrollPrepareEvent>
#include <QtGui/QSessionManager>
#include <QtGui/QShortcut>
#include <QtGui/QShortcutEvent>
#include <QtGui/QShowEvent>
#include <QtGui/QSinglePointEvent>
#include <QtGui/QStandardItem>
#include <QtGui/QStandardItemModel>
#include <QtGui/QStaticText>
#include <QtGui/QStatusTipEvent>
#include <QtGui/QStyleHints>
#include <QtGui/QSurface>
#include <QtGui/QSurfaceFormat>
#include <QtGui/QSyntaxHighlighter>
#include <QtGui/QTabletEvent>
#include <QtGui/QtEvents>
#include <QtGui/QTextBlock>
#include <QtGui/QTextBlockFormat>
#include <QtGui/QTextBlockGroup>
#include <QtGui/QTextBlockUserData>
#include <QtGui/QTextCharFormat>
#include <QtGui/QTextCursor>
#include <QtGui/QTextDocument>
#include <QtGui/QTextDocumentFragment>
#include <QtGui/QTextDocumentWriter>
#include <QtGui/QTextFormat>
#include <QtGui/QTextFragment>
#include <QtGui/QTextFrame>
#include <QtGui/QTextFrameFormat>
#include <QtGui/QTextFrameLayoutData>
#include <QtGui/QTextImageFormat>
#include <QtGui/QTextInlineObject>
#include <QtGui/QTextItem>
#include <QtGui/QTextLayout>
#include <QtGui/QTextLength>
#include <QtGui/QTextLine>
#include <QtGui/QTextList>
#include <QtGui/QTextListFormat>
#include <QtGui/QTextObject>
#include <QtGui/QTextObjectInterface>
#include <QtGui/QTextOption>
#include <QtGui/QTextTable>
#include <QtGui/QTextTableCell>
#include <QtGui/QTextTableCellFormat>
#include <QtGui/QTextTableFormat>
//#include <QtGui/QtGui>
//#include <QtGui/QtGuiDepends>
#include <QtGui/QtGuiVersion>
#include <QtGui/QToolBarChangeEvent>
#include <QtGui/QTouchEvent>
#include <QtGui/QTransform>
#include <QtGui/QUndoCommand>
#include <QtGui/QUndoGroup>
#include <QtGui/QUndoStack>
#include <QtGui/QValidator>
#include <QtGui/QVector2D>
#include <QtGui/QVector3D>
#include <QtGui/QVector4D>
#include <QtGui/QVulkanDeviceFunctions>
#include <QtGui/QVulkanExtension>
#include <QtGui/QVulkanFunctions>
#include <QtGui/QVulkanInfoVector>
#include <QtGui/QVulkanInstance>
#include <QtGui/QVulkanLayer>
#include <QtGui/QVulkanWindow>
#include <QtGui/QVulkanWindowRenderer>
#include <QtGui/QWhatsThisClickedEvent>
#include <QtGui/QWheelEvent>
#include <QtGui/QWidgetList>
#include <QtGui/QWidgetMapper>
#include <QtGui/QWidgetSet>
#include <QtGui/QWindow>
#include <QtGui/QWindowList>
#include <QtGui/QWindowStateChangeEvent>

View File

@ -0,0 +1,29 @@
#include <QtMultimedia/QAudio>
#include <QtMultimedia/QAudioBuffer>
#include <QtMultimedia/QAudioDecoder>
#include <QtMultimedia/QAudioDevice>
#include <QtMultimedia/QAudioFormat>
#include <QtMultimedia/QAudioFrame>
#include <QtMultimedia/QAudioInput>
#include <QtMultimedia/QAudioOutput>
#include <QtMultimedia/QAudioSink>
#include <QtMultimedia/QAudioSource>
#include <QtMultimedia/QCamera>
#include <QtMultimedia/QCameraDevice>
#include <QtMultimedia/QCameraFormat>
#include <QtMultimedia/QImageCapture>
#include <QtMultimedia/QMediaCaptureSession>
#include <QtMultimedia/QMediaDevices>
#include <QtMultimedia/QMediaFormat>
#include <QtMultimedia/QMediaMetaData>
#include <QtMultimedia/QMediaPlayer>
#include <QtMultimedia/QMediaRecorder>
#include <QtMultimedia/QMediaTimeRange>
#include <QtMultimedia/QSoundEffect>
//#include <QtMultimedia/QtMultimedia>
//#include <QtMultimedia/QtMultimediaDepends>
#include <QtMultimedia/QtMultimediaVersion>
#include <QtMultimedia/QVideoFrame>
#include <QtMultimedia/QVideoFrameFormat>
#include <QtMultimedia/QVideoSink>
#include <QtMultimedia/QWaveDecoder>

View File

@ -0,0 +1,56 @@
#include <QtNetwork/QAbstractNetworkCache>
#include <QtNetwork/QAbstractSocket>
#include <QtNetwork/QAuthenticator>
#include <QtNetwork/QDnsDomainNameRecord>
#include <QtNetwork/QDnsHostAddressRecord>
#include <QtNetwork/QDnsLookup>
#include <QtNetwork/QDnsMailExchangeRecord>
#include <QtNetwork/QDnsServiceRecord>
#include <QtNetwork/QDnsTextRecord>
#include <QtNetwork/QDtls>
#include <QtNetwork/QDtlsClientVerifier>
#include <QtNetwork/QHostAddress>
#include <QtNetwork/QHostInfo>
#include <QtNetwork/QHstsPolicy>
#include <QtNetwork/QHttp2Configuration>
#include <QtNetwork/QHttpMultiPart>
#include <QtNetwork/QHttpPart>
#include <QtNetwork/Q_IPV6ADDR>
#include <QtNetwork/QIPv6Address>
#include <QtNetwork/QLocalServer>
#include <QtNetwork/QLocalSocket>
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkAddressEntry>
#include <QtNetwork/QNetworkCacheMetaData>
#include <QtNetwork/QNetworkCookie>
#include <QtNetwork/QNetworkCookieJar>
#include <QtNetwork/QNetworkDatagram>
#include <QtNetwork/QNetworkDiskCache>
#include <QtNetwork/QNetworkInformation>
#include <QtNetwork/QNetworkInterface>
#include <QtNetwork/QNetworkProxy>
#include <QtNetwork/QNetworkProxyFactory>
#include <QtNetwork/QNetworkProxyQuery>
#include <QtNetwork/QNetworkReply>
#include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QOcspResponse>
#include <QtNetwork/QPasswordDigestor>
#include <QtNetwork/QSctpServer>
#include <QtNetwork/QSctpSocket>
#include <QtNetwork/QSsl>
#include <QtNetwork/QSslCertificate>
#include <QtNetwork/QSslCertificateExtension>
#include <QtNetwork/QSslCipher>
#include <QtNetwork/QSslConfiguration>
#include <QtNetwork/QSslDiffieHellmanParameters>
#include <QtNetwork/QSslEllipticCurve>
#include <QtNetwork/QSslError>
#include <QtNetwork/QSslKey>
#include <QtNetwork/QSslPreSharedKeyAuthenticator>
#include <QtNetwork/QSslSocket>
#include <QtNetwork/QTcpServer>
#include <QtNetwork/QTcpSocket>
//#include <QtNetwork/QtNetwork>
//#include <QtNetwork/QtNetworkDepends>
#include <QtNetwork/QtNetworkVersion>
#include <QtNetwork/QUdpSocket>

View File

@ -0,0 +1,11 @@
#include <QtPrintSupport/QAbstractPrintDialog>
#include <QtPrintSupport/QPageSetupDialog>
#include <QtPrintSupport/QPrintDialog>
#include <QtPrintSupport/QPrintEngine>
#include <QtPrintSupport/QPrinter>
#include <QtPrintSupport/QPrinterInfo>
#include <QtPrintSupport/QPrintPreviewDialog>
#include <QtPrintSupport/QPrintPreviewWidget>
//#include <QtPrintSupport/QtPrintSupport>
//#include <QtPrintSupport/QtPrintSupportDepends>
#include <QtPrintSupport/QtPrintSupportVersion>

View File

@ -0,0 +1,20 @@
#include <QtSql/QSql>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlDriver>
#include <QtSql/QSqlDriverCreator>
#include <QtSql/QSqlDriverCreatorBase>
#include <QtSql/QSqlDriverPlugin>
#include <QtSql/QSqlError>
#include <QtSql/QSqlField>
#include <QtSql/QSqlIndex>
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlQueryModel>
#include <QtSql/QSqlRecord>
#include <QtSql/QSqlRelation>
#include <QtSql/QSqlRelationalDelegate>
#include <QtSql/QSqlRelationalTableModel>
#include <QtSql/QSqlResult>
#include <QtSql/QSqlTableModel>
//#include <QtSql/QtSql>
//#include <QtSql/QtSqlDepends>
#include <QtSql/QtSqlVersion>

View File

@ -0,0 +1,5 @@
#include <QtSvg/QSvgGenerator>
#include <QtSvg/QSvgRenderer>
//#include <QtSvg/QtSvg>
//#include <QtSvg/QtSvgDepends>
#include <QtSvg/QtSvgVersion>

View File

@ -0,0 +1,4 @@
//#include <QtUiTools/QtUiTools>
//#include <QtUiTools/QtUiToolsDepends>
#include <QtUiTools/QtUiToolsVersion>
#include <QtUiTools/QUiLoader>

View File

@ -0,0 +1,196 @@
#include <QtWidgets/QAbstractButton>
#include <QtWidgets/QAbstractGraphicsShapeItem>
#include <QtWidgets/QAbstractItemDelegate>
#include <QtWidgets/QAbstractItemView>
#include <QtWidgets/QAbstractScrollArea>
#include <QtWidgets/QAbstractSlider>
#include <QtWidgets/QAbstractSpinBox>
#include <QtWidgets/QAccessibleWidget>
#include <QtWidgets/QApplication>
#include <QtWidgets/QBoxLayout>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QCalendarWidget>
#include <QtWidgets/QCheckBox>
#include <QtWidgets/QColorDialog>
#include <QtWidgets/QColormap>
#include <QtWidgets/QColumnView>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QCommandLinkButton>
#include <QtWidgets/QCommonStyle>
#include <QtWidgets/QCompleter>
#include <QtWidgets/QDataWidgetMapper>
#include <QtWidgets/QDateEdit>
#include <QtWidgets/QDateTimeEdit>
#include <QtWidgets/QDial>
#include <QtWidgets/QDialog>
#include <QtWidgets/QDialogButtonBox>
#include <QtWidgets/QDockWidget>
#include <QtWidgets/QDoubleSpinBox>
#include <QtWidgets/QErrorMessage>
#include <QtWidgets/QFileDialog>
#include <QtWidgets/QFileIconProvider>
#include <QtWidgets/QFocusFrame>
#include <QtWidgets/QFontComboBox>
#include <QtWidgets/QFontDialog>
#include <QtWidgets/QFormLayout>
#include <QtWidgets/QFrame>
#include <QtWidgets/QGesture>
#include <QtWidgets/QGestureEvent>
#include <QtWidgets/QGestureRecognizer>
#include <QtWidgets/QGraphicsAnchor>
#include <QtWidgets/QGraphicsAnchorLayout>
#include <QtWidgets/QGraphicsBlurEffect>
#include <QtWidgets/QGraphicsColorizeEffect>
#include <QtWidgets/QGraphicsDropShadowEffect>
#include <QtWidgets/QGraphicsEffect>
#include <QtWidgets/QGraphicsEllipseItem>
#include <QtWidgets/QGraphicsGridLayout>
#include <QtWidgets/QGraphicsItem>
#include <QtWidgets/QGraphicsItemAnimation>
#include <QtWidgets/QGraphicsItemGroup>
#include <QtWidgets/QGraphicsLayout>
#include <QtWidgets/QGraphicsLayoutItem>
#include <QtWidgets/QGraphicsLinearLayout>
#include <QtWidgets/QGraphicsLineItem>
#include <QtWidgets/QGraphicsObject>
#include <QtWidgets/QGraphicsOpacityEffect>
#include <QtWidgets/QGraphicsPathItem>
#include <QtWidgets/QGraphicsPixmapItem>
#include <QtWidgets/QGraphicsPolygonItem>
#include <QtWidgets/QGraphicsProxyWidget>
#include <QtWidgets/QGraphicsRectItem>
#include <QtWidgets/QGraphicsRotation>
#include <QtWidgets/QGraphicsScale>
#include <QtWidgets/QGraphicsScene>
#include <QtWidgets/QGraphicsSceneContextMenuEvent>
#include <QtWidgets/QGraphicsSceneDragDropEvent>
#include <QtWidgets/QGraphicsSceneEvent>
#include <QtWidgets/QGraphicsSceneHelpEvent>
#include <QtWidgets/QGraphicsSceneHoverEvent>
#include <QtWidgets/QGraphicsSceneMouseEvent>
#include <QtWidgets/QGraphicsSceneMoveEvent>
#include <QtWidgets/QGraphicsSceneResizeEvent>
#include <QtWidgets/QGraphicsSceneWheelEvent>
#include <QtWidgets/QGraphicsSimpleTextItem>
#include <QtWidgets/QGraphicsTextItem>
#include <QtWidgets/QGraphicsTransform>
#include <QtWidgets/QGraphicsView>
#include <QtWidgets/QGraphicsWidget>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QInputDialog>
#include <QtWidgets/QItemDelegate>
#include <QtWidgets/QItemEditorCreator>
#include <QtWidgets/QItemEditorCreatorBase>
#include <QtWidgets/QItemEditorFactory>
#include <QtWidgets/QKeySequenceEdit>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLayout>
#include <QtWidgets/QLayoutItem>
#include <QtWidgets/QLCDNumber>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QListView>
#include <QtWidgets/QListWidget>
#include <QtWidgets/QListWidgetItem>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMdiArea>
#include <QtWidgets/QMdiSubWindow>
#include <QtWidgets/QMenu>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QMessageBox>
#include <QtWidgets/QPanGesture>
#include <QtWidgets/QPinchGesture>
#include <QtWidgets/QPlainTextDocumentLayout>
#include <QtWidgets/QPlainTextEdit>
#include <QtWidgets/QProgressBar>
#include <QtWidgets/QProgressDialog>
#include <QtWidgets/QProxyStyle>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QRadioButton>
#include <QtWidgets/QRubberBand>
#include <QtWidgets/QScrollArea>
#include <QtWidgets/QScrollBar>
#include <QtWidgets/QScroller>
#include <QtWidgets/QScrollerProperties>
#include <QtWidgets/QSizeGrip>
#include <QtWidgets/QSizePolicy>
#include <QtWidgets/QSlider>
#include <QtWidgets/QSpacerItem>
#include <QtWidgets/QSpinBox>
#include <QtWidgets/QSplashScreen>
#include <QtWidgets/QSplitter>
#include <QtWidgets/QSplitterHandle>
#include <QtWidgets/QStackedLayout>
#include <QtWidgets/QStackedWidget>
#include <QtWidgets/QStandardItemEditorCreator>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QStyle>
#include <QtWidgets/QStyledItemDelegate>
#include <QtWidgets/QStyleFactory>
#include <QtWidgets/QStyleHintReturn>
#include <QtWidgets/QStyleHintReturnMask>
#include <QtWidgets/QStyleHintReturnVariant>
#include <QtWidgets/QStyleOption>
#include <QtWidgets/QStyleOptionButton>
#include <QtWidgets/QStyleOptionComboBox>
#include <QtWidgets/QStyleOptionComplex>
#include <QtWidgets/QStyleOptionDockWidget>
#include <QtWidgets/QStyleOptionFocusRect>
#include <QtWidgets/QStyleOptionFrame>
#include <QtWidgets/QStyleOptionGraphicsItem>
#include <QtWidgets/QStyleOptionGroupBox>
#include <QtWidgets/QStyleOptionHeader>
#include <QtWidgets/QStyleOptionHeaderV2>
#include <QtWidgets/QStyleOptionMenuItem>
#include <QtWidgets/QStyleOptionProgressBar>
#include <QtWidgets/QStyleOptionRubberBand>
#include <QtWidgets/QStyleOptionSizeGrip>
#include <QtWidgets/QStyleOptionSlider>
#include <QtWidgets/QStyleOptionSpinBox>
#include <QtWidgets/QStyleOptionTab>
#include <QtWidgets/QStyleOptionTabBarBase>
#include <QtWidgets/QStyleOptionTabWidgetFrame>
#include <QtWidgets/QStyleOptionTitleBar>
#include <QtWidgets/QStyleOptionToolBar>
#include <QtWidgets/QStyleOptionToolBox>
#include <QtWidgets/QStyleOptionToolButton>
#include <QtWidgets/QStyleOptionViewItem>
#include <QtWidgets/QStylePainter>
#include <QtWidgets/QStylePlugin>
#include <QtWidgets/QSwipeGesture>
#include <QtWidgets/QSystemTrayIcon>
#include <QtWidgets/QTabBar>
#include <QtWidgets/QTableView>
#include <QtWidgets/QTableWidget>
#include <QtWidgets/QTableWidgetItem>
#include <QtWidgets/QTableWidgetSelectionRange>
#include <QtWidgets/QTabWidget>
#include <QtWidgets/QTapAndHoldGesture>
#include <QtWidgets/QTapGesture>
#include <QtWidgets/QTextBrowser>
#include <QtWidgets/QTextEdit>
#include <QtWidgets/QTileRules>
#include <QtWidgets/QTimeEdit>
#include <QtWidgets/QToolBar>
#include <QtWidgets/QToolBox>
#include <QtWidgets/QToolButton>
#include <QtWidgets/QToolTip>
#include <QtWidgets/QTreeView>
#include <QtWidgets/QTreeWidget>
#include <QtWidgets/QTreeWidgetItem>
#include <QtWidgets/QTreeWidgetItemIterator>
//#include <QtWidgets/QtWidgets>
//#include <QtWidgets/QtWidgetsDepends>
#include <QtWidgets/QtWidgetsVersion>
#include <QtWidgets/QUndoView>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWhatsThis>
#include <QtWidgets/QWidget>
#include <QtWidgets/QWidgetAction>
#include <QtWidgets/QWidgetData>
#include <QtWidgets/QWidgetItem>
#include <QtWidgets/QWidgetItemV2>
#include <QtWidgets/QWizard>
#include <QtWidgets/QWizardPage>

View File

@ -0,0 +1,20 @@
#include <QtXml/QDomAttr>
#include <QtXml/QDomCDATASection>
#include <QtXml/QDomCharacterData>
#include <QtXml/QDomComment>
#include <QtXml/QDomDocument>
#include <QtXml/QDomDocumentFragment>
#include <QtXml/QDomDocumentType>
#include <QtXml/QDomElement>
#include <QtXml/QDomEntity>
#include <QtXml/QDomEntityReference>
#include <QtXml/QDomImplementation>
#include <QtXml/QDomNamedNodeMap>
#include <QtXml/QDomNode>
#include <QtXml/QDomNodeList>
#include <QtXml/QDomNotation>
#include <QtXml/QDomProcessingInstruction>
#include <QtXml/QDomText>
//#include <QtXml/QtXml>
//#include <QtXml/QtXmlDepends>
#include <QtXml/QtXmlVersion>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -49,8 +49,35 @@ grammar CPP
"(" ( s ( "," s )? attribute_value )* s ")" / numeric_const / string_const / id
end
rule ignored_attr
"__attribute__" s attribute_value /
"__asm" s attribute_value /
"constexpr" ![a-zA-Z0-9_] /
"__extension__" /
"__inline" /
"__m64" /
"__m128" /
"__m128d" /
"__m128i" /
"__m256" /
"__m256d" /
"__m256i" /
"__m512" /
"__m512d" /
"__m512i" /
"__mmask8" /
"__mmask16" /
"__v8df" /
"__v8di" /
"__v16sf" /
"__v16si" /
"decltype" s attribute_value /
"alignas" s "(" s block s ")" /
"[[" s block s "]]"
end
rule a
s ( "__attribute__" s attribute_value s / "__asm" s attribute_value s / "__extension__" s / "decltype" s attribute_value s )*
s ( ignored_attr s )*
end
rule unary_op
@ -70,7 +97,7 @@ grammar CPP
rule id
"operator" s "," /
"operator" s ( bin_op / unary_op / "," ) /
"operator" sp [a-zA-Z\*\& \t\n\r]+ &( s "(" ) /
"operator" sp [a-zA-Z_0-9\*\& \t\n\r]+ &( s "(" ) /
"~"? [a-zA-Z_] [a-zA-Z_0-9]*
end
@ -122,15 +149,15 @@ grammar CPP
end
rule enum_spec
id:id initspec:( s "=" s init:block_wo_comma )? <PEnumSpec>
a id:id a initspec:( s "=" s init:block_wo_comma )? <PEnumSpec>
end
rule enum_body
enum_spec ( s "," s enum_spec )*
enum_spec ( s "," s enum_spec )* ","?
end
rule enum_type
"enum" ![a-zA-Z0-9_] a s id:id? bodyspec:( s "{" s body:enum_body s "}" )? <PEnumType>
"enum" ![a-zA-Z0-9_] a is_class:(s "class" )? s id:id? ( s ":" s type )? bodyspec:( s "{" s body:enum_body s "}" )? <PEnumType>
end
rule virtual_spec
@ -147,13 +174,14 @@ grammar CPP
rule member_declaration_wo_semicolon
template:( d:template_decl s )?
attr:( ( explicit_key / mutable_key / storage_class / inline_spec / virtual_spec / constexpr_key ) s )*
attr:( ( explicit_key / mutable_key / storage_class / inline_spec / virtual_spec / ignored_attr ) s )*
t:type
# type declaration ends with a } .. does not need a semicolon
# (i.e. nested struct or enum)
&{ |seq| seq[-1].text_value_ends_with_curly_brace }
s
( ":" s block_wo_curly_braces s )?
( trailing_return_type )?
a
(
"{" s block s "}" /
@ -163,13 +191,14 @@ grammar CPP
rule member_declaration_w_semicolon
template:( d:template_decl s )?
attr:( ( explicit_key / mutable_key / storage_class / inline_spec / virtual_spec / constexpr_key ) s )*
attr:( ( explicit_key / mutable_key / storage_class / inline_spec / virtual_spec / ignored_attr ) s )*
t:type
# opposite case (member_see declaration_wo_semicolon)
# (i.e. nested struct or enum)
!{ |seq| seq[-1].text_value_ends_with_curly_brace }
s
( ":" s block_wo_curly_braces s )?
( trailing_return_type )?
a
(
"{" s block s "}" /
@ -186,7 +215,7 @@ grammar CPP
end
rule class_struct_body_declarations
( s ";" / s friend_decl / s using / s typedef / s !( "public" / "private" / "protected" ) member_declaration )*
( s ";" / s static_assert / s friend_decl / s using / s typedef / s !( "public" / "private" / "protected" ) member_declaration )*
end
rule class_struct_body
@ -201,8 +230,8 @@ grammar CPP
rule class_id
# In order to easily distinguish between constructor methods without
# a return type and class or typedef names we assume that all "name("
# constructs are considered constructor names but "name (*func_ptr) ()" is not.
qualified_id s !( "(" !( s "*" ) )
# constructs are considered constructor names but "name (*func_ptr) ()" or "name (class::*method_ptr) ()" is not.
qualified_id s ( "..." s )? !( "(" !( s "*" / s qualified_id s "::*" ) )
end
rule typeof
@ -222,11 +251,11 @@ grammar CPP
end
rule concrete_type
( constexpr_key / class_or_struct_type / enum_type / float_type / char_type / int_type / bool_type / void_type / typeof / class_id )?
( class_or_struct_type / enum_type / float_type / char_type / int_type / bool_type / void_type / typeof / class_id )?
end
rule cv
( constexpr_key / "const" ![a-zA-Z0-9_] / "__const" ![a-zA-Z0-9_] / "volatile" ![a-zA-Z0-9_] / "__volatile" ![a-zA-Z0-9_] ) <PCV>
( "const" ![a-zA-Z0-9_] / "__const" ![a-zA-Z0-9_] / "volatile" ![a-zA-Z0-9_] / "__volatile" ![a-zA-Z0-9_] ) <PCV>
end
rule pointer
@ -256,15 +285,15 @@ grammar CPP
end
rule noexcept_spec
"noexcept" ( s "=" s block / s "(" s block ")" )?
"noexcept" ( s "(" s block s ")" )?
end
rule func_spec
"(" s fa:( a:func_args )? s ")" cvspec:( s cv:cv )? ( s "throw" s "(" s ( type_wo_comma s )? ")" / s noexcept_spec )* ( s override_key )? a <PFuncSpec>
"(" s fa:( a:func_args )? s ")" cvspec:( s cv:cv )? refspec:( s ref:( "&" !"&" / "&&" ) )? ( s "throw" s "(" s ( type_wo_comma s )? ")" / s noexcept_spec / s override_key )* a <PFuncSpec>
end
rule member_pointer
cspec:( qid:qualified_id s "::*" s ) itspec:( it:inner_type )? cvspec:( s cv:cv )? <PMemberPointer>
cspec:( qid:qualified_id s "::*" s ) itspec:( it:inner_type )? cvspec:( s cv:cv )? refspec:( s ref:( "&" !"&" / "&&" ) )? <PMemberPointer>
end
rule inner_type_with_cv
@ -278,21 +307,25 @@ grammar CPP
pointer /
reference /
member_pointer /
( "__restrict" ![a-zA-Z0-9_] s )? qualified_id
( "__restrict" ![a-zA-Z0-9_] s / "..." s )* qualified_id
)
pfx:( s spec:( array_spec / func_spec ) )*
<PInnerType>
end
rule init_spec
block_wo_comma / "default" / "delete" / "0"
end
rule type
cvspec:( cv:cv s )?
a
( "typename" ![a-zA-Z0-9_] s )?
ct:concrete_type
a
il:( s t1:inner_type i1:(s "=" s is1:block_wo_comma)? tt:( s "," s t2:inner_type i2:(s "=" s is2:block_wo_comma)? )* )?
il:( s t1:inner_type i1:(s "=" s is1:init_spec)? tt:( s "," s t2:inner_type i2:(s "=" s is2:init_spec)? )* )?
# alternative initialization if only a concrete type is given:
pi:( s "=" s is:block_wo_comma )?
pi:( s "=" s is:init_spec )?
<PType>
end
@ -301,16 +334,16 @@ grammar CPP
a
( "typename" ![a-zA-Z0-9_] s )?
ct:concrete_type
il:( s t:inner_type i:(s "=" s is:block_wo_comma)? )?
il:( s t:inner_type i:(s "=" s is:init_spec)? )?
# alternative initialization if only a concrete type is given:
pi:( s "=" s is:block_wo_comma )?
pi:( s "=" s is:init_spec )?
<PTypeWoComma>
end
rule type_for_template
cvspec:( cv:cv s )?
a
( "typename" ![a-zA-Z0-9_] s )?
( ( "typename" / "class" ) ![a-zA-Z0-9_] s ( "..." s )? )?
ct:concrete_type
il:( s t:inner_type )?
<PTypeForTemplate>
@ -324,19 +357,15 @@ grammar CPP
"override" ![a-zA-Z0-9_]
end
rule constexpr_key
"constexpr" ![a-zA-Z0-9_]
end
rule inline_spec
"inline" ![a-zA-Z0-9_] <PInline>
end
# parse over blocks as gracefully as possible ...
rule block_atom_wo_gt
"(" s block s ")" / "[" s block s "]" / "<" s block_wo_gt ( s "," s block_wo_gt )* s ">" /
"(" s block s ")" / "[" s block s "]" / "<" !"=" s block_wo_gt ( s "," s block_wo_gt )* s ">" /
numeric_const / hex_const / string_const / char_const /
id / unary_op / bin_op_wo_gt / "?" / "::" / "." / ":" / ";"
id ( s "{" s block s "}" )? / unary_op / bin_op_wo_gt / "?" / "::" / "." / ":" / ";"
end
rule block_wo_gt
@ -347,7 +376,7 @@ grammar CPP
rule block_atom
"(" s block s ")" / "[" s block s "]" / "<" s block_wo_gt ( s "," s block_wo_gt )* s ">" /
numeric_const / hex_const / string_const / char_const /
id / unary_op / bin_op / "?" / "::" / "." / ":"
id ( s "{" s block s "}" )? / unary_op / bin_op / "?" / "::" / "." / ":"
end
rule block
@ -375,25 +404,27 @@ grammar CPP
end
rule template_decl_arg
( "class" / "typename" ) ![a-zA-Z0-9_] s id:id dtspec:( s "=" s dt:type_for_template )? <PClassTemplateArg> /
t:type_for_template initspec:( s "=" s init:block_wo_gt )? <PDirectTemplateArg>
t:type_for_template dtspec:( s "=" s dt:block_wo_gt )? <PClassTemplateArg>
end
rule template_decl
"template" s "<" s ( !">" template_decl_arg s ( "," s template_decl_arg )* )? s ">" <PTemplateDecl>
end
rule trailing_return_type
"->" s ( "decltype" s "(" s block s ")" / type )
end
rule declaration_w_semicolon
template:( d:template_decl s )?
template_member:( d_member:template_decl s )?
attr:( ( storage_class / inline_spec / constexpr_key ) s )*
a
( constexpr_key s )?
attr:( ( storage_class / inline_spec / ignored_attr ) s )*
t:type
# type declaration ends with a } .. does not need a semicolon
# (i.e. nested struct or enum)
!{ |seq| seq[-1].text_value_ends_with_curly_brace }
s ( ":" s block_wo_curly_braces s )?
( trailing_return_type )?
a
(
"{" s block s "}" /
@ -403,14 +434,13 @@ grammar CPP
rule declaration_wo_semicolon
template:( d:template_decl s )?
attr:( ( storage_class / inline_spec / constexpr_key ) s )*
a
( constexpr_key s )?
attr:( ( storage_class / inline_spec / ignored_attr ) s )*
t:type
# opposite case (see declaration_wo_semicolon)
# (i.e. nested struct or enum)
&{ |seq| seq[-1].text_value_ends_with_curly_brace }
s ( ":" s block_wo_curly_braces s )?
( trailing_return_type )?
a
(
"{" s block s "}" /
@ -432,8 +462,12 @@ grammar CPP
a "{" decls:( a ( ";" / typedef / namespace / extern_decl / declaration ) )* s "}" <PExternBlock>
end
rule asm
"asm" s "(" s block s ")"
end
rule module
( a ( ";" / static_assert / using / typedef / namespace / extern_decl / declaration ) )* s <PModule>
( a ( ";" / static_assert / using / typedef / namespace / extern_decl / declaration / asm ) )* s <PModule>
end
end

View File

@ -122,10 +122,17 @@ def add_native_impl_QPersistentQModelIndex
# alternative implementation for QPersistentQModelIndex::operator const QModelIndex &
add_native_impl("QPersistentModelIndex", <<'CODE', <<'DECL')
#if QT_VERSION < 0x60000
static const QModelIndex &castToQModelIndex(const QPersistentModelIndex *m)
{
return m->operator const QModelIndex &();
}
#else
static QModelIndex castToQModelIndex(const QPersistentModelIndex *m)
{
return m->operator QModelIndex();
}
#endif
CODE
gsi::method_ext("castToQModelIndex", &castToQModelIndex, "@brief Binding for \"operator const QModelIndex &\".")
DECL
@ -215,25 +222,25 @@ def add_native_impl_streams
return v;
}
static qt_gsi::Converter<class QChar>::target_type f_QDataStream_read_qchar(QDataStream *s)
static qt_gsi::Converter<QChar>::target_type f_QDataStream_read_qchar(QDataStream *s)
{
QChar v = 0;
QChar v = QChar (0);
*s >> v;
return qt_gsi::Converter<class QChar>::toc (v);
return qt_gsi::Converter<QChar>::toc (v);
}
static qt_gsi::Converter<class QList<int> >::target_type f_QDataStream_read_int_list(QDataStream *s)
static qt_gsi::Converter<QList<int> >::target_type f_QDataStream_read_int_list(QDataStream *s)
{
QList<int> v;
*s >> v;
return qt_gsi::Converter<class QList<int> >::toc (v);
return qt_gsi::Converter<QList<int> >::toc (v);
}
static qt_gsi::Converter<class QVector<int> >::target_type f_QDataStream_read_int_vector(QDataStream *s)
static qt_gsi::Converter<QVector<int> >::target_type f_QDataStream_read_int_vector(QDataStream *s)
{
QVector<int> v;
*s >> v;
return qt_gsi::Converter<class QVector<int> >::toc (v);
return qt_gsi::Converter<QVector<int> >::toc (v);
}
static QString f_QDataStream_read_string(QDataStream *s)
@ -316,21 +323,21 @@ def add_native_impl_streams
return s;
}
static QDataStream *f_QDataStream_put_qchar(QDataStream *s, const qt_gsi::Converter<class QChar>::target_type &v)
static QDataStream *f_QDataStream_put_qchar(QDataStream *s, const qt_gsi::Converter<QChar>::target_type &v)
{
*s << qt_gsi::Converter<class QChar>::toq (v);
*s << qt_gsi::Converter<QChar>::toq (v);
return s;
}
static QDataStream *f_QDataStream_put_int_list(QDataStream *s, const qt_gsi::Converter<class QList<int> >::target_type &v)
static QDataStream *f_QDataStream_put_int_list(QDataStream *s, const qt_gsi::Converter<QList<int> >::target_type &v)
{
*s << qt_gsi::Converter<class QList<int> >::toq (v);
*s << qt_gsi::Converter<QList<int> >::toq (v);
return s;
}
static QDataStream *f_QDataStream_put_int_vector(QDataStream *s, const qt_gsi::Converter<class QVector<int> >::target_type &v)
static QDataStream *f_QDataStream_put_int_vector(QDataStream *s, const qt_gsi::Converter<QVector<int> >::target_type &v)
{
*s << qt_gsi::Converter<class QVector<int> >::toq (v);
*s << qt_gsi::Converter<QVector<int> >::toq (v);
return s;
}
@ -441,7 +448,7 @@ add_native_impl("QTextStream", <<'CODE', <<'DECL')
static qt_gsi::Converter<QChar>::target_type f_QTextStream_read_qchar(QTextStream *s)
{
QChar v = 0;
QChar v = QChar (0);
*s >> v;
return qt_gsi::Converter<QChar>::toc (v);
}
@ -617,52 +624,52 @@ def add_native_impl_polygons
static void f_QPolygon_clear (QPolygon *m)
{
return m->clear();
m->clear();
}
static void f_QPolygon_remove (QPolygon *m, int i)
{
return m->remove (i);
m->remove (i);
}
static void f_QPolygon_insert (QPolygon *m, int i, const QPoint &p)
{
return m->insert (i, p);
m->insert (i, p);
}
static void f_QPolygon_replace (QPolygon *m, int i, const QPoint &p)
{
return m->replace (i, p);
m->replace (i, p);
}
static void f_QPolygon_pop_front (QPolygon *m)
{
return m->pop_front ();
m->pop_front ();
}
static void f_QPolygon_pop_back (QPolygon *m)
{
return m->pop_back ();
m->pop_back ();
}
static void f_QPolygon_push_front (QPolygon *m, const QPoint &p)
{
return m->push_front (p);
m->push_front (p);
}
static void f_QPolygon_push_back (QPolygon *m, const QPoint &p)
{
return m->push_back (p);
m->push_back (p);
}
static void f_QPolygon_reserve (QPolygon *m, int n)
{
return m->reserve (n);
m->reserve (n);
}
static void f_QPolygon_resize (QPolygon *m, int n)
{
return m->resize (n);
m->resize (n);
}
static void f_QPolygon_fill (QPolygon *m, const QPoint &p, int n)
@ -747,52 +754,52 @@ DECL
static void f_QPolygonF_clear (QPolygonF *m)
{
return m->clear();
m->clear();
}
static void f_QPolygonF_remove (QPolygonF *m, int i)
{
return m->remove (i);
m->remove (i);
}
static void f_QPolygonF_insert (QPolygonF *m, int i, const QPointF &p)
{
return m->insert (i, p);
m->insert (i, p);
}
static void f_QPolygonF_replace (QPolygonF *m, int i, const QPointF &p)
{
return m->replace (i, p);
m->replace (i, p);
}
static void f_QPolygonF_pop_front (QPolygonF *m)
{
return m->pop_front ();
m->pop_front ();
}
static void f_QPolygonF_pop_back (QPolygonF *m)
{
return m->pop_back ();
m->pop_back ();
}
static void f_QPolygonF_push_front (QPolygonF *m, const QPointF &p)
{
return m->push_front (p);
m->push_front (p);
}
static void f_QPolygonF_push_back (QPolygonF *m, const QPointF &p)
{
return m->push_back (p);
m->push_back (p);
}
static void f_QPolygonF_reserve (QPolygonF *m, int n)
{
return m->reserve (n);
m->reserve (n);
}
static void f_QPolygonF_resize (QPolygonF *m, int n)
{
return m->resize (n);
m->resize (n);
}
static void f_QPolygonF_fill (QPolygonF *m, const QPointF &p, int n)

View File

@ -87,8 +87,8 @@ end
# "cv" is a CPPCV object.
class CPPFunc < CPPOuterType
attr_accessor :inner, :args, :cv
def_initializer :inner, :args, :cv
attr_accessor :inner, :args, :cv, :ref
def_initializer :inner, :args, :cv, :ref
def to_s
a = self.args
@ -96,12 +96,13 @@ class CPPFunc < CPPOuterType
if !a.is_a?(Array)
a = [a]
end
self.inner.to_s + " (" + a.join(", ") + ")" + (self.cv ? " " + self.cv.to_s : "")
self.inner.to_s + " (" + a.join(", ") + ")" + (self.cv ? " " + self.cv.to_s : "") + (self.ref ? " " + self.ref.to_s : "")
end
def dump(i)
i + "CPPFunc\n" + i + " inner:\n" + self.inner.dump(i + " ") + "\n" +
i + " cv: " + self.cv.to_s + "\n" +
i + " ref: " + self.ref.to_s + "\n" +
i + " args:\n" + (self.args || []).collect { |f| f.dump(i + " ") }.join("\n")
end
@ -469,29 +470,19 @@ class CPPFriendDecl < CPPObject
end
# @brief A type template argument (with an optional initializer)
# @attribute id The name of the argument (a string)
# @attribute type The template argument (a type)
# @attribute def_type The default type (nil or a CPPType object)
class CPPClassTemplateArg < CPPObject
attr_accessor :id, :def_type
def_initializer :id, :def_type
attr_accessor :type, :def_type
def_initializer :type, :def_type
def to_s
self.id + (self.def_type ? ("=" + self.def_type.to_s) : "")
end
end
# @brief A value template argument (with an optional initializer)
# @attribute type A CPPType object describing the type
# @attribute def_expr The initializer expression (a string) or nil if no initializer is given
class CPPDirectTemplateArg < CPPObject
attr_accessor :type, :def_expr
def_initializer :type, :def_expr
def to_s
self.type.to_s + (self.def_expr ? ("=" + self.def_expr.to_s) : "")
if self.def_type
self.type.to_s + "=" + self.def_type.to_s
else
self.type.to_s
end
end
end
@ -624,15 +615,15 @@ end
# @attribute specs the enum members (an array of CPPEnumSpec objects)
class CPPEnum < CPPObject
attr_accessor :name, :specs
def_initializer :name, :specs
attr_accessor :name, :specs, :is_class
def_initializer :name, :specs, :is_class
def to_s
"enum " + (self.name || "")
end
def dump(i)
l = i + self.to_s + " {\n"
l = i + self.to_s + (self.is_class ? " class" : "") + " {\n"
l += (self.specs || []).collect { |s| i + " " + s.to_s + "\n" }.join("")
l += i + "}"
end

View File

@ -128,7 +128,7 @@ module PEnumType
def cpp
name = id ? id.text_value : nil
specs = bodyspec.nonterminal? ? bodyspec.body.cpp : nil
CPPEnum::new(name, specs)
CPPEnum::new(name, specs, is_class.nonterminal?)
end
end
@ -241,7 +241,7 @@ end
module PFuncSpec
def cpp
CPPFunc::new(nil, (fa.nonterminal? && fa.text_value != "void") ? (fa.a.cpp || []) : [], cvspec.nonterminal? && cvspec.cv.to_symbol)
CPPFunc::new(nil, (fa.nonterminal? && fa.text_value != "void") ? (fa.a.cpp || []) : [], cvspec.nonterminal? && cvspec.cv.to_symbol, refspec.nonterminal? && refspec.ref.text_value)
end
end
@ -404,13 +404,7 @@ end
module PClassTemplateArg
def cpp
CPPClassTemplateArg::new(id.text_value, dtspec.nonterminal? ? dtspec.cpp : nil)
end
end
module PDirectTemplateArg
def cpp
CPPDirectTemplateArg::new(t.cpp, initspec.nonterminal? ? initspec.text_value : nil)
CPPClassTemplateArg::new(t.cpp, dtspec.nonterminal? ? dtspec.cpp : nil)
end
end

View File

@ -29,7 +29,7 @@ $:.push(File.dirname($0))
require 'oj'
require 'treetop'
Treetop.load "c++"
Treetop.load File.join(File.dirname($0), "c++")
input="all.e"
output="all.db"

View File

@ -73,6 +73,10 @@ class CPPDeclaration
self.type.func.cv == :const
end
def ref
self.type.func.ref
end
def hash_str
# TODO: this is a hack for making the hash values unique:
@ -83,6 +87,13 @@ class CPPDeclaration
nmax = func.max_args
hk = (self.is_const? ? "c" : "")
if self.ref
if self.ref == "&"
hk += "r"
elsif self.ref == "&&"
hk += "rr"
end
end
if nmax > 0
@ -111,17 +122,28 @@ class CPPDeclaration
nmax = func.max_args
args = nmax.times.collect { |ia| func.args[ia].anonymous_type.to_s }.join(", ")
res = "(" + args + ")"
if self.is_const?
"(" + args + ") const"
else
"(" + args + ")"
res += " const"
end
if self.ref
res += " " + self.ref
end
res
end
def sig(cls)
self.type.name_substituted_type(CPPQualifiedId::new(false, [ cls, self.type.func.func_name ])).to_s
end
def raw_sig(cls)
# backward compatibility for signature computation
s = self.type.name_substituted_type(CPPQualifiedId::new(false, [ cls, self.type.func.func_name ])).to_s
if self.ref
s = s.sub(/\s+&+$/, "")
end
if self.is_const?
s = s.sub(/\s+const$/, "")
end
@ -144,6 +166,33 @@ class CPPNamespace
end
class CPPModule
def collect_enum_decls(map, &filter)
self.decls.each do |bd|
if bd.is_a?(CPPEnumDeclaration)
bd.enum && filter.call(bd) && (map[bd.enum.name] ||= bd)
end
end
end
end
class CPPEnum
def resolve_typedefs(scope)
end
def rescope(prev_scope, other_scope, idpath)
end
def each_qid(&block)
end
end
class CPPStruct
def resolve_typedefs(scope)
@ -216,7 +265,7 @@ class CPPStruct
cls = self.id.to_s
# collect enums from inner classes
# collect used enums from inner classes
(self.body_decl || []).each do |bd|
decl = nil
if bd.is_a?(CPPStructDeclaration) && bd.visibility == :public && bd.struct.body_decl && bd.myself != "" && !conf.is_class_dropped?(cls, bd.myself)
@ -224,6 +273,14 @@ class CPPStruct
end
end
# collect used enums from base classes
(self.base_classes || []).each do |bc|
bc_obj = self.parent.resolve_qid(bc.class_id)
if bc_obj.is_a?(CPPStructDeclaration) && bc_obj.visibility == :public && bc_obj.struct.body_decl && bc_obj.myself != "" && !conf.is_class_dropped?(cls, bc_obj.myself)
bc_obj.struct.collect_used_enums(map, conf)
end
end
methods = {}
self.collect_all_methods(methods, conf)
@ -266,7 +323,7 @@ class CPPStruct
end
def collect_methods(map)
def collect_methods(map, weak = false)
mmap = {}
@ -306,6 +363,7 @@ class CPPStruct
end
# take non-duplicates (by call signature) for the map
# weak ones do not redefine methods
mmap.each do |mn,decls|
seen = {}
@ -313,7 +371,9 @@ class CPPStruct
s = d.call_sig
if !seen[s]
seen[s] = true
(map[mn] ||= []) << d
if !weak || !map[mn]
(map[mn] ||= []) << d
end
end
end
@ -426,7 +486,7 @@ class CPPStruct
end
elsif bc_obj
raise("#{bc.class_id.to_s} is not a base class in #{self.id.to_s}")
puts("Warning: #{bc.class_id.to_s} is not a base class in #{self.id.to_s}")
else
puts("Cannot find base class: #{bc.class_id.to_s} of #{self.parent.myself} - declaration ignored")
end
@ -739,7 +799,13 @@ class CPPType
return "#{self.anonymous_type.to_s}(" + expr + ")"
elsif self.is_special(decl_obj)
ta = self.anonymous_type.to_s
if ta =~ /^const (.*) &$/
if ta =~ /^const (.*) &&$/
ta = $1
acc = ".cmove()"
elsif ta =~ /^(.*) &&$/
ta = $1
acc = ".move()"
elsif ta =~ /^const (.*) &$/
ta = $1
acc = ".cref()"
elsif ta =~ /^(.*) &$/
@ -776,6 +842,8 @@ class CPPType
# but can at least read them.
if ta =~ /^const (.*) &$/ || ta =~ /^(.*) &$/
ta = $1
elsif ta =~ /^const (.*) &&$/ || ta =~ /^(.*) &&$/
ta = $1
elsif ta =~ /^const (.*) \*$/ || ta =~ /^(.*) \*$/
ta = $1
acc = "*"
@ -911,6 +979,7 @@ class Configurator
@dropped_methods = {}
@dropped_classes = {}
@dropped_enums = {}
@included_enums = {}
@renamed_methods = {}
@kept_args = {}
@owner_args = {}
@ -1038,9 +1107,9 @@ class Configurator
else
dc = (@dropped_classes[:all_classes] || []) + (@dropped_classes[cls] || [])
if sig != :whole_class
return dc.find { |d| sig =~ d } != nil
return dc.find { |d| d == :whole_class || sig =~ d } != nil
else
return dc.find { |d| sig == d } != nil
return dc.find { |d| d == :whole_class || sig == d } != nil
end
end
end
@ -1140,6 +1209,7 @@ class Configurator
# static and non-static methods
if bd.storage_class == :static
sig = "static " + sig
sig2 = "static " + sig2
end
if is_dropped?(cls, sig) || is_dropped?(cls2, sig2)
@ -1151,6 +1221,11 @@ class Configurator
# replace assignment operator
if name == "="
# drop assignment if the class does not have a copy ctor ("no copy semantics")
# (required because otherwise operator= is exposed for adaptor classes)
if !has_copy_ctor?(cls)
return nil
end
name = "assign"
end
@ -1225,6 +1300,16 @@ class Configurator
gsub(/\s+/, "")
end
def include_enum(cls, sig)
@included_enums[cls] ||= []
@included_enums[cls] << sig
end
def is_enum_included?(cls, sig)
dm = (@included_enums[:all_classes] || []) + (@included_enums[cls] || [])
dm.find { |d| sig =~ d } != nil
end
def drop_enum(cls, sig)
@dropped_enums[cls] ||= []
@dropped_enums[cls] << sig
@ -1300,7 +1385,7 @@ end
class BindingProducer
attr_accessor :modn
attr_accessor :modn, :root
# @brief Read the input file (JSON)
#
@ -1394,7 +1479,7 @@ class BindingProducer
def produce_cpp_from_decl(conf, decl_obj)
if !decl_obj.is_a?(CPPStructDeclaration) && !decl_obj.is_a?(CPPNamespace)
if !decl_obj.is_a?(CPPStructDeclaration) && !decl_obj.is_a?(CPPNamespace) && !decl_obj.is_a?(CPPEnumDeclaration)
return
end
@ -1455,6 +1540,8 @@ END
cont = produce_class(conf, decl_obj, ofile, index)
elsif decl_obj.is_a?(CPPNamespace)
cont = produce_namespace(conf, decl_obj, ofile, index)
elsif decl_obj.is_a?(CPPEnumDeclaration)
cont = produce_enum(conf, decl_obj, ofile, index)
end
puts("#{ofile_name} written.")
@ -1559,7 +1646,26 @@ END
ofile.puts("#include \"gsiQt.h\"")
ofile.puts("#include \"gsi#{modn}Common.h\"")
ofile.puts("#include \"gsiDecl#{modn}TypeTraits.h\"")
end
def produce_enum(conf, decl_obj, ofile, index)
( cls, clsn ) = make_cls_names(decl_obj)
produce_class_include(conf, decl_obj, ofile)
ofile.puts("#include <memory>")
ofile.puts("")
ofile.puts("// -----------------------------------------------------------------------")
ofile.puts("// enum #{cls}")
ofile.puts("")
# emit enum wrapper classes (top level, hence container class is nil)
produce_enum_wrapper_class(ofile, conf, nil, cls, decl_obj)
return false
end
@ -1611,7 +1717,7 @@ END
def produce_enum_wrapper_class(ofile, conf, cls, en, ed)
clsn = make_cls_name(cls)
clsn = cls && make_cls_name(cls)
# emit enum wrapper classes
@ -1620,53 +1726,86 @@ END
ofile.puts("namespace qt_gsi")
ofile.puts("{")
ofile.puts("")
ofile.puts("static gsi::Enum<#{cls}::#{en}> decl_#{clsn}_#{en}_Enum (\"#{modn}\", \"#{clsn}_#{en}\",")
if cls
ofile.puts("static gsi::Enum<#{cls}::#{en}> decl_#{clsn}_#{en}_Enum (\"#{modn}\", \"#{clsn}_#{en}\",")
else
ofile.puts("static gsi::Enum<#{en}> decl_#{en}_Enum (\"#{modn}\", \"#{en}\",")
end
edecl = []
ec = ed.enum.specs.collect { |s| s.name }
ec.each_with_index do |ei,i|
ei_name = conf.target_name_for_enum_const(cls, "#{en}::#{ei}", ei)
ei_name = conf.target_name_for_enum_const(cls ? cls : "::", "#{en}::#{ei}", ei)
if ! ei_name
# enum dropped
next
end
edecl << " gsi::enum_const (\"#{ei_name}\", #{cls}::#{ei}, \"@brief Enum constant #{cls}::#{ei}\")"
if cls
if ed.enum.is_class
edecl << " gsi::enum_const (\"#{ei_name}\", #{cls}::#{en}::#{ei}, \"@brief Enum constant #{cls}::#{en}::#{ei}\")"
else
edecl << " gsi::enum_const (\"#{ei_name}\", #{cls}::#{ei}, \"@brief Enum constant #{cls}::#{ei}\")"
end
else
if ed.enum.is_class
edecl << " gsi::enum_const (\"#{ei_name}\", #{en}::#{ei}, \"@brief Enum constant #{en}::#{ei}\")"
else
edecl << " gsi::enum_const (\"#{ei_name}\", #{ei}, \"@brief Enum constant #{ei}\")"
end
end
end
ofile.puts(" " + edecl.join(" +\n ") + ",\n")
ofile.puts(" \"@qt\\n@brief This class represents the #{cls}::#{en} enum\");")
if cls
ofile.puts(" \"@qt\\n@brief This class represents the #{cls}::#{en} enum\");")
else
ofile.puts(" \"@qt\\n@brief This class represents the #{en} enum\");")
end
ofile.puts("")
ofile.puts("static gsi::QFlagsClass<#{cls}::#{en} > decl_#{clsn}_#{en}_Enums (\"#{modn}\", \"#{clsn}_QFlags_#{en}\",")
ofile.puts(" \"@qt\\n@brief This class represents the QFlags<#{cls}::#{en}> flag set\");")
ofile.puts("")
ofile.puts("// Inject the declarations into the parent")
# inject the declarations into the parent namespace or class
pdecl_obj = ed.parent
pcls = pdecl_obj.myself
o = pdecl_obj
while o.parent && o.parent.myself
o = o.parent
pcls = o.myself + "::" + pcls
if cls
ofile.puts("static gsi::QFlagsClass<#{cls}::#{en} > decl_#{clsn}_#{en}_Enums (\"#{modn}\", \"#{clsn}_QFlags_#{en}\",")
ofile.puts(" \"@qt\\n@brief This class represents the QFlags<#{cls}::#{en}> flag set\");")
ofile.puts("")
else
ofile.puts("static gsi::QFlagsClass<#{en} > decl_#{en}_Enums (\"#{modn}\", \"QFlags_#{en}\",")
ofile.puts(" \"@qt\\n@brief This class represents the QFlags<#{en}> flag set\");")
ofile.puts("")
end
pname = pcls
if pdecl_obj.is_a?(CPPNamespace)
pname = pcls + "_Namespace"
if cls
# inject the declarations into the parent namespace or class
pdecl_obj = ed.parent
pcls = pdecl_obj.myself
o = pdecl_obj
while o.parent && o.parent.myself
o = o.parent
pcls = o.myself + "::" + pcls
end
pname = pcls
if pdecl_obj.is_a?(CPPNamespace)
pname = pcls + "_Namespace"
end
if ! ed.enum.is_class
ofile.puts("// Inject the declarations into the parent")
ofile.puts("static gsi::ClassExt<#{pname}> inject_#{clsn}_#{en}_Enum_in_parent (decl_#{clsn}_#{en}_Enum.defs ());")
end
ofile.puts("static gsi::ClassExt<#{pname}> decl_#{clsn}_#{en}_Enum_as_child (decl_#{clsn}_#{en}_Enum, \"#{en}\");")
ofile.puts("static gsi::ClassExt<#{pname}> decl_#{clsn}_#{en}_Enums_as_child (decl_#{clsn}_#{en}_Enums, \"QFlags_#{en}\");")
ofile.puts("")
end
ofile.puts("static gsi::ClassExt<#{pname}> inject_#{clsn}_#{en}_Enum_in_parent (decl_#{clsn}_#{en}_Enum.defs ());")
ofile.puts("static gsi::ClassExt<#{pname}> decl_#{clsn}_#{en}_Enum_as_child (decl_#{clsn}_#{en}_Enum, \"#{en}\");")
ofile.puts("static gsi::ClassExt<#{pname}> decl_#{clsn}_#{en}_Enums_as_child (decl_#{clsn}_#{en}_Enums, \"QFlags_#{en}\");")
ofile.puts("")
ofile.puts("}")
ofile.puts("")
@ -1779,6 +1918,10 @@ END
base_cls = base_classes[0] && base_classes[0].class_id.to_s
base_clsn = base_cls && make_cls_name(base_cls)
# as we only support single base classes (a tribute to Ruby), we treat all other base classes as
# mixins
mixin_base_classes = base_classes[1..] || []
methods_by_name = {}
all_methods_by_name = {}
enum_decls_by_name = {}
@ -1786,13 +1929,13 @@ END
bc_methods_by_name = {}
base_classes.each do |bc|
bc_decl_obj = decl_obj.resolve_qid(bc.class_id)
bc_decl_obj && bc_decl_obj.struct.collect_all_methods(bc_methods_by_name, conf)
bc_decl_obj && bc_decl_obj.respond_to?(:struct) && bc_decl_obj.struct.collect_all_methods(bc_methods_by_name, conf)
end
mmap = {}
struct.collect_methods(methods_by_name)
struct.collect_all_methods(all_methods_by_name, conf)
struct.collect_enum_decls(enum_decls_by_name) { |bd| self.is_enum_used?(bd) }
struct.collect_methods(methods_by_name)
struct.collect_enum_decls(enum_decls_by_name) { |bd| self.is_enum_used?(bd) || conf.is_enum_included?(cls, bd.myself) }
# if one method is abstract, omit ctors for example
is_abstract = all_methods_by_name.values.find do |m|
@ -1832,7 +1975,7 @@ END
# create a default ctor if there is no ctor at all and we can have one
if ctors.empty? && conf.has_default_ctor?(cls)
func = CPPFunc::new(CPPQualifiedId::new(false, [ CPPId::new(decl_obj.myself, nil) ]), [], nil)
func = CPPFunc::new(CPPQualifiedId::new(false, [ CPPId::new(decl_obj.myself, nil) ]), [], nil, nil)
type = CPPType::new(nil, func, nil)
def_ctor = CPPDeclaration::new(type, nil, :public, nil, false, false)
def_ctor.parent = decl_obj
@ -1861,6 +2004,7 @@ END
native_impl = conf.native_impl(cls)
has_metaobject = ((struct.body_decl || []).find { |bd| bd.is_a?(CPPDeclaration) && bd.type.name == "metaObject" } != nil)
has_metaobject = has_metaobject && !conf.is_dropped?(cls, cls + "::staticMetaObject")
mdecl = []
mdecl_ctors = []
@ -1905,6 +2049,7 @@ END
func = bd.type.func
hk = bd.hash_str
sig = bd.sig(cls)
rsig = bd.raw_sig(cls)
mn = decl_obj.myself # ctor!
mn_name = conf.target_name(cls, bd, mn)
@ -1923,7 +2068,7 @@ END
qt_alist = n_args.times.collect { |ia| func.args[ia].renamed_type(alist[ia]).access_qt_arg(decl_obj) }
ofile.puts("")
ofile.puts("// Constructor #{sig}")
ofile.puts("// Constructor #{rsig}")
ofile.puts("")
ofile.puts("")
@ -1951,7 +2096,7 @@ END
ofile.puts("}")
ofile.puts("")
mdecl_ctors << "new qt_gsi::GenericStaticMethod (\"#{mn_name}\", \"@brief Constructor #{sig}\\nThis method creates an object of class #{cls}.\", &_init_ctor_#{clsn}_#{hk}, &_call_ctor_#{clsn}_#{hk});"
mdecl_ctors << "new qt_gsi::GenericStaticMethod (\"#{mn_name}\", \"@brief Constructor #{rsig}\\nThis method creates an object of class #{cls}.\", &_init_ctor_#{clsn}_#{hk}, &_call_ctor_#{clsn}_#{hk});"
end
@ -1978,6 +2123,7 @@ END
const = bd.is_const?
hk = bd.hash_str
sig = bd.sig(cls)
rsig = bd.raw_sig(cls)
if conf.event_args(cls, sig) && bd.type.return_type.is_void?
# don't produce bindings for signals (which are public in Qt5)
@ -2005,7 +2151,7 @@ END
qt_alist = n_args.times.collect { |ia| func.args[ia].renamed_type(alist[ia]).access_qt_arg(decl_obj) }
ofile.puts("")
ofile.puts("// #{sig}")
ofile.puts("// #{rsig}")
ofile.puts("")
ofile.puts("")
@ -2030,7 +2176,7 @@ END
ofile.puts("}")
ofile.puts("")
mdecl << "new qt_gsi::GenericMethod (\"#{mn_name}\", \"@brief Method #{sig}\\n" + (is_reimp ? "This is a reimplementation of #{is_reimp.parent.myself}::#{mid}" : "") + "\", #{const.to_s}, &_init_f_#{mn}_#{hk}, &_call_f_#{mn}_#{hk});"
mdecl << "new qt_gsi::GenericMethod (\"#{mn_name}\", \"@brief Method #{rsig}\\n" + (is_reimp ? "This is a reimplementation of #{is_reimp.parent.myself}::#{mid}" : "") + "\", #{const.to_s}, &_init_f_#{mn}_#{hk}, &_call_f_#{mn}_#{hk});"
end
@ -2065,6 +2211,7 @@ END
end
sig = bd_short.sig(cls)
rsig = bd_short.raw_sig(cls)
hk = bd_short.hash_str
n_args = func.max_args
@ -2078,7 +2225,7 @@ END
al = ant.collect { |a| a.to_s }.join(", ")
aln = ren_args.collect { |a| a.to_s }.join(", ")
sig_wo_void = sig.sub(/^void /, "")
rsig_wo_void = rsig.sub(/^void /, "")
al_subst = al
SignalSubstitutions.each do |t,s|
@ -2087,9 +2234,9 @@ END
argspecs = argnames.collect { |a| "gsi::arg(\"#{a}\"), " }.join("")
if gsi_args.empty?
mdecl << "gsi::qt_signal (\"#{mid}(#{al_subst})\", \"#{mn_name}\", \"@brief Signal declaration for #{sig_wo_void}\\nYou can bind a procedure to this signal.\");"
mdecl << "gsi::qt_signal (\"#{mid}(#{al_subst})\", \"#{mn_name}\", \"@brief Signal declaration for #{rsig_wo_void}\\nYou can bind a procedure to this signal.\");"
else
mdecl << "gsi::qt_signal<#{event_al} > (\"#{mid}(#{al_subst})\", \"#{mn_name}\", #{argspecs}\"@brief Signal declaration for #{sig_wo_void}\\nYou can bind a procedure to this signal.\");"
mdecl << "gsi::qt_signal<#{event_al} > (\"#{mid}(#{al_subst})\", \"#{mn_name}\", #{argspecs}\"@brief Signal declaration for #{rsig_wo_void}\\nYou can bind a procedure to this signal.\");"
end
end
@ -2114,6 +2261,7 @@ END
const = bd.is_const?
hk = bd.hash_str
sig = bd.sig(cls)
rsig = bd.raw_sig(cls)
mn = conf.mid2str(mid)
mn_name = conf.target_name(cls, bd, mid, all_methods_by_name, bd)
@ -2132,7 +2280,7 @@ END
qt_alist = n_args.times.collect { |ia| func.args[ia].renamed_type(alist[ia]).access_qt_arg(decl_obj) }
ofile.puts("")
ofile.puts("// static #{sig}")
ofile.puts("// static #{rsig}")
ofile.puts("")
ofile.puts("")
@ -2156,7 +2304,7 @@ END
ofile.puts("}")
ofile.puts("")
mdecl << "new qt_gsi::GenericStaticMethod (\"#{mn_name}\", \"@brief Static method #{sig}\\nThis method is static and can be called without an instance.\", &_init_f_#{mn}_#{hk}, &_call_f_#{mn}_#{hk});"
mdecl << "new qt_gsi::GenericStaticMethod (\"#{mn_name}\", \"@brief Static method #{rsig}\\nThis method is static and can be called without an instance.\", &_init_f_#{mn}_#{hk}, &_call_f_#{mn}_#{hk});"
end
@ -2173,6 +2321,7 @@ END
const = bd.is_const?
hk = bd.hash_str
sig = bd.sig("")
rsig = bd.raw_sig("")
# operators may be present twice with the same signature
# (here: same hash key)
@ -2206,7 +2355,7 @@ END
args = rnt.collect { |t| t.gsi_decl_arg(decl_obj) }.join(", ")
ofile.puts("")
ofile.puts("// #{sig}")
ofile.puts("// #{rsig}")
ofile.puts("static #{rt.gsi_decl_return(decl_obj)} op_#{clsn}_#{mn}_#{hk}(#{args}) {")
if !rt.is_void?
@ -2219,7 +2368,7 @@ END
argspecs = argnames[1..-1].collect { |a| "gsi::arg (\"#{a}\"), " }.join("")
mdecl << "gsi::method_ext(\"#{mn_name}\", &::op_#{clsn}_#{mn}_#{hk}, #{argspecs}\"@brief Operator #{sig}\\nThis is the mapping of the global operator to the instance method.\");"
mdecl << "gsi::method_ext(\"#{mn_name}\", &::op_#{clsn}_#{mn}_#{hk}, #{argspecs}\"@brief Operator #{rsig}\\nThis is the mapping of the global operator to the instance method.\");"
end
@ -2231,35 +2380,35 @@ END
base_classes.each do |bc|
bc_name = bc.class_id.to_s
bc_name = bc.class_id.to_s
ofile.puts("// base class cast for #{bc_name}")
ofile.puts("")
ofile.puts("static void _init_f_#{clsn}_as_#{bc_name} (qt_gsi::GenericMethod *decl)")
ofile.puts("{")
ofile.puts(" decl->set_return<#{bc_name} *> ();")
ofile.puts("}")
ofile.puts("")
ofile.puts("static void _call_f_#{clsn}_as_#{bc_name} (const qt_gsi::GenericMethod *, void *cls, gsi::SerialArgs &, gsi::SerialArgs &ret) ")
ofile.puts("{")
ofile.puts(" ret.write<#{bc_name} *> ((#{bc_name} *)(#{cls} *)cls);")
ofile.puts("}")
ofile.puts("")
ofile.puts("// base class cast for #{bc_name}")
ofile.puts("")
ofile.puts("static void _init_f_#{clsn}_as_#{bc_name} (qt_gsi::GenericMethod *decl)")
ofile.puts("{")
ofile.puts(" decl->set_return<#{bc_name} *> ();")
ofile.puts("}")
ofile.puts("")
ofile.puts("static void _call_f_#{clsn}_as_#{bc_name} (const qt_gsi::GenericMethod *, void *cls, gsi::SerialArgs &, gsi::SerialArgs &ret) ")
ofile.puts("{")
ofile.puts(" ret.write<#{bc_name} *> ((#{bc_name} *)(#{cls} *)cls);")
ofile.puts("}")
ofile.puts("")
mdecl_bcc << "new qt_gsi::GenericMethod (\"as#{bc_name}\", \"@brief Delivers the base class interface #{bc_name} of #{cls}\\nClass #{cls} is derived from multiple base classes. This method delivers the #{bc_name} base class aspect.\", false, &_init_f_#{clsn}_as_#{bc_name}, &_call_f_#{clsn}_as_#{bc_name});"
mdecl_bcc << "new qt_gsi::GenericMethod (\"as#{bc_name}\", \"@brief Delivers the base class interface #{bc_name} of #{cls}\\nClass #{cls} is derived from multiple base classes. This method delivers the #{bc_name} base class aspect.\", false, &_init_f_#{clsn}_as_#{bc_name}, &_call_f_#{clsn}_as_#{bc_name});"
ofile.puts("static void _init_f_#{clsn}_as_const_#{bc_name} (qt_gsi::GenericMethod *decl)")
ofile.puts("{")
ofile.puts(" decl->set_return<const #{bc_name} *> ();")
ofile.puts("}")
ofile.puts("")
ofile.puts("static void _call_f_#{clsn}_as_const_#{bc_name} (const qt_gsi::GenericMethod *, void *cls, gsi::SerialArgs &, gsi::SerialArgs &ret) ")
ofile.puts("{")
ofile.puts(" ret.write<const #{bc_name} *> ((const #{bc_name} *)(const #{cls} *)cls);")
ofile.puts("}")
ofile.puts("")
ofile.puts("static void _init_f_#{clsn}_as_const_#{bc_name} (qt_gsi::GenericMethod *decl)")
ofile.puts("{")
ofile.puts(" decl->set_return<const #{bc_name} *> ();")
ofile.puts("}")
ofile.puts("")
ofile.puts("static void _call_f_#{clsn}_as_const_#{bc_name} (const qt_gsi::GenericMethod *, void *cls, gsi::SerialArgs &, gsi::SerialArgs &ret) ")
ofile.puts("{")
ofile.puts(" ret.write<const #{bc_name} *> ((const #{bc_name} *)(const #{cls} *)cls);")
ofile.puts("}")
ofile.puts("")
mdecl_bcc << "new qt_gsi::GenericMethod (\"asConst#{bc_name}\", \"@brief Delivers the base class interface #{bc_name} of #{cls}\\nClass #{cls} is derived from multiple base classes. This method delivers the #{bc_name} base class aspect.\\n\\nUse this version if you have a const reference.\", true, &_init_f_#{clsn}_as_const_#{bc_name}, &_call_f_#{clsn}_as_const_#{bc_name});"
mdecl_bcc << "new qt_gsi::GenericMethod (\"asConst#{bc_name}\", \"@brief Delivers the base class interface #{bc_name} of #{cls}\\nClass #{cls} is derived from multiple base classes. This method delivers the #{bc_name} base class aspect.\\n\\nUse this version if you have a const reference.\", true, &_init_f_#{clsn}_as_const_#{bc_name}, &_call_f_#{clsn}_as_const_#{bc_name});"
end
@ -2335,25 +2484,29 @@ END
# forward decl
@ext_decls << "#{struct.kind.to_s} #{cls};\n\n"
# type traits included ...
tt = "namespace tl { template <> struct type_traits<#{cls}> : public type_traits<void> {\n"
if !conf.has_copy_ctor?(cls) || is_abstract || (eq_op && eq_op.visibility == :private)
tt += " typedef tl::false_tag has_copy_constructor;\n"
end
if !conf.has_default_ctor?(cls) || is_abstract
tt += " typedef tl::false_tag has_default_constructor;\n"
end
if (dtor = struct.get_dtor) && dtor.visibility != :public
tt += " typedef tl::false_tag has_public_destructor;\n"
end
tt += "}; }\n\n"
@ext_decls << tt
# only for top-level classes external declarations are produced currently
@ext_decls << "namespace gsi { GSI_#{modn.upcase}_PUBLIC gsi::Class<#{cls}> &qtdecl_#{clsn} (); }\n\n"
end
# Produce the mixin base classes
if ! mixin_base_classes.empty?
ofile.puts("")
ofile.puts("// Additional base classes")
ofile.puts("")
mixin_base_classes.each do |bc|
bc_name = bc.class_id.to_s
ofile.puts("gsi::Class<#{bc_name}> &qtdecl_#{bc_name} ();")
end
ofile.puts("")
end
mixin_base_classes.each do |bc|
bc_name = bc.class_id.to_s
ofile.puts("gsi::ClassExt<#{cls}> base_class_#{bc_name}_in_#{clsn} (qtdecl_#{bc_name} ());")
end
ofile.puts("")
ofile.puts("GSI_#{modn.upcase}_PUBLIC gsi::Class<#{cls}> &qtdecl_#{clsn} () { return decl_#{clsn}; }")
ofile.puts("")
@ -2383,6 +2536,7 @@ END
func = bd.type.func
hk = bd.hash_str
sig = bd.sig(cls)
rsig = bd.raw_sig(cls)
mn = decl_obj.myself # ctor!
mn_name = conf.target_name(cls, bd, mn)
@ -2406,7 +2560,7 @@ END
args = rnt.collect { |t| t.to_s }.join(", ")
ofile.puts("")
ofile.puts(" // [adaptor ctor] #{sig}")
ofile.puts(" // [adaptor ctor] #{rsig}")
ofile.puts(" #{clsn}_Adaptor(#{args}) : #{cls}(#{argnames.join(', ')})")
ofile.puts(" {")
ofile.puts(" qt_gsi::QtObjectBase::init (this);")
@ -2430,6 +2584,7 @@ END
func = bd.type.func
hk = bd.hash_str
sig = bd.sig(cls)
rsig = bd.raw_sig(cls)
const = bd.is_const?
# exclude events
@ -2453,7 +2608,7 @@ END
argexpr = rnt.collect { |t| t.access_qt_arg(decl_obj) }.join(", ")
ofile.puts("")
ofile.puts(" // [expose] #{sig}")
ofile.puts(" // [expose] #{rsig}")
ofile.puts(" " + (bd.storage_class == :static ? "static " : "") + "#{rt.gsi_decl_return(decl_obj)} fp_#{clsn}_#{mn}_#{hk} (#{args}) " + (const ? "const " : "") + "{")
if rt.is_void?
ofile.puts(" #{cls}::#{mid}(#{argexpr});")
@ -2481,6 +2636,7 @@ END
func = bd.type.func
hk = bd.hash_str
sig = bd.sig(cls)
rsig = bd.raw_sig(cls)
const = bd.is_const?
rt = bd.type.return_type
@ -2504,6 +2660,7 @@ END
end
sig = bd_short.sig(cls)
rsig = bd_short.raw_sig(cls)
# for events produce an emitter function
@ -2517,7 +2674,7 @@ END
call_args = argnames.join(", ")
ofile.puts("")
ofile.puts(" // [emitter impl] #{sig}")
ofile.puts(" // [emitter impl] #{rsig}")
ofile.puts(" #{rt.to_s} emitter_#{clsn}_#{mn}_#{hk}(#{raw_args})")
ofile.puts(" {")
if is_private
@ -2560,7 +2717,7 @@ END
call_args = argnames.join(", ")
ofile.puts("")
ofile.puts(" // [adaptor impl] #{sig}")
ofile.puts(" // [adaptor impl] #{rsig}")
ofile.puts(" #{rt.gsi_decl_return(decl_obj)} cbs_#{mn}_#{hk}_#{i_var}(#{args})" + (const ? " const" : ""))
ofile.puts(" {")
if abstract
@ -2625,6 +2782,7 @@ END
func = bd.type.func
hk = bd.hash_str
sig = bd.sig(cls)
rsig = bd.raw_sig(cls)
mn = decl_obj.myself # ctor!
mn_name = conf.target_name(cls, bd, mn)
@ -2642,7 +2800,7 @@ END
qt_alist = n_args.times.collect { |ia| func.args[ia].renamed_type(alist[ia]).access_qt_arg(decl_obj) }
ofile.puts("")
ofile.puts("// Constructor #{sig} (adaptor class)")
ofile.puts("// Constructor #{rsig} (adaptor class)")
ofile.puts("")
ofile.puts("static void _init_ctor_#{clsn}_Adaptor_#{hk} (qt_gsi::GenericStaticMethod *decl)")
ofile.puts("{")
@ -2664,7 +2822,7 @@ END
ofile.puts("}")
ofile.puts("")
mdecl << "new qt_gsi::GenericStaticMethod (\"#{mn_name}\", \"@brief Constructor #{sig}\\nThis method creates an object of class #{cls}.\", &_init_ctor_#{clsn}_Adaptor_#{hk}, &_call_ctor_#{clsn}_Adaptor_#{hk});"
mdecl << "new qt_gsi::GenericStaticMethod (\"#{mn_name}\", \"@brief Constructor #{rsig}\\nThis method creates an object of class #{cls}.\", &_init_ctor_#{clsn}_Adaptor_#{hk}, &_call_ctor_#{clsn}_Adaptor_#{hk});"
end
@ -2677,6 +2835,7 @@ END
func = bd.type.func
hk = bd.hash_str
sig = bd.sig(cls)
rsig = bd.raw_sig(cls)
const = bd.is_const?
rt = bd.type.return_type
@ -2698,6 +2857,7 @@ END
end
sig = bd_short.sig(cls)
rsig = bd_short.raw_sig(cls)
n_args = func.max_args
n_min_args = func.min_args
@ -2707,7 +2867,7 @@ END
ifc_obj = "GenericMethod"
ofile.puts("")
ofile.puts("// emitter #{sig}")
ofile.puts("// emitter #{rsig}")
ofile.puts("")
ofile.puts("static void _init_emitter_#{mn}_#{hk} (qt_gsi::#{ifc_obj} *decl)")
ofile.puts("{")
@ -2728,7 +2888,7 @@ END
if bd_short.storage_class != :static
const_flag = ", " + const.to_s
end
mdecl << "new qt_gsi::#{ifc_obj} (\"emit_#{mn_name}\", \"@brief Emitter for signal #{sig}\\nCall this method to emit this signal.\"#{const_flag}, &_init_emitter_#{mn}_#{hk}, &_call_emitter_#{mn}_#{hk});"
mdecl << "new qt_gsi::#{ifc_obj} (\"emit_#{mn_name}\", \"@brief Emitter for signal #{rsig}\\nCall this method to emit this signal.\"#{const_flag}, &_init_emitter_#{mn}_#{hk}, &_call_emitter_#{mn}_#{hk});"
elsif !bd.virtual && bd.visibility == :protected
@ -2742,7 +2902,7 @@ END
ifc_obj = bd.storage_class == :static ? "GenericStaticMethod" : "GenericMethod"
ofile.puts("")
ofile.puts("// exposed #{sig}")
ofile.puts("// exposed #{rsig}")
ofile.puts("")
ofile.puts("static void _init_fp_#{mn}_#{hk} (qt_gsi::#{ifc_obj} *decl)")
ofile.puts("{")
@ -2781,7 +2941,7 @@ END
if bd.storage_class != :static
const_flag = ", " + const.to_s
end
mdecl << "new qt_gsi::#{ifc_obj} (\"*#{mn_name}\", \"@brief Method #{sig}\\nThis method is protected and can only be called from inside a derived class.\"#{const_flag}, &_init_fp_#{mn}_#{hk}, &_call_fp_#{mn}_#{hk});"
mdecl << "new qt_gsi::#{ifc_obj} (\"*#{mn_name}\", \"@brief Method #{rsig}\\nThis method is protected and can only be called from inside a derived class.\"#{const_flag}, &_init_fp_#{mn}_#{hk}, &_call_fp_#{mn}_#{hk});"
elsif bd.virtual
@ -2798,7 +2958,7 @@ END
alist = n_args.times.collect { |ia| "arg#{ia + 1}" }
ofile.puts("")
ofile.puts("// #{sig}")
ofile.puts("// #{rsig}")
ofile.puts("")
ofile.puts("static void _init_cbs_#{mn}_#{hk}_#{i_var} (qt_gsi::GenericMethod *decl)")
ofile.puts("{")
@ -2834,7 +2994,7 @@ END
ofile.puts("}")
ofile.puts("")
mdecl << "new qt_gsi::GenericMethod (\"#{pp}#{mn_name}\", \"@brief Virtual method #{sig}\\nThis method can be reimplemented in a derived class.\", #{const.to_s}, &_init_cbs_#{mn}_#{hk}_#{i_var}, &_call_cbs_#{mn}_#{hk}_#{i_var});"
mdecl << "new qt_gsi::GenericMethod (\"#{pp}#{mn_name}\", \"@brief Virtual method #{rsig}\\nThis method can be reimplemented in a derived class.\", #{const.to_s}, &_init_cbs_#{mn}_#{hk}_#{i_var}, &_call_cbs_#{mn}_#{hk}_#{i_var});"
mdecl << "new qt_gsi::GenericMethod (\"#{pp}#{mn_name}\", \"@hide\", #{const.to_s}, &_init_cbs_#{mn}_#{hk}_#{i_var}, &_call_cbs_#{mn}_#{hk}_#{i_var}, &_set_callback_cbs_#{mn}_#{hk}_#{i_var});"
end
@ -2900,152 +3060,6 @@ END
end
def produce_ttfile_traits(ttfile, conf, decl_obj)
(cls, clsn) = make_cls_names(decl_obj)
struct = decl_obj.struct
mm = {}
struct.collect_all_methods(mm, conf)
# if one method is abstract, omit ctors for example
is_abstract = mm.values.find do |m|
m.find { |bd| bd.virtual && bd.type.init == "0" } != nil
end
eq_op = (mm["operator="] || [])[0]
# Note: right now, there is no way to specify type traits globally for nested
# classes because there is no forward declaration of inner classes. In that case we
# use the header
if cls =~ /^(.*?)::/
ttfile.puts("#include <#{$1}>")
else
ttfile.puts("#{struct.kind.to_s} #{cls};")
end
ttfile.puts("namespace tl {")
ttfile.puts "template <> struct type_traits<#{cls}> : public type_traits<void> {"
if !conf.has_copy_ctor?(cls) || is_abstract || (eq_op && eq_op.visibility == :private)
ttfile.puts " typedef tl::false_tag has_copy_constructor;"
end
if !conf.has_default_ctor?(cls) || is_abstract
ttfile.puts " typedef tl::false_tag has_default_constructor;"
end
if (dtor = struct.get_dtor) && dtor.visibility != :public
ttfile.puts " typedef tl::false_tag has_public_destructor;"
end
ttfile.puts "};"
ttfile.puts "}"
ttfile.puts ""
if struct.needs_adaptor(conf)
ttfile.puts("class #{clsn}_Adaptor;")
ttfile.puts("namespace tl {")
ttfile.puts "template <> struct type_traits<#{clsn}_Adaptor> : public type_traits<void> {"
if !conf.has_copy_ctor?(cls) || (eq_op && eq_op.visibility == :private)
ttfile.puts " typedef tl::false_tag has_copy_constructor;"
end
if !conf.has_default_ctor?(cls)
ttfile.puts " typedef tl::false_tag has_default_constructor;"
end
ttfile.puts "};"
ttfile.puts "}"
ttfile.puts ""
end
# walk through the subclasses
(struct.body_decl || []).each do |bd|
if bd.is_a?(CPPStructDeclaration) && bd.visibility == :public && bd.struct.body_decl && bd.myself != "" && !conf.is_class_dropped?(cls, bd.myself)
produce_ttfile_traits(ttfile, conf, bd)
end
end
end
def produce_ttfile(conf)
ttfile_name = "gsiDecl#{modn}TypeTraits.h"
ttfile_path = $gen_dir + "/" + ttfile_name
ttfile_path && File.open(ttfile_path, "w") do |ttfile|
ttfile.puts(<<"END");
/*
KLayout Layout Viewer
Copyright (C) 2006-2022 Matthias Koefferlein
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
END
ttfile.puts("/**")
ttfile.puts("* @file #{ttfile_path}")
ttfile.puts("* @brief Type traits for the Qt binding classes")
ttfile.puts("*")
ttfile.puts("* DO NOT EDIT THIS FILE. ")
ttfile.puts("* This file has been created automatically")
ttfile.puts("*/")
ttfile.puts("")
ttfile.puts("#ifndef _HDR_gsiDecl#{modn}TypeTraits")
ttfile.puts("#define _HDR_gsiDecl#{modn}TypeTraits")
ttfile.puts("")
ttfile.puts("#include \"gsiTypes.h\"")
ttfile.puts("")
ttfile.puts("")
prod_list(conf).each do |decl_obj|
if decl_obj.is_a?(CPPStructDeclaration)
decl_obj.myself && produce_ttfile_traits(ttfile, conf, decl_obj)
elsif decl_obj.is_a?(CPPNamespace)
cls = decl_obj.myself
ttfile.puts("class #{cls}_Namespace;")
ttfile.puts("namespace tl {")
ttfile.puts "template <> struct type_traits<#{cls}_Namespace> : public type_traits<void> {"
ttfile.puts " typedef tl::false_tag has_copy_constructor;"
ttfile.puts " typedef tl::false_tag has_default_constructor;"
ttfile.puts "};"
ttfile.puts("}")
ttfile.puts ""
end
end
ttfile.puts("")
ttfile.puts("#endif")
puts("#{ttfile_name} written.")
end
end
def produce_externals
externals_name = "gsiQtExternals.h"
@ -3232,7 +3246,7 @@ bp.read(input_file)
puts("Collecting used enums ..")
l = bp.prod_list(conf)
l.each_with_index do |decl_obj,i|
puts "#{decl_obj.myself}: #{i+1}/#{l.size}"
decl_obj.myself && puts("#{decl_obj.myself}: #{i+1}/#{l.size}")
bp.collect_used_enums(conf, decl_obj)
end
@ -3253,9 +3267,6 @@ end
puts("Producing class list")
bp.produce_class_list
puts("Producing type traits file ..")
bp.produce_ttfile(conf)
puts("Producing main source file ..")
bp.produce_main_source

View File

@ -196,7 +196,7 @@ module QualifiedNameResolver
@id2obj && @id2obj[id]
end
def resolve_qid(qid)
def resolve_qid(qid, stop = nil, include_other = true)
qid.is_a?(CPPQualifiedId) || raise("Argument of resolve_qid must be a CPPQualifiedId object")
@ -206,22 +206,30 @@ module QualifiedNameResolver
while root.parent
root = root.parent
end
obj = root.resolve_qid(qid)
obj = root.resolve_qid(qid, nil, false)
else
obj = id2obj(qid.parts[0].id)
if obj && qid.parts.size > 1
# The part may be a typedef: resolve it in that case before we proceed
while obj && obj.is_a?(CPPTypedef)
obj = obj.type.concrete.is_a?(CPPQualifiedId) && self.resolve_qid(obj.type.concrete)
obj = obj.type.concrete.is_a?(CPPQualifiedId) && self.resolve_qid(obj.type.concrete, stop, include_other)
end
if obj
qid_new = qid.dup
qid_new.parts = qid.parts[1 .. -1]
obj = obj.respond_to?(:resolve_qid) && obj.resolve_qid(qid_new)
obj = obj.respond_to?(:resolve_qid) && obj.resolve_qid(qid_new, stop, include_other)
end
end
if ! obj && self.parent
obj = self.parent.resolve_qid(qid)
if ! obj && include_other
# try base classes
self.other_children.each do |bc|
if bc != self && bc.respond_to?(:resolve_qid)
(obj = bc.resolve_qid(qid, self, false)) && break
end
end
end
if ! obj && self.parent && self.parent != stop
obj = self.parent.resolve_qid(qid, stop, include_other)
end
end
@ -281,6 +289,10 @@ class CPPDeclaration
[]
end
def other_children
[]
end
def myself
self.type.name
end
@ -295,8 +307,13 @@ class CPPEnumDeclaration
[]
end
def other_children
[]
end
def myself
self.enum.name.to_s
# exclude forward declarations
self.enum.specs && self.enum.name.to_s
end
end
@ -309,6 +326,10 @@ class CPPEnumSpec
[]
end
def other_children
[]
end
def myself
self.name.to_s
end
@ -352,6 +373,10 @@ class CPPTypedef
[]
end
def other_children
[]
end
end
class CPPStructDeclaration
@ -366,7 +391,7 @@ class CPPStructDeclaration
# add enum constants (CPPEnumSpec)
(self.struct.body_decl || []).each do |bd|
if bd.is_a?(CPPEnumDeclaration) && bd.enum && bd.enum.specs
if bd.is_a?(CPPEnumDeclaration) && bd.enum && bd.enum.specs && !bd.enum.is_class
c += bd.enum.specs
end
end
@ -394,7 +419,7 @@ class CPPStructDeclaration
# The parent may be null for template base classes which are
# forward-declared .. we're not interested in this case.
if self.parent
bc_obj = self.parent.resolve_qid(bc.class_id)
bc_obj = self.parent.resolve_qid(bc.class_id, nil, false)
# NOTE: it may look strange to test whether the base class is the class itself but
# since we do a half-hearted job of resolving template variants, this may happen
# if we derive a template specialization from another one (specifically
@ -523,6 +548,10 @@ class CPPModule
end
def other_children
[]
end
def remove(d)
self.decls.delete(d)
end

View File

@ -612,21 +612,13 @@ struct DB_PUBLIC_TEMPLATE box
*/
double double_area () const;
/**
* @brief Default conversion to string
*/
std::string to_string () const
{
return to_string (0.0);
}
/**
* @brief Conversion to string
*
* If dbu is set, it determines the factor by which the coordinates are multiplied to render
* micron units. In addition, a micron format is chosen for output of these coordinates.
*/
std::string to_string (double dbu) const
std::string to_string (double dbu = 0.0) const
{
if (empty ()) {
return "()";
@ -1423,19 +1415,6 @@ typedef box<db::DCoord> DBox;
namespace tl
{
/**
* @brief The type traits for the box type
*/
template <class C, class R>
struct type_traits <db::box<C, R> > : public type_traits<void>
{
typedef trivial_relocate_required relocate_requirements;
typedef true_tag supports_extractor;
typedef true_tag supports_to_string;
typedef true_tag has_less_operator;
typedef true_tag has_equal_operator;
};
template<> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::Box &b);
template<> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::DBox &b);

View File

@ -74,14 +74,14 @@ private:
/// @brief a helper class providing a linear-time iterator difference which is not necessarily
/// the actual difference but monotonous
template <class X>
size_t box_tree_lt_difference (const tl::reuse_vector_const_iterator<X> &a, const tl::reuse_vector_const_iterator<X> &b)
template <class X, bool R>
size_t box_tree_lt_difference (const tl::reuse_vector_const_iterator<X, R> &a, const tl::reuse_vector_const_iterator<X, R> &b)
{
return a.index () - b.index ();
}
template <class X>
size_t box_tree_lt_difference_ptr (const X *a, const tl::reuse_vector_const_iterator<X> &b)
template <class X, bool R>
size_t box_tree_lt_difference_ptr (const X *a, const tl::reuse_vector_const_iterator<X, R> &b)
{
return a - b.unsafe_target_addr ();
}

View File

@ -1144,16 +1144,5 @@ mem_stat (MemStatistics *stat, MemStatistics::purpose_t purpose, int cat, const
} // namespace db
namespace tl
{
/**
* @brief Type traits
*/
template <> struct type_traits <db::Cell> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
#endif

View File

@ -110,16 +110,6 @@ private:
}
namespace tl
{
template <>
struct type_traits<db::ColdProxy> : public type_traits<void>
{
typedef tl::false_tag has_default_constructor;
typedef tl::false_tag has_copy_constructor;
};
}
#endif

View File

@ -1620,17 +1620,4 @@ private:
}
namespace tl
{
template <>
struct type_traits<db::CompoundRegionOperationNode>
: public tl::type_traits<void>
{
typedef false_tag has_copy_constructor;
typedef false_tag has_default_constructor;
};
}
#endif

View File

@ -865,15 +865,5 @@ void DeepLayer::commit_shapes (VarCollector &collector, std::map<db::cell_index_
}
namespace tl
{
// disable copying of the deep shape store object
template <> struct type_traits <db::DeepShapeStore> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
#endif

View File

@ -586,21 +586,13 @@ public:
return dx_abs () + dy_abs ();
}
/**
* @brief Default conversion to string
*/
std::string to_string () const
{
return to_string (0.0);
}
/**
* @brief Conversion to a string.
*
* If dbu is set, it determines the factor by which the coordinates are multiplied to render
* micron units. In addition, a micron format is chosen for output of these coordinates.
*/
std::string to_string (double dbu) const
std::string to_string (double dbu = 0.0) const
{
return "(" + m_p1.to_string (dbu) + ";" + m_p2.to_string (dbu) + ")";
}
@ -1500,19 +1492,6 @@ public:
namespace tl
{
/**
* @brief The type traits for the edge type
*/
template <class C>
struct type_traits <db::edge<C> > : public type_traits<void>
{
typedef trivial_relocate_required relocate_requirements;
typedef true_tag supports_extractor;
typedef true_tag supports_to_string;
typedef true_tag has_less_operator;
typedef true_tag has_equal_operator;
};
template<> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::Edge &b);
template<> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::DEdge &b);

View File

@ -387,21 +387,13 @@ public:
return m_first.is_ortho () && m_second.is_ortho ();
}
/**
* @brief Default conversion to string
*/
std::string to_string () const
{
return to_string (0.0);
}
/**
* @brief Conversion to a string.
*
* If dbu is set, it determines the factor by which the coordinates are multiplied to render
* micron units. In addition, a micron format is chosen for output of these coordinates.
*/
std::string to_string (double dbu) const
std::string to_string (double dbu = 0.0) const
{
return lesser ().to_string (dbu) + (m_symmetric ? "|" : "/") + greater ().to_string (dbu);
}
@ -622,19 +614,6 @@ typedef edge_pair<db::DCoord> DEdgePair;
namespace tl
{
/**
* @brief The type traits for the edge type
*/
template <class C>
struct type_traits <db::edge_pair<C> > : public type_traits<void>
{
typedef trivial_relocate_required relocate_requirements;
typedef true_tag supports_extractor;
typedef true_tag supports_to_string;
typedef true_tag has_less_operator;
typedef true_tag has_equal_operator;
};
template<> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::EdgePair &b);
template<> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::DEdgePair &b);

View File

@ -613,20 +613,10 @@ private:
}
namespace tl
namespace tl
{
/**
* @brief The type traits for the box type
*/
template <>
struct type_traits <db::EdgePairs> : public type_traits<void>
{
typedef true_tag supports_extractor;
typedef true_tag supports_to_string;
typedef true_tag has_less_operator;
typedef true_tag has_equal_operator;
};
template<> DB_PUBLIC bool test_extractor_impl (tl::Extractor &ex, db::EdgePairs &b);
template<> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::EdgePairs &b);
}
#endif

View File

@ -1210,20 +1210,10 @@ private:
} // namespace db
namespace tl
namespace tl
{
/**
* @brief The type traits for the region type
*/
template <>
struct type_traits <db::Edges> : public type_traits<void>
{
typedef true_tag supports_extractor;
typedef true_tag supports_to_string;
typedef true_tag has_less_operator;
typedef true_tag has_equal_operator;
};
template<> DB_PUBLIC bool test_extractor_impl (tl::Extractor &ex, db::Edges &b);
template<> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::Edges &b);
}
#endif

View File

@ -532,18 +532,5 @@ private:
}
namespace tl
{
template <class TS, class TI, class TR>
struct type_traits<db::local_processor<TS, TI, TR> > : public tl::type_traits<void>
{
// mark "LocalProcessor" as not having a default ctor and no copy ctor
typedef tl::false_tag has_default_constructor;
typedef tl::false_tag has_copy_constructor;
};
}
#endif

View File

@ -229,27 +229,17 @@ inline LayerProperties &operator+= (LayerProperties &props, const LayerOffset &o
}
// tl namespace support for db::LayerProperties
/**
* @brief Special extractors for LayerProperties and LayerOffset
*/
namespace tl
{
template <>
struct type_traits <db::LayerProperties> : public type_traits<void>
{
typedef true_tag supports_extractor;
typedef true_tag supports_to_string;
typedef true_tag has_less_operator;
typedef true_tag has_equal_operator;
};
template<> DB_PUBLIC void extractor_impl<db::LayerProperties> (tl::Extractor &ex, db::LayerProperties &p);
template<> DB_PUBLIC void extractor_impl<db::LayerOffset> (tl::Extractor &ex, db::LayerOffset &p);
template <>
struct type_traits <db::LayerOffset> : public type_traits<void>
{
typedef true_tag supports_extractor;
typedef true_tag supports_to_string;
typedef true_tag has_less_operator;
typedef true_tag has_equal_operator;
};
}
template<> DB_PUBLIC bool test_extractor_impl<db::LayerProperties> (tl::Extractor &ex, db::LayerProperties &p);
template<> DB_PUBLIC bool test_extractor_impl<db::LayerOffset> (tl::Extractor &ex, db::LayerOffset &p);
} // namespace tl
#endif

View File

@ -1002,16 +1002,4 @@ inline void mem_stat (MemStatistics *stat, MemStatistics::purpose_t purpose, int
}
namespace tl
{
template<> struct type_traits<db::LayoutToNetlist> : public tl::type_traits<void>
{
// mark "NetlistDeviceExtractor" as not having a default ctor and no copy ctor
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
#endif

View File

@ -172,16 +172,4 @@ private:
}
namespace tl
{
template<> struct type_traits<db::LayoutVsSchematic> : public tl::type_traits<void>
{
// mark "NetlistDeviceExtractor" as not having a default ctor and no copy ctor
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
#endif

View File

@ -231,16 +231,6 @@ private:
}
namespace tl
{
/**
* @brief Type traits
*/
template <> struct type_traits <db::Library> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
}
#endif

View File

@ -351,15 +351,5 @@ private:
} // namespace db
namespace tl
{
template <>
struct type_traits <db::Manager> : public type_traits<void>
{
typedef tl::false_tag has_copy_constructor;
typedef tl::true_tag has_default_constructor;
};
}
#endif

View File

@ -41,8 +41,8 @@
namespace tl
{
template <class X> class vector;
template <class X> class reuse_vector;
template <class> class vector;
template <class, bool> class reuse_vector;
class Variant;
}

View File

@ -380,22 +380,4 @@ protected:
}
namespace tl
{
template<> struct type_traits<db::NetlistComparer> : public tl::type_traits<void>
{
// mark "NetlistDeviceExtractor" as having a default ctor and no copy ctor
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
template<> struct type_traits<db::NetlistCompareLogger> : public tl::type_traits<void>
{
// mark "NetlistDeviceExtractor" as having a default ctor and no copy ctor
typedef tl::false_tag has_copy_constructor;
};
}
#endif

View File

@ -312,15 +312,4 @@ private:
}
namespace tl
{
template<> struct type_traits<db::NetlistCrossReference> : public tl::type_traits<void>
{
// mark "NetlistDeviceExtractor" as having a default ctor and no copy ctor
typedef tl::false_tag has_copy_constructor;
};
}
#endif

View File

@ -571,16 +571,4 @@ private:
}
namespace tl
{
template<> struct type_traits<db::NetlistDeviceExtractor> : public tl::type_traits<void>
{
// mark "NetlistDeviceExtractor" as not having a default ctor and no copy ctor
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
#endif

View File

@ -405,63 +405,4 @@ protected:
}
namespace tl
{
template<> struct type_traits<db::NetlistDeviceExtractorMOS3Transistor> : public tl::type_traits<void>
{
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
template<> struct type_traits<db::NetlistDeviceExtractorMOS4Transistor> : public tl::type_traits<void>
{
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
template<> struct type_traits<db::NetlistDeviceExtractorCapacitor> : public tl::type_traits<void>
{
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
template<> struct type_traits<db::NetlistDeviceExtractorCapacitorWithBulk> : public tl::type_traits<void>
{
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
template<> struct type_traits<db::NetlistDeviceExtractorResistor> : public tl::type_traits<void>
{
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
template<> struct type_traits<db::NetlistDeviceExtractorResistorWithBulk> : public tl::type_traits<void>
{
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
template<> struct type_traits<db::NetlistDeviceExtractorBJT3Transistor> : public tl::type_traits<void>
{
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
template<> struct type_traits<db::NetlistDeviceExtractorBJT4Transistor> : public tl::type_traits<void>
{
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
template<> struct type_traits<db::NetlistDeviceExtractorDiode> : public tl::type_traits<void>
{
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
#endif

View File

@ -52,17 +52,4 @@ public:
}
namespace tl
{
template <>
struct type_traits<db::NetlistReader>
: public tl::type_traits<void>
{
typedef tl::false_tag has_default_constructor;
typedef tl::false_tag has_copy_constructor;
};
}
#endif

View File

@ -237,17 +237,4 @@ private:
}
namespace tl
{
template <>
struct type_traits<db::NetlistSpiceReader>
: public tl::type_traits<void>
{
typedef tl::false_tag has_default_constructor;
typedef tl::false_tag has_copy_constructor;
};
}
#endif

View File

@ -52,17 +52,4 @@ public:
}
namespace tl
{
template <>
struct type_traits<db::NetlistWriter>
: public tl::type_traits<void>
{
typedef tl::false_tag has_default_constructor;
typedef tl::false_tag has_copy_constructor;
};
}
#endif

View File

@ -546,16 +546,5 @@ private:
}
namespace tl
{
/**
* @brief Type traits
*/
template <> struct type_traits <db::PCellDeclaration> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
#endif

View File

@ -224,7 +224,6 @@ public:
typedef typename coord_traits::area_type area_type;
typedef object_tag< path<C> > tag;
typedef tl::vector<point_type> pointlist_type;
typedef typename tl::type_traits<pointlist_type>::relocate_requirements relocate_requirements;
typedef db::path_point_iterator<path <C>, db::unit_trans<C> > iterator;
/**
@ -1132,20 +1131,6 @@ Path round_path_corners (const Path &input, int rad, int npoints);
namespace tl
{
/**
* @brief The type traits for the path type
*/
template <class C>
struct type_traits <db::path<C> > : public type_traits<void>
{
typedef typename db::path<C>::relocate_requirements relocate_requirements;
typedef true_tag has_efficient_swap;
typedef true_tag supports_extractor;
typedef true_tag supports_to_string;
typedef true_tag has_less_operator;
typedef true_tag has_equal_operator;
};
/**
* @brief Special extractors for the paths
*/

View File

@ -285,14 +285,6 @@ public:
*/
double sq_double_distance () const;
/**
* @brief Default conversion to string
*/
std::string to_string () const
{
return to_string (0.0);
}
/**
* @brief String conversion
*
@ -300,7 +292,7 @@ public:
* micron units. In addition, a micron format is chosen for output of these coordinates.
*/
std::string
to_string (double dbu) const
to_string (double dbu = 0.0) const
{
if (dbu == 1.0) {
return tl::db_to_string (m_x) + "," + tl::db_to_string (m_y);
@ -750,16 +742,6 @@ inline bool equal (const tl::vector<point<C> > &a, const tl::vector<point<C> > &
namespace tl
{
template <class C>
struct type_traits <db::point<C> > : public type_traits<void>
{
typedef trivial_relocate_required relocate_requirements;
typedef true_tag supports_extractor;
typedef true_tag supports_to_string;
typedef true_tag has_less_operator;
typedef true_tag has_equal_operator;
};
template <> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::Point &p);
template <> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::DPoint &p);

View File

@ -1045,24 +1045,6 @@ private:
}
namespace tl
{
/**
* @brief The type traits for the contour type
*/
template <class C>
struct type_traits <db::polygon_contour<C> > : public type_traits<void>
{
// the contour just uses one pointer, hence the relocation requirements are simple
typedef typename tl::trivial_relocate_required relocate_requirements;
typedef true_tag has_efficient_swap;
typedef false_tag supports_extractor;
typedef false_tag supports_to_string;
typedef true_tag has_less_operator;
typedef true_tag has_equal_operator;
};
}
namespace db
{
@ -1437,7 +1419,6 @@ public:
typedef typename coord_traits::area_type area_type;
typedef polygon_contour<C> contour_type;
typedef tl::vector<contour_type> contour_list_type;
typedef typename tl::type_traits<contour_list_type>::relocate_requirements relocate_requirements;
typedef db::polygon_edge_iterator< polygon<C>, db::unit_trans<C> > polygon_edge_iterator;
typedef db::polygon_contour_iterator< contour_type, db::unit_trans<C> > polygon_contour_iterator;
typedef db::object_tag< polygon<C> > tag;
@ -2439,7 +2420,6 @@ public:
typedef typename coord_traits::area_type area_type;
typedef polygon_contour<C> contour_type;
typedef tl::vector<contour_type> contour_list_type;
typedef typename tl::type_traits<contour_type>::relocate_requirements relocate_requirements;
typedef db::polygon_edge_iterator< simple_polygon<C>, db::unit_trans<C> > polygon_edge_iterator;
typedef db::polygon_contour_iterator< contour_type, db::unit_trans<C> > polygon_contour_iterator;
typedef db::object_tag< simple_polygon<C> > tag;
@ -3568,33 +3548,6 @@ void swap (db::simple_polygon<C> &a, db::simple_polygon<C> &b)
namespace tl
{
/**
* @brief The type traits for the polygon type
*/
template <class C>
struct type_traits <db::polygon<C> > : public type_traits<void>
{
typedef typename db::polygon<C>::relocate_requirements relocate_requirements;
typedef true_tag has_efficient_swap;
typedef true_tag supports_extractor;
typedef true_tag supports_to_string;
typedef true_tag has_less_operator;
typedef true_tag has_equal_operator;
};
/**
* @brief The type traits for the simple_polygon type
*/
template <class C>
struct type_traits <db::simple_polygon<C> > : public type_traits<void>
{
typedef typename db::simple_polygon<C>::relocate_requirements relocate_requirements;
typedef true_tag supports_extractor;
typedef true_tag supports_to_string;
typedef true_tag has_less_operator;
typedef true_tag has_equal_operator;
};
/**
* @brief Special extractors for the polygons
*/

View File

@ -1821,20 +1821,10 @@ private:
} // namespace db
namespace tl
namespace tl
{
/**
* @brief The type traits for the region type
*/
template <>
struct type_traits <db::Region> : public type_traits<void>
{
typedef true_tag supports_extractor;
typedef true_tag supports_to_string;
typedef true_tag has_less_operator;
typedef true_tag has_equal_operator;
};
template<> DB_PUBLIC bool test_extractor_impl (tl::Extractor &ex, db::Region &b);
template<> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::Region &b);
}
#endif

View File

@ -786,8 +786,8 @@ public:
* we would probably create too much constness. Hence we use const_cast to convert it
* to a non-const one.
*/
template <class Obj>
Shape (const db::Shapes *shapes, const tl::reuse_vector_const_iterator<Obj> &tree_iter)
template <class Obj, bool R>
Shape (const db::Shapes *shapes, const tl::reuse_vector_const_iterator<Obj, R> &tree_iter)
: mp_shapes (const_cast<db::Shapes *> (shapes)), m_with_props (false), m_stable (true)
{
typename Obj::tag tag = typename Obj::tag ();
@ -800,8 +800,8 @@ public:
/**
* @brief Construct as a proxy to a certain object given by an iterator
*/
template <class Obj>
Shape (db::Shapes *shapes, const tl::reuse_vector_const_iterator<Obj> &tree_iter)
template <class Obj, bool R>
Shape (db::Shapes *shapes, const tl::reuse_vector_const_iterator<Obj, R> &tree_iter)
: mp_shapes (shapes), m_with_props (false), m_stable (true)
{
typename Obj::tag tag = typename Obj::tag ();
@ -818,8 +818,8 @@ public:
* we would probably create too much constness. Hence we use const_cast to convert it
* to a non-const one.
*/
template <class Obj, class Trans>
Shape (const db::Shapes *shapes, const tl::reuse_vector_const_iterator<Obj> &tree_iter, const Trans &trans)
template <class Obj, bool R, class Trans>
Shape (const db::Shapes *shapes, const tl::reuse_vector_const_iterator<Obj, R> &tree_iter, const Trans &trans)
: mp_shapes (const_cast<db::Shapes *> (shapes)), m_with_props (false), m_stable (true)
{
typename Obj::tag tag = typename Obj::tag ();
@ -832,8 +832,8 @@ public:
/**
* @brief Construct as a proxy to a certain object given by an iterator
*/
template <class Obj, class Trans>
Shape (db::Shapes *shapes, const tl::reuse_vector_const_iterator<Obj> &tree_iter, const Trans &trans)
template <class Obj, bool R, class Trans>
Shape (db::Shapes *shapes, const tl::reuse_vector_const_iterator<Obj, R> &tree_iter, const Trans &trans)
: mp_shapes (shapes), m_with_props (false), m_stable (true)
{
typename Obj::tag tag = typename Obj::tag ();

View File

@ -100,16 +100,4 @@ public:
}
namespace tl
{
template<> struct type_traits<db::ShapeCollection> : public tl::type_traits<void>
{
// mark "NetlistDeviceExtractor" as having a default ctor and no copy ctor
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
#endif

View File

@ -874,16 +874,5 @@ public:
}
namespace tl
{
/**
* @brief Type traits
*/
template <> struct type_traits <db::TechnologyComponent> : public type_traits<void> {
typedef tl::false_tag has_default_constructor;
typedef tl::false_tag has_copy_constructor;
};
}
#endif

View File

@ -757,9 +757,9 @@ public:
/**
* @brief String conversion
*/
std::string to_string () const
std::string to_string (double dbu = 0.0) const
{
return std::string ("(") + tl::to_quoted_string (string ()) + "," + m_trans.to_string () + ")";
return std::string ("(") + tl::to_quoted_string (string ()) + "," + m_trans.to_string (dbu) + ")";
}
/**
@ -1125,15 +1125,6 @@ inline void mem_stat (MemStatistics *stat, MemStatistics::purpose_t purpose, int
namespace tl
{
template <class C>
struct type_traits <db::text<C> > : public type_traits<void>
{
typedef true_tag supports_extractor;
typedef true_tag supports_to_string;
typedef true_tag has_less_operator;
typedef true_tag has_equal_operator;
};
template<> void DB_PUBLIC extractor_impl (tl::Extractor &ex, db::Text &p);
template<> void DB_PUBLIC extractor_impl (tl::Extractor &ex, db::DText &p);

View File

@ -618,20 +618,10 @@ private:
}
namespace tl
namespace tl
{
/**
* @brief The type traits for the box type
*/
template <>
struct type_traits <db::Texts> : public type_traits<void>
{
typedef true_tag supports_extractor;
typedef true_tag supports_to_string;
typedef true_tag has_less_operator;
typedef true_tag has_equal_operator;
};
template<> DB_PUBLIC bool test_extractor_impl (tl::Extractor &ex, db::Texts &b);
template<> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::Texts &b);
}
#endif

View File

@ -703,15 +703,5 @@ private:
}
namespace tl
{
template <>
struct type_traits<db::TilingProcessor> : public type_traits<void>
{
typedef tl::true_tag has_default_constructor;
typedef tl::false_tag has_copy_constructor;
};
}
#endif

View File

@ -1472,10 +1472,10 @@ public:
/**
* @brief String conversion
*/
std::string to_string () const
std::string to_string (double dbu = 0.0) const
{
std::string s1 = fixpoint_trans<C>::to_string ();
std::string s2 = m_u.to_string ();
std::string s2 = m_u.to_string (dbu);
if (! s1.empty () && ! s2.empty ()) {
return s1 + " " + s2;
} else {
@ -2242,14 +2242,6 @@ public:
return ! equal (t);
}
/**
* @brief Default string conversion
*/
std::string to_string () const
{
return to_string (false);
}
/**
* @brief String conversion
*
@ -2257,7 +2249,7 @@ public:
* When lazy is set to true, output that is not required (i.e. magnification when 1)
* is dropped. If dbu is set, the coordinates are multiplied with this factor to render micron units.
*/
std::string to_string (bool lazy, double dbu = 0.0) const
std::string to_string (bool lazy = false, double dbu = 0.0) const
{
std::string s;
if (is_mirror ()) {
@ -2679,6 +2671,7 @@ namespace tl
template<> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::CplxTrans &t);
template<> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::VCplxTrans &t);
template<> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::DCplxTrans &t);
template<> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::ICplxTrans &t);
template<> DB_PUBLIC bool test_extractor_impl (tl::Extractor &ex, db::UnitTrans &t);
template<> DB_PUBLIC bool test_extractor_impl (tl::Extractor &ex, db::DUnitTrans &t);
@ -2691,6 +2684,7 @@ namespace tl
template<> DB_PUBLIC bool test_extractor_impl (tl::Extractor &ex, db::CplxTrans &t);
template<> DB_PUBLIC bool test_extractor_impl (tl::Extractor &ex, db::VCplxTrans &t);
template<> DB_PUBLIC bool test_extractor_impl (tl::Extractor &ex, db::DCplxTrans &t);
template<> DB_PUBLIC bool test_extractor_impl (tl::Extractor &ex, db::ICplxTrans &t);
} // namespace tl

View File

@ -520,19 +520,6 @@ typedef tl::RegisteredClass<user_object_factory_base<db::DCoord> > DUserObjectDe
} // namespace db
namespace tl
{
/**
* @brief The type traits for the user object type
*/
template <class C>
struct type_traits <db::user_object<C> > : public type_traits<void>
{
typedef trivial_relocate_required relocate_requirements;
typedef true_tag has_efficient_swap;
};
}
// inject a swap specialization into the std namespace:
namespace std
{

View File

@ -327,14 +327,6 @@ public:
*/
double sq_double_length () const;
/**
* @brief Default conversion to string
*/
std::string to_string () const
{
return to_string (0.0);
}
/**
* @brief String conversion
*
@ -342,7 +334,7 @@ public:
* micron units. In addition, a micron format is chosen for output of these coordinates.
*/
std::string
to_string (double dbu) const
to_string (double dbu = 0.0) const
{
if (dbu == 1.0) {
return tl::db_to_string (m_x) + "," + tl::db_to_string (m_y);
@ -713,15 +705,6 @@ struct from_double_vector
namespace tl
{
template <class C>
struct type_traits <db::vector<C> > : public type_traits<void>
{
typedef true_tag supports_extractor;
typedef true_tag supports_to_string;
typedef true_tag has_less_operator;
typedef true_tag has_equal_operator;
};
template <> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::Vector &p);
template <> DB_PUBLIC void extractor_impl (tl::Extractor &ex, db::DVector &p);

View File

@ -441,10 +441,13 @@ struct box_defs
"\n"
"This method has been added in version 0.23.\n"
) +
method ("to_s", (std::string (C::*) () const) &C::to_string,
method ("to_s", &C::to_string, gsi::arg ("dbu", 0.0),
"@brief Returns a string representing this box\n"
"\n"
"This string can be turned into a box again by using \\from_s\n"
"This string can be turned into a box again by using \\from_s\n. "
"If a DBU is given, the output units will be micrometers.\n"
"\n"
"The DBU argument has been added in version 0.27.6.\n"
);
}
};

View File

@ -439,8 +439,11 @@ struct edge_defs
"\n"
"This method has been added in version 0.23.\n"
) +
method ("to_s", (std::string (C::*) () const) &C::to_string,
"@brief Returns a string representing the edge\n"
method ("to_s", &C::to_string, gsi::arg ("dbu", 0.0),
"@brief Returns a string representing the edge\n "
"If a DBU is given, the output units will be micrometers.\n"
"\n"
"The DBU argument has been added in version 0.27.6.\n"
) +
method ("is_parallel?", &C::parallel, gsi::arg ("e"),
"@brief Test for being parallel\n"

View File

@ -156,8 +156,11 @@ struct edge_pair_defs
"\n"
"This method has been added in version 0.23.\n"
) +
method ("to_s", (std::string (C::*) () const) &C::to_string,
"@brief Returns a string representing the edge pair\n"
method ("to_s", &C::to_string, gsi::arg ("dbu", 0.0),
"@brief Returns a string representing the edge pair\n "
"If a DBU is given, the output units will be micrometers.\n"
"\n"
"The DBU argument has been added in version 0.27.6.\n"
) +
method ("bbox", &C::bbox,
"@brief Gets the bounding box of the edge pair\n"

View File

@ -369,24 +369,6 @@ private:
int m_layer_index_b;
};
}
namespace tl
{
// Disable copy and default ctor for layout query
template <>
struct type_traits<LayoutDiff>
: public type_traits<void>
{
typedef false_tag has_copy_constructor;
};
}
namespace gsi
{
static unsigned int f_silent () {
return db::layout_diff::f_silent;
}

View File

@ -24,29 +24,6 @@
#include "gsiDecl.h"
#include "dbLayoutQuery.h"
namespace tl
{
// Disable copy and default ctor for layout query
template <>
struct type_traits<db::LayoutQuery>
: public type_traits<void>
{
typedef false_tag has_copy_constructor;
typedef false_tag has_default_constructor;
};
// Disable copy and default ctor for layout query
template <>
struct type_traits<db::LayoutQueryIterator>
: public type_traits<void>
{
typedef false_tag has_copy_constructor;
typedef false_tag has_default_constructor;
};
}
namespace gsi
{

View File

@ -316,11 +316,6 @@ private:
}
namespace tl
{
template<> struct type_traits<GenericNetlistCompareLogger> : public tl::type_traits<db::NetlistCompareLogger> { };
}
namespace gsi
{

View File

@ -93,26 +93,6 @@ public:
gsi::Callback cb_extract_devices;
};
}
namespace tl
{
template<> struct type_traits<GenericDeviceExtractor> : public tl::type_traits<void>
{
// mark "NetlistDeviceExtractor" as having a default ctor and no copy ctor
typedef tl::false_tag has_copy_constructor;
typedef tl::true_tag has_default_constructor;
};
}
namespace gsi
{
namespace
{
/**
* @brief A DeviceClassFactory implementation that allows reimplementation of the virtual methods
*/
@ -140,6 +120,9 @@ public:
}
namespace gsi
{
Class<DeviceClassFactoryImpl> decl_dbDeviceClassFactoryBase ("db", "DeviceClassFactory",
gsi::factory_callback ("create_class", &DeviceClassFactoryImpl::create_class, &DeviceClassFactoryImpl::cb_create_class,
"@brief Creates the DeviceClass object\n"

View File

@ -234,8 +234,11 @@ struct point_defs
"\n"
"This method has been added in version 0.23.\n"
) +
method ("to_s", (std::string (C::*) () const) &C::to_string,
"@brief String conversion\n"
method ("to_s", &C::to_string, gsi::arg ("dbu", 0.0),
"@brief String conversion.\n"
"If a DBU is given, the output units will be micrometers.\n"
"\n"
"The DBU argument has been added in version 0.27.6.\n"
);
}

View File

@ -345,8 +345,11 @@ struct text_defs
"\n"
"This method has been added in version 0.23.\n"
) +
method ("to_s", (std::string (C::*) () const) &C::to_string,
"@brief Convert to a string\n"
method ("to_s", &C::to_string, gsi::arg ("dbu", 0.0),
"@brief Convert to a string.\n"
"If a DBU is given, the output units will be micrometers.\n"
"\n"
"The DBU argument has been added in version 0.27.6.\n"
);
}
};

View File

@ -333,8 +333,11 @@ struct trans_defs
"\n"
"This method has been added in version 0.23.\n"
) +
method ("to_s", (std::string (C::*) () const) &C::to_string,
method ("to_s", &C::to_string, gsi::arg ("dbu", 0.0),
"@brief String conversion\n"
"If a DBU is given, the output units will be micrometers.\n"
"\n"
"The DBU argument has been added in version 0.27.6.\n"
) +
method ("disp", (const vector_type &(C::*) () const) &C::disp,
"@brief Gets to the displacement vector\n"
@ -853,8 +856,12 @@ struct cplx_trans_defs
"\n"
"This method has been added in version 0.23.\n"
) +
method ("to_s", (std::string (C::*) () const) &C::to_string,
method ("to_s", &C::to_string, gsi::arg ("lazy", false), gsi::arg ("dbu", 0.0),
"@brief String conversion\n"
"If 'lazy' is true, some parts are omitted when not required.\n"
"If a DBU is given, the output units will be micrometers.\n"
"\n"
"The lazy and DBU arguments have been added in version 0.27.6.\n"
) +
method ("disp", (displacement_type (C::*)() const) &C::disp,
"@brief Gets the displacement\n"

View File

@ -264,8 +264,11 @@ struct vector_defs
"@brief Creates an object from a string\n"
"Creates the object from a string representation (as returned by \\to_s)\n"
) +
method ("to_s", (std::string (C::*) () const) &C::to_string,
method ("to_s", &C::to_string, gsi::arg ("dbu", 0.0),
"@brief String conversion\n"
"If a DBU is given, the output units will be micrometers.\n"
"\n"
"The DBU argument has been added in version 0.27.6.\n"
);
}

View File

@ -1,7 +1,8 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditablePathPropertiesPage</class>
<widget class="QWidget" name="EditablePathPropertiesPage" >
<property name="geometry" >
<widget class="QWidget" name="EditablePathPropertiesPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@ -9,25 +10,34 @@
<height>378</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<layout class="QGridLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="spacing" >
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="5" column="0" colspan="3" >
<item row="5" column="0" colspan="3">
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>456</width>
<height>16</height>
@ -35,45 +45,54 @@
</property>
</spacer>
</item>
<item row="7" column="1" colspan="2" >
<widget class="QCheckBox" name="abs_cb" >
<property name="text" >
<item row="7" column="1" colspan="2">
<widget class="QCheckBox" name="abs_cb">
<property name="text">
<string>Absolute (accumulated) transformations</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="2" >
<widget class="QCheckBox" name="dbu_cb" >
<property name="text" >
<item row="6" column="1" colspan="2">
<widget class="QCheckBox" name="dbu_cb">
<property name="text">
<string>Coordinates in database units</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Extension type</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3" >
<widget class="QFrame" name="frame1" >
<property name="frameShape" >
<item row="0" column="0" colspan="3">
<widget class="QFrame" name="frame1">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_12" >
<property name="font" >
<widget class="QLabel" name="label_12">
<property name="font">
<font>
<family>Sans Serif</family>
<pointsize>12</pointsize>
@ -84,25 +103,23 @@
<strikeout>false</strikeout>
</font>
</property>
<property name="text" >
<property name="text">
<string>Path Properties</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="layer_lbl" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>5</vsizetype>
<widget class="QLabel" name="layer_lbl">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string/>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
@ -110,62 +127,66 @@
</layout>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Width</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Points (x,y)</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="QTextEdit" name="ptlist_le" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<item row="2" column="1" colspan="2">
<widget class="QTextEdit" name="ptlist_le">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="lineWidth" >
<property name="lineWidth">
<number>2</number>
</property>
<property name="tabStopWidth" >
<number>100</number>
</property>
</widget>
</item>
<item row="8" column="0" colspan="3" >
<widget class="QFrame" name="frame2" >
<property name="frameShape" >
<item row="8" column="0" colspan="3">
<widget class="QFrame" name="frame2">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>211</width>
<height>20</height>
@ -174,15 +195,15 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="prop_pb" >
<property name="text" >
<widget class="QPushButton" name="prop_pb">
<property name="text">
<string>User Properties</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="inst_pb" >
<property name="text" >
<widget class="QPushButton" name="inst_pb">
<property name="text">
<string>Instantiation</string>
</property>
</widget>
@ -190,34 +211,41 @@
</layout>
</widget>
</item>
<item row="4" column="1" colspan="2" >
<widget class="QFrame" name="frame_2" >
<property name="frameShape" >
<item row="4" column="1" colspan="2">
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_6" >
<property name="text" >
<widget class="QLabel" name="label_6">
<property name="text">
<string>start =</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="start_ext_le" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<widget class="QLineEdit" name="start_ext_le">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -225,18 +253,16 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_8" >
<property name="text" >
<widget class="QLabel" name="label_8">
<property name="text">
<string> end =</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="end_ext_le" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<widget class="QLineEdit" name="end_ext_le">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -246,24 +272,22 @@
</layout>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="width_le" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<item row="1" column="1">
<widget class="QLineEdit" name="width_le">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="2" >
<item row="1" column="2">
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>191</width>
<height>25</height>
@ -271,40 +295,38 @@
</property>
</spacer>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<item row="4" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Var. extensions </string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2" >
<widget class="QComboBox" name="type_cb" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<item row="3" column="1" colspan="2">
<widget class="QComboBox" name="type_cb">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text" >
<property name="text">
<string>Flush</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Square</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Variable</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Round</string>
</property>
</item>

View File

@ -1,7 +1,8 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PathPropertiesPage</class>
<widget class="QWidget" name="PathPropertiesPage" >
<property name="geometry" >
<widget class="QWidget" name="PathPropertiesPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@ -9,44 +10,60 @@
<height>368</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<layout class="QGridLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="spacing" >
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="3" column="1" colspan="2" >
<widget class="QFrame" name="frame_2" >
<property name="frameShape" >
<item row="3" column="1" colspan="2">
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_6" >
<property name="text" >
<widget class="QLabel" name="label_6">
<property name="text">
<string>start =</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="start_ext_le" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<widget class="QLineEdit" name="start_ext_le">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -54,18 +71,16 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_8" >
<property name="text" >
<widget class="QLabel" name="label_8">
<property name="text">
<string> end =</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="end_ext_le" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<widget class="QLineEdit" name="end_ext_le">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -75,41 +90,50 @@
</layout>
</widget>
</item>
<item row="7" column="1" colspan="2" >
<widget class="QCheckBox" name="abs_cb" >
<property name="text" >
<item row="7" column="1" colspan="2">
<widget class="QCheckBox" name="abs_cb">
<property name="text">
<string>Absolute (accumulated) transformations</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="2" >
<widget class="QCheckBox" name="dbu_cb" >
<property name="text" >
<item row="6" column="1" colspan="2">
<widget class="QCheckBox" name="dbu_cb">
<property name="text">
<string>Coordinates in database units</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="3" >
<widget class="QFrame" name="frame1" >
<property name="frameShape" >
<item row="8" column="0" colspan="3">
<widget class="QFrame" name="frame1">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>211</width>
<height>20</height>
@ -118,15 +142,15 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="prop_pb" >
<property name="text" >
<widget class="QPushButton" name="prop_pb">
<property name="text">
<string>User Properties</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="inst_pb" >
<property name="text" >
<widget class="QPushButton" name="inst_pb">
<property name="text">
<string>Instantiation</string>
</property>
</widget>
@ -134,33 +158,28 @@
</layout>
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="QTextEdit" name="ptlist_le" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<item row="2" column="1" colspan="2">
<widget class="QTextEdit" name="ptlist_le">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="lineWidth" >
<property name="lineWidth">
<number>2</number>
</property>
<property name="tabStopWidth" >
<number>100</number>
</property>
</widget>
</item>
<item row="5" column="0" colspan="3" >
<item row="5" column="0" colspan="3">
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>451</width>
<height>8</height>
@ -168,12 +187,12 @@
</property>
</spacer>
</item>
<item row="1" column="2" >
<item row="1" column="2">
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>135</width>
<height>20</height>
@ -181,60 +200,67 @@
</property>
</spacer>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Extensions</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="width_le" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<item row="1" column="1">
<widget class="QLineEdit" name="width_le">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Points (x,y)</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Width</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3" >
<widget class="QFrame" name="frame2" >
<property name="frameShape" >
<item row="0" column="0" colspan="3">
<widget class="QFrame" name="frame2">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_12" >
<property name="font" >
<widget class="QLabel" name="label_12">
<property name="font">
<font>
<family>Sans Serif</family>
<pointsize>12</pointsize>
@ -245,25 +271,23 @@
<strikeout>false</strikeout>
</font>
</property>
<property name="text" >
<property name="text">
<string>Path Properties</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="layer_lbl" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>5</vsizetype>
<widget class="QLabel" name="layer_lbl">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string/>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
@ -271,9 +295,9 @@
</layout>
</widget>
</item>
<item row="4" column="1" >
<widget class="QCheckBox" name="round_cb" >
<property name="text" >
<item row="4" column="1">
<widget class="QCheckBox" name="round_cb">
<property name="text">
<string>Round path ends</string>
</property>
</widget>

View File

@ -1,7 +1,8 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PolygonPropertiesPage</class>
<widget class="QWidget" name="PolygonPropertiesPage" >
<property name="geometry" >
<widget class="QWidget" name="PolygonPropertiesPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@ -9,22 +10,31 @@
<height>282</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<layout class="QGridLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="spacing" >
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="3" column="0" >
<item row="3" column="0">
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
@ -32,63 +42,70 @@
</property>
</spacer>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="pointCountLabel" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<item row="2" column="0">
<widget class="QLabel" name="pointCountLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Points (x,y)</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="6" column="1" >
<widget class="QCheckBox" name="abs_cb" >
<property name="text" >
<item row="6" column="1">
<widget class="QCheckBox" name="abs_cb">
<property name="text">
<string>Absolute (accumulated) transformations</string>
</property>
</widget>
</item>
<item row="5" column="1" >
<widget class="QCheckBox" name="dbu_cb" >
<property name="text" >
<item row="5" column="1">
<widget class="QCheckBox" name="dbu_cb">
<property name="text">
<string>Coordinates in database units</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2" >
<widget class="QFrame" name="frame" >
<property name="frameShape" >
<item row="0" column="0" colspan="2">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_12" >
<property name="font" >
<widget class="QLabel" name="label_12">
<property name="font">
<font>
<family>Sans Serif</family>
<pointsize>12</pointsize>
@ -99,25 +116,23 @@
<strikeout>false</strikeout>
</font>
</property>
<property name="text" >
<property name="text">
<string>Polygon Properties</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="layer_lbl" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>5</vsizetype>
<widget class="QLabel" name="layer_lbl">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string/>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
@ -125,27 +140,36 @@
</layout>
</widget>
</item>
<item row="7" column="0" colspan="2" >
<widget class="QFrame" name="frame1" >
<property name="frameShape" >
<item row="7" column="0" colspan="2">
<widget class="QFrame" name="frame1">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>211</width>
<height>20</height>
@ -154,15 +178,15 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="prop_pb" >
<property name="text" >
<widget class="QPushButton" name="prop_pb">
<property name="text">
<string>User Properties</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="inst_pb" >
<property name="text" >
<widget class="QPushButton" name="inst_pb">
<property name="text">
<string>Instantiation</string>
</property>
</widget>
@ -170,33 +194,28 @@
</layout>
</widget>
</item>
<item rowspan="3" row="1" column="1" >
<widget class="QTextEdit" name="pointListEdit" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<item row="1" column="1" rowspan="3">
<widget class="QTextEdit" name="pointListEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="lineWidth" >
<property name="lineWidth">
<number>2</number>
</property>
<property name="tabStopWidth" >
<number>100</number>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2" >
<item row="4" column="0" colspan="2">
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>470</width>
<height>16</height>

View File

@ -110,7 +110,7 @@ InstPropertiesPage::InstPropertiesPage (edt::Service *service, db::Manager *mana
}
QHBoxLayout *layout = new QHBoxLayout (pcell_tab);
layout->setMargin (0);
layout->setContentsMargins (0, 0, 0, 0);
pcell_tab->setLayout (layout);
}

View File

@ -166,8 +166,7 @@ PCellParametersPage::init ()
QGridLayout *frame_layout = new QGridLayout (this);
// spacing and margin for tool windows
frame_layout->setMargin (0);
frame_layout->setVerticalSpacing (0);
frame_layout->setContentsMargins (0, 0, 0, 0);
setLayout (frame_layout);
mp_update_frame = new QFrame ();
@ -216,7 +215,7 @@ PCellParametersPage::init ()
mp_error_label = new QLabel (mp_update_frame);
mp_error_label->setWordWrap (true);
palette = mp_error_label->palette ();
palette.setColor (QPalette::Foreground, Qt::red);
palette.setColor (QPalette::WindowText, Qt::red);
mp_error_label->setPalette (palette);
font = mp_error_label->font ();
font.setBold (true);
@ -260,7 +259,7 @@ PCellParametersPage::setup (lay::LayoutView *view, int cv_index, const db::PCell
QGridLayout *inner_grid = new QGridLayout (inner_frame);
inner_frame->setLayout (inner_grid);
if (m_dense) {
inner_grid->setMargin (4);
inner_grid->setContentsMargins (4, 4, 4, 4);
inner_grid->setHorizontalSpacing (6);
inner_grid->setVerticalSpacing (2);
}
@ -301,7 +300,7 @@ PCellParametersPage::setup (lay::LayoutView *view, int cv_index, const db::PCell
inner_grid = new QGridLayout (gb);
if (m_dense) {
inner_grid->setMargin (4);
inner_grid->setContentsMargins (4, 4, 4, 4);
inner_grid->setHorizontalSpacing (6);
inner_grid->setVerticalSpacing (2);
}
@ -342,7 +341,7 @@ PCellParametersPage::setup (lay::LayoutView *view, int cv_index, const db::PCell
{
QFrame *f = new QFrame (inner_frame);
QHBoxLayout *hb = new QHBoxLayout (f);
hb->setMargin (0);
hb->setContentsMargins (0, 0, 0, 0);
f->setLayout (hb);
f->setFrameShape (QFrame::NoFrame);

View File

@ -388,6 +388,12 @@ PolygonPropertiesPage::PolygonPropertiesPage (edt::Service *service, db::Manager
setupUi (this);
setup ();
#if QT_VERSION >= 0x60000
pointListEdit->setTabStopDistance (100);
#else
pointListEdit->setTabStopWidth (100);
#endif
connect (inst_pb, SIGNAL (clicked ()), this, SLOT (show_inst ()));
connect (prop_pb, SIGNAL (clicked ()), this, SLOT (show_props ()));
@ -905,6 +911,12 @@ PathPropertiesPage::PathPropertiesPage (edt::Service *service, db::Manager *mana
setupUi (this);
setup ();
#if QT_VERSION >= 0x60000
ptlist_le->setTabStopDistance (100);
#else
ptlist_le->setTabStopWidth (100);
#endif
connect (inst_pb, SIGNAL (clicked ()), this, SLOT (show_inst ()));
connect (prop_pb, SIGNAL (clicked ()), this, SLOT (show_props ()));
@ -966,6 +978,12 @@ EditablePathPropertiesPage::EditablePathPropertiesPage (edt::Service *service, d
setupUi (this);
setup ();
#if QT_VERSION >= 0x60000
ptlist_le->setTabStopDistance (100);
#else
ptlist_le->setTabStopWidth (100);
#endif
connect (inst_pb, SIGNAL (clicked ()), this, SLOT (show_inst ()));
connect (prop_pb, SIGNAL (clicked ()), this, SLOT (show_props ()));
connect (type_cb, SIGNAL (currentIndexChanged (int)), this, SLOT (type_selected (int)));

View File

@ -42,7 +42,7 @@ void
RecentConfigurationPage::init ()
{
QVBoxLayout *ly = new QVBoxLayout (this);
ly->setMargin (0);
ly->setContentsMargins (0, 0, 0, 0);
QLabel *label = new QLabel (this);
label->setText (tr ("Click to select a recent configuration"));

View File

@ -80,7 +80,7 @@ main (int argc, char *argv [])
QFontMetrics fm (f);
int w = fm.width (QChar::fromLatin1 ('W'));
int w = fm.averageCharWidth ();
printf ("\n// Font: %s\n", f.toString ().toLatin1 ().constData ());
printf ("const unsigned int ff%d_height = %d;\nconst unsigned int ff%d_line_height = %d;\nconst unsigned int ff%d_width = %d;\nconst unsigned int ff%d_stride = %d;\n",

View File

@ -44,74 +44,53 @@ namespace gsi
/**
* @brief A helper function to implement equal as efficiently as possible
*/
template<class T, class I>
bool _var_user_equal_impl (const T *a, const T *b, const VariantUserClassImpl *delegate, I);
template<class T, bool> struct _var_user_equal_impl;
template<class T>
bool _var_user_equal_impl (const T *a, const T *b, const VariantUserClassImpl * /*delegate*/, tl::true_tag)
struct _var_user_equal_impl<T, true>
{
return *a == *b;
}
static bool call (const T *a, const T *b, const VariantUserClassImpl * /*delegate*/) { return *a == *b; }
};
template<class T>
bool _var_user_equal_impl (const T *a, const T *b, const VariantUserClassImpl *delegate, tl::false_tag)
struct _var_user_equal_impl<T, false>
{
return delegate->equal_impl ((void *) a, (void *) b);
}
static bool call (const T *a, const T *b, const VariantUserClassImpl *delegate) { return delegate->equal_impl ((void *) a, (void *) b); }
};
/**
* @brief A helper function to implement less as efficiently as possible
* @brief A helper function to implement equal as efficiently as possible
*/
template<class T, class I>
bool _var_user_less_impl (const T *a, const T *b, const VariantUserClassImpl *delegate, I);
template<class T, bool> struct _var_user_less_impl;
template<class T>
bool _var_user_less_impl (const T *a, const T *b, const VariantUserClassImpl * /*delegate*/, tl::true_tag)
struct _var_user_less_impl<T, true>
{
return *a < *b;
}
static bool call (const T *a, const T *b, const VariantUserClassImpl * /*delegate*/) { return *a < *b; }
};
template<class T>
bool _var_user_less_impl (const T *a, const T *b, const VariantUserClassImpl *delegate, tl::false_tag)
struct _var_user_less_impl<T, false>
{
return delegate->less_impl ((void *) a, (void *) b);
}
static bool call (const T *a, const T *b, const VariantUserClassImpl *delegate) { return delegate->less_impl ((void *) a, (void *) b); }
};
/**
* @brief A helper function to implement to_string as efficiently as possible
* @brief A helper function to implement equal as efficiently as possible
*/
template<class T, class I>
std::string _var_user_to_string_impl (const T *a, const VariantUserClassImpl *delegate, I);
template<class T, bool> struct _var_user_to_string_impl;
template<class T>
std::string _var_user_to_string_impl (const T *a, const VariantUserClassImpl * /*delegate*/, tl::true_tag)
struct _var_user_to_string_impl<T, true>
{
return a->to_string ();
}
static std::string call (const T *a, const VariantUserClassImpl * /*delegate*/) { return a->to_string (); }
};
template<class T>
std::string _var_user_to_string_impl (const T *a, const VariantUserClassImpl *delegate, tl::false_tag)
struct _var_user_to_string_impl<T, false>
{
return delegate->to_string_impl ((void *) a);
}
/**
* @brief A helper function to implement read as efficiently as possible
*/
template<class T, class I>
void _var_user_read_impl (T *a, tl::Extractor &ex, I);
template<class T>
void _var_user_read_impl (T *a, tl::Extractor &ex, tl::true_tag)
{
ex.read (*a);
}
template<class T>
void _var_user_read_impl (T * /*a*/, tl::Extractor & /*ex*/, tl::false_tag)
{
tl_assert (false);
}
static std::string call (const T *a, const VariantUserClassImpl *delegate) { return delegate->to_string_impl ((void *) a); }
};
/**
* @brief A VariantUserClassBase specialization that links GSI classes and Variant classes
@ -165,20 +144,17 @@ public:
virtual bool equal (const void *a, const void *b) const
{
typename tl::type_traits<T>::has_equal_operator f;
return gsi::_var_user_equal_impl ((const T *) a, (const T *) b, this, f);
return gsi::_var_user_equal_impl<T, tl::has_equal_operator<T>::value>::call ((const T *) a, (const T *) b, this);
}
virtual bool less (const void *a, const void *b) const
{
typename tl::type_traits<T>::has_less_operator f;
return gsi::_var_user_less_impl ((const T *) a, (const T *) b, this, f);
return gsi::_var_user_less_impl<T, tl::has_less_operator<T>::value>::call ((const T *) a, (const T *) b, this);
}
virtual std::string to_string (const void *a) const
{
typename tl::type_traits<T>::supports_to_string f;
return gsi::_var_user_to_string_impl ((const T *) a, this, f);
return gsi::_var_user_to_string_impl<T, tl::has_to_string<T>::value>::call ((const T *) a, this);
}
void *clone (const void *obj) const
@ -212,8 +188,8 @@ public:
void read (void *a, tl::Extractor &ex) const
{
typename tl::type_traits<T>::supports_extractor f;
gsi::_var_user_read_impl ((T *) a, ex, f);
T *t = (T *) a;
ex.read (*t);
}
const gsi::ClassBase *gsi_cls () const
@ -244,256 +220,21 @@ private:
// -----------------------------------------------------------------------------
// GSI implementation
template <class X>
void *_get_vector_of (SerialArgs & /*from*/, const ArgType & /*a*/, void * /*data*/, void (* /*cb*/) (void * /*data*/, void * /*obj*/), tl::false_tag /*has_copy_ctor*/)
{
tl_assert (false); // cannot copy object of this type
return 0;
}
template <class X, bool> struct _destroy;
template <class X> struct _destroy<X, false> { static void call (X *) { tl_assert (false); } };
template <class X> struct _destroy<X, true> { static void call (X *x) { delete x; } };
template <class X>
void _get_vector_of (SerialArgs &from, const ArgType &a, void *data, void (*cb) (void *data, void *obj), tl::true_tag /*has_copy_ctor*/)
{
std::vector<X> vv;
const std::vector<X> *v = &vv;
if (a.is_cref ()) {
v = &from.template read<const std::vector<X> &> ();
} else if (a.is_cptr ()) {
v = from.template read<const std::vector<X> *> ();
} else if (a.is_ref ()) {
v = &from.template read<std::vector<X> &> ();
} else if (a.is_ptr ()) {
v = from.template read<std::vector<X> *> ();
} else {
vv = from.template read< std::vector<X> > ();
}
for (typename std::vector<X>::const_iterator o = v->begin (); o != v->end (); ++o) {
(*cb) (data, new X (*o));
}
}
template <class X, bool> struct _create;
template <class X> struct _create<X, false> { static void *call () { throw tl::Exception (tl::to_string (tr ("Object cannot be created here"))); } };
template <class X> struct _create<X, true> { static void *call () { return new X (); } };
template <class X>
void _get_cptr_vector_of (SerialArgs &from, const ArgType &a, void *data, void (*cb) (void *data, void *obj))
{
std::vector<const X *> vv;
const std::vector<const X *> *v = &vv;
if (a.is_cref ()) {
v = &from.template read<const std::vector<const X *> &> ();
} else if (a.is_cptr ()) {
v = from.template read<const std::vector<const X *> *> ();
} else if (a.is_ref ()) {
v = &from.template read<std::vector<const X *> &> ();
} else if (a.is_ptr ()) {
v = from.template read<std::vector<const X *> *> ();
} else {
vv = from.template read< std::vector<const X *> > ();
}
for (typename std::vector<const X *>::const_iterator o = v->begin (); o != v->end (); ++o) {
(*cb) (data, (void *) *o);
}
}
template <class X, bool> struct _clone;
template <class X> struct _clone<X, false> { static void *call (const void *) { throw tl::Exception (tl::to_string (tr ("Object cannot be copied here"))); } };
template <class X> struct _clone<X, true> { static void *call (const void *other) { return new X (*(const X *)other); } };
template <class X>
void _get_ptr_vector_of (SerialArgs &from, const ArgType &a, void *data, void (*cb) (void *data, void *obj))
{
std::vector<X *> vv;
const std::vector<X *> *v = &vv;
if (a.is_cref ()) {
v = &from.template read<const std::vector<X *> &> ();
} else if (a.is_cptr ()) {
v = from.template read<const std::vector<X *> *> ();
} else if (a.is_ref ()) {
v = &from.template read<std::vector<X *> &> ();
} else if (a.is_ptr ()) {
v = from.template read<std::vector<X *> *> ();
} else {
vv = from.template read< std::vector<X *> > ();
}
for (typename std::vector<X *>::const_iterator o = v->begin (); o != v->end (); ++o) {
(*cb) (data, *o);
}
}
template <class X>
void _destroy (X *, tl::false_tag /*has public dtor*/)
{
tl_assert (false); // cannot delete object of this type
}
template <class X>
void _destroy (X *x, tl::true_tag /*has public dtor*/)
{
delete x;
}
template <class X>
void _push_vector_of (SerialArgs & /*to*/, const ArgType & /*a*/, tl::Heap & /*heap*/, const std::vector<void *> & /*objects*/, tl::false_tag /*has_copy_ctor*/)
{
tl_assert (false); // cannot copy object of this type
}
template <class X>
void _push_vector_of (SerialArgs &to, const ArgType &a, tl::Heap &heap, const std::vector<void *> &objects, tl::true_tag /*has_copy_ctor*/)
{
tl_assert (a.inner () != 0);
std::vector<X> vv;
std::vector<X> *v;
if (a.is_ref () || a.is_cref () || a.is_ptr () || a.is_cptr ()) {
v = new std::vector<X> ();
heap.push (v);
} else {
v = &vv;
}
v->reserve (objects.size ());
for (std::vector<void *>::const_iterator o = objects.begin (); o != objects.end (); ++o) {
v->push_back (*(X *)*o);
}
if (a.is_cref ()) {
to.write<const std::vector<X> &> (*v);
} else if (a.is_cptr ()) {
to.write<const std::vector<X> *> (v);
} else if (a.is_ref ()) {
to.write<std::vector<X> &> (*v);
} else if (a.is_ptr ()) {
to.write<std::vector<X> *> (v);
} else {
to.write<std::vector<X> > (vv);
}
}
template <class X>
void _push_cptr_vector_of (SerialArgs &to, const ArgType &a, tl::Heap &heap, const std::vector<void *> &objects)
{
tl_assert (a.inner () != 0);
std::vector<const X *> vv;
std::vector<const X *> *v;
if (a.is_ref () || a.is_cref () || a.is_ptr () || a.is_cptr ()) {
v = new std::vector<const X *> ();
heap.push (v);
} else {
v = &vv;
}
v->reserve (objects.size ());
for (std::vector<void *>::const_iterator o = objects.begin (); o != objects.end (); ++o) {
v->push_back ((const X *)*o);
}
if (a.is_cref ()) {
to.write<const std::vector<const X *> &> (*v);
} else if (a.is_cptr ()) {
to.write<const std::vector<const X *> *> (v);
} else if (a.is_ref ()) {
to.write<std::vector<const X *> &> (*v);
} else if (a.is_ptr ()) {
to.write<std::vector<const X *> *> (v);
} else {
to.write<std::vector<const X *> > (vv);
}
}
template <class X>
void _push_ptr_vector_of (SerialArgs &to, const ArgType &a, tl::Heap &heap, const std::vector<void *> &objects)
{
tl_assert (a.inner () != 0);
std::vector<X *> vv;
std::vector<X *> *v;
if (a.is_ref () || a.is_cref () || a.is_ptr () || a.is_cptr ()) {
v = new std::vector<X *> ();
heap.push (v);
} else {
v = &vv;
}
v->reserve (objects.size ());
for (std::vector<void *>::const_iterator o = objects.begin (); o != objects.end (); ++o) {
v->push_back ((X *)*o);
}
if (a.is_cref ()) {
to.write<const std::vector<X *> &> (*v);
} else if (a.is_cptr ()) {
to.write<const std::vector<X *> *> (v);
} else if (a.is_ref ()) {
to.write<std::vector<X *> &> (*v);
} else if (a.is_ptr ()) {
to.write<std::vector<X *> *> (v);
} else {
to.write<std::vector<X *> > (vv);
}
}
template <class X>
void *_create (tl::false_tag)
{
throw tl::Exception (tl::to_string (tr ("Object cannot be created here")));
return 0;
}
template <class X>
void *_create (tl::true_tag)
{
return new X ();
}
template <class X>
void *_clone (tl::false_tag, const void * /*other*/)
{
throw tl::Exception (tl::to_string (tr ("Object cannot be copied here")));
return 0;
}
template <class X>
void *_clone (tl::true_tag, const void *other)
{
return new X (*(const X *)other);
}
template <class X>
void _assign (tl::false_tag /*has_copy_ctor*/, void *, const void *)
{
throw tl::Exception (tl::to_string (tr ("Object cannot be copied here")));
}
template <class X>
void _assign (tl::true_tag /*has_copy_ctor*/, void *dest, const void *src)
{
*(X *)dest = *(const X *)src;
}
/**
* @brief A class predicate telling us whether X is polymorphic
*
* The trick was taken from boost - if a class is made polymorphic and it
* has not been before, the size of the object changes since a virtual
* function table will be added.
*/
template <class X>
struct is_polymorphic
{
private:
struct P1 : public X
{
P1 ();
~P1 ();
int something;
};
struct P2 : public X
{
P2 ();
virtual ~P2 ();
int something;
};
public:
typedef typename tl::boolean_value<sizeof (P1) == sizeof (P2)>::value value;
};
template <class X, bool> struct _assign;
template <class X> struct _assign<X, false> { static void call (void *, const void *) { throw tl::Exception (tl::to_string (tr ("Object cannot be copied here"))); } };
template <class X> struct _assign<X, true> { static void call (void *dest, const void *src) { *(X *)dest = *(const X *)src; } };
/**
* @brief A helper class which tests whether a given object can be upcast
@ -513,14 +254,14 @@ public:
* The can_upcast method will return true, if the object (which has at least to
* be of type B) can be upcast to X.
*/
template <class X, class B, class B_IS_POLYMORPHIC>
template <class X, class B, bool B_IS_POLYMORPHIC>
class SubClassTester;
/**
* @brief Specialization for polymorphic types - we can use dynamic_cast to tests whether B object can be cast to X
*/
template <class X, class B>
class SubClassTester<X, B, tl::true_tag>
class SubClassTester<X, B, true>
: public SubClassTesterBase
{
public:
@ -534,7 +275,7 @@ public:
* @brief Specialization for non-polymorphic types
*/
template <class X, class B>
class SubClassTester<X, B, tl::false_tag>
class SubClassTester<X, B, false>
: public SubClassTesterBase
{
public:
@ -556,10 +297,6 @@ class GSI_PUBLIC_TEMPLATE ClassExt
: public ClassBase
{
public:
typedef typename tl::type_traits<X>::has_copy_constructor has_copy_ctor;
typedef typename tl::type_traits<X>::has_default_constructor has_default_ctor;
typedef typename tl::type_traits<X>::has_public_destructor has_public_dtor;
ClassExt (const Methods &mm, const std::string &doc = std::string ())
: ClassBase (doc, mm), mp_declaration (0)
{
@ -579,7 +316,7 @@ public:
* This feature is not quite useful usually and is reserved for special use cases
* such as including enums into a declaration namespace.
*/
ClassExt (const ClassBase &import, const std::string &name, const std::string &doc = std::string ())
ClassExt (const ClassBase &import, const std::string &name = std::string (), const std::string &doc = std::string ())
: ClassBase (doc, Methods ()), mp_declaration (&import)
{
set_name (name);
@ -713,10 +450,6 @@ class GSI_PUBLIC_TEMPLATE Class
: public ClassBase
{
public:
typedef typename tl::type_traits<X>::has_copy_constructor has_copy_ctor;
typedef typename tl::type_traits<X>::has_default_constructor has_default_ctor;
typedef typename tl::type_traits<X>::has_public_destructor has_public_dtor;
Class (const std::string &module, const std::string &name, const Methods &mm, const std::string &doc = std::string (), bool do_register = true)
: ClassBase (doc, mm, do_register)
{
@ -726,7 +459,7 @@ public:
template <class B>
Class (const Class<B> &base, const std::string &module, const std::string &name, const Methods &mm, const std::string &doc = std::string (), bool do_register = true)
: ClassBase (doc, mm, do_register), m_subclass_tester (new SubClassTester<X, B, typename is_polymorphic<B>::value> ())
: ClassBase (doc, mm, do_register), m_subclass_tester (new SubClassTester<X, B, std::is_polymorphic<B>::value> ())
{
set_module (module);
set_name (name);
@ -742,7 +475,7 @@ public:
template <class B>
Class (const Class<B> &base, const std::string &module, const std::string &name, const std::string &doc = std::string (), bool do_register = true)
: ClassBase (doc, Methods (), do_register), m_subclass_tester (new SubClassTester<X, B, typename is_polymorphic<B>::value> ())
: ClassBase (doc, Methods (), do_register), m_subclass_tester (new SubClassTester<X, B, std::is_polymorphic<B>::value> ())
{
set_module (module);
set_name (name);
@ -785,15 +518,12 @@ public:
virtual void destroy (void *p) const
{
X *x = (X *)p;
has_public_dtor hpd;
_destroy (x, hpd);
_destroy<X, std::is_destructible<X>::value>::call (x);
}
virtual void *create () const
{
has_default_ctor cst;
void *r = _create<X> (cst);
return r;
return _create<X, std::is_default_constructible<X>::value>::call ();
}
virtual void *create_from_adapted (const void *x) const
@ -818,33 +548,27 @@ public:
virtual void *clone (const void *other) const
{
has_copy_ctor cst;
void *r = _clone<X> (cst, other);
return r;
return _clone<X, std::is_copy_constructible<X>::value>::call (other);
}
virtual void assign (void *dest, const void *src) const
{
has_copy_ctor cst;
_assign<X> (cst, dest, src);
_assign<X, std::is_copy_assignable<X>::value>::call (dest, src);
}
virtual bool can_destroy () const
{
has_public_dtor hpd;
return tl::value_of (hpd);
return std::is_destructible<X>::value;
}
virtual bool can_copy () const
{
has_copy_ctor cpt;
return tl::value_of (cpt);
return std::is_copy_constructible<X>::value;
}
virtual bool can_default_create () const
{
has_default_ctor cpt;
return tl::value_of (cpt);
return std::is_default_constructible<X>::value;
}
virtual const ClassBase *subclass_decl (const void *p) const

View File

@ -26,17 +26,6 @@
#include "gsiDecl.h"
#include "tlTypeTraits.h"
namespace tl
{
template <> struct type_traits<gsi::Interpreter>
: tl::type_traits<void>
{
typedef false_tag has_copy_constructor;
typedef false_tag has_default_constructor;
typedef false_tag has_public_destructor;
};
}
namespace gsi
{

View File

@ -23,21 +23,6 @@
#include "gsiDecl.h"
namespace tl
{
template <> struct type_traits<gsi::ClassBase> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
template <> struct type_traits<gsi::MethodBase> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
namespace gsi
{

View File

@ -77,18 +77,6 @@ public:
}
};
}
namespace tl {
template <> struct type_traits<gsi::Logger> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
typedef tl::false_tag has_default_constructor;
};
}
namespace gsi
{
Class<Logger> decl_Logger ("tl", "Logger",
gsi::method ("info", &Logger::info, gsi::arg ("msg"),
"@brief Writes the given string to the info channel\n"
@ -464,6 +452,8 @@ private:
std::unique_ptr<tl::Expression> mp_expr;
};
}
static tl::Variant eval_expr (const std::string &e)
{
ExpressionWrapper expr;
@ -488,17 +478,6 @@ static ExpressionWrapper *new_expr2 (const std::string &e, const std::map<std::s
return expr.release ();
}
}
namespace tl {
template <> struct type_traits<ExpressionWrapper> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
typedef tl::true_tag has_default_constructor;
};
}
namespace gsi
{
@ -661,16 +640,6 @@ public:
gsi::Callback cleanup_cb;
};
}
namespace tl
{
template <> struct type_traits<gsi::Executable_Impl> : public type_traits<tl::Executable> { };
}
namespace gsi
{
Class<tl::Executable> decl_Executable ("tl", "ExecutableBase",
gsi::Methods (),
"@hide\n@alias Executable"
@ -719,16 +688,6 @@ public:
gsi::Callback executable_cb;
};
}
namespace tl
{
template <> struct type_traits<gsi::Recipe_Impl> : public type_traits<tl::Recipe> { };
}
namespace gsi
{
static Recipe_Impl *make_recipe (const std::string &name, const std::string &description)
{
return new Recipe_Impl (name, description);

View File

@ -106,6 +106,10 @@ public:
std::pair<bool, size_t> find (bool st, const std::string &name) const
{
std::map<std::pair<bool, std::string>, size_t>::const_iterator t = m_name_map.find (std::make_pair (st, name));
if (! st && t == m_name_map.end ()) {
// can also use static methods for instances
t = m_name_map.find (std::make_pair (true, name));
}
if (t != m_name_map.end ()) {
return std::make_pair (true, t->second);
} else {
@ -1088,11 +1092,7 @@ initialize_expressions ()
// skip external classes
continue;
} else if ((*c)->declaration () != *c) {
// we might encounter a child class which is a reference to a top-level class (e.g.
// duplication of enums into child classes). In this case we should create a reference inside the
// target class.
tl_assert ((*c)->parent () != 0); // top-level classes should be merged
// TODO: implement (see rba.cc:1544 for example)
continue;
}
@ -1360,6 +1360,65 @@ special_method_impl (gsi::MethodBase::special_method_type smt, tl::Variant &self
return tl::Variant ();
}
static std::pair<const ExpressionMethodTable *, size_t> find_method (const gsi::ClassBase *cls, bool as_static, const std::string &method)
{
const ExpressionMethodTable *mt = 0;
size_t mid = 0;
while (cls) {
mt = ExpressionMethodTable::method_table_by_class (cls);
std::pair<bool, size_t> t = mt->find (as_static, method);
if (t.first) {
mid = t.second;
return std::make_pair (mt, mid);
}
// try unnamed child classes as static
for (auto cc = cls->begin_child_classes (); cc != cls->end_child_classes (); ++cc) {
if (cc->name ().empty ()) {
std::pair<const ExpressionMethodTable *, size_t> m = find_method (cc->declaration (), true, method);
if (m.first) {
return m;
}
}
}
cls = cls->base ();
}
return std::make_pair ((const ExpressionMethodTable *) 0, size_t (0));
}
static const gsi::ClassBase *find_class_scope (const gsi::ClassBase *cls, const std::string &name)
{
while (cls) {
// try named child classes
for (auto cc = cls->begin_child_classes (); cc != cls->end_child_classes (); ++cc) {
if (cc->name () == name) {
return cc->declaration ();
}
}
// try unnamed child classes as additional bases
for (auto cc = cls->begin_child_classes (); cc != cls->end_child_classes (); ++cc) {
if (cc->name ().empty ()) {
const gsi::ClassBase *scope = find_class_scope (cc->declaration (), name);
if (scope) {
return scope;
}
}
}
cls = cls->base ();
}
return 0;
}
void
VariantUserClassImpl::execute_gsi (const tl::ExpressionParserContext & /*context*/, tl::Variant &out, tl::Variant &object, const std::string &method, const std::vector<tl::Variant> &args) const
{
@ -1374,25 +1433,34 @@ VariantUserClassImpl::execute_gsi (const tl::ExpressionParserContext & /*context
}
}
const ExpressionMethodTable *mt = 0;
size_t mid = 0;
const gsi::ClassBase *cls = clsact;
while (cls) {
auto m = find_method (clsact, mp_object_cls != 0 /*static*/, method);
mt = ExpressionMethodTable::method_table_by_class (cls);
std::pair<bool, size_t> t = mt->find (mp_object_cls != 0 /*static*/, method);
if (t.first) {
mid = t.second;
break;
const ExpressionMethodTable *mt = m.first;
size_t mid = m.second;
if (! mt) {
// try class scope
const gsi::ClassBase *scope = find_class_scope (clsact, method);
if (scope) {
if (! args.empty ()) {
throw tl::Exception (tl::to_string (tr ("'%s' is not a function and cannot have parameters")), method);
}
// we found a class scope: return a reference to that
const tl::VariantUserClassBase *scope_var_cls = scope->var_cls_cls ();
if (scope_var_cls) {
out = tl::Variant ((void *) 0, scope_var_cls, false);
} else {
out = tl::Variant ();
}
return;
} else {
throw tl::Exception (tl::to_string (tr ("Unknown method '%s' of class '%s'")), method, clsact->name ());
}
cls = cls->base ();
}
if (cls == 0) {
throw tl::Exception (tl::to_string (tr ("Unknown method")) + " '" + method + "' of class '" + clsact->name () + "'");
}
const gsi::MethodBase *meth = 0;

View File

@ -549,9 +549,12 @@ private:
{
check_data (as);
std::unique_ptr<AdaptorBase> p (*(AdaptorBase **)mp_read);
AdaptorBase *p = *(AdaptorBase **)mp_read;
mp_read += item_size<AdaptorBase *> ();
tl_assert (p.get () != 0);
tl_assert (p != 0);
// late-destroy the adaptor since the new X object may still need data from there (e.g. QLatin1String)
heap.push (p);
X x = X ();
copy_to<X> (*p, x, heap);
@ -565,9 +568,12 @@ private:
check_data (as);
std::unique_ptr<AdaptorBase> p (*(AdaptorBase **)mp_read);
AdaptorBase *p = *(AdaptorBase **)mp_read;
mp_read += item_size<AdaptorBase *> ();
tl_assert (p.get () != 0);
tl_assert (p != 0);
// late-destroy the adaptor since the new X object may still need data from there (e.g. QLatin1String)
heap.push (p);
x_type *x = new x_type ();
heap.push (x);
@ -601,14 +607,19 @@ private:
check_data (as);
std::unique_ptr<AdaptorBase> p (*(AdaptorBase **)mp_read);
AdaptorBase *p = *(AdaptorBase **) mp_read;
mp_read += item_size<AdaptorBase *> ();
x_type *x = 0;
if (p.get () != 0) {
if (p != 0) {
// late-destroy the adaptor since the new X object may still need data from there (e.g. QLatin1String)
heap.push (p);
x = new x_type ();
heap.push (x);
copy_to<x_type> (*p, *x, heap);
}
return x;
@ -895,6 +906,154 @@ private:
mutable QByteArray m_s_utf8;
};
#if QT_VERSION >= 0x60000
/**
* @brief Specialization for QString
*/
template <>
class GSI_PUBLIC StringAdaptorImpl<QStringView>
: public StringAdaptor
{
public:
StringAdaptorImpl (QStringView *s)
: mp_s (s), m_is_const (false)
{
// .. nothing yet ..
}
StringAdaptorImpl (const QStringView *s)
: mp_s (const_cast<QStringView *> (s)), m_is_const (true)
{
// .. nothing yet ..
}
StringAdaptorImpl (const QStringView &s)
: m_is_const (false), m_s (s)
{
mp_s = &m_s;
}
StringAdaptorImpl ()
: m_is_const (false)
{
mp_s = &m_s;
}
virtual ~StringAdaptorImpl ()
{
// .. nothing yet ..
}
virtual size_t size () const
{
return mp_s->toUtf8 ().size ();
}
virtual const char *c_str () const
{
m_s_utf8 = mp_s->toUtf8 ();
return m_s_utf8.constData ();
}
virtual void set (const char *c_str, size_t s, tl::Heap &heap)
{
if (! m_is_const) {
QString *hstr = heap.create<QString> ();
*hstr = QString::fromUtf8 (c_str, int (s));
*mp_s = QStringView (hstr->constData (), hstr->size ());
}
}
virtual void copy_to (AdaptorBase *target, tl::Heap &heap) const
{
StringAdaptorImpl<QStringView> *s = dynamic_cast<StringAdaptorImpl<QStringView> *>(target);
if (s) {
QString *hstr = heap.create<QString> ();
*hstr = mp_s->toString ();
*s->mp_s = QStringView (hstr->constData (), hstr->size ());
} else {
StringAdaptor::copy_to (target, heap);
}
}
private:
QStringView *mp_s;
bool m_is_const;
QStringView m_s;
mutable QByteArray m_s_utf8;
};
#endif
#if QT_VERSION >= 0x50000
/**
* @brief Specialization for QLatin1String
*/
template <>
class GSI_PUBLIC StringAdaptorImpl<QLatin1String>
: public StringAdaptor
{
public:
StringAdaptorImpl (QLatin1String *s)
: mp_s (s), m_is_const (false)
{
// .. nothing yet ..
}
StringAdaptorImpl (const QLatin1String *s)
: mp_s (const_cast<QLatin1String *> (s)), m_is_const (true)
{
// .. nothing yet ..
}
StringAdaptorImpl (const QLatin1String &s)
: m_is_const (false), m_s (s)
{
mp_s = &m_s;
}
StringAdaptorImpl ()
: m_is_const (false)
{
mp_s = &m_s;
}
virtual ~StringAdaptorImpl ()
{
// .. nothing yet ..
}
virtual size_t size () const
{
return QString::fromLatin1 (mp_s->data (), mp_s->size ()).toUtf8 ().size ();
}
virtual const char *c_str () const
{
m_s_utf8 = QString::fromLatin1 (mp_s->data (), mp_s->size ()).toUtf8 ();
return m_s_utf8.constData ();
}
virtual void set (const char *c_str, size_t s, tl::Heap &)
{
if (! m_is_const) {
m_latin1_holder = QString::fromUtf8 (c_str, int (s)).toLatin1 ();
*mp_s = QLatin1String (m_latin1_holder.constData (), m_latin1_holder.size ());
}
}
private:
QLatin1String *mp_s;
bool m_is_const;
QLatin1String m_s;
QByteArray m_latin1_holder;
mutable QByteArray m_s_utf8;
};
#endif
#endif
/**
@ -1211,6 +1370,84 @@ private:
QByteArray m_s;
};
#if QT_VERSION > 0x60000
/**
* @brief Specialization for QByteArray
*/
template <>
class GSI_PUBLIC ByteArrayAdaptorImpl<QByteArrayView>
: public ByteArrayAdaptor
{
public:
ByteArrayAdaptorImpl (QByteArrayView *s)
: mp_s (s), m_is_const (false)
{
// .. nothing yet ..
}
ByteArrayAdaptorImpl (const QByteArrayView *s)
: mp_s (const_cast<QByteArrayView *> (s)), m_is_const (true)
{
// .. nothing yet ..
}
ByteArrayAdaptorImpl (const QByteArrayView &s)
: m_is_const (false), m_s (s)
{
mp_s = &m_s;
}
ByteArrayAdaptorImpl ()
: m_is_const (false)
{
mp_s = &m_s;
}
virtual ~ByteArrayAdaptorImpl ()
{
// .. nothing yet ..
}
virtual size_t size () const
{
return mp_s->size ();
}
virtual const char *c_str () const
{
return mp_s->constData ();
}
virtual void set (const char *c_str, size_t s, tl::Heap &heap)
{
if (! m_is_const) {
QByteArray *str = heap.create<QByteArray> ();
*str = QByteArray (c_str, s);
*mp_s = QByteArrayView (str->constData (), str->size ());
}
}
virtual void copy_to (AdaptorBase *target, tl::Heap &heap) const
{
ByteArrayAdaptorImpl<QByteArrayView> *s = dynamic_cast<ByteArrayAdaptorImpl<QByteArrayView> *>(target);
if (s) {
QByteArray *str = heap.create<QByteArray> ();
*str = QByteArray (mp_s->constData (), mp_s->size ());
*s->mp_s = *str;
} else {
ByteArrayAdaptor::copy_to (target, heap);
}
}
private:
QByteArrayView *mp_s;
bool m_is_const;
QByteArrayView m_s;
};
#endif
#endif
/**
@ -1312,16 +1549,16 @@ public:
/**
* @brief Sets the variant's value
*/
virtual void set (const tl::Variant &v) = 0;
virtual void set (const tl::Variant &v, tl::Heap & /*heap*/) = 0;
/**
* @brief Implementation of copy_to
*/
virtual void copy_to (AdaptorBase *target, tl::Heap & /*heap*/) const
virtual void copy_to (AdaptorBase *target, tl::Heap &heap) const
{
VariantAdaptor *v = dynamic_cast<VariantAdaptor *>(target);
tl_assert (v);
v->set (var ());
v->set (var (), heap);
}
};
@ -1383,7 +1620,7 @@ public:
return *mp_v;
}
virtual void set (const tl::Variant &v)
virtual void set (const tl::Variant &v, tl::Heap & /*heap*/)
{
if (! m_is_const) {
*mp_v = v.to_qvariant ();
@ -1406,6 +1643,93 @@ private:
QVariant m_v;
};
#if QT_VERSION >= 0x50000
/**
* @brief Specialization for QVariant
*/
template <typename T>
class GSI_PUBLIC_TEMPLATE VariantAdaptorImpl<QPointer<T> >
: public VariantAdaptor
{
public:
VariantAdaptorImpl (QPointer<T> *v)
: mp_v (v), m_is_const (false)
{
// .. nothing yet ..
}
VariantAdaptorImpl (const QPointer<T> *v)
: mp_v (const_cast<QPointer<T> *> (v)), m_is_const (true)
{
// .. nothing yet ..
}
VariantAdaptorImpl (const QPointer<T> &v)
: m_is_const (true), m_v (v)
{
mp_v = &m_v;
}
VariantAdaptorImpl ()
: m_is_const (false)
{
mp_v = &m_v;
}
virtual ~VariantAdaptorImpl ()
{
// .. nothing yet ..
}
virtual tl::Variant var () const
{
return tl::Variant::make_variant_ref (mp_v->get ());
}
virtual void set (const tl::Variant &v, tl::Heap & /*heap*/)
{
if (m_is_const) {
// .. can't change
} else if (v.is_nil ()) {
mp_v->clear ();
} else if (v.is_user<T> ()) {
if (v.user_is_ref ()) {
*mp_v = (T *) v.to_user ();
} else {
// basically should not happen as the QPointer cannot hold anything other than a reference
// (a tl::Variant terminology)
tl_assert (false);
}
} else {
// basically should not happen as the QPointer cannot hold anything other than a user object
// (a tl::Variant terminology)
tl_assert (false);
}
}
virtual void copy_to (AdaptorBase *target, tl::Heap &heap) const
{
VariantAdaptorImpl<QPointer<T>> *v = dynamic_cast<VariantAdaptorImpl<QPointer<T>> *>(target);
if (v) {
if (mp_v->isNull ()) {
v->mp_v->clear ();
} else {
*v->mp_v = QPointer<T> (*mp_v);
}
} else {
VariantAdaptor::copy_to (target, heap);
}
}
private:
QPointer<T> *mp_v;
bool m_is_const;
QPointer<T> m_v;
};
#endif
#endif
/**
@ -1460,7 +1784,7 @@ public:
return *mp_v;
}
virtual void set (const tl::Variant &v)
virtual void set (const tl::Variant &v, tl::Heap & /*heap*/)
{
if (! m_is_const) {
*mp_v = v;
@ -1483,6 +1807,85 @@ private:
tl::Variant m_v;
};
#if __cplusplus >= 201703L
/**
* @brief Specialization for std::optional
*/
template <typename T>
class GSI_PUBLIC_TEMPLATE VariantAdaptorImpl<std::optional<T> >
: public VariantAdaptor
{
public:
VariantAdaptorImpl (std::optional<T> *v)
: mp_v (v), m_is_const (false)
{
// .. nothing yet ..
}
VariantAdaptorImpl (const std::optional<T> *v)
: mp_v (const_cast<std::optional<T> *> (v)), m_is_const (true)
{
// .. nothing yet ..
}
VariantAdaptorImpl (const std::optional<T> &v)
: m_is_const (true), m_v (v)
{
mp_v = &m_v;
}
VariantAdaptorImpl ()
: m_is_const (false)
{
mp_v = &m_v;
}
virtual ~VariantAdaptorImpl ()
{
// .. nothing yet ..
}
virtual tl::Variant var () const
{
return *mp_v ? tl::Variant (mp_v->value ()) : tl::Variant ();
}
virtual void set (const tl::Variant &v, tl::Heap & /*heap*/)
{
if (m_is_const) {
// .. can't change
} else if (v.is_nil ()) {
mp_v->reset ();
} else if (v.is_user<T> ()) {
*mp_v = v.to_user<T> ();
} else {
*mp_v = v.to<T> ();
}
}
virtual void copy_to (AdaptorBase *target, tl::Heap &heap) const
{
VariantAdaptorImpl<std::optional<T>> *v = dynamic_cast<VariantAdaptorImpl<std::optional<T>> *>(target);
if (v) {
if (*mp_v) {
v->mp_v->reset ();
} else {
*v->mp_v = mp_v->value ();
}
} else {
VariantAdaptor::copy_to (target, heap);
}
}
private:
std::optional<T> *mp_v;
bool m_is_const;
std::optional<T> m_v;
};
#endif
// ------------------------------------------------------------
// Vector adaptor framework
@ -1644,11 +2047,13 @@ void push_vector (std::set<X> &v, const X &x)
#if defined(HAVE_QT)
#if QT_VERSION < 0x60000
template <class X>
void push_vector (QVector<X> &v, const X &x)
{
v.push_back (x);
}
#endif
inline void push_vector (QStringList &v, const QString &x)
{

View File

@ -46,6 +46,13 @@
#include <QSet>
#include <QList>
#include <QStringList>
#if QT_VERSION >= 0x50000
# include <QLatin1String>
#endif
#if QT_VERSION >= 0x60000
# include <QByteArrayView>
# include <QStringView>
#endif
#endif
namespace tl
@ -434,12 +441,23 @@ template <> struct type_traits<__int128> : generic_type_trait
template <> struct type_traits<double> : generic_type_traits<double_tag, double, T_double> { };
template <> struct type_traits<float> : generic_type_traits<float_tag, float, T_float> { };
template <> struct type_traits<std::string> : generic_type_traits<string_tag, StringAdaptor, T_string> { };
#if __cplusplus >= 201703L
template <typename T> struct type_traits<std::optional<T> > : generic_type_traits<var_tag, VariantAdaptor, T_var> { };
#endif
#if defined(HAVE_QT)
template <> struct type_traits<QString> : generic_type_traits<string_tag, StringAdaptor, T_string> { };
template <> struct type_traits<QStringRef> : generic_type_traits<string_tag, StringAdaptor, T_string> { };
template <> struct type_traits<QByteArray> : generic_type_traits<byte_array_tag, StringAdaptor, T_byte_array> { };
template <> struct type_traits<std::vector<char> > : generic_type_traits<byte_array_tag, StringAdaptor, T_byte_array> { };
template <> struct type_traits<QVariant> : generic_type_traits<var_tag, VariantAdaptor, T_var> { };
#if QT_VERSION >= 0x50000
template <typename T> struct type_traits<QPointer<T> > : generic_type_traits<var_tag, VariantAdaptor, T_var> { };
template <> struct type_traits<QLatin1String> : generic_type_traits<string_tag, StringAdaptor, T_string> { };
#endif
#if QT_VERSION >= 0x60000
template <> struct type_traits<QStringView> : generic_type_traits<string_tag, StringAdaptor, T_string> { };
template <> struct type_traits<QByteArrayView> : generic_type_traits<byte_array_tag, StringAdaptor, T_byte_array> { };
#endif
#endif
template <> struct type_traits<tl::Variant> : generic_type_traits<var_tag, VariantAdaptor, T_var> { };
@ -467,12 +485,23 @@ template <> struct type_traits<const __int128 &> : generic_type_trait
template <> struct type_traits<const double &> : generic_type_traits<double_cref_tag, double, T_double> { };
template <> struct type_traits<const float &> : generic_type_traits<float_cref_tag, float, T_float> { };
template <> struct type_traits<const std::string &> : generic_type_traits<string_cref_tag, StringAdaptor, T_string> { };
#if __cplusplus >= 201703L
template <typename T> struct type_traits<const std::optional<T> &> : generic_type_traits<var_cref_tag, VariantAdaptor, T_var> { };
#endif
#if defined(HAVE_QT)
template <> struct type_traits<const QString &> : generic_type_traits<string_cref_tag, StringAdaptor, T_string> { };
template <> struct type_traits<const QStringRef &> : generic_type_traits<string_cref_tag, StringAdaptor, T_string> { };
template <> struct type_traits<const QByteArray &> : generic_type_traits<byte_array_cref_tag, StringAdaptor, T_byte_array> { };
template <> struct type_traits<const std::vector<char> &> : generic_type_traits<byte_array_cref_tag, StringAdaptor, T_byte_array> { };
template <> struct type_traits<const QVariant &> : generic_type_traits<var_cref_tag, VariantAdaptor, T_var> { };
#if QT_VERSION >= 0x50000
template <typename T> struct type_traits<const QPointer<T> &> : generic_type_traits<var_cref_tag, VariantAdaptor, T_var> { };
template <> struct type_traits<const QLatin1String &> : generic_type_traits<string_cref_tag, StringAdaptor, T_string> { };
#endif
#if QT_VERSION >= 0x60000
template <> struct type_traits<const QStringView &> : generic_type_traits<string_cref_tag, StringAdaptor, T_string> { };
template <> struct type_traits<const QByteArrayView &> : generic_type_traits<byte_array_cref_tag, StringAdaptor, T_byte_array> { };
#endif
#endif
template <> struct type_traits<const tl::Variant &> : generic_type_traits<var_cref_tag, VariantAdaptor, T_var> { };
template <> struct type_traits<const char * const &> : generic_type_traits<string_cref_tag, StringAdaptor, T_string> { };
@ -497,12 +526,23 @@ template <> struct type_traits<__int128 &> : generic_type_trait
template <> struct type_traits<double &> : generic_type_traits<double_ref_tag, double, T_double> { };
template <> struct type_traits<float &> : generic_type_traits<float_ref_tag, float, T_float> { };
template <> struct type_traits<std::string &> : generic_type_traits<string_ref_tag, StringAdaptor, T_string> { };
#if __cplusplus >= 201703L
template <typename T> struct type_traits<std::optional<T> &> : generic_type_traits<var_ref_tag, VariantAdaptor, T_var> { };
#endif
#if defined(HAVE_QT)
template <> struct type_traits<QString &> : generic_type_traits<string_ref_tag, StringAdaptor, T_string> { };
template <> struct type_traits<QStringRef &> : generic_type_traits<string_ref_tag, StringAdaptor, T_string> { };
template <> struct type_traits<QByteArray &> : generic_type_traits<byte_array_ref_tag, StringAdaptor, T_byte_array> { };
template <> struct type_traits<std::vector<char> &> : generic_type_traits<byte_array_ref_tag, StringAdaptor, T_byte_array> { };
template <> struct type_traits<QVariant &> : generic_type_traits<var_ref_tag, VariantAdaptor, T_var> { };
#if QT_VERSION >= 0x50000
template <typename T> struct type_traits<QPointer<T> &> : generic_type_traits<var_ref_tag, VariantAdaptor, T_var> { };
template <> struct type_traits<QLatin1String &> : generic_type_traits<string_ref_tag, StringAdaptor, T_string> { };
#endif
#if QT_VERSION >= 0x60000
template <> struct type_traits<QStringView &> : generic_type_traits<string_ref_tag, StringAdaptor, T_string> { };
template <> struct type_traits<QByteArrayView &> : generic_type_traits<byte_array_ref_tag, StringAdaptor, T_byte_array> { };
#endif
#endif
template <> struct type_traits<tl::Variant &> : generic_type_traits<var_ref_tag, VariantAdaptor, T_var> { };
template <> struct type_traits<const char * &> : generic_type_traits<string_ref_tag, StringAdaptor, T_string> { };
@ -528,12 +568,23 @@ template <> struct type_traits<const __int128 *> : generic_type_trait
template <> struct type_traits<const double *> : generic_type_traits<double_cptr_tag, double, T_double> { };
template <> struct type_traits<const float *> : generic_type_traits<float_cptr_tag, float, T_float> { };
template <> struct type_traits<const std::string *> : generic_type_traits<string_cptr_tag, StringAdaptor, T_string> { };
#if __cplusplus >= 201703L
template <typename T> struct type_traits<const std::optional<T> *> : generic_type_traits<var_cptr_tag, VariantAdaptor, T_var> { };
#endif
#if defined(HAVE_QT)
template <> struct type_traits<const QString *> : generic_type_traits<string_cptr_tag, StringAdaptor, T_string> { };
template <> struct type_traits<const QStringRef *> : generic_type_traits<string_cptr_tag, StringAdaptor, T_string> { };
template <> struct type_traits<const QByteArray *> : generic_type_traits<byte_array_cptr_tag, StringAdaptor, T_byte_array> { };
template <> struct type_traits<const std::vector<char> *> : generic_type_traits<byte_array_cptr_tag, StringAdaptor, T_byte_array> { };
template <> struct type_traits<const QVariant *> : generic_type_traits<var_cptr_tag, VariantAdaptor, T_var> { };
#if QT_VERSION >= 0x50000
template <typename T> struct type_traits<const QPointer<T> *> : generic_type_traits<var_cptr_tag, VariantAdaptor, T_var> { };
template <> struct type_traits<const QLatin1String *> : generic_type_traits<string_cptr_tag, StringAdaptor, T_string> { };
#endif
#if QT_VERSION >= 0x60000
template <> struct type_traits<const QStringView *> : generic_type_traits<string_cptr_tag, StringAdaptor, T_string> { };
template <> struct type_traits<const QByteArrayView *> : generic_type_traits<byte_array_cptr_tag, StringAdaptor, T_byte_array> { };
#endif
#endif
template <> struct type_traits<const tl::Variant *> : generic_type_traits<var_cptr_tag, VariantAdaptor, T_var> { };
template <> struct type_traits<const char * const *> : generic_type_traits<string_cptr_tag, StringAdaptor, T_string> { };
@ -559,18 +610,50 @@ template <> struct type_traits<__int128 *> : generic_type_trait
template <> struct type_traits<double *> : generic_type_traits<double_ptr_tag, double, T_double> { };
template <> struct type_traits<float *> : generic_type_traits<float_ptr_tag, float, T_float> { };
template <> struct type_traits<std::string *> : generic_type_traits<string_ptr_tag, StringAdaptor, T_string> { };
#if __cplusplus >= 201703L
template <typename T> struct type_traits<std::optional<T> *> : generic_type_traits<var_ptr_tag, VariantAdaptor, T_var> { };
#endif
#if defined(HAVE_QT)
template <> struct type_traits<QString *> : generic_type_traits<string_ptr_tag, StringAdaptor, T_string> { };
template <> struct type_traits<QStringRef *> : generic_type_traits<string_ptr_tag, StringAdaptor, T_string> { };
template <> struct type_traits<QByteArray *> : generic_type_traits<byte_array_ptr_tag, StringAdaptor, T_byte_array> { };
template <> struct type_traits<std::vector<char> *> : generic_type_traits<byte_array_ptr_tag, StringAdaptor, T_byte_array> { };
template <> struct type_traits<QVariant *> : generic_type_traits<var_ptr_tag, VariantAdaptor, T_var> { };
#if QT_VERSION >= 0x50000
template <typename T> struct type_traits<QPointer<T> *> : generic_type_traits<var_ptr_tag, VariantAdaptor, T_var> { };
template <> struct type_traits<QLatin1String *> : generic_type_traits<string_ptr_tag, StringAdaptor, T_string> { };
#endif
#if QT_VERSION >= 0x60000
template <> struct type_traits<QStringView *> : generic_type_traits<string_ptr_tag, StringAdaptor, T_string> { };
template <> struct type_traits<QByteArrayView *> : generic_type_traits<byte_array_ptr_tag, StringAdaptor, T_byte_array> { };
#endif
#endif
template <> struct type_traits<tl::Variant *> : generic_type_traits<var_ptr_tag, VariantAdaptor, T_var> { };
template <> struct type_traits<const char * *> : generic_type_traits<string_ptr_tag, StringAdaptor, T_string> { };
template <> struct type_traits<const unsigned char * *> : generic_type_traits<string_ptr_tag, StringAdaptor, T_string> { };
template <> struct type_traits<const signed char * *> : generic_type_traits<string_ptr_tag, StringAdaptor, T_string> { };
template <int n> struct __unsigned_type_with_size;
template <> struct __unsigned_type_with_size<1> { typedef uint8_t type; };
template <> struct __unsigned_type_with_size<2> { typedef uint16_t type; };
template <> struct __unsigned_type_with_size<4> { typedef uint32_t type; };
template <> struct type_traits<wchar_t> : type_traits<__unsigned_type_with_size<sizeof(wchar_t)>::type> { };
template <> struct type_traits<char16_t> : type_traits<__unsigned_type_with_size<sizeof(char16_t)>::type> { };
template <> struct type_traits<char32_t> : type_traits<__unsigned_type_with_size<sizeof(char32_t)>::type> { };
template <> struct type_traits<wchar_t *> : type_traits<__unsigned_type_with_size<sizeof(wchar_t)>::type *> { };
template <> struct type_traits<char16_t *> : type_traits<__unsigned_type_with_size<sizeof(char16_t)>::type *> { };
template <> struct type_traits<char32_t *> : type_traits<__unsigned_type_with_size<sizeof(char32_t)>::type *> { };
template <> struct type_traits<const wchar_t *> : type_traits<const __unsigned_type_with_size<sizeof(wchar_t)>::type *> { };
template <> struct type_traits<const char16_t *> : type_traits<const __unsigned_type_with_size<sizeof(char16_t)>::type *> { };
template <> struct type_traits<const char32_t *> : type_traits<const __unsigned_type_with_size<sizeof(char32_t)>::type *> { };
template <> struct type_traits<wchar_t &> : type_traits<__unsigned_type_with_size<sizeof(wchar_t)>::type &> { };
template <> struct type_traits<char16_t &> : type_traits<__unsigned_type_with_size<sizeof(char16_t)>::type &> { };
template <> struct type_traits<char32_t &> : type_traits<__unsigned_type_with_size<sizeof(char32_t)>::type &> { };
template <> struct type_traits<const wchar_t &> : type_traits<const __unsigned_type_with_size<sizeof(wchar_t)>::type &> { };
template <> struct type_traits<const char16_t &> : type_traits<const __unsigned_type_with_size<sizeof(char16_t)>::type &> { };
template <> struct type_traits<const char32_t &> : type_traits<const __unsigned_type_with_size<sizeof(char32_t)>::type &> { };
template <class X>
struct type_traits<const X>
: generic_type_traits<typename type_traits<X>::tag, typename type_traits<X>::value_type, T_void>
@ -749,6 +832,7 @@ struct type_traits< QSet<X> * >
typedef X inner_type;
};
#if QT_VERSION < 0x60000
template <class X>
struct type_traits< QVector<X> >
: generic_type_traits<vector_tag, VectorAdaptor, T_vector>
@ -783,6 +867,7 @@ struct type_traits< QVector<X> * >
{
typedef X inner_type;
};
#endif
template <class X, class Y>
struct type_traits< QHash<X, Y> >
@ -1142,7 +1227,7 @@ public:
/**
* @brief An implementation helper that provides a switch between classes having and having no copy ctor
*/
template <class T, class CC>
template <class T, bool>
class ArgSpecImpl
: public ArgSpecBase
{
@ -1187,7 +1272,7 @@ public:
* @brief A specialization for classes with default and copy ctor
*/
template <class T>
class ArgSpecImpl<T, tl::true_tag>
class ArgSpecImpl<T, true>
: public ArgSpecBase
{
public:
@ -1287,30 +1372,30 @@ private:
*/
template <class T>
class ArgSpec
: public ArgSpecImpl<T, typename tl::type_traits<T>::has_copy_constructor>
: public ArgSpecImpl<T, std::is_copy_constructible<T>::value && std::is_default_constructible<T>::value>
{
public:
typedef typename tl::type_traits<T>::has_copy_constructor cc_type;
typedef ArgSpecImpl<T, std::is_copy_constructible<T>::value && std::is_default_constructible<T>::value> Base;
ArgSpec ()
: ArgSpecImpl<T, cc_type> ()
: Base ()
{ }
ArgSpec (const ArgSpec<void> &other)
: ArgSpecImpl<T, cc_type> (other)
: Base (other)
{ }
template <class Q>
ArgSpec (const ArgSpec<Q> &other)
: ArgSpecImpl<T, cc_type> (other)
: Base (other)
{ }
ArgSpec (const std::string &name)
: ArgSpecImpl<T, cc_type> (name)
: Base (name)
{ }
ArgSpec (const std::string &name, const T &init, const std::string &init_doc = std::string ())
: ArgSpecImpl<T, cc_type> (name, init, init_doc)
: Base (name, init, init_doc)
{ }
virtual ArgSpecBase *clone () const
@ -1324,30 +1409,30 @@ public:
*/
template <class T>
class ArgSpec<const T &>
: public ArgSpecImpl<T, typename tl::type_traits<T>::has_copy_constructor>
: public ArgSpecImpl<T, std::is_copy_constructible<T>::value && std::is_default_constructible<T>::value>
{
public:
typedef typename tl::type_traits<T>::has_copy_constructor cc_type;
typedef ArgSpecImpl<T, std::is_copy_constructible<T>::value && std::is_default_constructible<T>::value> Base;
ArgSpec ()
: ArgSpecImpl<T, cc_type> ()
ArgSpec ()
: Base ()
{ }
ArgSpec (const ArgSpec<void> &other)
: ArgSpecImpl<T, cc_type> (other)
: Base (other)
{ }
template <class Q>
ArgSpec (const ArgSpec<Q> &other)
: ArgSpecImpl<T, cc_type> (other)
: Base (other)
{ }
ArgSpec (const std::string &name)
: ArgSpecImpl<T, cc_type> (name)
: Base (name)
{ }
ArgSpec (const std::string &name, const T &init, const std::string &init_doc = std::string ())
: ArgSpecImpl<T, cc_type> (name, init, init_doc)
: Base (name, init, init_doc)
{ }
virtual ArgSpecBase *clone () const
@ -1361,37 +1446,37 @@ public:
*/
template <class T>
class ArgSpec<T &>
: public ArgSpecImpl<T, typename tl::type_traits<T>::has_copy_constructor>
: public ArgSpecImpl<T, std::is_copy_constructible<T>::value && std::is_default_constructible<T>::value>
{
public:
typedef ArgSpecImpl<T, std::is_copy_constructible<T>::value && std::is_default_constructible<T>::value> Base;
typedef T &init_type;
typedef typename tl::type_traits<T>::has_copy_constructor cc_type;
ArgSpec ()
: ArgSpecImpl<T, cc_type> ()
: Base ()
{ }
ArgSpec (const ArgSpec<void> &other)
: ArgSpecImpl<T, cc_type> (other)
: Base (other)
{ }
template <class Q>
ArgSpec (const ArgSpec<Q> &other)
: ArgSpecImpl<T, cc_type> (other)
: Base (other)
{ }
ArgSpec (const std::string &name)
: ArgSpecImpl<T, cc_type> (name)
: Base (name)
{ }
ArgSpec (const std::string &name, const T &init, const std::string &init_doc = std::string ())
: ArgSpecImpl<T, cc_type> (name, init, init_doc)
: Base (name, init, init_doc)
{ }
T &init () const
{
// this simplifies the implementation, but it's not really clean since the caller may modify the default.
return const_cast<T &> (ArgSpecImpl<T, cc_type>::init ());
return const_cast<T &> (Base::init ());
}
virtual ArgSpecBase *clone () const

View File

@ -112,6 +112,8 @@ tl::Variant A::new_a_by_variant ()
return tl::Variant (A ());
}
#if defined(HAVE_QT)
std::vector<int>
A::qba_cref_to_ia (const QByteArray &ba)
{
@ -134,8 +136,8 @@ A::ia_cref_to_qba (const std::vector<int> &ia)
return ba;
}
const QByteArray &
A::ia_cref_to_qba_cref (const std::vector<int> &ia)
QByteArray &
A::ia_cref_to_qba_ref (const std::vector<int> &ia)
{
static QByteArray ba;
ba.clear ();
@ -145,6 +147,161 @@ A::ia_cref_to_qba_cref (const std::vector<int> &ia)
return ba;
}
#if QT_VERSION >= 0x60000
std::vector<int>
A::qbav_cref_to_ia (const QByteArrayView &ba)
{
const char *cp = ba.constData ();
size_t n = ba.size ();
std::vector<int> ia;
for (size_t i = 0; i < n; ++i) {
ia.push_back (int (*cp++));
}
return ia;
}
QByteArrayView
A::ia_cref_to_qbav (const std::vector<int> &ia)
{
static QByteArray ba;
ba.clear ();
for (std::vector<int>::const_iterator i = ia.begin (); i != ia.end (); ++i) {
ba.push_back (char (*i));
}
return ba;
}
QByteArrayView &
A::ia_cref_to_qbav_ref (const std::vector<int> &ia)
{
static QByteArray ba;
ba.clear ();
for (std::vector<int>::const_iterator i = ia.begin (); i != ia.end (); ++i) {
ba.push_back (char (*i));
}
static QByteArrayView bav;
bav = ba;
return bav;
}
#endif
std::vector<int>
A::qs_cref_to_ia (const QString &qs)
{
const QChar *cp = qs.constData ();
size_t n = qs.size ();
std::vector<int> ia;
for (size_t i = 0; i < n; ++i) {
ia.push_back ((*cp++).unicode ());
}
return ia;
}
QString
A::ia_cref_to_qs (const std::vector<int> &ia)
{
QString s;
for (std::vector<int>::const_iterator i = ia.begin (); i != ia.end (); ++i) {
s.push_back (char (*i));
}
return s;
}
QString &
A::ia_cref_to_qs_ref (const std::vector<int> &ia)
{
static QString s;
s.clear ();
for (std::vector<int>::const_iterator i = ia.begin (); i != ia.end (); ++i) {
s.push_back (char (*i));
}
return s;
}
#if QT_VERSION >= 0x50000
std::vector<int>
A::ql1s_cref_to_ia (const QLatin1String &ql1s)
{
std::vector<int> ia;
const char *cp = ql1s.data ();
size_t n = ql1s.size ();
for (size_t i = 0; i < n; ++i) {
ia.push_back (*cp++);
}
return ia;
}
QLatin1String
A::ia_cref_to_ql1s (const std::vector<int> &ia)
{
static std::string str;
str.clear ();
for (std::vector<int>::const_iterator i = ia.begin (); i != ia.end (); ++i) {
str += char (*i);
}
return QLatin1String (str.c_str (), str.size ());
}
QLatin1String &
A::ia_cref_to_ql1s_ref (const std::vector<int> &ia)
{
static std::string str;
str.clear ();
for (std::vector<int>::const_iterator i = ia.begin (); i != ia.end (); ++i) {
str += char (*i);
}
static QLatin1String s (0);
s = QLatin1String (str.c_str (), str.size ());
return s;
}
#endif
#if QT_VERSION >= 0x60000
std::vector<int>
A::qsv_cref_to_ia (const QStringView &qs)
{
const QChar *cp = qs.constData ();
size_t n = qs.size ();
std::vector<int> ia;
for (size_t i = 0; i < n; ++i) {
ia.push_back ((*cp++).unicode ());
}
return ia;
}
QStringView
A::ia_cref_to_qsv (const std::vector<int> &ia)
{
static QString s;
s.clear ();
for (std::vector<int>::const_iterator i = ia.begin (); i != ia.end (); ++i) {
s.push_back (char (*i));
}
return s;
}
QStringView &
A::ia_cref_to_qsv_ref (const std::vector<int> &ia)
{
static QString s;
s.clear ();
for (std::vector<int>::const_iterator i = ia.begin (); i != ia.end (); ++i) {
s.push_back (char (*i));
}
static QStringView sv;
sv = s;
return sv;
}
#endif
#endif
std::vector<int>
A::ba_cref_to_ia (const std::vector<char> &ba)
{
@ -165,8 +322,8 @@ A::ia_cref_to_ba (const std::vector<int> &ia)
return ba;
}
const std::vector<char> &
A::ia_cref_to_ba_cref (const std::vector<int> &ia)
std::vector<char> &
A::ia_cref_to_ba_ref (const std::vector<int> &ia)
{
static std::vector<char> ba;
ba.clear ();
@ -877,6 +1034,7 @@ static gsi::Class<A> decl_a ("", "A",
gsi::method ("new_a_by_variant", &A::new_a_by_variant) +
#if defined(HAVE_QT)
gsi::method ("qba_cref_to_ia", &A::qba_cref_to_ia) +
gsi::method ("qba_ref_to_ia", &A::qba_ref_to_ia) +
gsi::method ("qba_cptr_to_ia", &A::qba_cptr_to_ia) +
@ -884,14 +1042,75 @@ static gsi::Class<A> decl_a ("", "A",
gsi::method ("qba_to_ia", &A::qba_to_ia) +
gsi::method ("ia_cref_to_qba", &A::ia_cref_to_qba) +
gsi::method ("ia_cref_to_qba_cref", &A::ia_cref_to_qba_cref) +
gsi::method ("ia_cref_to_qba_ref", &A::ia_cref_to_qba_ref) +
gsi::method ("ia_cref_to_qba_cptr", &A::ia_cref_to_qba_cptr) +
gsi::method ("ia_cref_to_qba_ptr", &A::ia_cref_to_qba_ptr) +
gsi::method ("qs_cref_to_ia", &A::qs_cref_to_ia) +
gsi::method ("qs_ref_to_ia", &A::qs_ref_to_ia) +
gsi::method ("qs_cptr_to_ia", &A::qs_cptr_to_ia) +
gsi::method ("qs_ptr_to_ia", &A::qs_ptr_to_ia) +
gsi::method ("qs_to_ia", &A::qs_to_ia) +
gsi::method ("ia_cref_to_qs", &A::ia_cref_to_qs) +
gsi::method ("ia_cref_to_qs_cref", &A::ia_cref_to_qs_cref) +
gsi::method ("ia_cref_to_qs_ref", &A::ia_cref_to_qs_ref) +
gsi::method ("ia_cref_to_qs_cptr", &A::ia_cref_to_qs_cptr) +
gsi::method ("ia_cref_to_qs_ptr", &A::ia_cref_to_qs_ptr) +
#if QT_VERSION >= 0x50000
gsi::method ("ql1s_cref_to_ia", &A::ql1s_cref_to_ia) +
gsi::method ("ql1s_ref_to_ia", &A::ql1s_ref_to_ia) +
gsi::method ("ql1s_cptr_to_ia", &A::ql1s_cptr_to_ia) +
gsi::method ("ql1s_ptr_to_ia", &A::ql1s_ptr_to_ia) +
gsi::method ("ql1s_to_ia", &A::ql1s_to_ia) +
gsi::method ("ia_cref_to_ql1s", &A::ia_cref_to_ql1s) +
gsi::method ("ia_cref_to_ql1s_cref", &A::ia_cref_to_ql1s_cref) +
gsi::method ("ia_cref_to_ql1s_ref", &A::ia_cref_to_ql1s_ref) +
gsi::method ("ia_cref_to_ql1s_cptr", &A::ia_cref_to_ql1s_cptr) +
gsi::method ("ia_cref_to_ql1s_ptr", &A::ia_cref_to_ql1s_ptr) +
#endif
#if QT_VERSION >= 0x60000
gsi::method ("qbav_cref_to_ia", &A::qbav_cref_to_ia) +
gsi::method ("qbav_ref_to_ia", &A::qbav_ref_to_ia) +
gsi::method ("qbav_cptr_to_ia", &A::qbav_cptr_to_ia) +
gsi::method ("qbav_ptr_to_ia", &A::qbav_ptr_to_ia) +
gsi::method ("qbav_to_ia", &A::qbav_to_ia) +
gsi::method ("ia_cref_to_qbav", &A::ia_cref_to_qbav) +
gsi::method ("ia_cref_to_qbav_cref", &A::ia_cref_to_qbav_cref) +
gsi::method ("ia_cref_to_qbav_ref", &A::ia_cref_to_qbav_ref) +
gsi::method ("ia_cref_to_qbav_cptr", &A::ia_cref_to_qbav_cptr) +
gsi::method ("ia_cref_to_qbav_ptr", &A::ia_cref_to_qbav_ptr) +
gsi::method ("qsv_cref_to_ia", &A::qsv_cref_to_ia) +
gsi::method ("qsv_ref_to_ia", &A::qsv_ref_to_ia) +
gsi::method ("qsv_cptr_to_ia", &A::qsv_cptr_to_ia) +
gsi::method ("qsv_ptr_to_ia", &A::qsv_ptr_to_ia) +
gsi::method ("qsv_to_ia", &A::qsv_to_ia) +
gsi::method ("ia_cref_to_qsv", &A::ia_cref_to_qsv) +
gsi::method ("ia_cref_to_qsv_cref", &A::ia_cref_to_qsv_cref) +
gsi::method ("ia_cref_to_qsv_ref", &A::ia_cref_to_qsv_ref) +
gsi::method ("ia_cref_to_qsv_cptr", &A::ia_cref_to_qsv_cptr) +
gsi::method ("ia_cref_to_qsv_ptr", &A::ia_cref_to_qsv_ptr) +
#endif
#endif
gsi::method ("ba_cref_to_ia", &A::ba_cref_to_ia) +
gsi::method ("ba_ref_to_ia", &A::ba_ref_to_ia) +
gsi::method ("ba_cptr_to_ia", &A::ba_cptr_to_ia) +
gsi::method ("ba_ptr_to_ia", &A::ba_ptr_to_ia) +
gsi::method ("ba_to_ia", &A::ba_to_ia) +
gsi::method ("ia_cref_to_ba", &A::ia_cref_to_ba) +
gsi::method ("ia_cref_to_ba_ref", &A::ia_cref_to_ba_ref) +
gsi::method ("ia_cref_to_ba_cref", &A::ia_cref_to_ba_cref) +
gsi::method ("ia_cref_to_ba_ptr", &A::ia_cref_to_ba_ptr) +
gsi::method ("ia_cref_to_ba_cptr", &A::ia_cref_to_ba_cptr) +
gsi::method ("br", &A::br) +
gsi::method ("get_e", &A::get_e) +
@ -1017,6 +1236,20 @@ static gsi::Class<A> decl_a ("", "A",
static gsi::Class<A_NC> decl_a_nc (decl_a, "", "A_NC");
static gsi::Class<B> decl_b ("", "B",
#if __cplusplus >= 201703L
gsi::method ("int_to_optional", &B::int_to_optional) +
gsi::method ("int_to_optional_a", &B::int_to_optional_a) +
gsi::method ("optional_to_int", &B::optional_to_int) +
gsi::method ("optional_cref_to_int", &B::optional_cref_to_int) +
gsi::method ("optional_ref_to_int", &B::optional_ref_to_int) +
gsi::method ("optional_cptr_to_int", &B::optional_cptr_to_int) +
gsi::method ("optional_ptr_to_int", &B::optional_ptr_to_int) +
gsi::method ("optional_a_to_int", &B::optional_a_to_int) +
gsi::method ("optional_a_cref_to_int", &B::optional_a_cref_to_int) +
gsi::method ("optional_a_ref_to_int", &B::optional_a_ref_to_int) +
gsi::method ("optional_a_cptr_to_int", &B::optional_a_cptr_to_int) +
gsi::method ("optional_a_ptr_to_int", &B::optional_a_ptr_to_int) +
#endif
gsi::method ("inst", &B::inst) +
gsi::method ("has_inst", &B::has_inst) +
gsi::method ("set_inst", &B::set_inst) +
@ -1431,5 +1664,32 @@ static gsi::Class<GFactory_P> decl_gfactory (decl_gfactory_base, "", "GFactory",
gsi::factory_callback ("f", &GFactory_P::f, &GFactory_P::f_cb)
);
static gsi::Class<B1> decl_b1 ("", "B1",
gsi::method ("get1", &B1::get1) +
gsi::method ("set1", &B1::set1) +
gsi::constant ("C1", 42)
);
static gsi::Class<B2> decl_b2 ("", "B2",
gsi::constant ("C2", 17)
);
static gsi::Class<B3> decl_b3 ("", "B3",
gsi::constant ("C3", -1)
);
gsi::EnumIn<B3, B3::E> enum_in_b3 ("", "E",
gsi::enum_const ("E3A", B3::E3A) +
gsi::enum_const ("E3B", B3::E3B) +
gsi::enum_const ("E3C", B3::E3C)
);
// 3 base classes
static gsi::Class<BB> decl_bb (decl_b1, "", "BB",
gsi::method ("d3", &BB::d3)
);
gsi::ClassExt<BB> b2_in_bb (decl_b2);
gsi::ClassExt<BB> b3_in_bb (decl_b3);
}

View File

@ -99,6 +99,7 @@ struct A
static tl::Variant new_a_by_variant ();
#if defined(HAVE_QT)
/**
* @brief Byte sequences: tests access to QByteArray
*/
@ -108,11 +109,110 @@ struct A
static std::vector<int> qba_ptr_to_ia (QByteArray *ba) { return qba_cref_to_ia (*ba); }
static std::vector<int> qba_to_ia (QByteArray ba) { return qba_cref_to_ia (ba); }
#if QT_VERSION >= 0x60000
/**
* @brief Byte sequences: tests access to QByteArrayView
*/
static std::vector<int> qbav_cref_to_ia (const QByteArrayView &ba);
static std::vector<int> qbav_ref_to_ia (QByteArrayView &ba) { return qbav_cref_to_ia (ba); }
static std::vector<int> qbav_cptr_to_ia (const QByteArrayView *ba) { return qbav_cref_to_ia (*ba); }
static std::vector<int> qbav_ptr_to_ia (QByteArrayView *ba) { return qbav_cref_to_ia (*ba); }
static std::vector<int> qbav_to_ia (QByteArrayView ba) { return qbav_cref_to_ia (ba); }
#endif
/**
* @brief Byte sequences: tests access to QString
*/
static std::vector<int> qs_cref_to_ia (const QString &qs);
static std::vector<int> qs_ref_to_ia (QString &qs) { return qs_cref_to_ia (qs); }
static std::vector<int> qs_cptr_to_ia (const QString *qs) { return qs_cref_to_ia (*qs); }
static std::vector<int> qs_ptr_to_ia (QString *qs) { return qs_cref_to_ia (*qs); }
static std::vector<int> qs_to_ia (QString qs) { return qs_cref_to_ia (qs); }
#if QT_VERSION >= 0x50000
/**
* @brief Byte sequences: tests access to QLatin1String
*/
static std::vector<int> ql1s_cref_to_ia (const QLatin1String &qs);
static std::vector<int> ql1s_ref_to_ia (QLatin1String &qs) { return ql1s_cref_to_ia (qs); }
static std::vector<int> ql1s_cptr_to_ia (const QLatin1String *qs) { return ql1s_cref_to_ia (*qs); }
static std::vector<int> ql1s_ptr_to_ia (QLatin1String *qs) { return ql1s_cref_to_ia (*qs); }
static std::vector<int> ql1s_to_ia (QLatin1String qs) { return ql1s_cref_to_ia (qs); }
#endif
#if QT_VERSION >= 0x60000
/**
* @brief Byte sequences: tests access to QStringView
*/
static std::vector<int> qsv_cref_to_ia (const QStringView &qs);
static std::vector<int> qsv_ref_to_ia (QStringView &qs) { return qsv_cref_to_ia (qs); }
static std::vector<int> qsv_cptr_to_ia (const QStringView *qs) { return qsv_cref_to_ia (*qs); }
static std::vector<int> qsv_ptr_to_ia (QStringView *qs) { return qsv_cref_to_ia (*qs); }
static std::vector<int> qsv_to_ia (QStringView qs) { return qsv_cref_to_ia (qs); }
#endif
/**
* @brief Byte sequences: tests return of QByteArray
*/
static QByteArray ia_cref_to_qba (const std::vector<int> &ia);
static const QByteArray &ia_cref_to_qba_cref (const std::vector<int> &ia);
static QByteArray &ia_cref_to_qba_ref (const std::vector<int> &ia);
static const QByteArray &ia_cref_to_qba_cref (const std::vector<int> &ia) { return ia_cref_to_qba_ref (ia); }
static const QByteArray *ia_cref_to_qba_cptr (const std::vector<int> &ia) { return &ia_cref_to_qba_ref (ia); }
static QByteArray *ia_cref_to_qba_ptr (const std::vector<int> &ia) { return &ia_cref_to_qba_ref (ia); }
#if QT_VERSION >= 0x60000
/**
* @brief Byte sequences: tests return of QByteArrayView (uses a static buffer)
*/
static QByteArrayView ia_cref_to_qbav (const std::vector<int> &ia);
static QByteArrayView &ia_cref_to_qbav_ref (const std::vector<int> &ia);
static const QByteArrayView &ia_cref_to_qbav_cref (const std::vector<int> &ia) { return ia_cref_to_qbav_ref (ia); }
static const QByteArrayView *ia_cref_to_qbav_cptr (const std::vector<int> &ia) { return &ia_cref_to_qbav_ref (ia); }
static QByteArrayView *ia_cref_to_qbav_ptr (const std::vector<int> &ia) { return &ia_cref_to_qbav_ref (ia); }
#endif
/**
* @brief Byte sequences: tests return of QString
*/
static QString ia_cref_to_qs (const std::vector<int> &ia);
static QString &ia_cref_to_qs_ref (const std::vector<int> &ia);
static const QString &ia_cref_to_qs_cref (const std::vector<int> &ia) { return ia_cref_to_qs_ref (ia); }
static const QString *ia_cref_to_qs_cptr (const std::vector<int> &ia) { return &ia_cref_to_qs_ref (ia); }
static QString *ia_cref_to_qs_ptr (const std::vector<int> &ia) { return &ia_cref_to_qs_ref (ia); }
#if QT_VERSION >= 0x50000
/**
* @brief Byte sequences: tests return of QLatin1String
*/
static QLatin1String ia_cref_to_ql1s (const std::vector<int> &ia);
static QLatin1String &ia_cref_to_ql1s_ref (const std::vector<int> &ia);
static const QLatin1String &ia_cref_to_ql1s_cref (const std::vector<int> &ia) { return ia_cref_to_ql1s_ref (ia); }
static const QLatin1String *ia_cref_to_ql1s_cptr (const std::vector<int> &ia) { return &ia_cref_to_ql1s_ref (ia); }
static QLatin1String *ia_cref_to_ql1s_ptr (const std::vector<int> &ia) { return &ia_cref_to_ql1s_ref (ia); }
#endif
#if QT_VERSION >= 0x60000
/**
* @brief Byte sequences: tests return of QStringView (uses a static buffer)
*/
static QStringView ia_cref_to_qsv (const std::vector<int> &ia);
static QStringView &ia_cref_to_qsv_ref (const std::vector<int> &ia);
static const QStringView &ia_cref_to_qsv_cref (const std::vector<int> &ia) { return ia_cref_to_qsv_ref (ia); }
static const QStringView *ia_cref_to_qsv_cptr (const std::vector<int> &ia) { return &ia_cref_to_qsv_ref (ia); }
static QStringView *ia_cref_to_qsv_ptr (const std::vector<int> &ia) { return &ia_cref_to_qsv_ref (ia); }
#endif
#endif
@ -129,7 +229,10 @@ struct A
* @brief Byte sequences: tests return of std::vector<char>
*/
static std::vector<char> ia_cref_to_ba (const std::vector<int> &ia);
static const std::vector<char> &ia_cref_to_ba_cref (const std::vector<int> &ia);
static std::vector<char> &ia_cref_to_ba_ref (const std::vector<int> &ia);
static const std::vector<char> &ia_cref_to_ba_cref (const std::vector<int> &ia) { return ia_cref_to_ba_ref (ia); }
static std::vector<char> *ia_cref_to_ba_ptr (const std::vector<int> &ia) { return &ia_cref_to_ba_ref (ia); }
static const std::vector<char> *ia_cref_to_ba_cptr (const std::vector<int> &ia) { return &ia_cref_to_ba_ref (ia); }
/*
* @brief A dummy method providing a chance to set a breakpoint in the script
@ -207,11 +310,13 @@ struct A
std::string a10_d (double f) { return tl::to_string (f); }
std::vector<char> a10_d_ba (double f) { std::string s = tl::to_string (f); return std::vector<char> (s.begin (), s.end ()); }
#if defined(HAVE_QT)
QByteArray a10_d_qba (double f) { return tl::to_qstring (tl::to_string (f)).toUtf8 (); }
QString a10_d_qstr (double f) { return tl::to_qstring (tl::to_string (f)); }
QStringRef a10_d_qstrref (double f) { m_s = tl::to_qstring (tl::to_string (f)); return QStringRef (&m_s); }
#endif
std::string a10_f (float f) { return tl::to_string(f); }
std::string a10_s (short l) { return tl::to_string(int (l)); }
std::string a10_us (unsigned short l) { return tl::to_string(int (l)); }
@ -494,6 +599,27 @@ struct B
*/
static tl::Variant new_b_by_variant ();
#if __cplusplus >= 201703L
/**
* @brief std::optional for simple and complex types
*/
static std::optional<int> int_to_optional (int value, bool exists) { return exists ? std::optional<int> (value) : std::optional<int> (); }
static std::optional<A> int_to_optional_a (int value, bool exists) { return exists ? std::optional<A> (A (value)) : std::optional<A> (); }
static int optional_to_int (std::optional<int> optional, int def) { return optional ? optional.value () : def; }
static int optional_cref_to_int (const std::optional<int> &optional, int def) { return optional_to_int (optional, def); }
static int optional_ref_to_int (std::optional<int> &optional, int def) { return optional_to_int (optional, def); }
static int optional_cptr_to_int (const std::optional<int> *optional, int def) { return optional_to_int (*optional, def); }
static int optional_ptr_to_int (std::optional<int> optional, int def) { return optional_to_int (*optional, def); }
static int optional_a_to_int (std::optional<A> optional, int def) { return optional ? optional.value ().a1 () : def; }
static int optional_a_cref_to_int (const std::optional<A> &optional, int def) { return optional_a_to_int (optional, def); }
static int optional_a_ref_to_int (std::optional<A> &optional, int def) { return optional_a_to_int (optional, def); }
static int optional_a_cptr_to_int (const std::optional<A> *optional, int def) { return optional_a_to_int (*optional, def); }
static int optional_a_ptr_to_int (std::optional<A> optional, int def) { return optional_a_to_int (*optional, def); }
#endif
std::string addr () const;
int always_5 () const {
@ -1271,18 +1397,37 @@ private:
int m_tag;
};
}
namespace tl
class B1
{
template <> struct type_traits<gsi_test::A_NC> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
#if defined(HAVE_QT)
template <> struct type_traits<gsi_test::SQ> : public type_traits<void> {
typedef tl::false_tag has_copy_constructor;
};
#endif
public:
B1 () : m_value (0) {}
int get1 () { return m_value; }
void set1 (int v) { m_value = v; }
private:
int m_value;
};
class B2
{
public:
B2 () {}
};
class B3
{
public:
B3 () {}
enum E { E3A = 100, E3B = 101, E3C = 102 };
};
class BB
: public B1, public B2, public B3
{
public:
int d3 (B3::E a, B3::E b) { return b - a; }
};
}
#endif

Some files were not shown because too many files have changed in this diff Show More